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
Clicking on an item with x class should take us to y page
def navigate_click(classname, location) btn = find(classname) @emberHelper.ember_transition_click btn expect(current_path).to eq("/#{locale}/app/#{location}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_pager_item(index)\n pager_items[index - 1].click\n end", "def click(link); end", "def click_item_page\n add_to_cart_button_item_page.click\n end", "def onItemClick(parent, view, position, id)\n selectItem(position)\n end", "def navigate_click(classname, location)\n page.assert_selector(classname)\n find(classname).click\n page.assert_current_path(\"/#{locale}/app/#{location}\")\n end", "def click\n @mech.click self\n end", "def click\r\n start_point = screen.find ident\r\n click_x = start_point.x + offset_x\r\n click_y = start_point.y + offset_y\r\n\r\n screen.click click_x, click_y\r\n end", "def select_item(what)\n item = find_item(what)\n item.click if item\n end", "def navigate_to_specialtypizza\n\torder_online_page\n\tselecting_delivery_store\n\tfind(\".navigation-Pizza\").click\nend", "def clickCompanyProfile(items, itemNumber)\n items[itemNumber].find_element(NAMEOFTHEFREELANCER).click\n return CompanyProfilePage.new(@driver)\n end", "def clicked\n router.navigated\n end", "def sub_navigate\n page(FeedDetailsPage).touch_row\n page(MorePage).page_handler(\"Submission\")\n end", "def next__clicked(*argv)\t\t\t\t\n\t\tif (@@page == @@json_titles.length && @@load_favs == 1) # if nothing on next or previous page, do nothing\n\t\telse\t\t\n\t\t\t@@page = @@page + 8\n\t\t\trefresh_links()\n\t\t\tif @@load_favs != 0\t\n\t\t\t\tshow_favs()\n\t\t\tend\n\t\tend\n\tend", "def clickUserProfile(items, itemNumber)\n items[itemNumber].find_element(NAMEOFTHEFREELANCER).click\n return UserProfilePage.new(@driver)\n end", "def click; end", "def click; end", "def click; end", "def item_was_clicked(sender)\n # Find the selected Link instance via the array controller and get its url attribute\n url_string = array_controller.selectedObjects.first.url\n if url_string\n # convert the url into a NSURL instance and open it in the browser.\n url = NSURL.URLWithString(url_string)\n NSWorkspace.sharedWorkspace.openURL(url)\n end\n end", "def go_to_start_page\n find('#sidebar #start-page').click\nend", "def next__clicked(*argv)\t\t\t\t\n\t\tif (@@page == 24 && @@load_favs == 0) || (@@page == @@json_titles.length && @@load_favs == 1) # if nothing on next or previous page, do nothing\n\t\telse\t\t\n\t\t\t@@page = @@page + 8\n\t\t\tdestroy_window()\n\t\t\tif @@load_favs == 0\t\n\t\t\t\tshow()\n\t\t\telse\n\t\t\t\tshow_favs()\n\t\t\tend\n\t\tend\n\tend", "def click_item_wl\n @aux1 = $url[$url.length-2,$url.length].upcase\n if @aux1 == \"MX\"\n \tpage.find(:xpath, '/html/body/div[2]/section/div[2]/div[3]/ul/li/a/ul/li[1]/span/span/img').click\n elsif @aux1 == \"CL\"\n page.find(:xpath, '/html/body/div[1]/section/div[2]/div[3]/ul/li/a/ul/li[1]/span/span/img').click\n end\nend", "def click_on(what)\n if what.is_a? Integer\n child_elements = children\n child_elements[what - 1].click if what - 1 <= child_elements.count\n else\n click_label what\n end\n end", "def load_item_page\n visit(ITEM_PAGE_URL)\n end", "def click_next_gallery\n click NEXT_GALLERY_BUTTON\n end", "def move_to(x, y)\n cur_page.move_to(x, y)\n end", "def main_menu_nav(main_menu_item)\n main_menu_items.each do |item|\n if item.text == main_menu_item\n item.click\n break\n end\n end\n end", "def navigate_to(link)\n\t $driver.get link\nend", "def clicked;end", "def get_da_detail_page(page, da_container)\n\n tds = da_container.search('td')\n\n href = tds[0].at('a')['href']\n\n detail_page = page.link_with(:href => \"#{href}\").click\n\n \n\n return detail_page\n\nend", "def get_da_detail_page(page, da_container)\n\n tds = da_container.search('td')\n\n href = tds[0].at('a')['href']\n\n detail_page = page.link_with(:href => \"#{href}\").click\n\n \n\n return detail_page\n\nend", "def click_on_item(name, tag, container, content, match = true, klass = nil)\n map = SELECTOR_MAPPING[container][name][tag][ELEMENT]\n elem = eval(map)\n\n res = elem.find {|item| (match ? (item.text == content):((item.text).include? content))}\n\n res.click\n unless klass.nil?\n SitePrism::Waiter.wait_until_true {res[:class].include? klass}\n end\n sleep 1\n end", "def click_menu_item(bar, menu, item, timeout=nil)\r\n barElement = find_by_id_and_class(bar, \"ss-MainMenuBar\", timeout)\r\n menuElement = source_find_by_id_and_class(barElement, menu, \"gwt-MenuItem\", timeout)\r\n menuElement.click\r\n itemElement = find_by_id_and_class(item, \"gwt-MenuItem\", timeout)\r\n itemElement.click\r\n end", "def clicked(e)\n \n end", "def selected_page\n end", "def go_to_orderpage()\n locat = Locator.where(brand: 'all', offer: 'orderplacementlocators')\n if(@browser.first('.special-offers-popup') || @browser.first('.popover') || @browser.first('.tv0ffer-popup') || @browser.first('#notify'))\n homepage_popovers\n sleep(2)\n end\n Rails.logger.info \"clicking order now\"\n\n locat.where(step: \"order_now\").each do |locator|\n begin\n @browser.first(:css, locator.css).click()\n rescue => e\n\n end\n end\n\n sleep(3)\n if(@browser.first('.special-offers-popup') || @browser.first('.popover') || @browser.first('.tv0ffer-popup') || @browser.first('#notify'))\n homepage_popovers\n sleep(2)\n end\n\n locat.where(step: \"order_now\").each do |locator|\n begin\n @browser.first(:css, locator.css).click()\n rescue => e\n\n end\n end\n\n sleep(3)\n\n locat.where(step: \"order_now\").each do |locator|\n begin\n @browser.first(:css, locator.css).click()\n rescue => e\n\n end\n end\n end", "def navigate_to_product_page(product_permalink)\r\n selenium.open selenium.get_location + \"/#{product_permalink}\"\r\n end", "def change_page(direction)\n raise AttributeError unless [:next, :previous].include?(direction)\n begin\n history[:prev_page] = %r{\\/(\\d+)\\/$}.match(browser.url)[1].to_i\n rescue NoMethodError\n history[:prev_page] = 1\n end\n li = browser.li(class: direction.to_s)\n update_action_log(:li, !li.nil? && li.present?)\n a = li.a\n update_action_log(:a, !a.nil? && a.present?)\n browser.li(class: direction.to_s).a.click\n\n history[:current_page] = %r{\\/(\\d+)\\/$}.match(browser.url)[1].to_i\n\n update_action_log(\n direction.to_s + 'button_click',\n 1 == (history[:prev_page] - history[:current_page]).abs\n )\n end", "def go_to_where_you_belong\n \n end", "def click_with_index(value)\n # NO-OP\n end", "def navigate_to(page_cls, how = {:using => :default}, &block)\n path = path_for how\n to_index = find_index_for(path, page_cls)-1\n navigate_through_pages(path[0..to_index])\n on(page_cls, &block)\n end", "def click_by_coordinates(x, y)\n Capybara.execute_script(\"document.elementFromPoint(#{x}, #{y}).click()\")\n end", "def click()\n mouse_down\n mouse_up\n stall :click\n end", "def select_puppy(name = 'Brook')\n\t\tindex = index_for(name)\n\t\tbutton_element(value: 'View Details', index: index).click\n\t\t# view_detail_elements[index].click\n\tend", "def navigate_to(link)\n $driver.get link\nend", "def doubleClick\n\t@selenium.double_click(@locator)\n end", "def click_point(x, y, is_double = false)\n if is_double\n @java_obj.doubleClick(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n else\n @java_obj.click(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n end\n end", "def click\n raise \"Must implement custom click method.\"\n end", "def selected_page; @pages[index]; end", "def select_item_from_search_results(item_name)\n item_name.strip! if item_name.is_a? String\n item = search_results.find_link(item_name)\n if item.visible?\n item.click\n else\n raise \"#{item_name} doesn't exist in search results\"\n end\n end", "def previous__clicked(*argv)\t\t\t\t\n\t\tif @@page == 0 \n\t\telse\n\t\t\t@@page = @@page - 8\n\t\t\trefresh_links()\n\t\t\tif @@load_favs != 0\t\n\t\t\t\tshow_favs()\n\t\t\tend\n\t\tend \n\tend", "def on_click\n\t\tend", "def clicked(mouse_event)\n end", "def select_puppy(name = 'Hanna')\n index = index_for(name)\n view_detail_elements[index].click\n end", "def click_offer_by_index(idx)\n # @todo: This should raise if the offer is not on the wall.\n raise NotImplementedError\n end", "def click\n @clicked_x = @x\n @clicked_y = @y\n fire(:click, @clicked_x, @clicked_y)\n end", "def select_item\n @selected = @current\n\n items\n end", "def scrollProfileIntoView(items, itemNumber)\n if itemNumber >= 1\n element = items[(itemNumber-1)].find_element(TITLEOFTHEFREELANCER)\n @utills.scrollElementIntoView(element)\n end # End of IF\n end", "def next_slide\n switch_to_current_frame\n body = $driver.find_element(:tag_name => \"body\")\n $driver.mouse.move_to(body, 3*body.size.width/4, body.size.height/4)\n $driver.mouse.down\n $driver.mouse.move_by(-body.size.width/2, 0)\n $driver.mouse.up\n sleep(1)\n switch_to_current_frame\n end", "def click_on(*args, context: page)\n label = self.class.labels[args[0]] # attempt to get the label\n context = context.element if context.respond_to? :element\n label.present? ? context.click_on(label) : context.click_on(*args)\n end", "def go_to_page(k)\n @page_number = k\n state.page = state.pages[k - 1]\n generate_margin_box\n @y = @bounding_box.absolute_top\n end", "def click(locator, opts = {}, &block)\n actions << lambda {\n path = find_link(locator, opts)[:href] rescue nil\n raise SpiderCore::ClickPathNotFound, \"#{locator} not found\" if path.nil?\n if block_given?\n spider = self.spawn\n spider.entrance(path)\n spider.learn(&block)\n current_location[:click] ||= []\n current_location[:click] << spider.crawl[:results]\n else\n visit(path)\n end\n }\n end", "def click locator\r\n command 'click', locator\r\n end", "def click locator\r\n command 'click', locator\r\n end", "def continue_button\n\tfind(\".btn--large\").click\nend", "def click\n webapp = Webapp.find(params[:id])\n webapp.increment_nb_click(:element => params[:element])\n render :status => 200, :nothing => true\n end", "def click_button_with_id(id, opts = {})\r\n\t if opts && opts[:index] && opts[:index].to_i() > 0\r\n\t\t\t\t\telements = find_elements(:id, id)\r\n\t\t\t\t\tthe_index = opts[:index].to_i() - 1 \r\n first_match = elements[the_index]\r\n focus_on_element(first_match)\r\n first_match.click\r\n\t\t\t\telse\r\n\t\t\t\t focus_on_element(find_element(:id, id))\r\n\t find_element(:id, id).click\r\n end\r\n\t\t\r\n end", "def goto_url(url)\r\n @browser.navigate.to url\r\n end", "def choose_item\n @shop_viewport.color = Color::BLACK.deopacize(200)\n @shop_number_window.set_data(current_item, current_action)\n @shop_number_window.activate\n @shop_number_window.open\n end", "def click_activity(item, tag, container, content, count)\n expect($applications.study_design.send($helpers.to_page_file(container)).click_on_activity?({item=> content}, count)).to be_truthy\nend", "def continue_shopping\n self.lnkContinueShopping_element.when_present(30).click\n end", "def open_product_menu\n @driver.find_element(link_text: 'Produtos').click\n end", "def click\n root_node.click\n end", "def go_to_first_page\n to_first_page.click\n end", "def click_on_link(selector)\n\n click_link(selector)\n\n end", "def click_through_link\n\t\treturn '/items/' + self.items.first.slug if !self.items.first.blank?\n\t\treturn '/blog/' + self.blogs.first.slug if !self.blogs.first.blank?\n\t\treturn \"#\"\n\tend", "def go_to(url)\n @browser.navigate.to url\n end", "def click_casino_name(casino_name)\n page_out = nil\n casinos = find_tag_containing_text('a', casino_name)\n \n if casinos.length > 0\n # TODO: Put this into a utility method?\n @driver.execute_script('arguments[0].scrollIntoView();', casinos[0])\n casinos[0].click\n \n baseurl = Addressable::URI.parse(@driver.current_url).path\n page_out = PokerRoomPage.new(@driver, baseurl)\n else\n # Click nothing\n # TODO: Log a message that there was nothing to click?\n page_out = self\n end\n \n page_out\n end", "def next\n\t\t@curItem.where(\"id > ?\", id).order(\"id ASC\").first || @curItem.first\n\t\t@curItem.show\n\tend", "def visit_next_page(model, **opt)\n click_on NEXT_LABEL, match: :first\n if block_given?\n yield\n else\n show_url\n end\n assert_valid_index_page(model, **opt)\n end", "def click_on_x_button\n\n page.find(X_BUTTON).click\n sleep(THREAD_SLEEP_1)\n\n end", "def click_element(mixpath)\n get_element(mixpath).click\n end", "def click_element(mixpath)\n get_element(mixpath).click\n end", "def click_JustGiving_Home_link\n div = get_Payment_div\n div.link(:text, JUSTGIVING_HOME_LINKS_TEXT).click\n end", "def double_click_on(object)\n page.driver.browser.mouse.double_click(object.native)\n end", "def select_menu(path)\r\n menu_item(path).click\r\n end", "def click_selenium_test1\n @session.click_link(@link_text)\n end", "def clicked\n @return.clicked\n end", "def selected_item\n get_content()[focussed_index()]\n end", "def div_by_id_click(id_name)\n div_by_id(id_name).click\nend", "def select_menu_item(value)\n #checking for reach end of list( get_source is current screen id)\n current_screen = get_source\n previous_screen = \"\"\n\n until (exists {find_element(id:\"design_navigation_view\").find_element(xpath:\"//android.widget.CheckedTextView[@text='#{value}']\")}) || (current_screen == previous_screen) do\n Appium::TouchAction.new.swipe(start_x:0.5,start_y: 0.8,end_x:0.5,end_y:0.2,duration:500).perform\n previous_screen = current_screen\n current_screen = get_source\n end\n #add more information in case of errors\n if exists {find_element(id:\"design_navigation_view\").find_element(xpath:\"//android.widget.CheckedTextView[@text='#{value}']\")}\n find_element(id:\"design_navigation_view\").find_element(xpath:\"//android.widget.CheckedTextView[@text='#{value}']\").click\n else\n fail(\"Element #{value} was not found in menu\")\n end\nend", "def click_groups\n @dashboard.select_link('Groups')\n end", "def go_home\n self.homelink.click\n end", "def goto_page(path)\r\n @browser.navigate.to(site_url + path)\r\n end", "def click_batch_link\n wait_for_page_and_click batch_link\n end", "def click\n p [ :app_click ]\n view.click\n end", "def switchto_listview()\n\t\t@browser.button(:class, \"btn icon-list-view\").click\n\tend", "def goto_page(page)\r\n goto_url full_url(page);\r\n end", "def navigate_into\n title_element.when_present.click\n end" ]
[ "0.69796246", "0.64464384", "0.6351783", "0.6230519", "0.6208322", "0.6160633", "0.6133306", "0.6114633", "0.6094316", "0.6003099", "0.599102", "0.59581274", "0.59375954", "0.59373885", "0.58929425", "0.58929425", "0.58929425", "0.58550346", "0.5839433", "0.5785057", "0.5769431", "0.5751386", "0.5725498", "0.57188135", "0.56527036", "0.56483215", "0.5634033", "0.56194115", "0.5582095", "0.5582095", "0.5575048", "0.5554131", "0.5547862", "0.5524121", "0.552056", "0.5519052", "0.55134225", "0.5512141", "0.5510998", "0.55054015", "0.5502293", "0.54990184", "0.5484281", "0.54834837", "0.54567415", "0.5456638", "0.54530287", "0.54471636", "0.5441732", "0.543612", "0.54316926", "0.5422254", "0.5421052", "0.54186475", "0.5406327", "0.53926563", "0.538461", "0.5381419", "0.5370818", "0.53706723", "0.5364579", "0.5364397", "0.5364397", "0.53612226", "0.53535724", "0.53507996", "0.53441894", "0.53426635", "0.5341706", "0.53404903", "0.53338337", "0.5331707", "0.5324555", "0.53151006", "0.5303881", "0.529693", "0.52883726", "0.5284077", "0.52756304", "0.5274032", "0.5264493", "0.5264493", "0.5263912", "0.5262347", "0.52511555", "0.52504647", "0.52498996", "0.5247325", "0.5232495", "0.52320707", "0.5227992", "0.5221033", "0.52166325", "0.5198364", "0.5193318", "0.51858264", "0.51816285", "0.5176995" ]
0.5886504
19
def join user, invite=nil if private? and not invite return nil else ClanMember.create(clan_id: id, user: user) end end Please do not chnage this is overriden method remove space from start and end of the string before savingto database
def name=(name) write_attribute(:name, name.try(:strip)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join!(user)\n # It loads up all the user because in the case where the chat is saved but the chat_participations have not been saved,\n # this is the only way to ensure we don't have duplicates.\n return if self.chat_participations.map(&:user_id).include?(user.id)\n self.chat_participations.create!(:user => user)\n end", "def join\n @club = Club.find(params[:id])\n authorize @club\n @club.club_memberships.create! user_id: current_user.id\n redirect_to action: :show\n end", "def join\n @beer_club = BeerClub.find(params[:id])\n if Membership.where(:beer_club_id => @beer_club.id, :user_id => current_user.id).exists?\n respond_to do |format|\n format.html { redirect_to :back, notice: \"You are already a member of this club!\" }\n end\n else\n @membership = Membership.create\n @membership.beer_club_id = @beer_club.id\n @membership.user_id = current_user.id\n if @beer_club.memberships.count < 1\n @membership.confirmed = true\n else\n @membership.confirmed = false\n end\n respond_to do |format|\n if @membership.save\n format.html { redirect_to :back, notice: \"You joined #{@beer_club.name}\" }\n else\n format.html { redirect_to :back, notice: \"Something went awry! D:\" }\n end\n end\n end\n end", "def join\n\t\t@classroom = Classroom.find(params[:id])\n\n\t\tparams[:user_id] = current_user.id unless admin? && params[:user_id]\n\n\t\t@membership = Membership.new\n\t\t@membership.classroom_id = @classroom.id\n\t\t@membership.user_id = params[:user_id]\n\t\tif @membership.save\n\t\t\tredirect_to params[:redirect_url] || @classroom, notice: \"Joined!\"\n\t\telse\n\t\t\tredirect_to @classroom, alert: \"You are already a member of this class!\"\n\t\tend\n\tend", "def join \n\n #Check if user exists\n user = User.find_by!(id: params[:user_id])\n\n if (ChannelJoined.exists?({ channel_id: params[:id], user_id: params[:user_id]}))\n json_response({\n \"joined\": true\n })\n else\n joined = ChannelJoined.create!(user_id: params[:user_id], channel_id: params[:id])\n json_response(joined.channel)\n end\n \n \n end", "def join!(_user_id)\n if !is_private?\n if banned_users.where(user_id: _user_id).any?\n errors.add(:base, 'You were banned from this group.')\n false\n else\n add_participant(_user_id)\n end\n else\n errors.add(:base, 'This is a private group, please contact to administrator.')\n false\n end\n end", "def join\n @invite_code = params[:invite_code]\n end", "def join(user_id,group=nil,role=nil)\n if !is_a_member?(user_id)\n begin\n x = Note_User.new(:user_id => user_id, :note_id => self.id )\n x.group = group.id if group\n x.role = role if role\n x.save\n rescue\n return false\n end\n end\n return true\n end", "def invitee_string\n\t\n\tend", "def create_and_invite\n puts \"MembersController#create_and_invite\"\n # Convert month/year params to date\n params[:joined_at] = \"#{params[:joined_at_y]}-#{params[:joined_at_m]}-1\".to_date\n # Left_at should be the first of next month. A member who's left_at is set to 1st of August will\n # only pay for July.\n params[:left_at] = \"#{params[:left_at_y]}-#{params[:left_at_m]}-1\".to_date.next_month #.end_of_month\n \n # Invite a new member or add an existing to a project\n if params[:invite_or_add] == \"add\"\n # Add to existing project\n @member = Member.find(params[:member][:id])\n # Add member to existing project\n existing_project = Project.find(params[:project_id])\n puts \"Assign project '#{existing_project.name}' (#{params[:project_id]}) with admin #{existing_project.admin_id}, to member '#{@member.name}'.\"\n project_name = existing_project.name\n if existing_project.admin_id == current_member.id\n # Make sure that current member is admin of the project.\n @member.projects << existing_project\n membership = @member.memberships.where(\"project_id = ?\", existing_project.id)\n membership.update(joined_at: params[:joined_at], left_at: params[:left_at])\n @member.save\n \n # Member saved to db. Send invitiation email.\n if params[:send_invitation]\n @member.send_invitation_email sender: current_member, project: existing_project\n flash[:info] = \"Invitation email sent to #{@member.email} from #{current_member.name}. Invited to project #{existing_project.name}.\"\n end\n\n set_current_project_id existing_project.id\n redirect_to root_path and return\n else\n cancel_invite \"NOT PROJECT ADMIN. Member #{current_member.id} is not #{existing_project.admin_id}.\"\n return false\n end\n else\n # Create new and add to existing/newly created project\n # Init Member\n @member = Member.new(member_params)\n if @member.save\n # Saved member (along with project) to database\n puts \"Saved member #{@member.name} to db.\"\n # Choose an existing project or create a new?\n if params[:new_or_existing] == \"new\" && !params[:project][:name].blank?\n # Logged in member wants to create a new project\n project_name = params[:project][:name]\n params[:project][:admin_id] = current_member.id\n if current_member.projects.where(\"admin_id = ? AND name = ?\", current_member.id, project_name).empty?\n # Member is not the admin of a project with this name, create it\n puts \"Will create new Project: '#{project_name}'\"\n # Create project\n puts \"Assign project '#{project_name}' to member '#{@member.name}\"\n puts \"Assign project admin privileges to current member '#{current_member.name}\"\n current_member.projects.build(project_params)\n current_member.save\n else\n flash[:danger] = \"A project named '#{project_name}' already exists. Choose another name.\"\n puts \"A project named '#{project_name}' already exists. Choose another name.\"\n cancel_invite \"PROJECT ALREADY EXISTS\"\n return false\n end\n elsif params[:new_or_existing] == \"existing\" && params[:project_id] != \"0\"\n # Add member to existing project\n existing_project = Project.find(params[:project_id])\n p existing_project\n puts \"Assign project '#{existing_project.name}' (#{params[:project_id]}) with admin #{existing_project.admin_id}, to member '#{@member.name}'.\"\n project_name = existing_project.name\n if existing_project.admin_id == current_member.id\n # Make sure that current member is admin of the project.\n @member.projects << existing_project\n else\n cancel_invite \"NOT PROJECT ADMIN. Member #{current_member.id} is not #{existing_project.admin_id}.\"\n return false\n end\n else\n flash[:danger] = \"Enter a name for a new Project or choose an existing one.\"\n puts \"Enter a name for a new Project or choose an existing one.\"\n cancel_invite \"NO NEW PROJECT NAME or NO PROJECT SELECTED\"\n return false\n end\n @member.current_project_id = params[:project_id]\n @member.save\n\n project = @member.projects.find_by(name: project_name)\n unless project.nil?\n membership = @member.memberships.where(\"project_id = ?\", project.id)\n membership.update(joined_at: params[:joined_at], left_at: params[:left_at])\n @member.save\n\n if project.rents.empty?\n project.rents.create(amount: params[:monthly_rent], due_date: project.start_date.prev_month.change(day: 25))\n end\n end\n\n # Member saved to db. Send invitiation email.\n if params[:send_invitation]\n @member.send_invitation_email sender: current_member, project: project\n flash[:info] = \"Invitation email sent to #{@member.email} from #{current_member.name}. Invited to project #{project_name}.\"\n end\n set_current_project_id project.id\n redirect_to root_path\n else\n flash[:danger] = \"#{@member.name} could not be saved.\"\n p @member.errors.messages\n @projects = current_member.projects.where(admin_id: current_member.id)\n render 'invite'\n end\n end\n\n end", "def join(user)\n @mysqlHelper.insertConUser(user.getI,@id)\n @userList.getcontents.each { |users| \n \n users.userChangeFromChannel(\"204\", @id, user.getId)\n }\n @userList.add(user)\n \n end", "def create\n user = User.find_user(params[:member][:user_id])\n @board = Board.find_board(params[:member][:board_id])\n @action = 'join'\n if ( !user.nil? && !@board.nil? )\n logger.debug \"----------------Member.new-------------------------------------\"\n @member = Member.new(params[:member])\n @member.user_id = user.id\n if params[:commit] == Member::Commit::FOLLOW\n logger.debug \"----------------Adding a follower #{user.full_name}-------------------------------------\"\n @member.user_id = current_user.id # follower could be only the current user\n @member.member_type = Member::MemberType::FOLLOWER\n # follower? is true if a user is a follower, member or owner\n if !current_user.follower?(@board)\n logger.debug \"----------------Saving follower #{user.full_name}-------------------------------------\"\n @action = 'follow'\n @member.save\n flash.now[:success] = \"Board \\\"#{@board.title}\\\" was linked to your profile.\"\n else\n flash.now[:warning] = \"Your profile already linked to \\\"#{@board.title}\\\".\"\n end\n else\n logger.debug \"----------------Adding a member #{user.full_name}-------------------------------------\"\n if !user.member?(@board)\n logger.debug \"----------------User #{user.full_name} is not a member-------------------------------------\"\n follower = user.follower?(@board)\n if follower\n logger.debug \"----------------Updating follower #{user.full_name} to become a member-------------------------------------\"\n follower.update_attribute(:member_type, Member::MemberType::MEMBER)\n else\n logger.debug \"----------------Saving #{user.full_name} as a member-------------------------------------\"\n @member.member_type = Member::MemberType::MEMBER\n @member.save\n end\n else\n logger.debug \"----------------Saving a follower #{user.full_name}-------------------------------------\"\n @member.member_type = Member::MemberType::MEMBER\n @member.save\n end\n flash.now[:success] = \"#{user.full_name} was added to your Board \\\"#{@board.title}\\\".\"\n end\n end\n\n if params[:commit] == Message::Commit::CONFIRM\n msg_id = params[:member][:message]\n unless ( msg_id.nil? )\n message = Message.find(msg_id)\n unless ( message.nil? )\n message.update_attribute(:msg_state, Message::State::CONFIRMED)\n end\n end\n end\n \n params[:act] = 'board_search'\n params[:search] = params[:member][:search] if !params[:member][:search].nil?\n\n respond_to do |format|\n #if @member.save\n format.html { redirect_to home_path }\n format.js\n format.json { render json: home_path, status: :created, location: home_path }\n #else\n # format.html { render action: \"new\" }\n # format.json { render json: @member.errors, status: :unprocessable_entity }\n #end\n end\n end", "def invite_lab(user, invited_lab_id)\n # ユーザ再取得\n user = User.find_by(email: user.email)\n lab = Lab.find(invited_lab_id)\n one_time_token = OneTimeToken.find_by(mail_address: user.email)\n # nil チェック\n lab_user = LabUser.new({user_id: user.id, lab_id: lab.id})\n if lab_user.save\n one_time_token.destroy\n return lab_user\n else\n return nil\n end\n end", "def join_plan \n\t\trequire 'fcm'\n\t\tactivities = [\"grab food\", \"hang out\", \"group study\", \"party\"]\n\t\tplan_member = PlanMember.new(\n \tplan_id: params[:plan_id],\n \tuser_id: current_user.id\n )\n\t\tplan = Plan.find_by(id: params[:plan_id])\n\n\t\tif plan_member.save\n\t\t\tPlanMessage.create(\n \tplan_id: params[:plan_id],\n \tuser_id: current_user.id, \n \tcontent: \"#{current_user.fullname} is in!\",\n \tsystem_message: true\n )\t\n\n member_count = PlanMember.where(plan_id: params[:plan_id]).count\n\t\t\tis_happening = false\n\t if member_count > 2 && plan.is_happening == false\n\t \tis_happening = true\n\t \tplan.is_happening = true\n\t \tplan.save \n\n\t \tPlanMessage.create(\n\t \tplan_id: params[:plan_id],\n\t \tuser_id: current_user.id, \n\t \tcontent: \"Woohoo this plan to #{activities[plan.activity]} is happening! 3 or more people are in.\",\n\t \tsystem_message: true\n\t )\t\n\t end\n\t render json: { is_success: true, is_happening: is_happening, name_of_joiner: current_user.fullname}, status: :ok\n\t\t\n\t\telse\n\t\t\trender json: { is_success: false }, status: :ok\n\t\tend\n\tend", "def add_member(user, send_invite = false, send_message = false)\n member_id = Ecircle.client.\n create_member(:userId => user.id, :groupId => @id,\n :invite => send_invite, :sendMessage => send_message)\n Ecircle::Member.find_by_id(member_id)\n end", "def to user_id, message\n return yield false, USER_NOT_FOUND unless user = User.find(user_id)\n return yield false, INVALID_JOINABLE unless joinable_is_valid?\n\n owner_join_request = JoinRequest.where(joinable: @joinable, user_id: user_id, role: member_type).first_or_create\n\n ApplicationRecord.transaction do\n creator_join_requests.update_all(role: member_type)\n\n owner_join_request.update(status: :accepted, role: creator_type)\n\n @joinable.update_attribute(:user_id, user_id)\n end\n\n if message.present?\n ChatServices::ChatMessageBuilder.new(\n user: user,\n joinable: @joinable,\n join_request: owner_join_request,\n params: {\n message_type: :text,\n content: message,\n }\n ).create\n end\n\n yield true\n end", "def join_group(user = nil, role = nil)\n role = 'member' if role != 'admin'\n raise 'NotValidGroup' if id.nil?\n raise 'AlreadyMember' if member?(user)\n user_group = Membership.new(\n user_id: user.id,\n group_id: id,\n role: role\n )\n user_group.save!\n user_group\n end", "def invite\n \n end", "def local_join(body)\n room = body.dup\n room[0,1] = '' until room[0,1] != '@'\n return nil unless room.length >= 1\n unless @var[:special_rooms].include?(room)\n room_hash = MD5::digest(room)[0,8]\n room_hash = EMPTY_ROOM if room == 'chat'\n @connection.room_names[room_hash] = room\n @connection.room_ids[room] = room_hash\n _remote_control(@var[:our_name], :invite, body, true)\n _server_control('join', room_hash)\n end\n local_switch(room.dup)\nend", "def process_join(message)\n channel = message.channel\n /:(?<user>\\w+)/ =~ message.raw\n channel.users[user] = User.new user unless channel.users.key? user\n end", "def add_member(str, project)\n if (user = find_member(str))\n set_status(project, :member, user, :add)\n @candidate = nil\n else\n flash_error(:add_members_not_found.t(str))\n end\n redirect_to(project_path(project.id, q: get_query_param))\n end", "def member_invite_2(invite, sending_bus)\n unless invite.invitee.opted_out?\n @invite = invite\n @personal_message = invite.message\n @inviter = invite.inviter\n @business_id = invite.company_id #business of recipient\n @invitee_id = invite.invitee_id #recipient's id in Invite db record\n if !@business_id.nil? && !@invitee_id.nil?\n @business = sending_bus\n @invitee = Contact.find(invite.invitee_id)\n @invite_company = Company.find(@business_id)\n subject = \"Free marketing for #{@invite_company.try(:name) || \"you\"} in and around #{@invite_company.location.city_and_state}\"\n mail to: invite.invitee.email, from: \"#{@business.name} <#{Rails.application.secrets.invite_email}>\", subject: subject\n elsif !@invitee_id.nil?\n @business = sending_bus\n @invitee = Contact.find(invite.invitee_id)\n subject = \"Free marketing for you\"\n track extra: {business_id: @business.id}\n mail to: invite.invitee.email, from: \"#{@business.name} <#{Rails.application.secrets.invite_email}>\", subject: subject\n end\n end\n end", "def create\n @user = User.find_by_uid(params[:uid])\n\n if (@user.nil?)\n @user = User.new\n @user['uid'] = params[:uid]\n @user['provider'] = 'facebook'\n @user['name'] = params[:name]\n\n @user.save\n end\n\n if (Invite.find_by_plan_id_and_user_id(params[:plan_id], @user.id).nil?)\n\n @invite = Invite.new(params[:invite])\n @invite.plan = Plan.find(params[:plan_id])\n\n @invite.user = @user\n\n @invite.save\n\n end\n\n end", "def join\n @group = Group.find(params[:id])\n \n if group_user = GroupUser.first(:conditions => ['group_id = ? AND user_id = ?', @group.id, current_user.id])\n if ['cancelled', 'invite_declined'].include?(group_user.status)\n group_user.request!\n flash[:notice] = 'Your membership request was sent to group owner.'\n elsif group_user.status == 'approved'\n flash[:error] = 'You are already member of this group.'\n else\n flash[:error] = 'You cannot join this group.'\n end\n else\n group_user = GroupUser.create(:group_id => @group.id, :user_id => current_user.id, :role_id => Role.find_by_name('User').id)\n group_user.request!\n flash[:notice] = 'Your membership request was sent to group owner.'\n end\n \n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def join\n @group = Group.find(params[:id])\n \n if group_user = GroupUser.first(:conditions => ['group_id = ? AND user_id = ?', @group.id, current_user.id])\n if ['cancelled', 'invite_declined'].include?(group_user.status)\n group_user.request!\n flash[:notice] = 'Your membership request was sent to group owner.'\n elsif group_user.status == 'approved'\n flash[:error] = 'You are already member of this group.'\n else\n flash[:error] = 'You cannot join this group.'\n end\n else\n group_user = GroupUser.create(:group_id => @group.id, :user_id => current_user.id, :role_id => Role.find_by_name('User').id)\n group_user.request!\n flash[:notice] = 'Your membership request was sent to group owner.'\n end\n \n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def join\n if !current_user\n flash[:notice] = t(:join_dream)\n elsif @camp.users.include?(current_user)\n flash[:notice] = t(:join_already_sent)\n else\n flash[:notice] = t(:join_dream)\n @camp.users << @user\n end\n redirect_to @camp\n end", "def join(user)\n return false if member?(user)\n # Otherwise, we add a user\n add user\n @members.each { |m| m.notify :join, @name, :prefix => user.prefix }\n dispatch :outgoing_join, :target => @name, :nick => user.nick\n return true\n end", "def join\n # valid user?\n if !@user\n flash[:notice => \"You must be logged in to join\" ]\n render :action => \"error\"\n return\n end\n if !@note\n flash[:notice] = \"Nothing found by that name\"\n render :action => \"error\"\n return\n end\n # already a member?\n if @note.is_a_member?(@user)\n flash[:notice] = \"You are already a member\"\n render :action => \"error\"\n return\n end\n # join\n @note.join @user\n end", "def join\n network_invite = current_organization.network_invitations.find_by_network_id(params[:id], :include => :network)\n if network_invite.nil? then\n flash[:notice] = \"You must get an invite before joining that network.\"\n redirect_to networks_path\n else\n network_invite.accept!\n flash[:notice] = \"You have joined the network!\"\n redirect_to network_path(network_invite.network)\n end\n end", "def join_group(invite_code)\n invite = InviteCode.check_code(invite_code)\n self.users_groups.create!(:invite_code_id => invite.id, :group_id => invite.group_id, :join_date => Date.today)\n end", "def create\n @invite = Invite.new(invite_params)\n @invite[:token] = @invite.generate_token\n @invitee = @invite.find_invitee\n\n if @invite.to_existing_user?\n respond_to do |format|\n if @invite.save\n #round out the invites TODO: add these methods to user.rb instead:\n @invitee.memberships << Membership.new(member_id: @invitee.id, list_id: @invite.list_id)\n @invite.sender.memberships << Membership.new(member_id: @invite.sender_id, list_id: @invite.list_id)\n ExistingInviteMailer.existing_invite_mailer(@invite).deliver_now\n\n format.html { redirect_to list_path(@invite.list), notice: 'Invite was successfully created.' }\n format.json { render :show, status: :created, location: @invite }\n else\n format.html { render :new }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end #end respond_to\n\n else #exising user?\n\n respond_to do |format|\n if @invite.save\n InviteMailer.new_invite_mailer(@invite).deliver_now\n #assign the sender the membership as well, TODO: move logic to user.rb\n @invite.sender.memberships << Membership.new(member_id: @invite.sender_id, list_id: @invite.list_id)\n format.html { redirect_to list_path(@invite.list), notice: 'Invite was successfully created.' }\n format.json { render :show, status: :created, location: @invite }\n else\n format.html { render :new }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end\n end #determining existing user\n end", "def create\n @user = User.new(params[:user])\n \n puts \"#{@user.name} - #{@user.email}\"\n \n if !@@invite.nil? && self.encrypt_word(@user.email).eql?(encrypt_word(@@invite.email))\n @user.active = true\n if @user.save\n @@invite.update_attributes(:active => true)\n flash[:notice] = \"Usuario cadastrado com sucesso.\"\n render :action => :show\n end\n else\n flash[:notice] = \"Email invalido.\"\n render :action => :new\n end\n end", "def join\n @group = Group.find(params[:id])\n\n if !current_user.is_member_of?(@group)\n current_user.join!(@group)\n flash[:notice] = \"Successfully joined the group!\"\n else\n flash[:warning] = \"You are a member of this group!\"\n end\n\n redirect_to group_path(@group)\n end", "def create\n @member = Member.new(params[:member]) \n if @member.save\n \n require 'aweber'\n @oauth = AWeber::OAuth.new('Ak8Buwis5Q1j0OwvVZ4eJROe','TjtgHED5PIYPqS85ZgBekIf9jol1PgpUEpETmrV9')\n @oauth.authorize_with_access('Agvk8sGM8K4XFU2axg2d9z2j', 'qcAyJIPah2lBKcqrU85IviuOXjC0gLtYx0koG115')\n @aweber = AWeber::Base.new(@oauth)\n @account = @aweber.account\n\n new_subscriber = {}\n new_subscriber[\"email\"] = params[:member][:email]\n new_subscriber[\"name\"] = params[:member][:username] \n @account.lists.find_by_name(\"cpclist\").subscribers.create(new_subscriber)\n \n \n insert_id = @member.id\n random_string = SecureRandom.hex(5)\n Member.find(insert_id).update_attribute(:random_code, random_string)\n\n flash[:success] = \"Member was successfully created.\"\n session[:user_id] = insert_id\n redirect_to root_url\n #render 'home/index'\n\n flash[:success] = \"\";\n\n #render :partial => 'home/index', :locals => { :success => flash[:success] }\n else\n render 'home/index'\n end\n end", "def join_meeting(meeting_id, user_name, password, options={})\n valid_options = [:userID, :webVoiceConf]\n valid_options += [:createTime] if @version >= \"0.8\"\n options.reject!{ |k,v| !valid_options.include?(k) }\n\n params = { :meetingID => meeting_id, :password => password, :fullName => user_name }.merge(options)\n\n send_api_request(:join, params)\n end", "def join(m)\n # self.reset_timer(m)\n if Channel(@channel_name).has_user?(m.user)\n if @game.accepting_players?\n added = @game.add_player(m.user)\n unless added.nil?\n Channel(@channel_name).send \"#{m.user.nick} has joined the game (#{@game.players.count}/#{@game.max_players})\"\n Channel(@channel_name).voice(m.user)\n end\n else\n if @game.started?\n Channel(@channel_name).send \"#{m.user.nick}: Game has already started.\"\n elsif @game.at_max_players?\n Channel(@channel_name).send \"#{m.user.nick}: Game is at max players. Switch to ONUWW to add more players\"\n else\n Channel(@channel_name).send \"#{m.user.nick}: You cannot join.\"\n end\n end\n else\n User(m.user).send \"You need to be in #{@channel_name} to join the game.\"\n end\n end", "def call(user)\n return unless user.invite_token\n invite = Invite.find_by_invite_token(user.invite_token)\n invite.update!(grader_id: user.id) if invite\n end", "def join\r\n if @trip.participants.include?(current_person)\r\n redirect_to(@trip, :notice => \"You are already a participant in the #{@trip.name}.\")\r\n return\r\n elsif @trip.organizers.include?(current_person) && request.post?\r\n @trip.participants << current_person\r\n redirect_to(manage_membership_trip_url(@trip), :notice => \"You are now a participant in the #{@trip.name}.\")\r\n else\r\n @token = params[:token]\r\n invitation = Invitation.find_by_token(@token)\r\n if invitation.nil?\r\n redirect_to(person_root_url, :error => \"The invitation link you followed is invalid.\")\r\n return\r\n end\r\n \r\n if request.post?\r\n invitation.accept(current_person)\r\n redirect_to(manage_membership_trip_url(@trip), :notice => \"You are now a participant in the #{@trip.name}.\")\r\n end\r\n end\r\n end", "def get_friends_list\n # Append user string \n data_string = twitter\n\n # Append friend strings\n Invite.find( :all, :conditions => { :host_user => id } ).each do |invite|\n \n if( invite.accepted && invite.active )\n #friend = invite.users[0]\n friend = User.find( invite.target_user )\n data_string = data_string + \"|\" + friend.twitter\n end\n \n end \n \n return data_string\nend", "def add_member(user, id = nil)\n raise \"The user \\\"#{user.name}\\\" is already a member of the team, \\\"#{self.name}\\\"\" if user?(user)\n t_user = TeamsUser.create(user_id: user.id, team_id: self.id)\n parent = TeamNode.find_by(node_object_id: self.id)\n TeamUserNode.create(parent_id: parent.id, node_object_id: t_user.id)\n add_participant(self.parent_id, user)\n end", "def add_member(member)\n Rails.logger.info(\"------------adding #{member} to circle\")\n if !self.circle.users.include?( member )\n member.memberships.create(:circle => self.circle)\n UserMailer.notify_added_to_circle(self,member).deliver\n #send email\n else\n Rails.logger.info(\"--------------already a member!\") \n end\n end", "def create\n invite = nil\n # is this invite from user to family\n if params[:invite][:family_name].present?\n authorize! :create, Invite\n new_family = Family.find_by_name(params[:invite][:family_name])\n if new_family.present?\n if current_user.family != new_family\n invite = Invite.new(family: new_family,\n user: current_user,\n creator: current_user,\n is_sent_to_email: false)\n else\n respond_to do |format|\n format.js { render json: { result: \"Нельзя попроситься в свою же семью\", status: 500 } and return }\n end\n end\n else\n respond_to do |format|\n format.js { render json: { result: \"Семья #{params[:invite][:family_name]} не найдена\", status: 404 } and return }\n end\n end\n\n # is this invite from family to user\n elsif params[:invite][:user_data].present?\n authorize! :create, Invite\n # check if this user exists in database\n user = User.find_by_login(params[:invite][:user_data]) || User.find_by_email(params[:invite][:user_data])\n if user.present?\n if current_user != user\n invite = Invite.new(family: current_user.family,\n user: user,\n creator: current_user,\n is_sent_to_email: false)\n else\n respond_to do |format|\n format.js { render json: { result: \"Нельзя пригласить самого себя в свою семью\", status: 500 } and return }\n end\n end\n else\n if params[:invite][:user_data] =~ /^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$/\n #TODO: send the email with invite to user\n respond_to do |format|\n format.js { render json: {result: \"Email с приглашением отправлен на адрес #{params[:invite][:user_data]}\", status: 204 } and return }\n end\n else\n respond_to do |format|\n format.js { render json: {result: \"Пользователь #{params[:invite][:user_data]} не найден! Вы можете ввести его email и снова пригласить. Мы вышлем ему приглашение на почту.\", status: 404 } and return }\n end\n end\n end\n end\n\n if invite && invite.save!\n respond_to do |format|\n render_string = render_to_string(partial: \"invites/invite\", layout: false, locals: {name: invite.name_for_family, invite_id: invite.id, can_manage: false})\n format.js { render json: { result: render_string, status: 201 }}\n end\n else\n respond_to do |format|\n format.js { render json: {result: \"Не удалось создать приглашение.\", status: 500 } }\n end\n end\n end", "def addmember(user)\n\t\t#generate random leid for mailchimp\n\t\tuser.euid = rand(1 .. 500000000).to_s\n\t\tuser.save\n\t\t#assuming LEID is our user id and EUID is mailchimp's unique one\n\t\t#taken from here https://bitbucket.org/mailchimp/mailchimp-api-ruby/\n\t\tsubscribers = [{ \"EMAIL\" => { \"email\" => user.email,\n \"LEID\" => user.id.to_s,\n \"EUID\" => user.euid\n },\n\n :EMAIL_TYPE => 'html',\n :merge_vars => { \"FNAME\" => user.first_name,\n \"LNAME\" => user.last_name,\n \"STATUS\" => \"Subscribed\"\n }\n }]\n\n #batch-subscribe(string apikey, string id, array batch, boolean double_optin, boolean update_existing, boolean replace_interests)\n \t@mc.lists.batch_subscribe(@mli, subscribers, false, true, false)\n\tend", "def join_meeting(meeting_id, user_name, password, user_id = nil, web_voice_conf = nil)\n params = { :meetingID => meeting_id, :password => password, :fullName => user_name,\n :userID => user_id, :webVoiceConf => web_voice_conf }\n send_api_request(:join, params)\n end", "def fmt_memberid(member)\n if member.club_memberid && member.club_memberid.length > 5\n member.club_memberid.insert(5,\"-\")\n end\n end", "def create\n\n @user = User.where(firstName: params[:user][:firstName]).first\n @loop = Loop.find(params[:loop_id])\n\n if @user\n lm = @user.loop_memberships.build(loop_id: @loop.id)\n lm.status = \"pending\"\n lm.author_id = current_user.id\n lm.save\n flash[:success] = \"invitation sent\"\n redirect_to loop_path(@loop)\n else \n flash[:error] = \"error with invitation\"\n redirect_to loop_path(@loop)\n end\n\n end", "def msg_JOIN(source, args)\n u = User.find(source)\n if u == nil\n return nil\n end\n\n if args[0] == '0' && args.length == 1\n u.channels.each do |c|\n c.del_user(u)\n end\n u.part_all()\n return nil\n end\n\n # Ignoring TS rules since we don't even keep track of cmodes\n\n c = Channel.find_by_name(args[1])\n if c == nil\n c = Channel.new(args[1], args[0].to_i())\n end\n\n c.add_user(u)\n u.join(c)\n return nil\n end", "def invite_to_mesa\n unless UserMission.exists?(params[:user_id],params[:mesa_id]).nil?\n user=User.find(params[:user_id])\n send_invite(user)\n end\n respond_to do |format|\n if @mission_invitation\n format.html { redirect_to @mission, notice: 'Mission was successfully created.' }\n format.json { render :json=> {:status => true} }\n else\n format.html { render :new }\n format.json { render :json=> {:error => 'Invalid user id,mesa id or duplicate invitation', :status => false} }\n end\n end\n end", "def create\n #@account_member = AccountMember.new(params[:account_member])\n #@account = Account.find(params[:id])\n #authorize! :admin_team, @account\n if @account.user_count <= @account.account_members.count\n redirect_to account_account_members_path(@account), :notice => \"Unable to add another user. Increase number of account users to add.\"\n else\n email = params[:email]\n user = User.find_by_email(email)\n if user.nil?\n @account.account_members.create( :email => email )\n else\n m = @account.account_members.create( :email => email)\n m.user = user # REVIEW Is this safe?\n m.save\n end\n # respond_to do |format|\n # if @account_member.save\n # format.html { redirect_to @account_member, notice: 'Account member was successfully created.' }\n # format.json { render json: @account_member, status: :created, location: @account_member }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @account_member.errors, status: :unprocessable_entity }\n # end\n # end\n redirect_to account_account_members_path(@account), :notice => \"Team member with email #{email} was successfully created.\"\n \n end\n\n end", "def invite(invite)\n @invite = invite\n mail(:to => invite.email, :subject => \"#{@invite.user.name} has invited you to the \\\"#{invite.idea.name}\\\" idea\", :tag => 'invite') \n end", "def invite_people\n end", "def create\n @invite = Invite.new(invite_params)\n @invite.sender_id = current_user.id\n if @invite.save\n\n #if the user already exists\n if @invite.recipient != nil \n\n #send a notification email\n InviteMailer.existing_user_invite(@invite).deliver \n\n #Add the user to the user group\n @invite.recipient.user_groups.push(@invite.user_group)\n else\n InviteMailer.new_user_invite(@invite, new_user_registration_path(:invite_token => @invite.token)).deliver\n end\n \n else\n format.html { render action: 'new' }\n format.json { render json: @invite.errors, status: :unprocessable_entity }\n end\n end", "def invite(user)\n participation = @tandem.participations.create(\n user:user,\n token: generate_token\n )\n\n send_invitation_mail participation\n true\n end", "def invite_only?\n join_rule == :invite\n end", "def join_game(game)\n Player.create!(user: self, game: game, username: username) \n end", "def invite\n invite = params[:invite]\n profile.update_attribute(:email, invite[:email])\n invite = Notifier.send_invite(profile, invite[:message])\n invite.deliver\n flash[:notice] = \"An invititation to join YentaFriend was sent to #{profile.name}. Check your dashboard for an update when they join!\"\n end", "def join\n @room = Room.find(params.require(:room_id))\n if @room&.add_user(current_user)\n success\n else\n not_found\n end\n end", "def join_user user, as=:worker\n # Try to find previous role, who was deleted before\n if role = Role.unscoped.where(user_id: user.id, project_id: self.id).first\n role.update!({\n deleted: false,\n level: self.class.parse_role(as, true)\n })\n\n role\n else\n Role.create({\n level: self.class.parse_role(as, true),\n project_id: self.id,\n user_id: user.id\n })\n end\n end", "def create\n @invite = Invite.new(invite_params)\n\n if (self.admin? || (self.check_user && self.check_no_guild && self.check_own_invite)) && @invite.save\n render json: @invite, status: :created\n else\n render json: @invite.errors, status: :unprocessable_entity\n end\n end", "def join(person)\n members.push(person);\n end", "def blank_join_list\n if params[:signup] && params[:signup][:email]\n pw = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}#{self.object_id}#{Array.new(256){rand(256)}.join}\")\n user = User.new\n user.password = user.password_confirmation = pw\n user.email = params[:signup][:email]\n user.name = user.email # only by default \n\n if user.save_without_session_maintenance\t# prevents auto-login\n #flash[:notice] = \"We will add <strong>#{params[:signup][:email]}</strong> to the #{params[:signup][:list]} newsletter. #{params[:signup][:welcome]}\"\n flash[:notice] = params[:signup][:welcome] \n user.roles << Role.find_by_name(\"mail_list\")\n user.mailing_lists << MailingList.find_by_name(params[:signup][:list])\n else\n flash[:notice] = \"Email address not added. It did not look like a valid address, or has already been used. Please try again.\"\n end\n end\n redirect_back_or_default products_path\n end", "def friendify\n if username.downcase == \"admin\"\n \"user-#{username}\"\n else\n \"#{username}\"\n end\n end", "def joinRoom(roomname, username)\n room = @chats.fetch roomname #get record of \"chats\"\n #puts(room)\n userID = @users.fetch username\n puts(\"joinroom userID #{userID}\")\n puts(userID)\n room.addUser(userID, username) #add user to that chat\n puts room.printMe\n end", "def invite(user, options = {})\n group = options[:to] or raise \"Must give a :to => group option\"\n if user.kind_of?(String)\n user = User.create! :login => user, :created_from_invite => true\n end\n Invite.create! :group => group, :user => user, :admin_accepted => self.is_admin_of?(group), :requestor => self\n end", "def subject_for_recommand_friends_stage_1(invited_user)\n return \"#{@referrer.name} vous invite à créer votre profil sur CoursAvenue\"\n end", "def joins_game (user)\n raise IllegalStateTransitionError unless user_state[user] == :invited\n invite = user.invite\n invite.accept user\n if invite.all_accepted?\n # create the game, change users' states to playing,\n # update users' known documents and remove the invite\n players = invite.users\n game = Game.setup(invite.document,\n invite.reader_id, invite.guesser_id, invite.judge_id)\n players.each do |usr|\n usr.knows invite.document\n user_state[usr] = :playing\n games[usr.id] = game.id\n old_request[usr] = nil\n end\n Invite.destroy(invite.id)\n self.save\n end\n check_rep\n end", "def join\n \n #TODO add player to hunt\n #player = User.find(params[:id])\n redirect_to hunt_player_path()\n end", "def create\n user = User.new params.require(:user).permit(:email, :full_name, :password, :password_confirmation, :invite)\n \n user.should_validate_invite!\n user.should_validate_name!\n \n if user.valid?\n \n if user.invite.data && user.invite.data[:email] == user.email\n # Activate and login\n # \n user.save!\n\n if user.invite.owner.instance_of?(Company)\n user.invite.update(data: user.invite.data.merge({ user_id: user.id }) )\n else\n user.invite.destroy\n end\n \n warden.set_user(user, scope: :user)\n\n respond_to do |format|\n format.json { render json: { state: :login, previous_path: previous_path }}\n end\n else\n # Create activation token and send email\n # \n token = Token.create(\n name: :activation,\n data: { \n full_name: user.full_name,\n address: user.email,\n password_digest: user.password_digest,\n invite_id: user.invite.id\n }\n )\n\n ProfileMailer.activation_email(token).deliver\n SlackWebhooksWorker.perform_async(\n text: t('user.activities.started_to_sign_up', name: user.full_name, email: user.email)\n ) if should_perform_sidekiq_worker?\n\n respond_to do |format|\n format.json { render json: { state: :activation }}\n end\n end\n \n else\n respond_to do |format|\n format.json { render json: { errors: user.errors }, status: 403 }\n end\n end\n \n end", "def add_collaborator\n @project = current_user.projects.find(params[:id])\n @collaborator = User.find_by_email(params[:collaborator])\n @project.users << @collaborator\n\n if @project.save\n record_activity(\"added supervisor \" + params[:collaborator])\n redirect_to project_path(@project), :notice => \"Supervisor is added successfully\"\n else\n record_activity(\"error occured when added supervisor \" + params[:collaborator])\n redirect_to project_path(@project), :alert => \"Supervisor is already added\"\n end\n end", "def do_invite(invite)\n if invite.existing_user?\n deliver_email(InviteMailer.existing_user(invite))\n after_invite_existing_user(invite)\n invite.save\n else\n deliver_email(InviteMailer.new_user(invite))\n after_invite_new_user(invite)\n end\n end", "def existing_user_invite\n InviteMailer.existing_user_invite(Invite.last)\n end", "def sjoin_user(u, c)\n return \":#{@server.sid} SJOIN #{c.ts} #{c.name} + :@#{u.uid}\"\n end", "def create\n @club=Club.find(session[:current_club])\n @title=\"Sign up\"\n logout_keeping_session!\n @member = @club.members.build(params[:member])\n success = @member && @member.save\n \n \n if success\n session[:current_club]=nil\n # Member dem Club zuordnen\n # @club.members << @member\n flash[:success] = \"Member created for #{@club.name}\"\n redirect_to(login_path)\n else\n flash.now[:error] = \"We couldn't set up that account, sorry. Please try again, or contact an admin. \"\n render :action => 'new'\n end\n \n end", "def invite(user)\n return false if user == self || find_any_friendship_with(user)\n Amistad.friendship_class.new{ |f| f.friendable = self ; f.friend = user }.save\n end", "def join_team(team_id)\n group = Team.find(team_id).group\n users_team = self.users_teams.where('group_id = ? OR group_id IS NULL', group.id).first\n if users_team\n users_team.update_attributes!(:team_id => team_id, :group_id => group.id)\n else\n self.users_teams.create!(:team_id => team_id, :group_id => group.id)\n end\n end", "def create_leader(user)\n participant = Participant.new(school_id: self.id, user_id: user.id)\n participant.role_id = 1\n participant.accepted = 2\n participant.prereq = true\n participant.save\n end", "def send_invite(chat_invite)\n invite_id = Uniqueid.generate_token(chat_invite.inviter)\n stored_id = \"invite_#{chat_invite.channel_name}_#{invite_id}\"\n #puts \"#{chat_invite.inviter} #{chat_invite.invitee}\"\n commands.datastore.put(MessageLib::Entity.new.set_id(stored_id))\n chat_invite.set_invite_id(invite_id)\n commands.player.send_message(chat_invite,chat_invite.invitee)\n end", "def invite_member\n @organization = MnoEnterprise::Organization.find(params[:id])\n\n # Find or create a new user - We create it in the frontend as MnoHub will send confirmation instructions for newly\n # created users\n user = MnoEnterprise::User.find_by(email: user_params[:email]) || create_unconfirmed_user(user_params)\n\n # Create the invitation\n invite = @organization.org_invites.create(\n user_email: user.email,\n user_role: params[:user][:role],\n referrer_id: current_user.id,\n status: 'staged' # Will be updated to 'accepted' for unconfirmed users\n )\n\n @user = if user.confirmed?\n invite.accept!(user)\n invite.reload\n else\n user.reload\n end\n end", "def add_member(user)\n update_membership(user, true)\n end", "def new_invite\n if idea_posting.users.exists?(current_user.id)\n @joinrequest = Joinrequest.new\n respond_to do |format|\n format.html \n format.json {redirect_to @joinrequest}\n end\n end\n end", "def addmember\n\t\t@member=User.new\n\t\tend", "def get_data_words_this_week_social\n\n # Append user string \n data_string = \"-1\"\n data_string = data_string + \"|\" + get_data_words_this_week\n\n # Append friend strings\n #invites.find( :all, :conditions => { :host_user => id } ).each do |invite|\n Invite.find( :all, :conditions => { :host_user => id } ).each do |invite|\n \n if( invite.accepted && invite.active)\n #friend = invite.users[0]\n friend = User.find( invite.target_user )\n data_string = data_string + \"|\" + \"-1\" + \"|\" + friend.get_data_words_this_week\n end\n \n end\n\n return data_string\nend", "def invite\n parent = {coparent_email: 'lalala@gmail.com', coparent_name: 'Vasco'}\n UserMailer.invite(parent)\n end", "def add_contact(ownnick, person)\n return ret_fail('can not add yourself') if person == ownnick #you cant add yourself !\n\n usr = User.first(:nickname=>person)\n return ret_fail('no such user') if usr == nil #user does not exist !\n\n ownusr = User.first(:nickname => ownnick) #get own record to get the contact list\n return ret_fail('already in list') if ownusr.contacts.first(:userid => usr.id) != nil\n\n c = ownusr.contacts.new\n c.userid = usr.id\n puts usr.id\n puts c.userid\n c.authgiven = 'f'\n c.save\n\n return ret_success\nend", "def after_invite_new_user(invite)\n end", "def join\n if logged_in?\n @group_wanted = Group.find(params[:id]) # later change to params[:name]\n @country_wanted = Country.find(@group_wanted.country_id, :limit => 1)\n #match = current_user.countries.find(@country_wanted.id)\n #unless current_user.has_country?(@country_wanted.id) #countries.find(@country_wanted.id)\n #@matches = current_user.countries\n @match = Country.find_by_sql([\"SELECT * FROM countries_users WHERE user_id = ? AND country_id = ?\", current_user.id, @country_wanted.id])\n if @match.empty? #current_user.countries.find(@country_wanted.id).nil? #current_user.has_country?(@country_wanted.id) \n flash[:notice] = \"Joined!\"\n current_user.groups << @group_wanted # add group\n current_user.countries << @country_wanted # add country\n redirect_to '/perfil'\n else\n flash[:error] = \"You're either already subscribed to a group in the same country or in the same group.\"\n redirect_to :action => 'index'\n end \n end \n end", "def accepted_by(user)\n return false unless self.active?\n # assign user to startup unless they are already part of a startup\n relationship_role = nil\n\n if self.invite_type == Invite::TEAM_MEMBER\n user.startup_id = self.startup_id if !self.startup_id.blank? or !user.startup_id.blank?\n user.set_account_type(:entrepreneur)\n # Bypass forcing user to setup account if they were invited from startup that is setup, also don't suggest startups\n user.setup_complete! if self.startup.account_setup?\n elsif self.invite_type == Invite::STARTUP\n user.set_account_type(:entrepreneur)\n relationship_role = :startup_startup\n elsif self.invite_type == Invite::MENTOR || self.invite_type == Invite::NREDUCE_MENTOR # Add user as mentor to startup\n user.set_account_type(:mentor)\n user.roles << :nreduce_mentor if self.invite_type == Invite::NREDUCE_MENTOR\n relationship_role = :startup_mentor\n elsif self.invite_type == Invite::INVESTOR\n user.set_account_type(:investor)\n relationship_role = :startup_investor\n end\n\n # Add user to startup if invite came from startup\n if !self.startup.blank? and !relationship_role.blank?\n r = Relationship.start_between(user, self.startup, relationship_role, true)\n if r.blank?\n self.errors.add(:user_id, 'could not be added to startup')\n else\n self.errors.add(:user_id, 'could not be added to startup') unless r.approve!\n end\n end\n \n if user.save\n self.to = user\n self.accepted_at = Time.now\n self.save\n else\n false\n end\n end", "def join\n game = Game.find(params[:id])\n \n raise \"Game already started\" unless game.open?\n \n # Only add the player to the game if they aren't already in it\n game.join(current_user) unless game.has_player?(current_user)\n current_user.lives = 25\n current_user.save!\n redirect_to game_path\n rescue \n flash[:error] = \"That is not a game that can be joined\"\n redirect_to lobby_path\n end", "def join(id)\n precondition do\n raise unless id > 0\n end\n\n id = rpc \"join\", id \n @game.sync\n \n postcondition do\n raise unless id\n end\n end", "def create\n\t\t\n\t\tcourse = { course_id: @course.id }\n\t\tcourse_invite = course.merge( invite_params )\n\t\t@invite = @course.invites.new(course_invite)\n\t\t\n\t\t@email = invite_params[:email]\n\t\tif @email.nil?\n\t\t\t\tflash[:danger] = 'Email cannot be blank'\n\t\t\t\trender 'new'\n\t\telsif @email != @current_user.email\n\t\t\tif (User.find_by_email(@email) != nil) && @invite.valid?\n\t\t\t\t@invite.save \n\t\t\t\t@user = User.find_by_email(@email)\n\t\t\t\tTutor.create!(user_id: @user.id, course_id: @course.id)\n\t\t\t\tflash[:success] = 'User successfully added to course'\n\t\t\t\tredirect_to course_members_path(@course)\n\t\t\telse\n\t\t\t\tflash[:danger] = 'Email does not exist in database. User must have an existing account to be invited to join a course. Sign up email sent to supplied email address'\n\t\t\t\tInviteMailer.invite(@current_user, @course, @email).deliver_now\n\t\t\t\tredirect_to course_members_path(@course)\n\t\t\tend\n\t\telse\n\t\t\trender 'new'\n\t\t\tflash.now[:danger] = \"You are already the course convenor, you may not invite yourself to join the course.\"\n\t\tend\n\tend", "def invite(user, group, mailto)\n @user = user\n @group = group\n mail(to: mailto, subject:'user.name invite you! Join GURUPU')\n end", "def ensure_invitee(user)\n if self.invitee.nil?\n self.invitee = user\n save\n else\n self.invitee == user\n end\n end", "def add_member\n result=@cabal.add_member(params[:username])\n member = \"\"\n if result==0\n notice = \"User does not exist. \"\n elsif result==-1\n notice = \"User already in cabal. \"\n else\n notice = \"Successfully added user to cabal. \"\n member = \", \" + params[:username]\n end\n @response = notice\n @member = member\n respond_to do |format|\n format.js {}\n end\n end", "def create\n @join = Join.find_by(user_id: current_user.id, hike_id: params[:id])\n if @join\n redirect_to :back\n else\n @join = Join.create(user_id:current_user.id, hike_id:params[:id])\n redirect_to :back\n end\n end", "def join_group\n @disc_group = DiscussionGroup.find(params[:id])\n @join = DiscussionGroupUser.new(:discussion_group_id => @disc_group.id, :user_id => @login_user.id, :is_member => 1)\n if @join.save\n respond_to do |format|\n format.js\n end\n else\n render :text=>\"Fail\"\n end\n end", "def after_invite_existing_user(invite)\n # Add the user to the invitable resource/organization\n invite.invitable.add_invited_user(invite.recipient)\n end", "def local_invite(body)\n peer = _pop_token(body)\n room = @var[:room] if body.length < 2\n _remote_control(peer, :invite, room)\n _notice \"#{peer} has been invited to #{room}\"\nend", "def join_group(user_group, admin=0)\n Membership.create!(:user => self,\n :user_group => user_group,\n :admin => admin,\n :accepted_at => Time.now) unless user_group.is_member?(self)\n end", "def create_member(data)\n headers = @client.make_request(:post, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/members\"), data)[1]\n id = Client.get_id_from_location_header(headers[:location])\n get_member(id)\n end", "def join\n @room = OnlineMeetingRoom.find_by_id(params[:id])\n role = @room.user_role(current_user)\n unless role == :denied\n join_internal(current_user.full_name, role, :join)\n else\n flash[:notice] = \"#{t('access_denied')}\"\n redirect_to :index and return\n end\n end", "def join\n if (not @event.users.include? current_user)\n EventUser.create(user: current_user, event: @event)\n redirect_to events_path, notice: \"You are now participating.\"\n else\n ev = EventUser.find_by user: current_user, event: @event\n ev.destroy\n redirect_to events_path, notice: \"Removed you from the event.\"\n end\n end" ]
[ "0.61996776", "0.60027933", "0.5995404", "0.58978456", "0.58726716", "0.5857235", "0.57745343", "0.5766841", "0.5762479", "0.5746051", "0.5743181", "0.5708433", "0.57070357", "0.5702719", "0.565002", "0.56422156", "0.5638033", "0.5636886", "0.56287897", "0.5603159", "0.5597975", "0.5592569", "0.55918205", "0.5583057", "0.5583057", "0.5564038", "0.5553515", "0.5506633", "0.54498434", "0.5435233", "0.53937423", "0.53840566", "0.5382796", "0.5311857", "0.5306119", "0.5300039", "0.5293727", "0.52932835", "0.52882653", "0.5283654", "0.5283182", "0.52824116", "0.52787906", "0.52785134", "0.5265985", "0.52636415", "0.5252844", "0.5248719", "0.52410984", "0.5234598", "0.5225337", "0.5222173", "0.52196825", "0.5218036", "0.52141154", "0.52140325", "0.52063847", "0.5205778", "0.51867735", "0.51865363", "0.51832205", "0.5179831", "0.5176423", "0.51712084", "0.51690173", "0.51626694", "0.51581174", "0.51574415", "0.515418", "0.51514566", "0.5151103", "0.51497865", "0.51350313", "0.5130076", "0.51213366", "0.511752", "0.5117512", "0.511366", "0.5105605", "0.509829", "0.5096702", "0.50929326", "0.5089801", "0.5087027", "0.5085301", "0.50835544", "0.50817037", "0.507879", "0.5077595", "0.50679564", "0.5064025", "0.50624937", "0.50575715", "0.5055234", "0.5053637", "0.50531214", "0.50511587", "0.5047335", "0.5039434", "0.5035743", "0.5033148" ]
0.0
-1
return all contracts for a clan newest first
def get_contracts Contract.where(clan_id: id).order('start_date_time desc') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @employment_contracts = EmploymentContract.order(\"created_at desc\")\n end", "def index\n @contracts = Contract.all.first(50000)\n end", "def sort_contracts(how_many)\n return_array = []\n contracts_sorted = join_table_gas_simulation_contracts.sort_by(&:savings).reverse\n how_many.times do |i|\n return_array << GasContract.find(contracts_sorted[i].gas_contract_id)\n rescue\n return_array\n end\n return_array\n end", "def sort_contracts(how_many)\n return_array = []\n contracts_sorted = join_table_ele_simulation_contracts.sort_by(&:savings).reverse\n how_many.times do |i|\n return_array << EleContract.find(contracts_sorted[i].ele_contract_id)\n rescue\n return_array\n end\n return_array\n end", "def latest\n return self.transactions.first(:order => [:date.desc])\n end", "def index\n @consignments = Consignment.newest_first.page params[:page]\n end", "def index\n #@contracts = Contract.all.order(sort_column + \" \" + sort_name).uniq{|contract| contract.name}\n @contracts = Contract.all.order(sort_column + \" \" + sort_name).uniq{|contract| contract.name}\n end", "def earliest\n return self.transactions.first(:order => [:date.asc])\n end", "def contract; Contract.get(self.contract_id); end", "def last_flight\n approved_flights.order(date: :desc).first\n end", "def latest_block(blockchain)\n blockchain[-1]\n end", "def getLatest()\r\n return OzbKonto.get(self.KtoNr)\r\n end", "def get_contracts\n response = @client.get(contracts_link)\n raise Inkdit::Error.new(response) unless response.status == 200\n\n response.parsed['resources'].map do |contract_params|\n Contract.new @client, contract_params\n end\n end", "def newest(constraints = {})\n constraints.merge!(order: :created_at.desc)\n _q = query(constraints)\n _q.define_singleton_method(:method_missing) { |m, *args, &block| self.results.send(m, *args, &block) }\n _q\n end", "def show\n @contract = Contract.find(params[:id])\n @installments = @contract.installments.order(\"date\")\n\n end", "def newest\n unless newest?\n return self.class.unscoped.where(_id: self.tll_top).first\n end\n\n self\n end", "def first\n self.class.where(:id => rid).order('lower(validity)').first\n end", "def contracts\n\t\t@user = User.find_by_username(params[:profile_id])\n\t\tif !@user.present?\n\t\t\tredirect_to root_path\n\t\tend\n\n\t\tcontracts = []\n\t\tif current_admin.present? || (current_user.meets_contract_preferences?(@user) && !@user.is_blocking_user?(current_user))\n\t\t\t(@user.posted_contracts.where(status: \"Open\") + @user.posted_bounties.where(status: \"Open\")).each do | c |\n\t\t\t\tcontracts << {\n\t\t\t\t\t:id => c.id,\n\t\t\t\t\t:start=> c.start_date_time,\n\t\t\t\t\t:end=> c.end_date_time,\n\t\t\t\t\t:title=> \"$#{c.price_in_dollars}\",\n\t\t\t\t\t:type => c.contract_type\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\t\trender :json => contracts\n\tend", "def index\n @contracts = Contract.all\n end", "def index\n @contracts = Contract.all\n end", "def index\n @contracts = Contract.all\n end", "def index\n @contracts = Contract.all\n end", "def index\n @contracts = Contract.all\n end", "def topMostCard\n object.cards.mostRecentlyUpdated.one[0]\n end", "def last\n self.class.where(:id => rid).order('lower(validity)').last\n end", "def find_first_comment\n\t\tcomments.first(created_at DESC)\n\tend", "def index \n @contracts = Contract.all \n end", "def index\n get_contracts\n end", "def getContract( contract_id)\n params = Hash.new\n params['contract_id'] = contract_id\n return doCurl(\"get\",\"/contract\",params)\n end", "def current_contract\n self.this_year.contract\n end", "def recent_citations\n courtlistener = CourtListener.new\n citations = courtlistener.citing_opinions(cite1)\n citation_list = citations[0..4].map do |citation|\n data_hash = courtlistener.case_data_by_opinion(citation[\"citing_opinion\"])\n c = CLOpinion.new(data_hash)\n c.id = courtlistener.id_from_url(citation[\"citing_opinion\"])\n c\n end\n end", "def get_citizens\n citizens = self._get_citizens\n self.apply_to_children { |entity| citizens.concat(entity._get_citizens) }\n citizens.uniq { |c| c.id }.sort_by { |c| c.last_activity_at }.reverse\n end", "def getLatest()\r\n return EeKonto.get(self.KtoNr)\r\n end", "def biggest_council\n return if payer_breakdown.blank? || payer_breakdown.all?{ |o| o[:organisation_type] != 'Council' }\n council_details = payer_breakdown.select{ |o| o[:organisation_type] == 'Council'}.sort{|a,b| b[:total_spend] <=> a[:total_spend]}.first\n Council.find_by_id(council_details[:organisation_id])\n end", "def earliest; all(:order => [:started_at.asc, :id.asc ]) end", "def latest\n self\n end", "def best_minimal_contracts(dir)\n with_each_strain(dir).inject([-350, []]) do |best_score_contracts_pair, (strain, tricks)|\n score = score_with_bonuses(strain, tricks)\n if score == best_score_contracts_pair[0]\n [score, best_score_contracts_pair[1] << minimal_contract(strain, tricks)]\n elsif score > best_score_contracts_pair[0]\n [score, [minimal_contract(strain, tricks)]]\n else\n best_score_contracts_pair\n end\n end[1].to_set\n end", "def first_entry\n Entry.find(:first, :conditions => [\"round_id = ?\", self], :order =>[\"created_at DESC\"])\n end", "def last_changed_craft nac = new_and_changed #call new_and_changed just once, with option to pass it in if its already been called.\n last_updated = self.craft.where(\"deleted = ? and name != ?\", false, \"Auto-Saved Ship\").order(\"updated_at\").last\n\n if !nac[:changed].empty? || !nac[:new].empty?\n craft_names = nac[:changed].select{|c| !c.include?(\"Auto-Saved Ship\")}\n craft_names = nac[:new].select{|c| !c.include?(\"Auto-Saved Ship\")} unless nac[:new].empty?\n unless craft_names.empty?\n matched_craft = Craft.where(:name => craft_names.map{|cn| cn.split(\"/\").last.sub(\".craft\",\"\")}, :deleted => false, :campaign_id => self.id)\n matched_craft = matched_craft.sort_by{|c| File.mtime(c.file_path) if File.exists?(c.file_path) } \n last_updated = matched_craft.last unless matched_craft.empty?\n end\n end\n last_updated\n end", "def first\n self.class.where(id: rid).chronological.first\n end", "def previous\n self.class.first(\n conditions: ['contract_id = ? AND id != ? AND effective_from <= ?', contract_id, id, effective_from],\n order: 'effective_from DESC',\n )\n end", "def last\n self.class.where(id: rid).chronological.last\n end", "def last\n result ? all.last : limit(1).descending.all.last\n end", "def index\n @page_count, @contracts = Locomotive::Contract.paginated(:page => (params[:page] || 1).to_i)\n display @contracts\n end", "def index\n @cscenters = Cscenter.order(created_at: :desc)\n end", "def find_first\n Period.order(\"begins_at ASC\").first\n end", "def getLatest()\n return Gesellschafter.get(self.Mnr)\n end", "def get_contract_current()\n self.class.get(\"/api/contracts/current\", :basic_auth => @auth)\n end", "def current_businesses\r\n ct = Localization::localizer.now()\r\n current_date = ::Date.new(ct.year, ct.month, ct.day)\r\n businesses = []\r\n unit_contracts.each do | uc |\r\n if ( (current_date >= uc.start_date) && \r\n ((uc.end_date.nil?) || (current_date < uc.end_date )) )\r\n businesses << uc.business\r\n end\r\n end\r\n \r\n return businesses\r\n end", "def most_recent_recipe\n self.recipe_cards.sort do |recipe_card|\n recipe_card.date\n end.first\n end", "def get_contract\n if self.complete? and not self.passed_out?\n bid = self.get_current_call(Bid)\n double = self.get_current_call(Double)\n redouble = self.get_current_call(Redouble)\n declarer_bid = nil\n # Determine partnership.\n caller = self.who_called?(bid)\n partnership = [caller, Direction[(caller + 2) % 4]]\n # Determine declarer.\n self.calls.each do |call|\n if call.is_a?(Bid) and call.strain == bid.strain and partnership.include?(self.who_called?(call))\n declarer_bid = call\n break\n end\n end\n \n {\n :bid => bid,\n :declarer => declarer_bid.nil? ? nil : self.who_called?(declarer_bid),\n :double_by => double.nil? ? nil : self.who_called?(double),\n :redouble_by => redouble.nil? ? nil : self.who_called?(redouble) \n }\n else\n nil # Bidding passed out or not complete, no contract.\n end\n end", "def getContract_logBy_contract_id( contract_id, page, per_page)\n params = Hash.new\n params['contract_id'] = contract_id\n params['page'] = page\n params['per_page'] = per_page\n return doCurl(\"get\",\"/contract_log/by_contract_id\",params)\n end", "def newest_certificate\n self.death_certificates.where('created_at is NOT NULL').order('created_at DESC').first\n end", "def newest\n @client = Client.recent.first\n respond_with(@client)\n end", "def first_commit\n\tcommit = nil\n\tresp = github_api(\"commits\")\n\tsha = resp[-1][\"commit\"][\"sha\"]\n\twhile true\n\t\tr = github_api(\"commits?sha=#{sha}&per_page=100\")\n\t\tif r.count != 1 \n\t\t\tsha = r[-1][\"sha\"]\n\t\t\tnext\n\t\tend\n\t\tcommit = r[0]\n\t\tbreak\n\tend\n\tcommit\nend", "def oldest_commit\n commits.last\n end", "def index\n @comites = Comite.all.sort_by(&:updated_at).reverse!\n end", "def newest\n # Get the newest players\n req = @server + \"/#{CouchDB::DB}/_design/Person/_view/byDate?descending=true&limit=1\"\n result = CouchRest.get req\n if result[\"rows\"].length == 1\n return Person.new(result['rows'][0]['value'], @server)\n else\n return nil\n end\n end", "def get_del_with_min_effort(complexity_id)\n c_dels = [] \n del_types = self.get_same_stock_deliverable_types\n \n del_types.each do |type|\n c_dels += type.deliverables.find_all_by_complexity_id(complexity_id,\n :order => \"estimated_effort asc\",\n :limit => 1) unless type.deliverables.nil?\n end\n c_dels.sort! {|a, b| a.estimated_effort <=> b.estimated_effort}\n c_dels.first unless c_dels.nil?\n end", "def biggest_investment\n self.funding_rounds.max_by do |round|\n round.startup.uniq \n end\n end", "def branche\n Rails.cache.fetch(\"commits/#{branche_id}-#{commit_hash}/branche\", expires_in: 240.hours) do\n Branche.find(@branche_id)\n end\n end", "def newest\n params[:sort] = 'ACTIVATED_AT DESC'\n params[:school_id] = auth_user.current_school_id\n index\n end", "def index\n @contractors = current_contractor\n end", "def index\n if params[:search].present?\n @contracts = Contract.search(params[:search])\n elsif params[:sort].present?\n @contracts = Contract.where(contract_type: params[:sort])\n else\n @contracts = Contract.all\n end\n end", "def top_ten\n Rails.cache.fetch('top_ten_resp', expires_in: 1.minutes) do\n conn = Faraday.new(url: @base_url) do |faraday|\n faraday.adapter(Faraday.default_adapter)\n end\n\n resp = conn.get do |req|\n req.url '/v1/cryptocurrency/listings/latest'\n req.headers['X-CMC_PRO_API_KEY'] = @api_key\n req.params['start'] = 1\n req.params['limit'] = 10\n req.params['convert'] = 'USD'\n req.params['sort'] = 'market_cap'\n req.params['sort_dir'] = 'desc'\n end\n\n raise 'Cannot parse response body' unless resp.body\n\n resp.body\n end\n end", "def create_random_contract\n available_contract_missions.each do |m|\n end\n end", "def most_recent_recipe\n self.recipe_cards.max_by {|recipecard| recipecard.date}\nend", "def index\n @list_of_slayders = Slayder.all.order(updated_at: :desc)\n end", "def contract(name)\n request(method: 'getContract', params: {name: name})\n end", "def index\n @contract_types = ContractType.all\n end", "def oldest(constraints = {})\n constraints.merge!(order: :created_at.asc)\n _q = query(constraints)\n _q.define_singleton_method(:method_missing) { |m, *args, &block| self.results.send(m, *args, &block) }\n _q\n end", "def most_recent_recipe\n recipe_cards.sort_by { |card| card.date}.reverse.first.recipe\n end", "def current_campaign\n return nil if campaigns.empty?\n campaigns.order(donation_deadline: 'DESC').first\n end", "def latest\n Sibit::Json.new(http: @http, log: @log).get(\n URI('https://blockchain.info/latestblock')\n )['hash']\n end", "def index\n @calls = Call.all.order('created_at DESC')\n end", "def index\n @clients = Client.all.order(created_at: :desc)\n end", "def index\n @hr_config_contracts = Hr::Config::Contract.all\n end", "def query_4\n all_contracts =Perpetuity[LegalContract].all.sort(:created_at)\n indexes = [0,18,2,4,1,15,3,17,16,19]\n contracts =[]\n 10.times do\n contracts << all_contracts[indexes.pop]\n end\n\n team_members = []\n contracts.each do |contract|\n ptms = Perpetuity[ProjectsTeamMember].select{|ptm| ptm.project.id == contract.project.id }.to_a\n ptms.each do |pt|\n team_member = Perpetuity[TeamMember].select{|tm| tm.id == pt.team_member.id}.to_a\n team_members << team_member\n end\n end\n return team_members.size\nend", "def first\n all.first\n end", "def current_budget\n Budget.where(user_id: current_user.id).sort_by(&:created_at).last\n end", "def latest_comments\n self.comments.order(created_at: :desc)\n end", "def latest\n @comic = Comic.order(\"created_at ASC\").last\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @comic }\n end\n end", "def latest\n @comic = Comic.order(\"created_at ASC\").last\n respond_to do |format|\n format.html { render 'show' }\n format.json { render json: @comic }\n end\n end", "def first\n all.first\n end", "def first\n all.first\n end", "def first\n all.first\n end", "def first\n all.first\n end", "def most_recent_recipe\n recipes.sort_by do |i| \n i.date\n end.last\n end", "def latest_market_data\n cryptsy = Cryptsy::API::Client.new\n # TODO: I need exception handling here because\n # when cryptsy fails to respond to my request, \n # it causes the program to crash.\n cryptsy.marketdata(self.cryptsy_market_id)\n end", "def last_finances\n return self.club_finances_rounds.find(:first, :conditions => {\n :round_id => self.current_season.get_previous_round\n }) unless self.current_season.first_round? || self.current_season.finished?\n\n if self.current_season.finished?\n return self.club_finances_rounds.find(:first, :conditions => {\n :round_id => self.current_season.round_actual\n })\n end\n end", "def get_contract_filter\n\t get_contract\n\t @tabtitle = @contract.name unless @contract.nil?\n\t true\n\tend", "def most_recent\n Visit.all.sort_by{|visit| visit.timestamps}.last\n end", "def find_last_gift(donor)\n selected_gifts = Gift.where(:donor_id => donor)\n last_gift = nil\n selected_gifts.each do |g|\n if last_gift.nil?\n last_gift = g\n else\n if g.created_at > last_gift.created_at\n last_gift = g\n end\n end\n end \n return last_gift\n end", "def chronic\n @chronic ||= statements.except(:order).order('entered_on ASC, entered_at ASC, id ASC').all\n end", "def earliest!\n earliest_order!.first\n end", "def all_plans\n Plan.joins(:plan_category).includes(:plan_category) \\\n .yr(year).order('plan_categories.ordinal, plans.cat_order')\n end", "def home\n @comic = Comic.where(:tweet => true).order(\"updated_at DESC\").limit(1)[0]\n\n end", "def index\n if current_user.customer?\n @contracts = Contract.where(customer: current_user)\n else\n @contracts = Contract.where(ninja: current_user).or(Contract.where(ninja: nil))\n end\n end", "def caar; first.first end", "def last\n self.all.last\n end" ]
[ "0.58834624", "0.5801333", "0.5739579", "0.56616473", "0.5656057", "0.55541444", "0.55098265", "0.55043143", "0.5476279", "0.5446749", "0.5417555", "0.5410505", "0.5337612", "0.53325564", "0.53202784", "0.53202426", "0.52933043", "0.526573", "0.52451736", "0.52451736", "0.52451736", "0.52451736", "0.52451736", "0.52338594", "0.5232297", "0.51673126", "0.5128231", "0.5092904", "0.5092032", "0.50833553", "0.5078264", "0.50405455", "0.5030293", "0.5023867", "0.5010629", "0.500253", "0.49957138", "0.4994579", "0.498845", "0.4988147", "0.49853933", "0.49798936", "0.496835", "0.4963876", "0.49535057", "0.49464226", "0.49457508", "0.49401668", "0.49197096", "0.49015987", "0.48948726", "0.48836014", "0.48808214", "0.4879935", "0.48750767", "0.4871098", "0.48651978", "0.4862286", "0.48581147", "0.48564887", "0.48528278", "0.4842588", "0.48425436", "0.48388726", "0.48357025", "0.48305663", "0.4829001", "0.48252177", "0.481811", "0.48166505", "0.4816269", "0.4808644", "0.48055285", "0.47890002", "0.47879377", "0.47648254", "0.4764383", "0.4761447", "0.47602916", "0.4758357", "0.4745675", "0.4742383", "0.4742383", "0.47377437", "0.47377437", "0.47377437", "0.47377437", "0.4728623", "0.4724986", "0.47230005", "0.47073507", "0.46949738", "0.46943027", "0.468684", "0.46867844", "0.46850714", "0.46836182", "0.4682945", "0.46770468", "0.46761656" ]
0.74952155
0
GET /dianosaurs GET /dianosaurs.json
def index @dianosaurs = Dianosaur.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end", "def show\n dinosaurs = Dinosaur.filter_by_species(params[:species])\n\n if dinosaurs\n render json: dinosaurs\n else\n render json: dinosaurs.errors, status: :unprocessable_entity\n end\n end", "def index\n @dnas = Dna.all\n\n render json: @dnas\n end", "def index\n @dossiers = Dossier.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dossiers }\n end\n end", "def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end", "def index\n @dinosaurs = Dinosaur.search(params[:search])\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def show\n json = self.as_json(only: [:created_at, :version])\n json['url'] = doi_url\n json\n end", "def show\n render json: @archdiocese\n end", "def show\n render json: @diet, status: 200, root: true\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def show\n @dinosaur = Dinosaur.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dinosaur }\n end\n end", "def index\n @title = \"Studies\"\n\n respond_to do |format|\n format.html do\n @my_studies = Study.with_user(current_user.netid)\n end\n format.json do\n render :json => Study.with_user(current_user.netid).to_json\n end\n end\n end", "def index\n @archdioceses = Archdiocese.all\n\n render json: @archdioceses\n end", "def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end", "def show\n @skydatum = Skydatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skydatum }\n end\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "def index\n @socioeconomic_studies = SocioeconomicStudy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socioeconomic_studies }\n end\n end", "def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end", "def index\n @duty_stations = DutyStation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @duty_stations }\n end\n end", "def show\n @diapo = current_church.diapos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diapo }\n end\n end", "def index\n @studies = Study.all\n #render json: @studies\n end", "def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end", "def index\n @dolgnosts = Dolgnost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dolgnosts }\n end\n end", "def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end", "def index\n @uchronists = Uchronist.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronists }\n end\n end", "def index\n render json: @fiestas\n end", "def index\n @tour_dates = TourDate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tour_dates }\n end\n end", "def show\n render json: @dino\n end", "def index\n @ultimo_grado_de_estudios = UltimoGradoDeEstudio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ultimo_grado_de_estudios }\n end\n end", "def index\n @diciplinas = Diciplina.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @diciplinas }\n end\n end", "def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end", "def index\n @diaries = current_user.diaries.all\n respond_to do |format|\n format.html {render :index}\n format.json { render json: @diaries }\n end\n end", "def index\n @estacionamientos = Estacionamiento.all\n\n @json = Estacionamiento.all.to_gmaps4rails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estacionamientos }\n end\n end", "def index\n @nepals = Nepal.all\n\n render json: @nepals\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end", "def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end", "def index\n render json: WeatherDatum.all\n end", "def show\n @sotrudniki = Sotrudniki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sotrudniki }\n end\n end", "def index\n @preparatoria_o_universidad_de_origens = PreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origens }\n end\n end", "def index\n render json: Loan.all\n end", "def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end", "def index\n @stations = Station.all\n\n render json: @stations\n end", "def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end", "def index\n @stations = Station.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stations }\n end\n end", "def index\n @countries = Country.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @countries }\n end\n end", "def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\n end", "def index\n @title = \"Районы\"\n @districts = District.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @districts }\n end\n end", "def show\n @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gasto }\n end\n end", "def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def index\n\n @directions = Direction.all\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @directions }\n format.xml { render :xml => @directions }\n end\n end", "def show\n @tupian = Tupian.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tupian }\n end\n end", "def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\n end\n end", "def show\n @torneo = Torneo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torneo }\n end\n end", "def index\n head 404\n # @api_v1_followings = Api::V1::Following.all\n\n # render json: @api_v1_followings\n end", "def index\n @countries = Country.all\n\n render json: @countries\n end", "def index\n @dougas = Douga.all\n end", "def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\n end\n end", "def index\n @seguridad_usuarios = Seguridad::Usuario.order('usuario')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @seguridad_usuarios }\n end\n end", "def index\n if params[:species_name].nil?\n @dinosaurs = Dinosaur.all\n else\n @dinosaurs = Species.name_filter(params[:species_name]).joins :dinosaurs\n end\n #TODO generate errors for invalid parameters/valuies\n exposes @dinosaurs\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_insurances }\n end\n end", "def index\n @german_go_leagues = GermanGoLeague.all\n\t\t@title = \"Bundesliga Spiele\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @german_go_leagues }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @neuropsychologist }\n end\n end", "def show\n @nyan = Nyan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nyan }\n end\n end", "def index\n @tutor = Tutor.all\n\n render json: @tutor, status: :ok\n end", "def index_hosting\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.hosted_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "def index\n @universities = University.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @universities }\n end\n end", "def index\n @treks = Trek.all\n @title = \"Trekking routes and destinations\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @treks }\n end\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socio }\n end\n end", "def index\n @studies = Study.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @studies }\n end\n end", "def index\n @dices = Dice.all\n\n render json: @dices\n end", "def index\n puts \"user: #{@current_user.json_hash[:id]}\"\n hosted_dinners = []\n attended_dinners = []\n @hosted_dinners = @current_user.hosted_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n hosted_dinners << dinner.all_info\n end\n @attended_dinners = @current_user.attended_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n attended_dinners << dinner.all_info\n end\n render json: {\n hosting: hosted_dinners,\n attending: attended_dinners\n }\n end", "def show\n @seo_datum = SeoDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seo_datum }\n end\n end", "def index\n if params[:q]\n url = \"http://api.worldweatheronline.com/premium/v1/tz.ashx?q=#{params[:q]}&format=json&key=2c46659bd90a41a0bcf132257162410\"\n @json = ActiveSupport::JSON.decode(open(url).read)\n else\n end\n end", "def show\n @nail_salon = NailSalon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nail_salon }\n end\n end", "def index\n @drone_attacks = DroneAttack.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :layout => 'blank'}\n end\n end", "def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end", "def index\n @noise = Noise.new\n @noises = Noise.all\n params[:page] ||= 1\n\n respond_to do |format|\n format.html { @noises = Noise.paginate(per_page: 20, page: params[:page]) }\n format.json do \n list = @noises.map\n render json: Noise.all.select('id, sounds, icon') \n end\n end\n end", "def show\n render json: @tutorado, status: :ok\n end", "def show\n @turma = Turma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @turma }\n end\n end", "def show\n @nguoi_dung = NguoiDung.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nguoi_dung }\n end\n end", "def index\n @siritoris = Siritori.order(created_at: :DESC).page(params[:page]).per(12)\n end", "def index\n @ordens = Orden.all\n render json: @ordens\n end", "def index\n @nationals = National.all\n end", "def index\n @countries = Country.all\n json_response(@countries)\n end", "def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end", "def show\n render json: @lugar\n end", "def index\n @clues = Clue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clues }\n end\n end", "def index\n puts \"Index method called...\"\n @studies = Study.all\n\n # render json: @studies\n end", "def corona_virus\n # endpoint = \"https://corona.lmao.ninja/all\"\n endpoint = 'https://corona.lmao.ninja/v2/all'\n response = HTTParty.get(endpoint)\n data = JSON.parse response.body\n res = data\n result = []\n result<<{\n country: \"world\",\n cases: res[\"cases\"],\n todayCases: res[\"todayCases\"],\n deaths: res[\"deaths\"],\n todayDeaths: res[\"todayDeaths\"],\n recovered: res[\"recovered\"],\n active: res[\"active\"],\n critical: res[\"critical\"],\n casesPerOneMillion: res[\"casesPerOneMillion\"],\n deathsPerOneMillion: res[\"deathsPerOneMillion\"],\n tests: res[\"tests\"],\n testsPerOneMillion: res[\"testsPerOneMillion\"],\n affectedCountries: res[\"affectedCountries\"]\n }\n render json: result\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @socio }\n end\n end", "def index\n @loves = Love.all\n render json: @loves\n end", "def index\n @turista = Turistum.all\n end" ]
[ "0.65777904", "0.65596354", "0.6470492", "0.617811", "0.6157605", "0.613789", "0.6126394", "0.61251336", "0.61018944", "0.610158", "0.6087258", "0.60863346", "0.60516644", "0.603589", "0.60243237", "0.6007011", "0.6003411", "0.6001562", "0.6001041", "0.5988936", "0.5985258", "0.5973541", "0.59592736", "0.5956599", "0.59440655", "0.5924165", "0.59235567", "0.59226716", "0.5909676", "0.58999056", "0.5892547", "0.5890043", "0.58782625", "0.58661294", "0.58569556", "0.58549094", "0.5851193", "0.58452564", "0.5842834", "0.5832888", "0.5828219", "0.5819461", "0.5812291", "0.58099204", "0.5806568", "0.5800974", "0.58003664", "0.5795312", "0.57889587", "0.5787177", "0.57861567", "0.57847106", "0.5782398", "0.5776077", "0.57758397", "0.5773594", "0.5768333", "0.57654476", "0.575083", "0.5736619", "0.5735938", "0.57332754", "0.57321954", "0.57295555", "0.57250506", "0.5723514", "0.57224065", "0.57213414", "0.57198465", "0.5718073", "0.5718017", "0.5717249", "0.57148784", "0.571187", "0.5711628", "0.5707955", "0.57075816", "0.570652", "0.57045305", "0.5703589", "0.5703575", "0.5703234", "0.57017326", "0.5695417", "0.5695113", "0.56944674", "0.56933725", "0.56915826", "0.56904566", "0.5689743", "0.5688952", "0.56851083", "0.5684958", "0.56828797", "0.56826526", "0.56766397", "0.5667697", "0.56675225", "0.56659234", "0.56657887" ]
0.6803119
0
GET /dianosaurs/1 GET /dianosaurs/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end", "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end", "def show\n dinosaurs = Dinosaur.filter_by_species(params[:species])\n\n if dinosaurs\n render json: dinosaurs\n else\n render json: dinosaurs.errors, status: :unprocessable_entity\n end\n end", "def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end", "def index\n @dianosaurs = Dianosaur.all\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def show\n json = self.as_json(only: [:created_at, :version])\n json['url'] = doi_url\n json\n end", "def index\n @dossiers = Dossier.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dossiers }\n end\n end", "def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end", "def show\n render json: @diet, status: 200, root: true\n end", "def show\n @sotrudniki = Sotrudniki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sotrudniki }\n end\n end", "def show\n @skydatum = Skydatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skydatum }\n end\n end", "def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def show\n @sezione = Sezione.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sezione }\n end\n end", "def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end", "def index\n @title = \"Studies\"\n\n respond_to do |format|\n format.html do\n @my_studies = Study.with_user(current_user.netid)\n end\n format.json do\n render :json => Study.with_user(current_user.netid).to_json\n end\n end\n end", "def show\n @dinosaur = Dinosaur.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dinosaur }\n end\n end", "def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end", "def show\n @tupian = Tupian.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tupian }\n end\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socio }\n end\n end", "def index\n @studies = Study.all\n #render json: @studies\n end", "def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end", "def show\n render json: @archdiocese\n end", "def index\n @dnas = Dna.all\n\n render json: @dnas\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @socio }\n end\n end", "def index\n render json: @fiestas\n end", "def show\n @study = Study.find(params[:id])\n render json: @study\n end", "def show\n @diapo = current_church.diapos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diapo }\n end\n end", "def show\n @turma = Turma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @turma }\n end\n end", "def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end", "def show\n @seo_datum = SeoDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seo_datum }\n end\n end", "def index\n @socioeconomic_studies = SocioeconomicStudy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socioeconomic_studies }\n end\n end", "def show\n @uchronist = Uchronist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronist }\n end\n end", "def show\n @lei = Lei.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lei }\n end\n end", "def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end", "def show\n sondage = SondageService.instance.afficherSondageParId(params[:id])\n (sondage != nil) ? (render json: sondage, status: :ok) : (render json: nil, status: :not_found)\n end", "def show\n #@stanza = Stanza.find(params[:id])\n #@stanza = Stanza.where(:stanzno=>params[:id])\n @stanza = Stanza.find_by_no(params[:id]) || not_found\n logger.info @stanza\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stanza }\n end\n end", "def show\n @nguoi_dung = NguoiDung.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nguoi_dung }\n end\n end", "def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end", "def show\n @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gasto }\n end\n end", "def show\n render json: @dino\n end", "def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end", "def show\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @therapist }\n end\n end", "def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end", "def index\n @uchronists = Uchronist.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronists }\n end\n end", "def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\n end\n end", "def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end", "def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end", "def show\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @giang_vien }\n end\n end", "def show\n @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lieu }\n end\n end", "def show\n @diemtrentuyen = Diemtrentuyen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diemtrentuyen }\n end\n end", "def show\n @torneo = Torneo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torneo }\n end\n end", "def show\n render :json => Neuron.find(params[:id])\n # @neuron = Neuron.find(params[:id])\n # \n # respond_to do |format|\n # format.html # show.html.erb\n # format.json { render json: @neuron }\n # end\n end", "def show\n @huerto = Huerto.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @huerto }\n end\n end", "def show\n @soiree = Soiree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @soiree }\n end\n end", "def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estudiante }\n end\n end", "def show\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguro }\n end\n end", "def show\n @ref_sanatorium = Ref::Sanatorium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ref_sanatorium }\n end\n end", "def show\n @dato = Dato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dato }\n end\n end", "def show\n @humanidades1 = Humanidades1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades1 }\n end\n end", "def index\n @archdioceses = Archdiocese.all\n\n render json: @archdioceses\n end", "def show\n @lore = Lore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lore }\n end\n end", "def index\n @studies = Study.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @studies }\n end\n end", "def index\n @noise = Noise.new\n @noises = Noise.all\n params[:page] ||= 1\n\n respond_to do |format|\n format.html { @noises = Noise.paginate(per_page: 20, page: params[:page]) }\n format.json do \n list = @noises.map\n render json: Noise.all.select('id, sounds, icon') \n end\n end\n end", "def show\n @jedi = Jedi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jedi }\n end\n end", "def show\n my_dream = Dream.find params[:id]\n render json: {dream: my_dream}\n end", "def index\n @duty_stations = DutyStation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @duty_stations }\n end\n end", "def show\n @nail_salon = NailSalon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nail_salon }\n end\n end", "def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end", "def index\n @stations = Station.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stations }\n end\n end", "def index\n @ultimo_grado_de_estudios = UltimoGradoDeEstudio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ultimo_grado_de_estudios }\n end\n end", "def show\n @konyu_rireki = KonyuRireki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konyu_rireki }\n end\n end", "def show\n @nyan = Nyan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nyan }\n end\n end", "def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end", "def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end", "def show\n @anuncio = Anuncio.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @anuncio }\n end\n end", "def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end", "def show\n @stone = Stone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stone }\n end\n end", "def show\n @humanidades2 = Humanidades2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades2 }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end", "def show\n @seguidore = Seguidore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguidore }\n end\n end", "def index\n @diciplinas = Diciplina.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @diciplinas }\n end\n end", "def show\n @humanidades3 = Humanidades3.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades3 }\n end\n end", "def index\n puts \"Index method called...\"\n @studies = Study.all\n\n # render json: @studies\n end", "def index\n @himalayas ||= Himalaya.limit(10).order('id desc')\n @descuentos ||= Descuento.limit(10).order('id desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end", "def index\n \tif params[:category] == \"METRO\"\n \trender :json => Interest.stops.to_json\n elsif params[:category] == \"Photos\"\n render :json => Interest.panoramio\n \telsif params[:category]\n \t\tcategory_id = Category.find_by_name(params[:category]).id\n \t\trender :json => Interest.find_all_by_category_id(category_id).to_json(:methods => :category_name)\n \telse\n \t\trender :json => Interest.all\n \tend\n\n end", "def show\n @galeria = Galeria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @galeria }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end", "def show\n @socioeconomic_study = SocioeconomicStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n\n\n format.json { render json: @socioeconomic_study }\n end\n end", "def show\n @territorio = Territorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @territorio }\n end\n end", "def index\n @countries = Country.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @countries }\n end\n end", "def show\n @guille = Guille.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guille }\n end\n end" ]
[ "0.6598212", "0.6565846", "0.6494683", "0.6470051", "0.64124167", "0.6409542", "0.63456607", "0.63095874", "0.63077646", "0.63058996", "0.62892926", "0.62767226", "0.6257876", "0.6252885", "0.62468827", "0.6244384", "0.62425673", "0.6239019", "0.623283", "0.62325054", "0.6221149", "0.6195232", "0.618941", "0.61881006", "0.6181776", "0.6175232", "0.61716396", "0.61673355", "0.61598283", "0.614938", "0.6141239", "0.61394423", "0.613785", "0.6135037", "0.61336046", "0.61252284", "0.61222744", "0.61123323", "0.6104897", "0.6099305", "0.60982627", "0.6085156", "0.60838974", "0.60827965", "0.6079108", "0.60703784", "0.6068163", "0.60676825", "0.606715", "0.6064933", "0.60640466", "0.6062849", "0.6062064", "0.6058168", "0.6057507", "0.6055907", "0.60539526", "0.6051053", "0.6045667", "0.60404956", "0.6037485", "0.6032566", "0.6023324", "0.6022198", "0.6018361", "0.6015578", "0.6011707", "0.6010332", "0.600692", "0.5997029", "0.59952736", "0.5994255", "0.59930605", "0.5988175", "0.5985897", "0.5983133", "0.5982973", "0.5981095", "0.5979355", "0.597823", "0.59780824", "0.59780073", "0.59734404", "0.597203", "0.5967164", "0.5958941", "0.59569687", "0.59472245", "0.59472245", "0.59446937", "0.59432274", "0.5939431", "0.5938857", "0.59357184", "0.59304327", "0.59295046", "0.592918", "0.5922832", "0.5922357", "0.5919845", "0.5918178" ]
0.0
-1
POST /dianosaurs POST /dianosaurs.json
def create @dianosaur = Dianosaur.new(dianosaur_params) respond_to do |format| if @dianosaur.save format.html { redirect_to @dianosaur, notice: 'Dianosaur was successfully created.' } format.json { render :show, status: :created, location: @dianosaur } else format.html { render :new } format.json { render json: @dianosaur.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n neuron = Neuron.create! params\n render :json => neuron\n # @neuron = Neuron.new(params[:neuron])\n # \n # respond_to do |format|\n # if @neuron.save\n # format.html { redirect_to @neuron, notice: 'Neuron was successfully created.' }\n # format.json { render json: @neuron, status: :created, location: @neuron }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @neuron.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @sotrudniki = Sotrudniki.new(params[:sotrudniki])\n\n respond_to do |format|\n if @sotrudniki.save\n format.html { redirect_to @sotrudniki, notice: 'Sotrudniki was successfully created.' }\n format.json { render json: @sotrudniki, status: :created, location: @sotrudniki }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sotrudniki.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dino = Dino.new(dino_params)\n\n if @dino.save\n render json: @dino, status: :created, location: @dino\n else\n render json: @dino.errors, status: :unprocessable_entity\n end\n end", "def create\n @dinosaur = Dinosaur.new(params[:dinosaur])\n\n respond_to do |format|\n if @dinosaur.save\n format.html { redirect_to @dinosaur, notice: 'Dinosaur was successfully created.' }\n format.json { render json: @dinosaur, status: :created, location: @dinosaur }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dinosaur.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dia_hora = DiaHora.new(dia_hora_params)\n\n respond_to do |format|\n if @dia_hora.save\n format.html { redirect_to @dia_hora, notice: 'Dia hora was successfully created.' }\n format.json { render :show, status: :created, location: @dia_hora }\n else\n format.html { render :new }\n format.json { render json: @dia_hora.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dino = Dino.new(dino_params)\n\n respond_to do |format|\n if @dino.save\n format.html { redirect_to @dino, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @dino }\n else\n format.html { render :new }\n format.json{ render json: @dino.errors, status: :unprocessable_entity }\n end\n end\nend", "def create\n @skydatum = Skydatum.new(params[:skydatum])\n\n respond_to do |format|\n if @skydatum.save\n format.html { redirect_to @skydatum, notice: 'Skydatum was successfully created.' }\n format.json { render json: @skydatum, status: :created, location: @skydatum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @skydatum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dinosaur = Dinosaur.new(dinosaur_params)\n\n respond_to do |format|\n if @dinosaur.save\n format.html { redirect_to @dinosaur, notice: \"Dinosaur was successfully created.\" }\n format.json { render :show, status: :created, location: @dinosaur }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @dinosaur.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dinosaur = Dinosaur.new(dinosaur_params)\n\n respond_to do |format|\n if @dinosaur.save\n format.html { redirect_to @dinosaur, notice: 'Dinosaur was successfully created.' }\n format.json { render :show, status: :created, location: @dinosaur }\n else\n format.html { render :new }\n format.json { render json: @dinosaur.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tiendas_juego = TiendasJuego.new(tiendas_juego_params)\n\n respond_to do |format|\n if @tiendas_juego.save\n format.html { redirect_to @tiendas_juego, notice: 'Tiendas juego was successfully created.' }\n format.json { render :show, status: :created, location: @tiendas_juego }\n else\n format.html { render :new }\n format.json { render json: @tiendas_juego.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nail_salon = NailSalon.new(params[:nail_salon])\n\n respond_to do |format|\n if @nail_salon.save\n format.html { redirect_to @nail_salon, notice: 'Nail salon was successfully created.' }\n format.json { render json: @nail_salon, status: :created, location: @nail_salon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nail_salon.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "def create\n @uchronia = Uchronia.new(params[:uchronia])\n\n respond_to do |format|\n if @uchronia.save\n format.html { redirect_to @uchronia, notice: 'Uchronia was successfully created.' }\n format.json { render json: @uchronia, status: :created, location: @uchronia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @uchronia.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @archdiocese = Archdiocese.new(archdiocese_params)\n\n if @archdiocese.save\n render json: @archdiocese, status: :created, location: @archdiocese\n else\n render json: @archdiocese.errors, status: :unprocessable_entity\n end\n end", "def create\n @turistum = Turistum.new(turistum_params)\n\n respond_to do |format|\n if @turistum.save\n format.html { redirect_to @turistum, notice: 'Turistum was successfully created.' }\n format.json { render :show, status: :created, location: @turistum }\n else\n format.html { render :new }\n format.json { render json: @turistum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @satellite = Satellite.new\n\n respond_to do |format|\n if @satellite.save\n format.html { redirect_to satellites_path, notice: 'Satellite was successfully created.' }\n format.json { render :show, status: :created, location: satellites_path }\n else\n format.html { render :new }\n format.json { render json: @satellite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nitrou = Nitrou.new(nitrou_params)\n\n respond_to do |format|\n if @nitrou.save\n format.html { redirect_to @nitrou, notice: 'Nitrou was successfully created.' }\n format.json { render :show, status: :created, location: @nitrou }\n else\n format.html { render :new }\n format.json { render json: @nitrou.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, :notice => 'Socio cadastrado com sucesso.' }\n format.json { render :json => @socio, :status => :created, :location => @socio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @sondage = Sondage.new(sondage_params)\n\n respond_to do |format|\n if @sondage.save\n format.html { redirect_to sondages_path, notice: {status: 'success', message: 'Le sondage a été créé.' }}\n format.json { render action: 'show', status: :created, location: @sondage }\n else\n format.html { render action: 'new' }\n format.json { render json: @sondage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @national = National.new(national_params)\n\n respond_to do |format|\n if @national.save\n format.html { redirect_to @national, notice: 'National was successfully created.' }\n format.json { render :show, status: :created, location: @national }\n else\n format.html { render :new }\n format.json { render json: @national.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @souvenior = Souvenior.new(souvenior_params)\n\n respond_to do |format|\n if @souvenior.save\n format.html { redirect_to root_path, notice: 'Souvenior was successfully created.' }\n format.json { render :show, status: :created, location: @souvenior }\n else\n format.html { render :new }\n format.json { render json: @souvenior.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @seo_datum = SeoDatum.new(params[:seo_datum])\n\n respond_to do |format|\n if @seo_datum.save\n format.html { redirect_to @seo_datum, notice: 'Seo datum was successfully created.' }\n format.json { render json: @seo_datum, status: :created, location: @seo_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @seo_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dia_evento = DiaEvento.new(dia_evento_params)\n\n if @dia_evento.save\n render json: @dia_evento, status: :created, location: @dia_evento\n else\n render json: @dia_evento.errors, status: :unprocessable_entity\n end\n end", "def create\n @sinistro = Sinistro.new(sinistro_params)\n\n respond_to do |format|\n if @sinistro.save\n format.html { redirect_to @sinistro, notice: 'Sinistro was successfully created.' }\n format.json { render :show, status: :created, location: @sinistro }\n else\n format.html { render :new }\n format.json { render json: @sinistro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @torso = Torso.new(params[:torso])\n\n respond_to do |format|\n if @torso.save\n format.html { redirect_to @torso, notice: 'Torso was successfully created.' }\n format.json { render json: @torso, status: :created, location: @torso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @torso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @torneo = Torneo.new(params[:torneo])\n\n respond_to do |format|\n if @torneo.save\n format.html { redirect_to @torneo, notice: 'Torneo was successfully created.' }\n format.json { render json: @torneo, status: :created, location: @torneo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @torneo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stilage = Stilage.new(stilage_params)\n respond_to do |format|\n if @stilage.save\n format.html { redirect_to @stilage, notice: 'Stilage was successfully created.' }\n format.json { render :show, status: :created, location: @stilage }\n else\n format.html { render :new }\n format.json { render json: @stilage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @turma = Turma.new(params[:turma])\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to @turma, notice: 'Turma criada com sucesso.' }\n format.json { render json: @turma, status: :created, location: @turma }\n else\n format.html { render action: \"new\" }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nebulosa = Nebulosa.new(nebulosa_params)\n\n respond_to do |format|\n if @nebulosa.save\n format.html { redirect_to @nebulosa, notice: 'Nebulosa was successfully created.' }\n format.json { render :show, status: :created, location: @nebulosa }\n else\n format.html { render :new }\n format.json { render json: @nebulosa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nguoi_dung = NguoiDung.new(params[:nguoi_dung])\n\n respond_to do |format|\n if @nguoi_dung.save\n format.html { redirect_to @nguoi_dung, notice: 'Nguoi dung was successfully created.' }\n format.json { render json: @nguoi_dung, status: :created, location: @nguoi_dung }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nguoi_dung.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diarista = Diarista.new(diarista_params)\n\n respond_to do |format|\n if @diarista.save\n format.html { redirect_to @diarista, notice: 'Diarista was successfully created.' }\n format.json { render :show, status: :created, location: @diarista }\n else\n format.html { render :new }\n format.json { render json: @diarista.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @turma = @disciplina.turmas.new(turma_params)\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to @turma, notice: 'A Turma foi criada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @turma }\n else\n format.html { render action: 'new' }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @duo = Duo.new(duo_params)\n\n respond_to do |format|\n if @duo.save\n format.html { redirect_to @duo, notice: 'Duo was successfully created.' }\n format.json { render :show, status: :created, location: @duo }\n else\n format.html { render :new }\n format.json { render json: @duo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @danni = Danni.new(danni_params)\n\n respond_to do |format|\n if @danni.save\n format.html { redirect_to @danni, notice: 'Danni was successfully created.' }\n format.json { render :show, status: :created, location: @danni }\n else\n format.html { render :new }\n format.json { render json: @danni.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ton_giao = TonGiao.new(ton_giao_params)\n\n respond_to do |format|\n if @ton_giao.save\n format.html { redirect_to @ton_giao, notice: 'Ton giao was successfully created.' }\n format.json { render :show, status: :created, location: @ton_giao }\n else\n format.html { render :new }\n format.json { render json: @ton_giao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tupian = Tupian.new(params[:tupian])\n\n respond_to do |format|\n if @tupian.save\n format.html { redirect_to @tupian, notice: 'Tupian was successfully created.' }\n format.json { render json: @tupian, status: :created, location: @tupian }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tupian.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @noyau = Noyau.new(noyau_params)\n\n respond_to do |format|\n if @noyau.save\n format.html { redirect_to @noyau, notice: 'Noyau was successfully created.' }\n format.json { render :show, status: :created, location: @noyau }\n else\n format.html { render :new }\n format.json { render json: @noyau.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @asos_datum = AsosDatum.new(asos_datum_params(asos_station))\n\n respond_to do |format|\n if @asos_datum.save\n format.html { redirect_to @asos_datum, notice: 'Asos datum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @asos_datum }\n else\n format.html { render action: 'new' }\n format.json { render json: @asos_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tour = Tour.new(tour_params)\n\n respond_to do |format|\n if @tour.save\n\n format.html { redirect_to @tour, notice: 'Tour was successfully created.' }\n format.json { render :show, status: :created, location: @tour }\n else\n format.html { render :new }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @society = Society.new(society_params)\n\n respond_to do |format|\n if @society.save\n format.html { redirect_to @society, notice: 'Se ha creado exitosamente.' }\n format.json { render :show, status: :created, location: @society }\n else\n format.html { render :new }\n format.json { render json: @society.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end", "def create\n @treino = Treino.new(treino_params)\n\n respond_to do |format|\n if @treino.save\n format.html { redirect_to @treino, notice: 'Treino was successfully created.' }\n format.json { render :show, status: :created, location: @treino }\n else\n format.html { render :new }\n format.json { render json: @treino.errors, status: :unprocessable_entity }\n end\n end\n end", "def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end", "def create\n @sinh_vien = SinhVien.new(params[:sinh_vien])\n\n respond_to do |format|\n if @sinh_vien.save \n format.json { render json: @sinh_vien, status: :created, location: @sinh_vien }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @usine = Usine.new(usine_params)\n\n respond_to do |format|\n if @usine.save\n format.html { redirect_to @usine, notice: 'Usine was successfully created.' }\n format.json { render :show, status: :created, location: @usine }\n else\n format.html { render :new }\n format.json { render json: @usine.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @onda = Onda.new(onda_params)\n\n respond_to do |format|\n if @onda.save\n format.html { redirect_to ondas_path, notice: 'Onda was successfully created.' }\n format.json { render :show, status: :created, location: @onda }\n else\n format.html { render :new }\n format.json { render json: @onda.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @situacoes_juridica = SituacoesJuridica.new(params[:situacoes_juridica])\n\n respond_to do |format|\n if @situacoes_juridica.save\n format.html { redirect_to(@situacoes_juridica, :notice => 'Situação jurídica cadastrada com sucesso.') }\n format.xml { render :xml => @situacoes_juridica, :status => :created, :location => @situacoes_juridica }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @situacoes_juridica.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @simulado = Simulado.new(simulado_params)\n\n respond_to do |format|\n if @simulado.save\n format.html { redirect_to @simulado, notice: 'Simulado was successfully created.' }\n format.json { render :show, status: :created, location: @simulado }\n else\n format.html { render :new }\n format.json { render json: @simulado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ref_sanatorium = Ref::Sanatorium.new(params[:ref_sanatorium])\n\n respond_to do |format|\n if @ref_sanatorium.save\n format.html { redirect_to ref_sanatoria_path, notice: I18n.t(:record_created) }\n format.json { render json: @ref_sanatorium, status: :created, location: @ref_sanatorium }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ref_sanatorium.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def create\n @siritori = Siritori.new(siritori_params)\n\n respond_to do |format|\n if @siritori.save\n format.html { redirect_to @siritori, notice: 'Siritori was successfully created.' }\n format.json { render :show, status: :created, location: @siritori }\n else\n format.html { render :new }\n format.json { render json: @siritori.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @interest.save\n format.html { redirect_to @interest, :notice => 'Интересот е успешно додаден.' }\n format.json { render :json => @interest, :status => :created, :location => @interest }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @track_dress = TrackDress.new(params[:track_dress])\n\n respond_to do |format|\n if @track_dress.save\n format.html { redirect_to @track_dress, notice: 'Track dress was successfully created.' }\n format.json { render json: @track_dress, status: :created, location: @track_dress }\n else\n format.html { render action: \"new\" }\n format.json { render json: @track_dress.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nippou = Nippou.new(nippou_params)\n\n respond_to do |format|\n if @nippou.save\n format.html { redirect_to @nippou, notice: 'Nippou was successfully created.' }\n format.json { render action: 'show', status: :created, location: @nippou }\n else\n format.html { render action: 'new' }\n format.json { render json: @nippou.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @asiento = Asiento.new(params[:asiento])\n\n respond_to do |format|\n if @asiento.save\n format.html { redirect_to @asiento, :notice => 'El apunte fue creado.' }\n format.json { render :json => @asiento, :status => :created, :location => @asiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @torneo = Torneo.new(torneo_params)\n\n respond_to do |format|\n if @torneo.save\n format.html { redirect_to @torneo, notice: 'Torneo fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @torneo }\n else\n format.html { render :new }\n format.json { render json: @torneo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @soda = Soda.new(soda_params)\n\n respond_to do |format|\n if @soda.save\n format.html { redirect_to @soda, notice: 'Soda was successfully created.' }\n format.json { render :show, status: :created, location: @soda }\n else\n format.html { render :new }\n format.json { render json: @soda.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @saida = Saida.new(saida_params)\n\n respond_to do |format|\n if @saida.save\n format.html { redirect_to @saida, notice: 'Saida was successfully created.' }\n format.json { render :show, status: :created, location: @saida }\n else\n format.html { render :new }\n format.json { render json: @saida.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@pasien = Pasien.find(params[:pasien_id])\n #@hasil = @pasien.hasils.create(params[:hasil])\n #redirect_to pasien_path(@post)\n @hasil = Hasil.create(params[:hasil])\n\n respond_to do |format|\n if @hasil.save\n format.html { redirect_to @hasil, notice: 'Hasil was successfully created.' }\n format.json { render json: @hasil, status: :created, location: @hasil }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hasil.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @jour = current_user.jours.new(jour_params)\n\n respond_to do |format|\n if @jour.save\n format.html { redirect_to jours_url, notice: 'Jour was successfully created.' }\n format.json { render :show, status: :created, location: @jour }\n else\n format.html { render :new }\n format.json { render json: @jour.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @sivic_turma = SivicTurma.new(sivic_turma_params)\r\n\r\n respond_to do |format|\r\n if @sivic_turma.save\r\n format.html { redirect_to @sivic_turma, notice: 'Registro inserido com sucesso.' }\r\n format.json { render action: 'show', status: :created, location: @sivic_turma }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @sivic_turma.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @seihinn = Seihinn.new(seihinn_params)\n\n respond_to do |format|\n if @seihinn.save\n format.html { redirect_to @seihinn, notice: \"Seihinn was successfully created.\" }\n format.json { render :show, status: :created, location: @seihinn }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @seihinn.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @socio_serasa = SocioSerasa.new(socio_serasa_params)\n\n respond_to do |format|\n if @socio_serasa.save\n format.html { redirect_to @socio_serasa, notice: 'Socio serasa was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_serasa }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_serasa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stone = Stone.new(stone_params)\n\n \n if @stone.save\n respond_with @stone\n else\n render json: @stone.errors, status: :unprocessable_entity \n end\n \n \n end", "def create\n @dress = Dress.new(params[:dress])\n\n respond_to do |format|\n if @dress.save\n format.html { redirect_to @dress, notice: 'Vestido criado com sucesso.' }\n format.json { render json: @dress, status: :created, location: @dress }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dress.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @natulang = Natulang.new(params[:natulang])\n\n respond_to do |format|\n if @natulang.save\n format.html { redirect_to @natulang, notice: 'Natulang was successfully created.' }\n format.json { render json: @natulang, status: :created, location: @natulang }\n else\n format.html { render action: \"new\" }\n format.json { render json: @natulang.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @soil_moisture = SoilMoisture.new(soil_moisture_params)\n\n respond_to do |format|\n if @soil_moisture.save\n format.html { redirect_to @soil_moisture, notice: 'Soil moisture was successfully created.' }\n format.json { render :show, status: :created, location: @soil_moisture }\n else\n format.html { render :new }\n format.json { render json: @soil_moisture.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diet = Diet.new(diet_params)\n @diet.user = @current_user\n\n if @diet.save\n render json: @diet, status: 201, location: @diet, root: true\n else\n render json: @diet.errors, status: 422\n end\n end", "def create\n @panneau = Panneau.new(panneau_params)\n\n respond_to do |format|\n if @panneau.save\n format.html { redirect_to @panneau, notice: 'Panneau was successfully created.' }\n format.json { render :show, status: :created, location: @panneau }\n else\n format.html { render :new }\n format.json { render json: @panneau.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diemtrentuyen = Diemtrentuyen.new(params[:diemtrentuyen])\n\n respond_to do |format|\n if @diemtrentuyen.save\n format.html { redirect_to @diemtrentuyen, notice: 'Diemtrentuyen was successfully created.' }\n format.json { render json: @diemtrentuyen, status: :created, location: @diemtrentuyen }\n else\n format.html { render action: \"new\" }\n format.json { render json: @diemtrentuyen.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diario = Diario.new(diario_params)\n\n respond_to do |format|\n if @diario.save\n format.html { redirect_to @diario, notice: \"Diario was successfully created.\" }\n format.json { render :show, status: :created, location: @diario }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @diario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @iglesia = Iglesia.new(iglesia_params)\n\n respond_to do |format|\n if @iglesia.save\n format.html { redirect_to iglesias_path, notice: \"La iglesia #{@iglesia.nombre} ha sido creada.\" }\n format.json { render action: 'show', status: :created, location: @iglesia }\n else\n format.html { render action: 'new' }\n format.json { render json: @iglesia.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sanvandong = Sanvandong.new(sanvandong_params)\n\n respond_to do |format|\n if @sanvandong.save\n format.html { redirect_to @sanvandong, notice: 'Sanvandong was successfully created.' }\n format.json { render :show, status: :created, location: @sanvandong }\n else\n format.html { render :new }\n format.json { render json: @sanvandong.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @datos_estudiante = DatosEstudiante.new(datos_estudiante_params)\n\n respond_to do |format|\n if @datos_estudiante.save\n format.html { redirect_to @datos_estudiante, notice: 'Datos estudiante was successfully created.' }\n format.json { render :show, status: :created, location: @datos_estudiante }\n else\n format.html { render :new }\n format.json { render json: @datos_estudiante.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n @socio.save\n format.html { redirect_to socios_url}\n end\n end", "def create\n @nepal = Nepal.new(nepal_params)\n\n if @nepal.save\n render json: @nepal, status: :created, location: @nepal\n else\n render json: @nepal.errors, status: :unprocessable_entity\n end\n end", "def create\n params.permit(:intituleSondage, :descriptionSondage, :categorie_id, :administrateur_id)\n ajout = SondageService.instance.creerNouveauSondage(params[:intituleSondage], params[:descriptionSondage], params[:categorie_id], params[:administrateur_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\nend", "def create\n @turkey = Turkey.new(turkey_params)\n\n respond_to do |format|\n if @turkey.save\n format.html { redirect_to @turkey, notice: 'Turkey was successfully created.' }\n format.json { render :show, status: :created, location: @turkey }\n else\n format.html { render :new }\n format.json { render json: @turkey.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ucastnik = Ucastnik.new(ucastnik_params)\n\n respond_to do |format|\n if @ucastnik.save\n format.html { redirect_to @ucastnik, notice: 'Ucastnik was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ucastnik }\n else\n format.html { render action: 'new' }\n format.json { render json: @ucastnik.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @siren = Siren.new(siren_params)\n\n respond_to do |format|\n if @siren.save\n format.html { redirect_to @siren, notice: 'Siren was successfully created.' }\n format.json { render :show, status: :created, location: @siren }\n else\n format.html { render :new }\n format.json { render json: @siren.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dado = Dado.new(dado_params)\n\n respond_to do |format|\n if @dado.save\n format.html { redirect_to @dado, notice: 'Dado was successfully created.' }\n format.json { render :show, status: :created, location: @dado }\n else\n format.html { render :new }\n format.json { render json: @dado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dado = Dado.new(dado_params)\n\n respond_to do |format|\n if @dado.save\n format.html { redirect_to @dado, notice: 'Dado was successfully created.' }\n format.json { render :show, status: :created, location: @dado }\n else\n format.html { render :new }\n format.json { render json: @dado.errors, status: :unprocessable_entity }\n end\n end\n end", "def creacion\n fiesta = Fiesta.new (params[:id])\n if Fiesta.save\n puts \"su fiesta a sido registrada\"\n else \n puts \"su fiesta no a sido registrada\"\n end\n render = json: fiesta \n end", "def create\n @uzser = Uzser.new(uzser_params)\n\n respond_to do |format|\n if @uzser.save\n format.html { redirect_to @uzser, notice: 'Uzser was successfully created.' }\n format.json { render :show, status: :created, location: @uzser }\n else\n format.html { render :new }\n format.json { render json: @uzser.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @surfari = Surfari.new(surfari_params)\n\n respond_to do |format|\n if @surfari.save\n format.html { redirect_to surfaris_path, notice: 'Surfari was successfully created.' }\n format.json { render :show, status: :created, location: @surfari }\n else\n format.html { render :new }\n format.json { render json: @surfari.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tour = Tour.new(tour_params)\n extract_packages\n extract_dates\n respond_to do |format|\n if @tour.save\n extract_accomodations\n extract_prices\n extract_transportations\n manage_uploads\n format.html { redirect_to \"/tours/#{@tour.uuid}\", notice: 'Tour was successfully created.' }\n format.json { render :show, status: :created, location: @tour }\n else\n format.html { render :new }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lokasis = Rute.select(\"id_jalan\").uniq\n @jalan = Jalan.new(jalan_params)\n\n respond_to do |format|\n if @jalan.save\n format.html { redirect_to @jalan, notice: \"Jalan was successfully created.\" }\n format.json { render :show, status: :created, location: @jalan }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @jalan.errors, status: :unprocessable_entity }\n end\n end\n end", "def criar_sobrevivente\n @suvivor = Sobrevivente.create(\n name: params[:name], genero: params[:genero], idade: params[:idade],\n lat: params[:lat], lon: params[:lon],\n agua: params[:agua], comida: params[:comida], medicamento: params[:medicamento],\n municao: params[:municao]\n )\n render json: @suvivor\n end", "def create\n @raw_datum = RawDatum.new(params[:raw_datum])\n\n respond_to do |format|\n if @raw_datum.save\n format.html { redirect_to @raw_datum, notice: 'Raw datum was successfully created.' }\n format.json { render json: @raw_datum, status: :created, location: @raw_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @raw_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sezione = Sezione.new(params[:sezione])\n\n respond_to do |format|\n if @sezione.save\n format.html { redirect_to sezioni_path, notice: 'Sezione was successfully created.' }\n format.json { render json: @sezione, status: :created, location: @sezione }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sezione.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testis = Teste.new(params[:testis])\n\n respond_to do |format|\n if @testis.save\n format.html { redirect_to @testis, notice: 'Teste was successfully created.' }\n format.json { render json: @testis, status: :created, location: @testis }\n else\n format.html { render action: \"new\" }\n format.json { render json: @testis.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tiezi = Tiezi.new(params[:tiezi])\n\n respond_to do |format|\n if @tiezi.save\n format.html { redirect_to @tiezi, notice: 'Tiezi was successfully created.' }\n format.json { render json: @tiezi, status: :created, location: @tiezi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tiezi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @meteo_datum = MeteoDatum.new(meteodatum_params)\n @meteo_datum.weather_station_id = params[:weather_station_id]\n\n if @meteo_datum.save\n render json: @meteo_datum, status: :created\n else\n render json: @meteo_datum.errors, status: :unprocessable_entity\n end\n end", "def create\n @municipio_dominio = MunicipioDominio.new(params[:municipio_dominio])\n\n respond_to do |format|\n if @municipio_dominio.save\n format.html { redirect_to @municipio_dominio, :notice => 'Municipio dominio was successfully created.' }\n format.json { render :json => @municipio_dominio, :status => :created, :location => @municipio_dominio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @municipio_dominio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @souvenir = Souvenir.new(souvenir_params)\n\n respond_to do |format|\n if @souvenir.save\n format.html { redirect_to @souvenir, notice: 'Souvenir was successfully created.' }\n format.json { render :show, status: :created, location: @souvenir }\n else\n format.html { render :new }\n format.json { render json: @souvenir.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ginasio = Ginasio.new(params[:ginasio])\n\n respond_to do |format|\n if @ginasio.save\n format.html { redirect_to @ginasio, :flash => { :success => 'Ginasio criado com sucesso!' } }\n format.json { render :json => @ginasio, :status => :created, :location => @ginasio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tuiguang = Tuiguang.new(tuiguang_params)\n\n respond_to do |format|\n if @tuiguang.save\n format.html { redirect_to @tuiguang, notice: 'Tuiguang was successfully created.' }\n format.json { render :show, status: :created, location: @tuiguang }\n else\n format.html { render :new }\n format.json { render json: @tuiguang.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sancion = Sancion.new(sancion_params)\n\n respond_to do |format|\n if @sancion.save\n format.html { redirect_to @sancion, notice: \"Sancion was successfully created.\" }\n format.json { render :show, status: :created, location: @sancion }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sancion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @surah = Surah.new(surah_params)\n\n respond_to do |format|\n if @surah.save\n format.html { redirect_to @surah, notice: 'Surah was successfully created.' }\n format.json { render action: 'show', status: :created, location: @surah }\n else\n format.html { render action: 'new' }\n format.json { render json: @surah.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @selecao = Selecao.new(params[:selecao])\n\n respond_to do |format|\n if @selecao.save\n format.html { redirect_to @selecao, notice: 'Selecao was successfully created.' }\n format.json { render json: @selecao, status: :created, location: @selecao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @selecao.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.616665", "0.61308", "0.602781", "0.5998858", "0.5955735", "0.5935511", "0.5916064", "0.591441", "0.59037507", "0.5852463", "0.58503026", "0.58277565", "0.5826517", "0.5823598", "0.5815129", "0.5812158", "0.58114207", "0.580662", "0.5795816", "0.57928896", "0.5791833", "0.5784218", "0.57825094", "0.57720715", "0.57713085", "0.57648164", "0.57625765", "0.57609606", "0.5760454", "0.57597816", "0.5756937", "0.574842", "0.57409483", "0.57280135", "0.57274324", "0.57261586", "0.5724566", "0.57202685", "0.57190514", "0.57143974", "0.57106835", "0.5699455", "0.56972253", "0.5689522", "0.5689317", "0.5689247", "0.5686017", "0.56855404", "0.5677182", "0.56705964", "0.5666937", "0.56656015", "0.56619436", "0.5661568", "0.5655191", "0.5642843", "0.5639562", "0.56393063", "0.563865", "0.5636648", "0.5634701", "0.5631327", "0.56308603", "0.5629729", "0.5628112", "0.56242406", "0.56203425", "0.5620231", "0.56188244", "0.56175196", "0.56173474", "0.5603212", "0.56011885", "0.55982786", "0.5598275", "0.55925125", "0.55913067", "0.5587659", "0.5575583", "0.55744094", "0.55710703", "0.55710703", "0.55694133", "0.5566229", "0.5563274", "0.55619925", "0.5560963", "0.555705", "0.5554825", "0.5553734", "0.5552872", "0.5548931", "0.55488217", "0.55477256", "0.5546336", "0.5546044", "0.554564", "0.5540612", "0.55393094", "0.5536153" ]
0.63877773
0
PATCH/PUT /dianosaurs/1 PATCH/PUT /dianosaurs/1.json
def update respond_to do |format| if @dianosaur.update(dianosaur_params) format.html { redirect_to @dianosaur, notice: 'Dianosaur was successfully updated.' } format.json { render :show, status: :ok, location: @dianosaur } else format.html { render :edit } format.json { render json: @dianosaur.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.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 patch!\n request! :patch\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end", "def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, :notice => 'Socio atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n if @ginasio.update_attributes(params[:ginasio])\n format.html { redirect_to @ginasio, :flash => { :success => 'Dados do ginasio alterados com successo!' } }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end", "def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update # PATCH\n raise NotImplementedError\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n respond_to do |format|\n if @sintoma.update(sintoma_params)\n format.html { redirect_to @sintoma, notice: 'Sintoma was successfully updated.' }\n format.json { render :show, status: :ok, location: @sintoma }\n else\n format.html { render :edit }\n format.json { render json: @sintoma.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tapioca.update(tapioca_params)\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sinh_vien = SinhVien.find(params[:id])\n\n respond_to do |format|\n if @sinh_vien.update_attributes(params[:sinh_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @platoon.update(platoon_params)\n format.html { redirect_to @platoon, notice: 'Platoon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @platoon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio_serasa.update(socio_serasa_params)\n format.html { redirect_to @socio_serasa, notice: 'Socio serasa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_serasa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kata.update(kata_params)\n format.html { redirect_to @kata, notice: 'Kata was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kata.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @plato = Plato.find(params[:id])\n\n if @plato.update(plato_params)\n head :no_content\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @<%= singular_table_name %>.update(<%= singular_table_name %>_params)\n format.html { redirect_to @<%= singular_table_name %>, notice: \"#{t('activerecord.models.<%= singular_table_name %>.one')} atualizado com sucesso.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @<%= singular_table_name %>.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @soiree = Soiree.find(params[:id])\n\n respond_to do |format|\n if @soiree.update_attributes(params[:soiree])\n format.html { redirect_to @soiree, notice: 'Soiree was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @soiree.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio.update(socio_params)\n format.html { redirect_to @socio, notice: 'Socio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio.update(socio_params)\n format.html { redirect_to @socio, notice: 'Socio modificado com sucesso.' }\n format.json { render :show, status: :ok, location: @socio }\n else\n format.html { render :edit }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @servico.update(servico_params)\n format.html { redirect_to servicos_url, notice: 'Serviço atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servico }\n else\n format.html { render :edit }\n format.json { render json: @servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @testmonial = Testmonial.find(params[:id])\n\n if @testmonial.update(testmonial_params)\n head :no_content\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def update(data = :object || :json)\n end", "def update\n respond_to do |format|\n if @kota_stone.update(kota_stone_params)\n format.html { redirect_to kota_stones_url, notice: 'Kota stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kota_stone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, notice: 'Socio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @solicitud.update(solicitud_params)\n format.html { redirect_to @solicitud, notice: 'Solicitud was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sekilas_info.update(sekilas_info_params)\n format.html { redirect_to @sekilas_info, notice: 'Sekilas info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sekilas_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stone = Stone.find(params[:id])\n\n respond_to do |format|\n if @stone.update_attributes(params[:stone])\n format.html { redirect_to @stone, notice: 'Stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end", "def update\n respond_to do |format|\n if @sejour.update(sejour_params)\n format.html { redirect_to @sejour, notice: 'Sejour mis a jour.' }\n format.json { render :show, status: :ok, location: @sejour }\n else\n format.html { render :edit }\n format.json { render json: @sejour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sinistro.update(sinistro_params)\n format.html { redirect_to @sinistro, notice: 'Sinistro was successfully updated.' }\n format.json { render :show, status: :ok, location: @sinistro }\n else\n format.html { render :edit }\n format.json { render json: @sinistro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @snipet.update(snipet_params)\n format.html { redirect_to @snipet, notice: 'Snipet was successfully updated.' }\n format.json { render :show, status: :ok, location: @snipet }\n else\n format.html { render :edit }\n format.json { render json: @snipet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_contcelula.update(sivic_contcelula_params)\r\n format.html { redirect_to @sivic_contcelula, notice: 'Sivic contcelula was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_contcelula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\r\n respond_to do |format|\r\n if @sivic_celula.update(sivic_celula_params)\r\n format.html { redirect_to @sivic_celula, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_celula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @selecao = Selecao.find(params[:id])\n\n respond_to do |format|\n if @selecao.update_attributes(params[:selecao])\n format.html { redirect_to @selecao, notice: 'Selecao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @selecao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to @sitio, notice: 'Sitio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dossier = Dossier.find(params[:id])\n \n respond_to do |format|\n if @dossier.update_attributes(params[:dossier])\n format.html { redirect_to(@dossier, :notice => 'Dossier was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => { :success => true, :message => \"Updated Dossier #{@dossier.id}\", :data => @dossier.attributes.merge(:institution_nom => @dossier.institution.nom, :type_etat_dossier_description => @dossier.type_etat_dossier.try(:description), :juge_mission_id => @dossier.juge_mission.try(:contact_id), :juge_controlleur_id => @dossier.juge_controlleur.try(:contact_id))}}\n \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dossier.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tiposveiculo.update(tiposveiculo_params)\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resto.update(resto_params)\n format.html { redirect_to @resto, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @resto }\n else\n format.html { render :edit }\n format.json { render json: @resto.errors, status: :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n respond_to do |format|\n if @asos_datum.update(asos_datum_params)\n format.html { redirect_to @asos_datum, notice: 'Asos datum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @asos_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format|\n if @giang_vien.update_attributes(params[:giang_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @giang_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sotrudniki = Sotrudniki.find(params[:id])\n\n respond_to do |format|\n if @sotrudniki.update_attributes(params[:sotrudniki])\n format.html { redirect_to @sotrudniki, notice: 'Sotrudniki was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sotrudniki.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jour.update(jour_params)\n format.html { redirect_to jours_url, notice: 'Jour was successfully updated.' }\n format.json { render :show, status: :ok, location: @jour }\n else\n format.html { render :edit }\n format.json { render json: @jour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @iglesia.update(iglesia_params)\n format.html { redirect_to @iglesia, notice: 'La iglesia #{@iglesia.nombre} ha sido actualizada.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @iglesia.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @soda.update(soda_params)\n format.html { redirect_to @soda, notice: 'Soda was successfully updated.' }\n format.json { render :show, status: :ok, location: @soda }\n else\n format.html { render :edit }\n format.json { render json: @soda.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio_irpj.update(socio_irpj_params)\n format.html { redirect_to @socio_irpj, notice: 'Socio irpj was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_irpj.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def update\n @dato = Dato.find(params[:id])\n\n respond_to do |format|\n if @dato.update_attributes(params[:dato])\n format.html { redirect_to @dato, notice: 'Dato was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dato.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @repuesto_servicio.update(repuesto_servicio_params)\n format.html { redirect_to @repuesto_servicio, notice: 'Repuesto o servicio fue actualizado con éxito.' }\n format.json { render :show, status: :ok, location: @repuesto_servicio }\n else\n format.html { render :edit }\n format.json { render json: @repuesto_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stilage.update(stilage_params)\n format.html { redirect_to @stilage, notice: 'Stilage was successfully updated.' }\n format.json { render :show, status: :ok, location: @stilage }\n else\n format.html { render :edit }\n format.json { render json: @stilage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @society.update(society_params)\n format.html { redirect_to @society }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @society.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @saloon.update(saloon_params)\n format.html { redirect_to @saloon, notice: 'Saloon was successfully updated.' }\n format.json { render :show, status: :ok, location: @saloon }\n else\n format.html { render :edit }\n format.json { render json: @saloon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @strosek.update(strosek_params)\n format.html { redirect_to @strosek, notice: 'Strosek was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @strosek.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def update\n if @diet.update(diet_params)\n head :no_content, status: 204\n else\n render json: @diet.errors, status: 422\n end\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.html { redirect_to @interest, :notice => 'Интересот е успешно ажуриран.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @iine.update(iine_params)\n format.html { redirect_to @iine, notice: 'Iine was successfully updated.' }\n format.json { render :show, status: :ok, location: @iine }\n else\n format.html { render :edit }\n format.json { render json: @iine.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @clientes_servico.update(clientes_servico_params)\n format.html { redirect_to @clientes_servico, notice: 'Clientes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clientes_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @example.update(example_params)\n format.html { redirect_to @example, notice: 'Operação realizada com sucesso.' }\n format.json { render :show, status: :ok, location: @example }\n else\n format.html { render :edit }\n format.json { render json: @example.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipomedalla = Tipomedalla.find(params[:id])\n\n respond_to do |format|\n if @tipomedalla.update_attributes(params[:tipomedalla])\n format.html { redirect_to @tipomedalla, notice: 'Tipomedalla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipomedalla.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sire.update(sire_params)\n format.html { redirect_to @sire, notice: 'Sire was successfully updated.' }\n format.json { render :show, status: :ok, location: @sire }\n else\n format.html { render :edit }\n format.json { render json: @sire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @respuesta = Respuesta.find(params[:id])\n\n if @respuesta.update(params[:respuesta])\n head :no_content\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n\n if @thesis.update(thesis_params)\n format.html { redirect_to @thesis }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thesis.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kristine_toy.update(kristine_toy_params)\n format.html { redirect_to @kristine_toy, notice: 'Kristine toy was successfully updated.' }\n format.json { render :show, status: :ok, location: @kristine_toy }\n else\n format.html { render :edit }\n format.json { render json: @kristine_toy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sindicato.update(sindicato_params)\n format.html { redirect_to @sindicato, notice: 'Sindicato fue actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @sindicato }\n else\n format.html { render :edit }\n format.json { render json: @sindicato.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @one = One.find(params[:id])\n\n respond_to do |format|\n if @one.update_attributes(params[:one])\n format.html { redirect_to @one, notice: 'One was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n if @uchronia.update_attributes(params[:uchronia])\n format.html { redirect_to @uchronia, notice: 'Uchronia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uchronia.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def update\n respond_to do |format|\n if @society.update(society_params)\n format.html { redirect_to @society, notice: 'Society was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @society.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kolegij = Kolegij.find(params[:id])\n\n respond_to do |format|\n if @kolegij.update_attributes(params[:kolegij])\n format.html { redirect_to @kolegij, notice: 'Kolegij was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kolegij.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n if @solicitud_servicio.update_attributes(params[:solicitud_servicio])\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end", "def update\n respond_to do |format|\n if @tatoo.update(tatoo_params)\n format.html { redirect_to tatoos_path, notice: 'Tatoo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tatoo }\n else\n format.html { render :edit }\n format.json { render json: @tatoo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @octopus.update(octopus_params)\n format.html { redirect_to octopi_path, notice: 'Octopus was successfully updated.' }\n format.json { render :show, status: :ok, location: @octopus }\n else\n format.html { render :edit }\n format.json { render json: @octopus.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @species.update(species_params)\n format.html { redirect_to @species, notice: 'Species was successfully updated.' }\n format.json { render :show, status: :ok, location: @species }\n else\n format.html { render :edit }\n format.json { render json: @species.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update\n @testis = Teste.find(params[:id])\n\n respond_to do |format|\n if @testis.update_attributes(params[:testis])\n format.html { redirect_to @testis, notice: 'Teste was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @testis.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goody = Goody.find(params[:id])\n\n respond_to do |format|\n if @goody.update_attributes(params[:goody])\n format.html { redirect_to @goody, notice: 'Goody was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goody.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.65240806", "0.6504909", "0.6405766", "0.63472193", "0.63209087", "0.6298435", "0.6297537", "0.62822706", "0.626692", "0.6262864", "0.6238612", "0.6233836", "0.6224269", "0.6200524", "0.61938566", "0.6176954", "0.6174561", "0.61668295", "0.61572844", "0.6154369", "0.61517715", "0.61505413", "0.6138889", "0.6136485", "0.6136423", "0.6136423", "0.61328477", "0.61205024", "0.61035335", "0.6101906", "0.6094327", "0.6090369", "0.60833704", "0.6082969", "0.60792375", "0.6077741", "0.60758924", "0.60734516", "0.6073326", "0.6068044", "0.60601825", "0.6053517", "0.6049696", "0.6048774", "0.6045635", "0.6043885", "0.6043784", "0.6040609", "0.6037897", "0.6037393", "0.60335785", "0.6023995", "0.60148984", "0.6014087", "0.6013641", "0.6012076", "0.6011009", "0.600928", "0.600474", "0.6002668", "0.60017425", "0.60012037", "0.5997675", "0.5997187", "0.59969664", "0.59952956", "0.59909785", "0.59892267", "0.5988997", "0.59839964", "0.59816796", "0.5977273", "0.5975143", "0.5975143", "0.5973972", "0.5972501", "0.5967581", "0.59646636", "0.596366", "0.5963227", "0.5958795", "0.5958019", "0.59568673", "0.59521484", "0.595203", "0.5951964", "0.5950926", "0.5949206", "0.59478605", "0.594712", "0.59456915", "0.5945629", "0.5945504", "0.59452313", "0.5944642", "0.5942212", "0.5941907", "0.59390473", "0.5938903", "0.59361243", "0.593482" ]
0.0
-1
DELETE /dianosaurs/1 DELETE /dianosaurs/1.json
def destroy @dianosaur.destroy respond_to do |format| format.html { redirect_to dianosaurs_url, notice: 'Dianosaur was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @dinosaur = Dinosaur.find(params[:id])\n @dinosaur.destroy\n\n respond_to do |format|\n format.html { redirect_to dinosaurs_url }\n format.json { head :ok }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete\n request(:delete)\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to datos_url }\n format.json { head :no_content }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete()\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 @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def destroy\n @kanri_daicho.destroy\n respond_to do |format|\n format.html { redirect_to kanri_daichos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @asos_datum.destroy\n respond_to do |format|\n format.html { redirect_to asos_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sotrudniki = Sotrudniki.find(params[:id])\n @sotrudniki.destroy\n\n respond_to do |format|\n format.html { redirect_to sotrudnikis_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request 'DELETE', path\n end", "def delete\n supprimer = SondageService.instance.supprimerSondage(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\nend", "def destroy\n @asthenium.destroy\n respond_to do |format|\n format.html { redirect_to asthenia_url }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @sejour.destroy\n respond_to do |format|\n format.html { redirect_to sejours_url, notice: 'Sejour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to dossiers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ginasio = Ginasio.find(params[:id])\n @ginasio.destroy\n\n respond_to do |format|\n format.html { redirect_to ginasios_url, :flash => { :notice => 'Ginasio apagado.' } }\n format.json { head :ok }\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @sivic_discipulo.destroy\n respond_to do |format|\n format.html { redirect_to sivic_discipulos_url }\n format.json { head :no_content }\n end\n end", "def delete!\n request! :delete\n end", "def destroy\n @dinosaur.destroy\n respond_to do |format|\n format.html { redirect_to dinosaurs_url, notice: \"Dinosaur was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @duda.destroy\n respond_to do |format|\n format.html { redirect_to dudas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @diapo = current_church.diapos.find(params[:id])\n @diapo.destroy\n\n respond_to do |format|\n format.html { redirect_to diapos_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @jedi = Jedi.find(params[:id])\n @jedi.destroy\n\n respond_to do |format|\n format.html { redirect_to jedis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dinosaur.destroy\n respond_to do |format|\n format.html { redirect_to dinosaurs_url, notice: 'Dinosaur was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\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 @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nominee.destroy\n respond_to do |format|\n format.html { redirect_to nominees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @diemtrentuyen = Diemtrentuyen.find(params[:id])\n @diemtrentuyen.destroy\n\n respond_to do |format|\n format.html { redirect_to diemtrentuyens_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @surah.destroy\n respond_to do |format|\n format.html { redirect_to surahs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @jednani.destroy\n respond_to do |format|\n format.html { redirect_to jednanis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def destroy\n @jour.destroy\n respond_to do |format|\n format.html { redirect_to jours_url, notice: 'Jour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @datosgenerale.destroy\n respond_to do |format|\n format.html { redirect_to datosgenerales_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def destroy\n @sitio = Sitio.find(params[:id])\n @sitio.destroy\n\n respond_to do |format|\n format.html { redirect_to sitios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stanza = Stanza.find_by_no(params[:id])\n @stanza.destroy\n\n respond_to do |format|\n format.html { redirect_to stanzas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sezione = Sezione.find(params[:id])\n @sezione.destroy\n\n respond_to do |format|\n format.html { redirect_to sezioni_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def destroy\n @giang_vien = GiangVien.find(params[:id])\n @giang_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @seo_datum = SeoDatum.find(params[:id])\n @seo_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to seo_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gasto = Gasto.find(params[:id])\n @gasto.destroy\n\n respond_to do |format|\n format.html { redirect_to gastos_url }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @direcciont.destroy\n respond_to do |format|\n format.html { redirect_to direccionts_url, notice: 'Direcciont was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @testis = Teste.find(params[:id])\n @testis.destroy\n\n respond_to do |format|\n format.html { redirect_to testes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uchronist = Uchronist.find(params[:id])\n @uchronist.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datum.destroy\n respond_to do |format|\n format.html { redirect_to data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unidad.destroy\n respond_to do |format|\n format.html { redirect_to unidades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @strosek.destroy\n respond_to do |format|\n format.html { redirect_to stroseks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @detalle = Detalle.find(params[:id])\n @detalle.destroy\n\n respond_to do |format|\n format.html { redirect_to detalles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @humanidades2 = Humanidades2.find(params[:id])\n @humanidades2.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades2s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ref_sanatorium = Ref::Sanatorium.find(params[:id])\n @ref_sanatorium.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_sanatoria_url }\n format.json { head :ok }\n end\n end", "def destroy\r\n @sivic_rede.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_redes_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @dinosaur.destroy\n head :no_content\n end", "def destroy\n @datos_estudiante.destroy\n respond_to do |format|\n format.html { redirect_to datos_estudiantes_url, notice: 'Datos estudiante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n delete_from_server single_url\n end", "def destroy\n @soiree = Soiree.find(params[:id])\n @soiree.destroy\n\n respond_to do |format|\n format.html { redirect_to soirees_url }\n format.json { head :no_content }\n end\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @one = One.find(params[:id])\n @one.destroy\n\n respond_to do |format|\n format.html { redirect_to ones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @duo.destroy\n respond_to do |format|\n format.html { redirect_to duos_url, notice: 'Duo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @direccion.destroy\n respond_to do |format|\n format.html { redirect_to direcciones_url, notice: 'Direccion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @socio_serasa.destroy\n respond_to do |format|\n format.html { redirect_to socio_serasas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @socio = Socio.find(params[:id])\n @socio.destroy\n\n respond_to do |format|\n format.html { redirect_to socios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @socio = Socio.find(params[:id])\n @socio.destroy\n\n respond_to do |format|\n format.html { redirect_to socios_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7264388", "0.7014365", "0.6952717", "0.69443405", "0.6911502", "0.6852525", "0.6835401", "0.6822832", "0.68194366", "0.67999977", "0.67946404", "0.6794366", "0.6789622", "0.67777646", "0.6775682", "0.67647266", "0.67647266", "0.67647266", "0.67647266", "0.6756896", "0.67540133", "0.6753509", "0.6738186", "0.67324704", "0.6728325", "0.6714494", "0.6707423", "0.6706513", "0.6705452", "0.6705452", "0.6703826", "0.6701749", "0.66998357", "0.669734", "0.6687744", "0.66875714", "0.66857564", "0.6685171", "0.6684448", "0.6683341", "0.6682855", "0.667777", "0.6677536", "0.66769475", "0.6675309", "0.6674381", "0.66741186", "0.66735893", "0.66718405", "0.66716474", "0.66672266", "0.66672266", "0.6667183", "0.6666153", "0.6665972", "0.6664983", "0.66636705", "0.66604114", "0.6652023", "0.66487837", "0.66482484", "0.6647257", "0.66464454", "0.66457075", "0.66450727", "0.66438276", "0.6637389", "0.6630072", "0.6628282", "0.66237617", "0.66233575", "0.6621198", "0.6616853", "0.66163766", "0.6616138", "0.6615372", "0.66150635", "0.66144675", "0.66134584", "0.6613145", "0.6613076", "0.66123873", "0.6611394", "0.660775", "0.66075975", "0.66074526", "0.660583", "0.660348", "0.6599247", "0.6597597", "0.65967745", "0.6596697", "0.6596383", "0.6595305", "0.659383", "0.6592148", "0.65867", "0.65836865", "0.65805024", "0.65805024" ]
0.6945403
3
Use callbacks to share common setup or constraints between actions.
def set_dianosaur @dianosaur = Dianosaur.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 dianosaur_params params.require(:dianosaur).permit(:name, :genus, :description, :period) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
GET /profile_diet_tags GET /profile_diet_tags.json
def index @profile_diet_tags = ProfileDietTag.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags\n get('tags')\n end", "def profile_diet_tag_params\n params[:profile_diet_tag]\n end", "def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end", "def tags\n @tags_with_count = Asset.tag_counts_on(:tags)\n \n @tags = @tags_with_count.map{|tag_hash| tag_hash = tag_hash.name }\n \n respond_to do |format|\n format.html\n format.json { render :json => @tags }\n end\n end", "def tags\n return head :unauthorized unless current_user\n @tags = current_user.owned_tags.where(\"name like ?\", \"%#{params[:tag]}%\").\n page(params[:page]).per(20)\n if @tags.empty?\n @tags = [current_user.owned_tags.new(name: I18n.t('record.tag_list.no_tags'))]\n end\n respond_with(@tags)\n end", "def show\n @taggable = current_user.taggables.find(params[:id])\n @tags = @taggable.tags\n @url_no_path = URI.parse(@taggable.photo.url).path[%r{[^/]+\\z}]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taggable }\n end\n end", "def set_profile_diet_tag\n @profile_diet_tag = ProfileDietTag.find(params[:id])\n end", "def tags\n response[\"tags\"]\n end", "def tags\n get.tagGuids\n end", "def get_user_tags username, password\n do_request 'get_user_tags', username: username, password: password\n end", "def index\n tags_list = []\n @user.tags.find_each do |tag|\n tags_list << tag_as_hash(tag, false)\n end\n\n render :status => 200,\n :json => {\n status: 200,\n tags: tags_list\n }\n end", "def activities_tags\n\t\ttags = ActivityTag.tags_for_teacher(@current_teacher_user.id)\n\n\t\trender json: {status: \"success\" , tags: tags}\n\tend", "def index\n unless params[:tag].blank?\n @recipes = current_user.recipes.tagged_with(params[:tag]).order(\"created_at desc\").page(params[:page]).per(10)\n else\n @recipes = current_user.recipes.order(\"created_at desc\").page(params[:page]).per(10) \n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipes }\n end\n end", "def tags(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Tags\", params: params)\n end", "def tags\n _get(\"/query/image/tags\") { |json| json }\n end", "def list(user_id)\n @_client.get(\"/users/#{user_id}/tags\")\n end", "def tags\n @tags = User.tag_counts_on(:tags, :conditions => \"name LIKE '\" + (params[:query] || \"\") + \"%'\").limit(50).order('count desc')\n respond_to do |format|\n format.html # tags.html.erb\n format.json { render json: @tags }\n format.xml { render xml: @tags }\n end\n end", "def index\n @tags, @tags_attached = TagService.list(current_user.id)\n end", "def tags(options={})\n self.class.parse_tags(request(singular(user_id) + \"/tags\", options))\n end", "def tags\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n #@tags = Node.tag_counts(:limit => 50, :order => \"count desc\")\n #@tags = Node.tag_counts_on(:tag, :limit => 50, :order => \"count desc\")\n @out = @tags.map{|b| {:id => b.id, :name => b.name }}\n \n\n \n respond_to do |format|\n format.json { render :json => @out }\n end\n\n end", "def tags\n @data['tags']\n end", "def tags\n data[:tags]\n end", "def tags\n data[:tags]\n end", "def tags\n data[:tags]\n end", "def tags\n data[:tags]\n end", "def tags\n data[:tags]\n end", "def show_my_tags\n tags = Tag.where('customer_id = ? AND active = ?', current_customer.id, true)\n\n if tags.nil?\n return_error_infos(400, 'No tags found', 'NoTagsFound', nil)\n else\n json_tags = []\n\n tags.each { |tag| json_tags << create_tag_infos(tag, nil) }\n\n render :status => 200, :json => { :tags => json_tags }\n end\n end", "def gettags\n @ideaid = params[:ideaid]\n @ideatagsthen = IdeasTags.find(:all, :conditions => {:idea_id => @ideaid})\n @ideatags = Tag.where(:id => @ideatagsthen.map(&:tag_id))\n respond_to do |format|\n format.html\n format.js\n end\n end", "def top_tags()\n get(:standard, {:method => \"tag.getTopTags\"})\n end", "def index\n @taggables = current_user.taggables\n @taggable_center = current_user.taggables.first\n \n\n if !@taggable_center.nil?\n @url_no_path = URI.parse(@taggable_center.photo.url(:editable)).path[%r{[^/]+\\z}]\n @url_path = URI.parse(@taggable_center.photo.url(:editable)).path\n @tags = @taggable_center.tags\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taggables }\n end\n end", "def show\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tags_of_novel }\n end\n end", "def tags(client)\n client.get(\"#{PATH}/tags\")\n end", "def show\n @tag = Tag.find(params[:id])\n if current_admin\n if params[:pin]\n @tag.photo_id = params[:pin]\n @tag.save\n end\n end\n # @category_photo = @tag.photo\n @photos = Photo.includes(:tags).where(:tags => {:name => @tag.name})\n @untagged_photos = []\n Photo.all.each do |p|\n @untagged_photos << p if p.tags.count == 0\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end", "def tags\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n #@tags = Video.tag_counts(:limit => 50, :order => \"count desc\")\n #@tags = Video.tag_counts_on(:tag, :limit => 50, :order => \"count desc\")\n @out = @tags.map{|b| {:id => b.id, :name => b.name }}\n \n\n \n respond_to do |format|\n format.json { render :json => @out }\n end\n\n end", "def taglist\n @tags = Note.tag_counts.map {|tag| tag.name}\n\n respond_to do |format|\n format.json { render json: @tags }\n end\n end", "def tag\n require_admin_permissions\n @model = 'tag'\n @key = 'tag'\n @values = Tag.all.pluck(:tag)\n render 'tags'\n end", "def by_tag\n Gist.tagged_with(tag_name).includes(:profile)\n end", "def get_tag_list\n # body = {\n # cmd: \"get_tag_list\"\n # }\n\n end", "def show\n @tag = Tag.find_by_name(params[:id]) || raise_404\n redirect_to tag_path(@tag.redirect_tag_name) if @tag.redirect_tag_id\n @taggings = @tag.taggings.order(:karma).reverse_order.paginate(:page => params[:page], :per_page => 25)\n end", "def index\n tags = Tag.all\n render json: tags, status: :ok\n end", "def tags() ; info[:tags] ; end", "def tags() ; info[:tags] ; end", "def tags\n @obj['tags']\n end", "def tag(id, params = {})\n get \"tags/#{id}\", {query: params}\n end", "def index\n authorize @user\n render :json => @user.tags\n end", "def index\n return render_json_for_api(Tag.map) if params[:map] == \"true\" && api_call?\n @tags_with_counts = Tag.\n joins(:vulnerabilities).\n group(\"tags.id\").\n select(\"tags.name\",\n \"tags.shortname\",\n \"tags.color\",\n \"tags.icon\",\n \"tags.id\",\n \"tags.family\",\n 'count(*) AS num_vulns').\n having('count(*) > 1')\n\n @tags = Tag.order(name: :asc).\n select(\"\n *,\n substring(tags.description from 0 for 240) || '...' as short_desc\n \")\n @articleTags = ArticleTag.joins(:article).distinct(:article_id).select(:title, :blurb, :art)\n if @tags == nil\n flash[:error] = \"Error: Tag not found\"\n redirect_to controller: 'tags', :action => 'index'\n else\n render_json_for_api(@tags)\n end\n end", "def tags\n\t\tresponse = self.server.run_with_json_template( :tags )\n\t\treturn response.flatten.map {|tag| Hglib::Repo::Tag.new(self, **tag) }\n\tend", "def tag\n @tag = params[:id]\n @personas = Persona.find_tagged_with(@tag,:order=>\"apepat,apemat,nombre\")\n @familias = Familia.find_tagged_with(@tag) \n @instituciones = Institucion.find_tagged_with(@tag,:order=>\"nombre\")\n @comentarios = Comentario.find_tagged_with(@tag,:order=>\"created_at desc\")\n end", "def index # This is what we'll need if we want our url/tags page to exist\n @tags = Tag.all\n end", "def create\n @profile_diet_tag = ProfileDietTag.new(profile_diet_tag_params)\n\n respond_to do |format|\n if @profile_diet_tag.save\n format.html { redirect_to @profile_diet_tag, notice: 'Profile diet tag was successfully created.' }\n format.json { render :show, status: :created, location: @profile_diet_tag }\n else\n format.html { render :new }\n format.json { render json: @profile_diet_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @tagname = params[:id].to_s\n @tags = Tag.name_is(@tagname).descend_by_updated_at.reject {|r| !r.tagable.read_allowed?(current_user) }.paginate(\n :page => params[:page], :per_page => POSTINGS_PER_PAGE)\n @tagables = @tags.map { |t| \n t.tagable\n }.sort { |b,a| a.updated_at <=> b.updated_at }\n end", "def retrieve_tags\n # noop\n end", "def tags_url\n view_context.tags_url\n end", "def classroom_tags\n\n\t\t@classroom = Classroom.where({teacher_user_id: @current_teacher_user.id, id: params[:classroom_id]}).first\n\n\t\trender json: @classroom.tags(true, false).to_json\n\t\t\n\tend", "def show\n @tagging = Tagging.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tagging }\n end\n end", "def show\n get_status\n @tag = Tag.find(params[:id])\n taggings = Tagging.where(:tag_id => params[:id])\n\n post_ids = []\n taggings.each do |tagging|\n post_ids << tagging.post_id\n end\n post_ids.compact!\n\n @posts = Post.where(:id => post_ids).order('created_at DESC').page(params[:page]).per(5)\n @labels = [\"<span class=\\\"label\\\">\",\"<span class=\\\"label label-success\\\">\",\"<span class=\\\"label label-warning\\\">\",\"<span class=\\\"label label-important\\\">\",\"<span class=\\\"label label-info\\\">\"]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end", "def index\n @users = User.where(banned: false, public_profile: true).order(:name).includes(:skills)\n\n @users = @users.ilike(:name, params[:query]) unless params[:query].blank?\n @users = @users.tagged_with(params[:skills]) unless params[:skills].blank?\n\n @tags = User.tag_counts_on(:skills).order('taggings_count DESC')\n end", "def new\n @taggable = current_user.taggables.new(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taggable }\n end\n end", "def tag\n @favors = Favor.tagged_with(params[:tag], :order => @order)\n @tag = params[:tag]\n\n respond_to do |format|\n format.html # tag.html.erb\n format.json { render json: @favors }\n end\n end", "def get_tags_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.get_tags ...\"\n end\n # resource path\n local_var_path = \"/tags\"\n\n # query parameters\n query_params = {}\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\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 => 'PageResourcestring')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tags\n klass = Object.const_get(\"Concepts\").const_get(params[:tag_class])\n results = klass.search_for_label_starting_with(params[:term]).map(&:label)\n render :json => results.uniq.sort\n end", "def tag(t)\n tag = get url: \"tags/#{generate_slug(t)}\", filter: @everything_filter\n tag.tag if tag\n end", "def index\n @taggings = Tagging.all\n end", "def show\n @tagg = Tagg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tagg }\n end\n end", "def tags\n tags = get_user_tags\n # prevents resource from being applied on every run if clearing tags with ''\n tags = [''] if tags == []\n tags\n end", "def show\n @user_tag = UserTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_tag }\n end\n end", "def show\n tagging = Tagging.find(params[:id])\n tag = tagging.tag\n render json: {status: 'SUCCESS', message:'Loaded tagging', data:tagging, tag:tag},status: :ok\n end", "def get_dogs\n user_dog = User.find(params[:id]).dog\n if user_dog\n render json: user_dog.to_json(include: :dog_photos)\n else\n render json: []\n end\n end", "def get_tags_uri\n @get_tags_uri ||= \"#{base_uri}/gettags\"\n end", "def show\r\n render json: Tag.find(params[:id])\r\n end", "def tags\n @tags ||= begin\n resp = @client.access_token.get('/reader/api/0/tag/list?output=json')\n raise \"unable to retrieve the list of tags for user \\\"#{user_id}\\\": #{resp.inspect}\" unless resp.code_type == Net::HTTPOK\n JSON.parse(resp.body)['tags'].collect do |hash|\n Google::Reader::Tag.new(hash.merge({:client => @client}))\n end\n end\n end", "def show\n @expense = Expense.find(params[:id])\n\n @tags = @expense.get_tags\n end", "def index # p \"TagsController.index: params=#{params.inspect}\"\n # p \"params['example_id']=#{params['example_id']}, params[:example_id]=#{params[:example_id]}\"\n if (params[:example_id])\n @tags = Tag.where(\"example_id=?\", params[:example_id])\n else\n @tags = Tag.all\n end\n\n p \"@tags=#{@tags.inspect}\"\n\n respond_to do |format|\n format.html {}\n format.json {render :json => @tags }\n end\n end", "def show_contact_tags(**params)\n get('contactTags', params)\n end", "def tags; end", "def tags; end", "def tags; end", "def tags; end", "def tags; end", "def tags\n @values.fetch('tags') { \n @values['tags'] = {}\n }\n end", "def get\n\t\tformat = getFormat(params)\n\n\t\tquery_text =\"\nselect * from tags \nwhere tag_normalized like '#{cleanTag(params[:tag])}%'\"\n\n\t\tresults = Tag.find_by_sql(query_text)\n\n\t\ttags = results.inject([]) {|res, tag|\n\t\t\tres << \n\t\t\t\t{\n\t\t\t\t\t:tag_value => tag.tag_value, \n\t\t\t\t\t:tag_normalized => tag.tag_normalized, \n\t\t\t\t\t:id => tag.id}\n\t\t\t\t}\n\n\t\trender format.to_sym => tags\n\tend", "def index\n @tagihans = Tagihan.all\n @tagihans = @tagihans.select { |x| x.user_id == params[:user_id].to_i }\n render json: { items: @tagihans }\n end", "def index\n @expert_tags = ExpertTag.where(:user_id => params[:user_id])\n end", "def my_tag_list\n self.taggings.order('id ASC').map(&:tag).map(&:name)\n end", "def all\n response= handle_errors{ self.class.get('/get')}\n response[\"tags\"][\"tag\"].collect do |tag| \n t= Rubycious::Tag.new(tag)\n end\n end", "def _get_tags(tag)\n tags = if tag.attr['tags'] && !tag.attr['tags'].blank?\n Tag.from_list(tag.attr['tags'], false) # false parameter -> not to create missing tags\n elsif tag.locals.page.respond_to?(:requested_tags)\n tag.locals.page.requested_tags\n elsif tag.locals.page\n tag.locals.page.attached_tags.visible\n else\n []\n end\n tag.locals.tags = tags.uniq.compact\n end", "def get_tag_list\n args = receive_should_validate?\n get('redtube.Tags.getTagList', {}, [], args[:should_validate])\n end", "def get_tags( params )\n secure = !params.include?(:user)\n LastFM.requires_authentication if secure\n LastFM.post( \"track.getTags\", params, secure )\n end", "def index\n if params[:tag]\n @tag = ActsAsTaggableOn::Tag.find_by(name: params[:tag])\n @business_profiles = BusinessProfile.tagged_with(params[:tag])\n else\n @business_profiles = BusinessProfile.all\n end\n end", "def index\n if params[:tag] == nil\n @photos = Photo.where('user_id=?',session[:user_id]).latest.paginate(:page=>params[:page], :per_page=>10)\n else\n @photos = Photo.tagged_with(params[:tag]).where('user_id=?',session[:user_id]).latest.paginate(:page=>params[:page],:per_page=>10)\n end\n @tags = Photo.tag_counts_on(:tags)\n @tag_name=params[:tag]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end", "def tags\n return false if params[:q] and params[:q].size < 3\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n respond_to do |format|\n format.json { render :json => @tags.map{|t| {:id => t.name, :name => t.name }}}\n end\n end", "def access_tags\n tags = []\n tags << 'admin' if admin?\n tags << 'speaker' if speaker?\n tags << 'staff' if staff?\n tags\n end", "def show\n @tag = Tag.find(params[:id])\n render json: JSON.parse(@tag.to_json)\n end", "def return_tag_infos(tag, language_code)\n if tag.nil?\n render :status => 400, :json => { :error => { :message => 'Tag not found', :code => 'InvalidRequest' }}\n else\n tag_infos = create_tag_infos(tag, language_code)\n\n render :status => 200, :json => { :tags => [tag_infos] }\n end\n end", "def show\n @tag = Tag.find(params[:id])\n\n @tweets = @tag.tweets.paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tag }\n end\n end", "def show\n # For each of the possible contexts get the tags...\n @className = params[:class]\n @personId = params[:id]\n \n # taggings.tagger_id IS NULl .... need to deal with owner ????\n \n if isok(@className)\n obj = eval(@className).find(@personId)\n # 1. Get the set of contexts\n # contexts = TagContext.all\n contexts1 = getContexts(@className).sort_by{|name| name.downcase }\n contexts2 = TagContext.all.collect{|v| v.name}\n contexts = contexts1.concat(contexts2).collect{|a| a.downcase }.uniq.sort_by{|name| name.downcase }.collect{|n| n.capitalize}\n \n # 2. For each context get the tags for thie person and add them to the results\n @allTags = Hash.new\n contexts.each do |context|\n if getTagOwner\n tags = obj.owner_tag_list_on(getTagOwner, context)\n else \n tags = obj.tag_list_on( context )\n end\n \n if tags != nil\n @allTags[context] = tags\n end\n end\n end\n rescue => ex\n render status: :bad_request, text: ex.message\n end", "def get_tags(opts = {})\n data, _status_code, _headers = get_tags_with_http_info(opts)\n return data\n end", "def index\n @tags = Tag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tags }\n end\n end", "def get_tags() tag_ids.inject([]) { |l, tag_id| l << get_tag_from_id(tag_id) } end", "def tags(include_private=false)\n Tag.find_all_by_user(self, include_private)\n end" ]
[ "0.7142842", "0.68965954", "0.6883749", "0.6806724", "0.6692058", "0.6658526", "0.6566993", "0.65361464", "0.6491817", "0.64789355", "0.63980937", "0.63587475", "0.63569975", "0.63379407", "0.6311361", "0.6305095", "0.6297352", "0.62745374", "0.6233613", "0.61860204", "0.6181977", "0.6174436", "0.6174436", "0.6174436", "0.6174436", "0.6174436", "0.6158849", "0.6137042", "0.6126846", "0.6124368", "0.61209995", "0.6119742", "0.6114632", "0.61061573", "0.6102397", "0.60843086", "0.6065487", "0.60586834", "0.6044443", "0.6037746", "0.60318303", "0.60318303", "0.6021365", "0.60196763", "0.6009545", "0.60018456", "0.5999241", "0.5994526", "0.5973193", "0.5956683", "0.5943234", "0.59372544", "0.5886638", "0.5884795", "0.5884302", "0.5883072", "0.58754736", "0.5868624", "0.5867299", "0.58651274", "0.5861584", "0.585549", "0.5848996", "0.5845258", "0.5844102", "0.5843861", "0.5829401", "0.58265007", "0.58185625", "0.5815515", "0.5807483", "0.5798036", "0.57872194", "0.57859313", "0.5767143", "0.5767143", "0.5767143", "0.5767143", "0.5767143", "0.574672", "0.57351375", "0.5733484", "0.57284254", "0.572757", "0.5717222", "0.57157", "0.57106376", "0.57089674", "0.57087886", "0.5707549", "0.57061976", "0.57043904", "0.5700291", "0.5679264", "0.56779754", "0.56776977", "0.5675926", "0.566592", "0.56643504", "0.5654037" ]
0.7445801
0
GET /profile_diet_tags/1 GET /profile_diet_tags/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @profile_diet_tags = ProfileDietTag.all\n end", "def tags\n get('tags')\n end", "def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end", "def set_profile_diet_tag\n @profile_diet_tag = ProfileDietTag.find(params[:id])\n end", "def tags\n @tags_with_count = Asset.tag_counts_on(:tags)\n \n @tags = @tags_with_count.map{|tag_hash| tag_hash = tag_hash.name }\n \n respond_to do |format|\n format.html\n format.json { render :json => @tags }\n end\n end", "def profile_diet_tag_params\n params[:profile_diet_tag]\n end", "def show\n @taggable = current_user.taggables.find(params[:id])\n @tags = @taggable.tags\n @url_no_path = URI.parse(@taggable.photo.url).path[%r{[^/]+\\z}]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taggable }\n end\n end", "def index\n unless params[:tag].blank?\n @recipes = current_user.recipes.tagged_with(params[:tag]).order(\"created_at desc\").page(params[:page]).per(10)\n else\n @recipes = current_user.recipes.order(\"created_at desc\").page(params[:page]).per(10) \n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipes }\n end\n end", "def tags\n return head :unauthorized unless current_user\n @tags = current_user.owned_tags.where(\"name like ?\", \"%#{params[:tag]}%\").\n page(params[:page]).per(20)\n if @tags.empty?\n @tags = [current_user.owned_tags.new(name: I18n.t('record.tag_list.no_tags'))]\n end\n respond_with(@tags)\n end", "def index\n tags_list = []\n @user.tags.find_each do |tag|\n tags_list << tag_as_hash(tag, false)\n end\n\n render :status => 200,\n :json => {\n status: 200,\n tags: tags_list\n }\n end", "def tags\n response[\"tags\"]\n end", "def show\n @tag = Tag.find(params[:id])\n if current_admin\n if params[:pin]\n @tag.photo_id = params[:pin]\n @tag.save\n end\n end\n # @category_photo = @tag.photo\n @photos = Photo.includes(:tags).where(:tags => {:name => @tag.name})\n @untagged_photos = []\n Photo.all.each do |p|\n @untagged_photos << p if p.tags.count == 0\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end", "def show\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tags_of_novel }\n end\n end", "def tags\n @tags = User.tag_counts_on(:tags, :conditions => \"name LIKE '\" + (params[:query] || \"\") + \"%'\").limit(50).order('count desc')\n respond_to do |format|\n format.html # tags.html.erb\n format.json { render json: @tags }\n format.xml { render xml: @tags }\n end\n end", "def tags\n _get(\"/query/image/tags\") { |json| json }\n end", "def get_user_tags username, password\n do_request 'get_user_tags', username: username, password: password\n end", "def index\n @taggables = current_user.taggables\n @taggable_center = current_user.taggables.first\n \n\n if !@taggable_center.nil?\n @url_no_path = URI.parse(@taggable_center.photo.url(:editable)).path[%r{[^/]+\\z}]\n @url_path = URI.parse(@taggable_center.photo.url(:editable)).path\n @tags = @taggable_center.tags\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taggables }\n end\n end", "def show\n @tagging = Tagging.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tagging }\n end\n end", "def tags\n get.tagGuids\n end", "def tags(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Tags\", params: params)\n end", "def activities_tags\n\t\ttags = ActivityTag.tags_for_teacher(@current_teacher_user.id)\n\n\t\trender json: {status: \"success\" , tags: tags}\n\tend", "def show\r\n render json: Tag.find(params[:id])\r\n end", "def show\n tagging = Tagging.find(params[:id])\n tag = tagging.tag\n render json: {status: 'SUCCESS', message:'Loaded tagging', data:tagging, tag:tag},status: :ok\n end", "def new\n @taggable = current_user.taggables.new(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taggable }\n end\n end", "def tag\n require_admin_permissions\n @model = 'tag'\n @key = 'tag'\n @values = Tag.all.pluck(:tag)\n render 'tags'\n end", "def tag(id, params = {})\n get \"tags/#{id}\", {query: params}\n end", "def tags\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n #@tags = Node.tag_counts(:limit => 50, :order => \"count desc\")\n #@tags = Node.tag_counts_on(:tag, :limit => 50, :order => \"count desc\")\n @out = @tags.map{|b| {:id => b.id, :name => b.name }}\n \n\n \n respond_to do |format|\n format.json { render :json => @out }\n end\n\n end", "def index\n tags = Tag.all\n render json: tags, status: :ok\n end", "def index\n @tags, @tags_attached = TagService.list(current_user.id)\n end", "def create\n @profile_diet_tag = ProfileDietTag.new(profile_diet_tag_params)\n\n respond_to do |format|\n if @profile_diet_tag.save\n format.html { redirect_to @profile_diet_tag, notice: 'Profile diet tag was successfully created.' }\n format.json { render :show, status: :created, location: @profile_diet_tag }\n else\n format.html { render :new }\n format.json { render json: @profile_diet_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @user_tag = UserTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_tag }\n end\n end", "def taglist\n @tags = Note.tag_counts.map {|tag| tag.name}\n\n respond_to do |format|\n format.json { render json: @tags }\n end\n end", "def list(user_id)\n @_client.get(\"/users/#{user_id}/tags\")\n end", "def show\n get_status\n @tag = Tag.find(params[:id])\n taggings = Tagging.where(:tag_id => params[:id])\n\n post_ids = []\n taggings.each do |tagging|\n post_ids << tagging.post_id\n end\n post_ids.compact!\n\n @posts = Post.where(:id => post_ids).order('created_at DESC').page(params[:page]).per(5)\n @labels = [\"<span class=\\\"label\\\">\",\"<span class=\\\"label label-success\\\">\",\"<span class=\\\"label label-warning\\\">\",\"<span class=\\\"label label-important\\\">\",\"<span class=\\\"label label-info\\\">\"]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end", "def show\n @tag = Tag.find_by_name(params[:id]) || raise_404\n redirect_to tag_path(@tag.redirect_tag_name) if @tag.redirect_tag_id\n @taggings = @tag.taggings.order(:karma).reverse_order.paginate(:page => params[:page], :per_page => 25)\n end", "def show\n @tagg = Tagg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tagg }\n end\n end", "def tags\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n #@tags = Video.tag_counts(:limit => 50, :order => \"count desc\")\n #@tags = Video.tag_counts_on(:tag, :limit => 50, :order => \"count desc\")\n @out = @tags.map{|b| {:id => b.id, :name => b.name }}\n \n\n \n respond_to do |format|\n format.json { render :json => @out }\n end\n\n end", "def show_my_tags\n tags = Tag.where('customer_id = ? AND active = ?', current_customer.id, true)\n\n if tags.nil?\n return_error_infos(400, 'No tags found', 'NoTagsFound', nil)\n else\n json_tags = []\n\n tags.each { |tag| json_tags << create_tag_infos(tag, nil) }\n\n render :status => 200, :json => { :tags => json_tags }\n end\n end", "def show\n @tag = Tag.find(params[:id])\n render json: JSON.parse(@tag.to_json)\n end", "def index\n return render_json_for_api(Tag.map) if params[:map] == \"true\" && api_call?\n @tags_with_counts = Tag.\n joins(:vulnerabilities).\n group(\"tags.id\").\n select(\"tags.name\",\n \"tags.shortname\",\n \"tags.color\",\n \"tags.icon\",\n \"tags.id\",\n \"tags.family\",\n 'count(*) AS num_vulns').\n having('count(*) > 1')\n\n @tags = Tag.order(name: :asc).\n select(\"\n *,\n substring(tags.description from 0 for 240) || '...' as short_desc\n \")\n @articleTags = ArticleTag.joins(:article).distinct(:article_id).select(:title, :blurb, :art)\n if @tags == nil\n flash[:error] = \"Error: Tag not found\"\n redirect_to controller: 'tags', :action => 'index'\n else\n render_json_for_api(@tags)\n end\n end", "def tags\n @data['tags']\n end", "def tags(client)\n client.get(\"#{PATH}/tags\")\n end", "def index # p \"TagsController.index: params=#{params.inspect}\"\n # p \"params['example_id']=#{params['example_id']}, params[:example_id]=#{params[:example_id]}\"\n if (params[:example_id])\n @tags = Tag.where(\"example_id=?\", params[:example_id])\n else\n @tags = Tag.all\n end\n\n p \"@tags=#{@tags.inspect}\"\n\n respond_to do |format|\n format.html {}\n format.json {render :json => @tags }\n end\n end", "def tag\n @tag = params[:id]\n @personas = Persona.find_tagged_with(@tag,:order=>\"apepat,apemat,nombre\")\n @familias = Familia.find_tagged_with(@tag) \n @instituciones = Institucion.find_tagged_with(@tag,:order=>\"nombre\")\n @comentarios = Comentario.find_tagged_with(@tag,:order=>\"created_at desc\")\n end", "def tags(options={})\n self.class.parse_tags(request(singular(user_id) + \"/tags\", options))\n end", "def by_tag\n Gist.tagged_with(tag_name).includes(:profile)\n end", "def show\n @tagname = params[:id].to_s\n @tags = Tag.name_is(@tagname).descend_by_updated_at.reject {|r| !r.tagable.read_allowed?(current_user) }.paginate(\n :page => params[:page], :per_page => POSTINGS_PER_PAGE)\n @tagables = @tags.map { |t| \n t.tagable\n }.sort { |b,a| a.updated_at <=> b.updated_at }\n end", "def index\n authorize @user\n render :json => @user.tags\n end", "def gettags\n @ideaid = params[:ideaid]\n @ideatagsthen = IdeasTags.find(:all, :conditions => {:idea_id => @ideaid})\n @ideatags = Tag.where(:id => @ideatagsthen.map(&:tag_id))\n respond_to do |format|\n format.html\n format.js\n end\n end", "def tags\n data[:tags]\n end", "def tags\n data[:tags]\n end", "def tags\n data[:tags]\n end", "def tags\n data[:tags]\n end", "def tags\n data[:tags]\n end", "def tag(t)\n tag = get url: \"tags/#{generate_slug(t)}\", filter: @everything_filter\n tag.tag if tag\n end", "def top_tags()\n get(:standard, {:method => \"tag.getTopTags\"})\n end", "def tag\n @favors = Favor.tagged_with(params[:tag], :order => @order)\n @tag = params[:tag]\n\n respond_to do |format|\n format.html # tag.html.erb\n format.json { render json: @favors }\n end\n end", "def get_tag_list\n # body = {\n # cmd: \"get_tag_list\"\n # }\n\n end", "def show\n tag = Tag.find_by_tid(params[:id])\n if tag.nil?\n render json_status_response(404, \"Tag not found\")\n return\n end\n\n render :status => 200,\n :json => tag_as_hash(tag).merge({\n status: 200,\n # TODO csrf\n })\n end", "def show\n @expense = Expense.find(params[:id])\n\n @tags = @expense.get_tags\n end", "def tags() ; info[:tags] ; end", "def tags() ; info[:tags] ; end", "def tags\n\t\tresponse = self.server.run_with_json_template( :tags )\n\t\treturn response.flatten.map {|tag| Hglib::Repo::Tag.new(self, **tag) }\n\tend", "def get_dogs\n user_dog = User.find(params[:id]).dog\n if user_dog\n render json: user_dog.to_json(include: :dog_photos)\n else\n render json: []\n end\n end", "def get_tags_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.get_tags ...\"\n end\n # resource path\n local_var_path = \"/tags\"\n\n # query parameters\n query_params = {}\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\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 => 'PageResourcestring')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index # This is what we'll need if we want our url/tags page to exist\n @tags = Tag.all\n end", "def tags\n @obj['tags']\n end", "def index\n @taggings = Tagging.all\n end", "def show\n @tag = Tag.find(params[:id])\n\n @tweets = @tag.tweets.paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tag }\n end\n end", "def show\n @tag = Tag.find(params[:id])\n if !@tag.nil?\n render json: @tag, status: :ok\n else\n render json: @tag.errors, status: :not_found\n end\n end", "def classroom_tags\n\n\t\t@classroom = Classroom.where({teacher_user_id: @current_teacher_user.id, id: params[:classroom_id]}).first\n\n\t\trender json: @classroom.tags(true, false).to_json\n\t\t\n\tend", "def index\n if params[:tag] == nil\n @photos = Photo.where('user_id=?',session[:user_id]).latest.paginate(:page=>params[:page], :per_page=>10)\n else\n @photos = Photo.tagged_with(params[:tag]).where('user_id=?',session[:user_id]).latest.paginate(:page=>params[:page],:per_page=>10)\n end\n @tags = Photo.tag_counts_on(:tags)\n @tag_name=params[:tag]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end", "def retrieve_tags\n # noop\n end", "def index\n @tagihans = Tagihan.all\n @tagihans = @tagihans.select { |x| x.user_id == params[:user_id].to_i }\n render json: { items: @tagihans }\n end", "def get_tags_uri\n @get_tags_uri ||= \"#{base_uri}/gettags\"\n end", "def show\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end", "def show\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end", "def show\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end", "def show\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end", "def update\n respond_to do |format|\n if @profile_diet_tag.update(profile_diet_tag_params)\n format.html { redirect_to @profile_diet_tag, notice: 'Profile diet tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile_diet_tag }\n else\n format.html { render :edit }\n format.json { render json: @profile_diet_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def get\n\t\tformat = getFormat(params)\n\n\t\tquery_text =\"\nselect * from tags \nwhere tag_normalized like '#{cleanTag(params[:tag])}%'\"\n\n\t\tresults = Tag.find_by_sql(query_text)\n\n\t\ttags = results.inject([]) {|res, tag|\n\t\t\tres << \n\t\t\t\t{\n\t\t\t\t\t:tag_value => tag.tag_value, \n\t\t\t\t\t:tag_normalized => tag.tag_normalized, \n\t\t\t\t\t:id => tag.id}\n\t\t\t\t}\n\n\t\trender format.to_sym => tags\n\tend", "def index\n @tags = Tag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tags }\n end\n end", "def index\n @expert_tags = ExpertTag.where(:user_id => params[:user_id])\n end", "def show\n # For each of the possible contexts get the tags...\n @className = params[:class]\n @personId = params[:id]\n \n # taggings.tagger_id IS NULl .... need to deal with owner ????\n \n if isok(@className)\n obj = eval(@className).find(@personId)\n # 1. Get the set of contexts\n # contexts = TagContext.all\n contexts1 = getContexts(@className).sort_by{|name| name.downcase }\n contexts2 = TagContext.all.collect{|v| v.name}\n contexts = contexts1.concat(contexts2).collect{|a| a.downcase }.uniq.sort_by{|name| name.downcase }.collect{|n| n.capitalize}\n \n # 2. For each context get the tags for thie person and add them to the results\n @allTags = Hash.new\n contexts.each do |context|\n if getTagOwner\n tags = obj.owner_tag_list_on(getTagOwner, context)\n else \n tags = obj.tag_list_on( context )\n end\n \n if tags != nil\n @allTags[context] = tags\n end\n end\n end\n rescue => ex\n render status: :bad_request, text: ex.message\n end", "def tags\n klass = Object.const_get(\"Concepts\").const_get(params[:tag_class])\n results = klass.search_for_label_starting_with(params[:term]).map(&:label)\n render :json => results.uniq.sort\n end", "def tag\n Tag.find(tag_id)\n end", "def show\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tag }\n end\n end", "def tags\n @audio_file = AudioFile.find(params[:id])\n @tags = @audio_file.tags\n\n respond_to do |format|\n format.html # tags.html.erb\n format.xml { render :xml => @tags }\n format.json { render :json => @tags }\n end\n end", "def show\n @user_follow_tag = UserFollowTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_follow_tag }\n end\n end", "def index\n @tagged_items = TaggedItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tagged_items }\n end\n end", "def show\n @tagged_item = TaggedItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tagged_item }\n end\n end", "def getRecipeByTag\n begin\n @recipe = Recipe.where('tags ILIKE ?', '%'+params[:tag]+'%').all\n\n if !@recipe.empty?\n render json: { status: 'SUCCESS', message: 'Loaded recipe!', data: @recipe }, status: :ok\n else\n render json: { status: 'SUCCESS', message: 'No recipe found', data: {} }, status: :not_found\n end\n rescue\n render json: { status: 'ERROR', message: 'Error loading recipe', data: {} }, status: :not_found\n end\n end", "def index\n @all = Tag.all\n render json: @all.collect{|tag| tag.strip}\n end", "def destroy\n @profile_diet_tag.destroy\n respond_to do |format|\n format.html { redirect_to profile_diet_tags_url, notice: 'Profile diet tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deli_tags(uri, id)\n begin\n md5 = Digest::MD5.hexdigest(uri)\n target = \"http://badges.del.icio.us/feeds/json/url/data?hash=#{md5}\"\n json = open(target).read\n deli = JSON.load(json)[0]\n tags = \"\"\n if deli['top_tags'].class == Hash then\n all_tags = deli['top_tags'].sort_by {|k,v| v}.reverse.map{|i|i[0]}\n if all_tags.size > 8 then\n all_tags = all_tags.first(8) << '...'\n end\n tags = '(' << all_tags.join(', ') << ')'\n end\n if deli['total_posts'].to_i > 0 then\n response = \"#{id}: (deli) #{deli['total_posts']} links, tagged #{tags}\"\n $q_meta.enq response\n end\n rescue\n puts \"problem fetching deli for #{uri}\"\n end\nend", "def tag\n # Whats the last tag we are asking for? (the rest don't matter I don't think..)\n requested_tag = params[:tag].split(\"/\").last\n tag = Taxonomy.find_by_seo_url requested_tag\n\n if tag.present?\n @tag = tag\n @posts = get_posts tag.posts\n\n\n respond_to do |format|\n format.html { render :template => 'default/index' }\n format.json { render json: @posts }\n end\n else\n # No such category found, redirect to root index\n redirect_to root_path\n end\n end", "def tags_url\n view_context.tags_url\n end", "def all\n response= handle_errors{ self.class.get('/get')}\n response[\"tags\"][\"tag\"].collect do |tag| \n t= Rubycious::Tag.new(tag)\n end\n end", "def return_tag_infos(tag, language_code)\n if tag.nil?\n render :status => 400, :json => { :error => { :message => 'Tag not found', :code => 'InvalidRequest' }}\n else\n tag_infos = create_tag_infos(tag, language_code)\n\n render :status => 200, :json => { :tags => [tag_infos] }\n end\n end", "def index\n @users = User.where(banned: false, public_profile: true).order(:name).includes(:skills)\n\n @users = @users.ilike(:name, params[:query]) unless params[:query].blank?\n @users = @users.tagged_with(params[:skills]) unless params[:skills].blank?\n\n @tags = User.tag_counts_on(:skills).order('taggings_count DESC')\n end", "def index\n @posttags = Posttag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posttags }\n end\n end" ]
[ "0.7284194", "0.68466455", "0.683047", "0.6770027", "0.6747835", "0.6725521", "0.6708171", "0.63837165", "0.6369457", "0.6313448", "0.6308699", "0.62392014", "0.623756", "0.6227399", "0.6215166", "0.6186085", "0.6167213", "0.6162167", "0.61581844", "0.613525", "0.6118961", "0.610134", "0.6091384", "0.6087956", "0.60792917", "0.6078753", "0.6077431", "0.6074567", "0.6071181", "0.6071136", "0.6070852", "0.60522103", "0.6048045", "0.6046222", "0.6038324", "0.6024925", "0.60240793", "0.6017232", "0.5997375", "0.59929144", "0.598656", "0.5984069", "0.5972941", "0.59553474", "0.59443134", "0.5939727", "0.5920997", "0.59137577", "0.5907019", "0.5895284", "0.5895284", "0.5895284", "0.5895284", "0.5895284", "0.5894226", "0.58898026", "0.5886541", "0.5868505", "0.5866471", "0.5862146", "0.5852523", "0.5852523", "0.58446133", "0.58330363", "0.5820396", "0.5816928", "0.5812125", "0.580244", "0.5801209", "0.579691", "0.57965744", "0.5777276", "0.57748383", "0.57677966", "0.57649827", "0.5760802", "0.5760802", "0.5760802", "0.5760802", "0.57527554", "0.57486165", "0.57329935", "0.5717782", "0.5707114", "0.57045066", "0.5693204", "0.5691446", "0.5686035", "0.5665225", "0.5658411", "0.56559616", "0.5655854", "0.5654959", "0.56544244", "0.5634949", "0.56315887", "0.56289667", "0.5626372", "0.5617731", "0.56033087", "0.5582626" ]
0.0
-1
POST /profile_diet_tags POST /profile_diet_tags.json
def create @profile_diet_tag = ProfileDietTag.new(profile_diet_tag_params) respond_to do |format| if @profile_diet_tag.save format.html { redirect_to @profile_diet_tag, notice: 'Profile diet tag was successfully created.' } format.json { render :show, status: :created, location: @profile_diet_tag } else format.html { render :new } format.json { render json: @profile_diet_tag.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile_diet_tag_params\n params[:profile_diet_tag]\n end", "def set_profile_diet_tag\n @profile_diet_tag = ProfileDietTag.find(params[:id])\n end", "def tag!(params = {})\n self.post params, edge: :tags\n end", "def create\n create_tags = params[:create_tags]\n\t@good = Good.new(params[:good])\n\t\n\tif @good.save\n\t\tif create_tags == '1'\n\t\t\tvalues = params[:good][:name].split(':')\n\t\t\tname = values[values.size-1]\n\t\t\tlasttag = values.size-2\n\t\t\tfor i in 0..lasttag\n\t\t\t\ttag_name = values[i]\n\t\t\t\ttag = Tag.find_or_create_by_name(tag_name)\n\t\t\t\ttag.save\n\t\t\t\tgt = GoodsTag.new(:tag=>tag,:good=>@good)\n\t\t\t\tgt.save\n\t\t\tend\n\t\tend\n\t respond_to do |format|\n\t\t\tformat.html { redirect_to :action=>\"index\" }\n\t\t\tformat.json { render :json => @good, :status => :created, :location => @good }\n\t\tend\n else\n\t\trespond_to do |format|\n\t\t\tformat.html { render :action => \"new\" }\n\t\t\tformat.json { render :json => @good.errors, :status => :unprocessable_entity }\n\t\tend\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n @profile.birthdate = JalaliDate.to_gregorian(params[:ja_birth_yyyy],params[:ja_birth_mm],params[:ja_birth_dd])\n # @email = @profile.official_email.split(\"@\").first\n @tags = params[:tags].split(',')\n @tagged = []\n respond_to do |format|\n if @profile.save\n for tag in @tags\n if !tag.blank?\n @tag = Tag.where(title: tag).first\n if @tag.blank?\n @tag = Tag.create(title: tag, user_id: current_user.id)\n end\n @tagging = Tagging.create(taggable_id: @profile.user.id, taggable_type: 'User', tag_id: @tag.id)\n end\n end\n if params[:caller] == 'reg'\n format.html { redirect_to '/registeration_steps?step=2&name=' + @email}\n else\n format.html { redirect_to '/', notice: 'Profile was successfully created.' }\n end\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:tag_names].split(',').each do |name|\n @tag = Tag.find_or_create_by_name name.strip\n @tagging = Tagging.new(params[:tagging])\n @tagging.tag = @tag\n @tags_saved = @tagging.save\n end\n \n respond_to do |format|\n if @tags_saved\n format.html { redirect_to @tagging.taggable, notice: 'Tagged.' }\n format.json { render json: @tagging, status: :created, location: @tagging }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tagging.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @profile_diet_tags = ProfileDietTag.all\n end", "def create\n #...\n params[:cat].permit(...:tag_ids: []) #allow tag_ids and expect it to be an Array\n end", "def create\n @taggable = current_user.taggables.new(params[:taggable], :user_id => current_user.id)\n \n respond_to do |format|\n if @taggable.save\n # if the DB commit was successful then try to tag faces.\n logger.debug(@taggable.photo.path)\n faceArray = findFaces(@taggable.photo.path(:editable))\n \n faceArray.each do |rect|\n @tag = @taggable.tags.new(:upperLeftX => rect[0],\n :upperLeftY => rect[1],\n :lowerRightX => rect[2],\n :lowerRightY => rect[3],\n :person => \"Random Person\")\n @tag.save\n end\n\n format.html { redirect_to \"/tagging/#{@taggable.id}\", notice: 'Taggable was successfully created.' }\n format.json { render json: @taggable, status: :created, location: @taggable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taggable.errors, status: :unprocessable_entity }\n end\n end\n end", "def postEntityAdvertiserTag( gen_id, entity_id, language, tags_to_add, tags_to_remove)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n params['language'] = language\n params['tags_to_add'] = tags_to_add\n params['tags_to_remove'] = tags_to_remove\n return doCurl(\"post\",\"/entity/advertiser/tag\",params)\n end", "def create\n @plant = Plant.find(params[:plant_id])\n if params[:plant_tag][:tag].present?\n tags = Tag.where(id: params[:plant_tag][:tag])\n tags.each do |t|\n @plant_tag = PlantTag.new\n @plant_tag.plant = @plant\n @plant_tag.tag = t\n @plant_tag.save\n end\n redirect_to garden_path(@plant.garden)\n else\n render :new\n end\n end", "def add_new_tag\n puts \"******* add_new_tag *******\"\n puts \" ** params: #{params.inspect}\"\n\n @post_id = params[:post_id]\n\n # == create brand new tag; add to Tags\n if params[:new_tag] != \"new\"\n\n # == check if tag already exists\n check_tag = Tag.where(tag_name: params[:new_tag])\n puts \" ** check_tag.length: #{check_tag.length.inspect}\"\n\n # == create new tag if not existing and assign to post\n if check_tag.length == 0\n @tag = Tag.create(tag_name: params[:new_tag], tag_rank: 0)\n @post_tag = PostTag.create(post_id: params[:post_id], tag_id: @tag[:id])\n puts \" ** NEW TAG @post_tag: #{@post_tag.inspect}\"\n end\n end\n\n # == assign existing tag if selected from select box (not \"ng\")\n if params[:tag_id] != \"ng\"\n\n # == check if tag already assigned to post\n check_tag = PostTag.where(post_id: params[:post_id], tag_id: params[:tag_id])\n puts \" ** check_tag.length: #{check_tag.length.inspect}\"\n\n if check_tag.length == 0\n @post_tag = PostTag.create(post_id: params[:post_id], tag_id: params[:tag_id])\n puts \" ** EXISTING TAG @post_tag: #{@post_tag.inspect}\"\n end\n end\n @post_tags = PostTag.where(post_id: params[:post_id])\n @post_tag_ids = @post_tags.map{|pt| pt.tag_id }\n @post_no_tags = Tag.where(\"id NOT IN (?)\", @post_tag_ids)\n @tags = Tag.where(id: @post_tag_ids)\n render json: { tags: @tags, post_no_tags: @post_no_tags, post_id: @post_id}\n end", "def create\n name_normalized = ActsAsTaggableOn::Tag.normalize(params['name'])\n\n if name_normalized.nil? || name_normalized.empty?\n render :nothing => true, :status => 403\n else\n @tag = ActsAsTaggableOn::Tag.find_or_create_by_name(name_normalized)\n @tag_following = current_user.tag_followings.new(:tag_id => @tag.id)\n\n if @tag_following.save\n render :json => @tag.to_json, :status => 201\n else\n render :nothing => true, :status => 403\n end\n end\n end", "def create_tags\n\tend", "def create\n @tag = Tag.new(tag_params)\n if @tag.save\n render json: @tag\n else\n render json: @tag.errors, status: :unprocessable_entity\n end\n end", "def garden_tag_params\n params.require(:garden_tag).permit(:tag_id)\n end", "def create\n @diet = @profile.diets.new(params[:diet])\n\n respond_to do |format|\n if @diet.save\n format.html { redirect_to [@profile,@diet], notice: 'Diet was successfully created.' }\n format.json { render json: @diet, status: :created, location: @diet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @diet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expert_tag = ExpertTag.new\n @expert_tag.tag_name = params[:tag_name].downcase\n @expert_tag.user_id = params[:user_id]\n @expert_tag.expert_id = params[:expert_id]\n if @expert_tag.save\n render :json=> {:success => true, :id => @expert_tag.id}, :status=>200\n else\n render :json=> {:success => false}, :status=>204\n end\n end", "def tag_params\n params.require(:tag).permit(:expert_id, :tag)\n end", "def create\n tag = @user.tags.new(:location => params[:location])\n\n if tag.save\n render :status => 200,\n :json => tag_as_hash(tag).merge(status: 200)\n else\n render :status => 400,\n :json => {\n status: 400,\n message: \"Bad request\",\n errors: tag.errors,\n }\n end\n end", "def update\n begin\n entity = Tagger::EntityTag.create_entity_tags(params)\n render json: { \"#{Tagger.tagged_resource}\": entity, tags: entity.tags }, status: 201\n rescue Exception => e\n render json: { error: \"Unprocessable entity\" }, status: 422\n end\n end", "def tag\n params.require(:tag).permit(:example_id, :tag)\n end", "def tag_params\n\t\tparams.require(:identity).permit(:name, :nature)\n\tend", "def create\n # params[:tag_id].split(\",\").each do |p|\n @tag = Tag.new(title:params[:title])\n @tag.save\n#end\n @meetup = Meetup.new(meetup_params)\n @meetup.save\n params[:tag_id].split(\",\").each do |p|\n @tagmeetup = Tagmeetup.new(tag_id:p,meetup_id:@meetup.id);\n @tagmeetup.save\n end\n respond_to do |format|\n if @meetup.save\n format.html { redirect_to @meetup, notice: 'Meetup was successfully created.' }\n format.json { render :show, status: :created, location: @meetup }\n else\n format.html { render :new }\n format.json { render json: @meetup.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:post])\n\n if params['tag_field'] != nil\n tags_array = params['tag_field'].split(\",\")\n tags_array.each do |tag|\n @post.tags << Tag.find_or_create_by_etiqueta_and_post_id(tag.strip, @post.id)\n end\n end\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, 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", "def create\r\n @tag = Tag.new(tag_params)\r\n\r\n if @tag.save\r\n render json: @tag\r\n else\r\n render json: { error: \"Tag creating error\" }, status: :unprocessable_entity\r\n end\r\n end", "def new\n @taggable = current_user.taggables.new(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taggable }\n end\n end", "def create\n @plant = Plant.find(params[:plant_id])\n tags = Tag.where(id: params[:plant_tag][:tag])\n valid_tag = true\n\n tags.each do |t|\n @plant_tag = PlantTag.new\n @plant_tag.plant = @plant\n @plant_tag.tag = t\n if !@plant_tag.save\n valid_tag = false\n end\n end\n\n if valid_tag\n redirect_to garden_path(@plant.garden)\n else\n render :new\n end\n end", "def tag_params\n params.require(:tag).permit(:name, tag_task_id: [])\n end", "def post_tag_params\n params.require(:post_tag).permit(:post_id, :tag)\n end", "def tag_params\n params.fetch(:tag, {}).permit(:name, tag_ids: [])\n end", "def update\n respond_to do |format|\n if @profile_diet_tag.update(profile_diet_tag_params)\n format.html { redirect_to @profile_diet_tag, notice: 'Profile diet tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile_diet_tag }\n else\n format.html { render :edit }\n format.json { render json: @profile_diet_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tag = Tag.new(params[:tag])\n\n respond_to do |format|\n if @tag.save\n format.html { redirect_to @tag, notice: 'Tag dodany do bazy tagów' }\n format.json { render json: @tag, status: :created, location: @tag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_tag\n @review = Review.find_by(id: params[:id])\n tag_cat = params[:tag][:category]\n tag_name = params[:tag][:name]\n\n if valid_tag(tag_cat, tag_name)\n @tag = grab_tag(tag_cat, tag_name)\n if ReviewTag.find_by(tag_id: @tag.id, review_id: @review.id).nil?\n ReviewTag.create(tag_id: @tag.id, review_id: @review.id)\n end\n end\n redirect_to '/profile'\n end", "def create\n @tags_of_novel = TagsOfNovel.new(params[:tags_of_novel])\n\n respond_to do |format|\n if @tags_of_novel.save\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully created.' }\n format.json { render json: @tags_of_novel, status: :created, location: @tags_of_novel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end", "def tag_params\n params.require(:tag).permit(:tag)\n end", "def create\n @user_tag = UserTag.new(params[:user_tag])\n\n respond_to do |format|\n if @user_tag.save\n format.html { redirect_to @user_tag, notice: 'User tag was successfully created.' }\n format.json { render json: @user_tag, status: :created, location: @user_tag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def tag_params\n params.require(:tag).permit(:tag_id, :rssi, :antenna, :last_seen_at, :funded, :member)\n end", "def create\n @posttag = Posttag.new(params[:posttag])\n\n respond_to do |format|\n if @posttag.save\n format.html { redirect_to @posttag, :notice => 'Posttag was successfully created.' }\n format.json { render :json => @posttag, :status => :created, :location => @posttag }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @posttag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def tag_params\n params.require(:tag).permit(:name, :tag_type_id)\n end", "def create\n \n # special case for multiple tags\n tags = params[\"_json\"]\n if (tags.class.name == 'Array')\n Tag.delete_all\n puts \"this is an array\"\n success = true\n @tag = nil \n tags.each do |tag_hash|\n puts \"params are going from #{tag_hash} to #{tag_in_array_params(tag_hash)}\"\n @tag = Tag.new(tag_in_array_params(tag_hash))\n success &= @tag.save \n break unless success\n end\n respond_to do |format|\n if success\n format.json { render action: 'show', status: :created, location: @tag }\n else\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n return \n else \n puts \"class is #{tags.class}\"\n end\n \n @tag = Tag.new(tag_params)\n\n respond_to do |format|\n if @tag.save\n format.html { redirect_to @tag, notice: 'Tag was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tag }\n else\n format.html { render action: 'new' }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def tagging_params\n params.require(:tagging).permit(:id, :tag_group_id, :tag_id, :person_id, :_destroy, :start_date, :end_date, :comments)\n end", "def tagging_params\n params.require(:tagging).permit(:campsite_id, :tag_id, :user_id)\n end", "def tag_params\n params.require(:tag).permit(:category, :description)\n end", "def tag_params\n params.require(:tag).permit(:id, :name, :description)\n end", "def tag_params\n params.require(:tag).permit(:post_id, :sharer,:user_id)\n end", "def tags\n @tags_with_count = Asset.tag_counts_on(:tags)\n \n @tags = @tags_with_count.map{|tag_hash| tag_hash = tag_hash.name }\n \n respond_to do |format|\n format.html\n format.json { render :json => @tags }\n end\n end", "def create\n @blog = Blog.create(blog_params)\n params[:tags][:tag_id].each do |p|\n @tagging = Tagging.create(tag_id: p.to_i, blog_id: @blog.id)\n end\n respond_to do |format|\n\n format.html { redirect_to @blog, notice: 'Blog was successfully created.' }\n format.json { render :show, status: :created, location: @blog }\n\n end\nend", "def create\n\t\tif params[:tag] \n\t\t\ttag_ids = params[:tag][:id]\n\t\tend\n\n\t\ttourist_sight_id = params[:tourist_sight_id]\n\t\t@tourist_sight = TouristSight.find(tourist_sight_id)\n\n\t\tnew_tags = []\n\t\tif tag_ids and tag_ids.length > 0\n\t\t\ttag_ids.each do |id|\n\t\t\t\tnew_tags << Tag.find(id)\n\t\t\tend\n\t\tend\n\n\t\tif @tourist_sight.save_tags(new_tags)\n\t\t\tflash[:notice] = 'Tags adicionadas com sucesso.'\n\t\telse\n\t\t\tflash[:error] = 'Falha ao adicionar tags!'\n\t\tend\n\n\t\trespond_to do |format|\n\t format.html { redirect_to(@tourist_sight) } # tourist_sights/show.html.erb\n\t\tend\n\tend", "def tag_params\r\n params.require(:tag).permit(:tag, :task_id)\r\n end", "def create\n @question = Question.new(question_params)\n @question.user_id = current_user.id\n @tags = params[:tags].split(',')\n @tagged = []\n\n\n respond_to do |format|\n if @question.save\n @activity = Activity.create(user_id: current_user.id, activity_type: 'Create', target_type: 'Question', target_id: @question.id)\n for tag in @tags\n if !tag.blank?\n @tag = Tag.where(title: tag).first\n if @tag.blank?\n @tag = Tag.create(title: tag, user_id: current_user.id)\n end\n @tagging = Tagging.create(taggable_id: @question.id, taggable_type: 'Question', tag_id: @tag.id)\n end\n end\n format.html { redirect_to \"/questions?question_id=#{@question.id}\", notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post_tag = PostTag.new(post_tag_params)\n\n respond_to do |format|\n if @post_tag.save\n format.html { redirect_to @post_tag, notice: 'Tagi lisätty' }\n format.json { render :show, status: :created, location: @post_tag }\n else\n @alert = @post_tag.errors\n format.html { render :new }\n format.json { render json: @post_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tag = Tag.new(params[:tag])\n\n respond_to do |format|\n if @tag.save\n format.html { redirect_to tags_url, :notice => 'Tag was successfully created.' }\n format.json { render :json => @tag, :status => :created, :location => @tag }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ad_tag = AdTag.new(params[:ad_tag])\n\n respond_to do |format|\n if @ad_tag.save\n format.html { redirect_to @ad_tag, notice: 'Ad tag was successfully created.' }\n format.json { render json: @ad_tag, status: :created, location: @ad_tag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ad_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def door_tag_params\n params.require(:door_tag).permit(:tag)\n end", "def create\n @tag = current_user.tags.new(tag_params)\n\n respond_to do |format|\n if @tag.save\n format.html { redirect_to @tag, notice: 'Tag was successfully created.' }\n format.json { respond_with_bip(@tag) }\n format.js {}\n else\n format.html { render :new }\n end\n end\n end", "def create\n params[:profile][:tag_list] = params[:profile][:tag_list]\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n # Store friendly profile URI\n current_user.profile_uri = getUniqueURI(current_user) \n current_user.save\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prd_tag = PrdTag.new(prd_tag_params)\n\n respond_to do |format|\n if @prd_tag.save\n format.html { redirect_to @prd_tag, notice: 'Prd tag was successfully created.' }\n format.json { render :show, status: :created, location: @prd_tag }\n else\n format.html { render :new }\n format.json { render json: @prd_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def thetag_params\n params.require(:thetag).permit(:name, :color, :is-favorite, :user_id)\n end", "def create \n @idea = Idea.new(idea_params)\n @idea.user_id = current_user.id\n @idea.save!\n if params[:idea][:tags]\n params[:idea][:tags].each do |new_tag|\n tag_title = new_tag[:title]\n tag = Tag.find_by title: tag_title\n if tag.present?\n tag.used = tag.used + 1\n tag.save!\n else\n tag = Tag.new\n tag.title = tag_title.downcase\n tag.used = 1 \n tag.save!\n end\n @idea.tags << tag\n end\n end\n Notification.generate(current_user, @idea)\n Notification.push(@idea) \n render json: @idea.to_json(include: [{user: {only: [:name, :id, :image_url]}}, {comments: {include: {user: {only: [:name, :image_url]}}}}], methods: [:voted])\n end", "def tag_params\n params.require(:tag).permit(:name, :tag_type)\n end", "def create\n @tag = Tag.new(params[:tag])\n\n respond_to do |format|\n if @tag.save\n format.html { redirect_to @tag, :notice => 'Tag was successfully created.' }\n format.json { render :json => @tag, :status => :created, :location => @tag }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(tag)\n api_client.tags.multi_add(resource_hrefs: [api_client.get_instance.href], tags: [tag])\n end", "def mytag_params\n params.require(:mytag).permit(:category)\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n\n new_tags = params[:tags].split(',')\n\n new_tags.each do |stag|\n @event.tags.create(tag: stag)\n end\n\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_new_tags\n if params[:listing][:tag_ids].present?\n params[:listing][:tag_ids].map! do |tag_id|\n if Tag.exists? tag_id\n tag_id\n else\n new_tag = Tag.create(name: tag_id.downcase)\n new_tag.id\n end\n end\n end\n end", "def create\n @tag = Tag.new(tag_params)\n respond_to do |format|\n if @tag.save\n format.html { redirect_to @tag, notice: 'Tag was successfully created.' }\n format.json { render :show, status: :created, location: @tag }\n else\n format.html { render :new }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @has_tag = HasTag.new(has_tag_params)\n\n respond_to do |format|\n if @has_tag.save\n format.html { redirect_to @has_tag, notice: 'Has tag was successfully created.' }\n format.json { render :show, status: :created, location: @has_tag }\n else\n format.html { render :new }\n format.json { render json: @has_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @poem = Poem.new(poem_params)\n @poem.user = current_user\n\n if params[:tags_id].present?\n arr = params[:tags_id].split(',')\n @poem.tags = Tag.find(arr)\n end\n\n respond_to do |format|\n if @poem.save\n format.html { redirect_to @poem, notice: 'Poem was successfully created.' }\n format.json { render :show, status: :created, location: @poem }\n else\n format.html { render :new }\n format.json { render json: @poem.errors, status: :unprocessable_entity }\n end\n end\n end", "def postEntityTag( entity_id, tag, language)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tag'] = tag\n params['language'] = language\n return doCurl(\"post\",\"/entity/tag\",params)\n end", "def create\n @tag = Tag.new(params[:tag])\n\n respond_to do |format|\n if @tag.save\n format.html { redirect_to @tag, notice: 'Tag was successfully created.' }\n format.json { render json: @tag, status: :created, location: @tag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tag = Tag.new(params[:tag])\n\n respond_to do |format|\n if @tag.save\n format.html { redirect_to :tags, notice: 'Метка успешно создана.' }\n else\n format.html { render action: 'new' }\n end\n end\n end", "def tag(taggable)\n Tagging.create :tag_id => id, :taggable => taggable\n taggings.reset\n end", "def add_tag\n url = Url.find_by(id: params[:id])\n tag = Tag.find_by(name: params[:tag])\n if tag\n ## TODO: handle tag with url in backend\n # if not url.tags.where(:tag_id => tag.id).any?\n # url.tags << tag\n # end\n url.tags << tag\n else\n tag = Tag.new(name: params[:tag])\n url.tags << tag\n end\n render json: {code: 200, tags: url.tags}\n end", "def create\n @tagging = Tagging.new(tagging_params)\n\n respond_to do |format|\n if @tagging.save\n format.html { redirect_to @tagging, notice: 'Tagging was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tagging }\n else\n format.html { render action: 'new' }\n format.json { render json: @tagging.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tag = Tag.new(tag_params)\n\n respond_to do |format|\n if @tag.save\n format.html { redirect_to @tag, notice: 'Tag was successfully created.' }\n format.json { render :show, status: :created, location: @tag }\n else\n format.html { render :new }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n tag = Tag.find_or_create_by(name: params[:tag][:name])\n if !current_user.tags.find_by(id: tag.id) # use this instead of .find(tag.id)< returns an error but .find_by returns nil and goes throgh tot eh if statement.\n Tagging.create(user_id: current_user.id, tag_id: tag.id)\n render json: tag\n end\n # this is the only way we will return a tag, if the tag doesn;t exisit.\n end", "def create\n if params[\"theme\"].eql? \"Existing Tags\"\n @temp = Tagg.find(params[:tagg][:id])\n params[:tagg][:name] = @temp.name\n end\n\n @tagg = Tagg.new(params[:tagg])\n @tagg.post_id = params[\"post_id\"]\n @post = Post.find(params[\"post_id\"])\n\n\n respond_to do |format|\n @arr = Tagg.where( \"post_id = ? AND name = ?\", params[\"post_id\"], params[:tagg][:name] )\n if @arr.empty?\n if @tagg.save\n format.html { redirect_to @post, notice: 'Tag was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tagg.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to @post, notice: 'Tag already exists.' }\n format.json { render json: @post, status: :created, location: @post }\n end\n end\n end", "def tags\n @values.fetch('tags') { \n @values['tags'] = {}\n }\n end", "def user_tag_params\n params.require(:user_tag).permit(:user_id, :tag_id)\n end", "def add_tags tags\n aux_errors = []\n tags = tags.split(\",\") if tags.instance_of? String\n tags = tags.map{|tag| tag.strip }\n tags.each do |tag_name|\n # find a tag if exists\n tag = Tag.where(:name => tag_name).first\n\n if tag.nil?\n if Tag.creatable_by? current_user\n t = Tag.new :name => tag_name, :creator => current_user\n aux_errors.push \"Tag #{tag_name} could not be saved\" unless t.save\n else\n aux_errors.push \"You don't have permission to create tag #{tag_name}\"\n end\n else\n self.tags << tag\n end\n end\n aux_errors\n end", "def gtag_params\n params.require(:gtag).permit(:tag_uid, :banned, :customer_id, :redeemed, :ticket_type_id)\n end", "def test_tagged_request_for_no_tags\n login_as(:quentin)\n post :tagged, {:tags=>nil}\n assert_response :success\n assert_nil assigns(:tag)\n assert_equal [], assigns(:selected_tags)\n assert_equal Hash[], assigns(:remove_tag_links)\n assert_equal Hash['Good'=>'Good', 'Bad'=>'Bad', 'Ugly'=>'Ugly', 'Question'=>'Question', 'Crazy sugar'=>'Crazy sugar', 'Pretty'=>'Pretty'], assigns(:add_tag_links)\n assert_equal 4, assigns(:samples).size\n end", "def update\n\n tags = params[:tags]\n @piece.taggings.destroy_all\n\n tags.downcase.split(',').each do |tag_name|\n tag = Tag.find_or_create_by(name: tag_name.strip)\n @piece.taggings.create(user_id: current_user.id, tag_id: tag.id)\n end\n\n if @piece.update(piece_params)\n redirect_to @piece, notice: 'Piece was successfully updated.'\n else\n render :edit\n end\n end", "def create\n @tags_post = TagsPost.new(tags_post_params)\n\n respond_to do |format|\n if @tags_post.save\n format.html { redirect_to @tags_post, notice: 'Tags post was successfully created.' }\n format.json { render :show, status: :created, location: @tags_post }\n else\n format.html { render :new }\n format.json { render json: @tags_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def tag\n @tag = params[:id]\n @personas = Persona.find_tagged_with(@tag,:order=>\"apepat,apemat,nombre\")\n @familias = Familia.find_tagged_with(@tag) \n @instituciones = Institucion.find_tagged_with(@tag,:order=>\"nombre\")\n @comentarios = Comentario.find_tagged_with(@tag,:order=>\"created_at desc\")\n end", "def create\n @post = Post.new(params[:post])\n@post.user=current_user\n\tcurrent_user.tag(@post, :with => params[:post][:tag_list], :on => :tags)\n\tputs @post.save\n respond_to do |format|\n if @post.save\n format.html { redirect_to(@post, :notice => 'Post was successfully created.') }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def tag_params\n params.require(:tag).permit(:tagname)\n end", "def tags_params\n params.fetch(:tag, {}).permit!\n end", "def meal_params\n params.require(:meal).permit(:address, :title, :description,\n :max_people, :date, :place, :tags, :image).tap do |meal|\n meal[:tags] = meal[:tags].split(',').map(&:strip)\n end\n end", "def tag_params\n params.require(:tag).permit(:name, :description)\n end", "def create\n @joke = Joke.new(params[:joke].except(:tags))\n str_tags = params[:joke][:tags].split(',')\n @tags = str_tags.map {|tag_name|\n Tag.find_or_create_by_name(tag_name)\n }\n @joke.user = current_user\n @joke.tags = @tags\n \n respond_to do |format|\n if @joke.save\n format.html { redirect_to @joke, :notice => 'Joke was successfully created.' }\n format.json { render :json => @joke, :status => :created, :location => @joke }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @joke.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tag = Tag.new(tag_params)\n\n respond_to do |format|\n if @tag.save\n format.html { redirect_to @tag, notice: t('.created') }\n format.json { render :show, status: :created, location: @tag }\n else\n format.html { render :new }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def activities_tags\n\t\ttags = ActivityTag.tags_for_teacher(@current_teacher_user.id)\n\n\t\trender json: {status: \"success\" , tags: tags}\n\tend", "def create\n @post = Post.new(post_params.except(:tags))\n tags = post_params[:tags].split(',')\n @post.user = current_user\n\n respond_to do |format|\n if @post.save\n @post.add_tags_with_check(tags)\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 tag_params\n params.permit(:title, :user_id)\n end", "def create\n @tag = Tag.new(tag_params)\n render json: @tag.errors unless @tag.save\n end", "def create\n #tags are sent to the controller as a string array\n #we'll create our own way to find the Tag objects\n tags = equipment_params[:tags]\n\n tags_object_collection = []\n\n tags.each do |tag|\n if tag == ''\n next\n end\n\n tag_obj = Tag.find(tag)\n\n if tag_obj != nil\n tags_object_collection.push(tag_obj)\n end\n end\n\n new_equipment_params = equipment_params.except(:tags)\n\n @equipment = Equipment.new(new_equipment_params)\n @equipment.tags = tags_object_collection\n\n respond_to do |format|\n if @equipment.save\n format.html { redirect_to equipment_index_path, notice: 'Equipment was successfully created.' }\n format.json { render json: @equipment, status: :created, location: @equipment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @equipment.errors, status: :unprocessable_entity }\n end\n end\n end", "def tag_params\n params.require(:tag).permit(:name)\n end", "def tag_params\n params.require(:tag).permit(:name, :organization_id)\n end" ]
[ "0.70521736", "0.66481566", "0.6553769", "0.6461527", "0.642987", "0.64071137", "0.6380477", "0.63663846", "0.632313", "0.63159275", "0.6286612", "0.626933", "0.61837506", "0.61769056", "0.61709404", "0.61588347", "0.6151251", "0.6146749", "0.61093503", "0.61013556", "0.6098771", "0.6084928", "0.6084906", "0.60831696", "0.6077079", "0.607637", "0.6049675", "0.60386056", "0.60384536", "0.6037574", "0.603255", "0.6023262", "0.5990358", "0.5989272", "0.59873176", "0.5973972", "0.5957522", "0.59248996", "0.5922878", "0.59164715", "0.5893027", "0.5886965", "0.58853585", "0.58689356", "0.58666044", "0.5853468", "0.58448106", "0.58418775", "0.58394676", "0.583192", "0.58188266", "0.5815875", "0.5813201", "0.58123755", "0.58062065", "0.5801953", "0.5788926", "0.57882005", "0.5783584", "0.5771185", "0.5768572", "0.5762289", "0.5762244", "0.5761489", "0.5760819", "0.5754602", "0.57515997", "0.5739931", "0.5732375", "0.57294065", "0.5728112", "0.5722259", "0.5721905", "0.5721769", "0.57165474", "0.57149667", "0.57107854", "0.5708059", "0.5706513", "0.5703266", "0.5702654", "0.5700116", "0.56986654", "0.5698037", "0.5694072", "0.5692638", "0.5687946", "0.5687893", "0.5684998", "0.56833154", "0.56751436", "0.5674465", "0.56686926", "0.5661981", "0.5654147", "0.56525344", "0.565138", "0.56509584", "0.5649159", "0.5648921" ]
0.73827595
0
PATCH/PUT /profile_diet_tags/1 PATCH/PUT /profile_diet_tags/1.json
def update respond_to do |format| if @profile_diet_tag.update(profile_diet_tag_params) format.html { redirect_to @profile_diet_tag, notice: 'Profile diet tag was successfully updated.' } format.json { render :show, status: :ok, location: @profile_diet_tag } else format.html { render :edit } format.json { render json: @profile_diet_tag.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n begin\n entity = Tagger::EntityTag.create_entity_tags(params)\n render json: { \"#{Tagger.tagged_resource}\": entity, tags: entity.tags }, status: 201\n rescue Exception => e\n render json: { error: \"Unprocessable entity\" }, status: 422\n end\n end", "def update\n if @tag.update(tag_params)\n render json: @tag\n else\n render json: @tag.errors, status: :unprocessable_entity\n end\n end", "def update\n @taggable = current_user.taggables.find(params[:id])\n\n respond_to do |format|\n logger.debug(params)\n if @taggable.update_attributes(params[:taggable])\n format.html { redirect_to @taggable, notice: 'Taggable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taggable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tag_profile\n # body = {\n # cmd: \"update_tag_profile\"\n # }\n\n end", "def update\n render json: @tag.errors unless @tag.update(tag_params)\n end", "def update\n # creates tag objects for photos\n tag_array = tag_params['tags'].split(',').each do |x|\n x.strip!\n end\n tag_array.each do |x| \n if Tag.find_by(name: x)\n @tag = Tag.find_by(name: x)\n else\n @tag = Tag.create(name: x)\n end\n Tagging.create(photo_id: @photo.id, tag_id: @tag.id)\n end\n\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\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\n update_and_respond(@tag, tag_params)\n end", "def update\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n if @tags_of_novel.update_attributes(params[:tags_of_novel])\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @expert_tag.update_attributes(:tag_name => params[:tag_name], :user_id => params[:user_id])\n format.html { redirect_to @expert_tag, notice: 'Expert tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @expert_tag }\n else\n format.html { render :edit }\n format.json { render json: @expert_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @diet = @profile.diets.find(params[:id])\n\n if @diet.update_attributes(params[:diet])\n redirect_to profile_diets_url, notice: 'Diet was successfully updated.'\n else\n render json: @diet.errors, status: :unprocessable_entity\n end\n end", "def update\n @user_tag = UserTag.find(params[:id])\n\n respond_to do |format|\n if @user_tag.update_attributes(params[:user_tag])\n format.html { redirect_to @user_tag, notice: 'User tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @api_tag = Api::Tag.find(params[:id])\n\n respond_to do |format|\n if @api_tag.update_attributes(params[:api_tag])\n format.html { redirect_to @api_tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to tags_url, :notice => 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tag = Tag.find(params[:id])\n \n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n body[\"tag\"]\n end", "def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, :notice => 'Tag was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @task.tags.each { |t| t.delete}\n\n respond_to do |format|\n if @task.update(task_params)\n create_multiple_tags(task_params[\"tag\"], @task.id)\n\n format.html { redirect_to @task.list, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tag = Tag.find(params[:id])\n\n if @tag.update_attributes(params[:tag])\n render json: JSON.parse(@tag.to_json)\n else\n render json: JSON.parse(@tag.errors.to_json)\n end\n end", "def update\n @tag = Tag.find(params[:id])\n respond_to do |format|\n if @tag.update(tag_params)\n format.json { render :show, status: :ok, location: @tag }\n else\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tag_one.update(tag_one_params)\n format.html { redirect_to @tag_one, notice: 'Tag one was successfully updated.' }\n format.json { render :show, status: :ok, location: @tag_one }\n else\n format.html { render :edit }\n format.json { render json: @tag_one.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @has_tag.update(has_tag_params)\n format.html { redirect_to @has_tag, notice: 'Has tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @has_tag }\n else\n format.html { render :edit }\n format.json { render json: @has_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n current_user.tag(@post, :with => params[:post][:tag_list], :on => :tags)\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(@post, :notice => 'Post was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # @post.delete_all_tags\n # @post.tag(post_params[:tags], current_user) if post_params[:tags]\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:post][:tag_ids] ||= []\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to [@post.user, @post], notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @user\n @user.tag_list.add @tags\n if @user.save\n render :json => @user.reload.tags\n else\n error!(:invalid_resource, @user.errors, \"Tags have not been saved\")\n end\n end", "def update\n @joke = Joke.find(params[:id])\n\n respond_to do |format|\n str_tags = params[:joke][:tags].split(',')\n @tags = str_tags.map {|tag_name|\n Tag.find_or_create_by_name(tag_name)\n }\n @joke.tags = @tags\n \n if @joke.update_attributes(params[:joke].except(:tags))\n format.html { redirect_to @joke, :notice => 'Joke was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @joke.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag editada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @photo_tag.update(photo_tag_params)\n format.html { redirect_to @photo_tag, notice: 'Photo tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo_tag }\n else\n format.html { render :edit }\n format.json { render json: @photo_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @posttag = Posttag.find(params[:id])\n\n respond_to do |format|\n if @posttag.update_attributes(params[:posttag])\n format.html { redirect_to @posttag, :notice => 'Posttag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @posttag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n get_status\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @entity_tag = EntityTag.find(params[:id])\n\n respond_to do |format|\n if @entity_tag.update_attributes(params[:entity_tag])\n format.html { redirect_to @entity_tag, notice: 'Entity tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entity_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag zaktualizowany' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: t('.updated') }\n format.json { render :show, status: :ok, location: @tag }\n else\n format.html { render :edit }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_profile_diet_tag\n @profile_diet_tag = ProfileDietTag.find(params[:id])\n end", "def update\n @tagg = Tagg.find(params[:id])\n\n respond_to do |format|\n if @tagg.update_attributes(params[:tagg])\n format.html { redirect_to @tagg, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tagg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @tag }\n else\n format.html { render :edit }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @tag }\n else\n format.html { render :edit }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @tag }\n else\n format.html { render :edit }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n tag = Tag.find_by_id(params[:id])\n if tag.update(params.permit(:name))\n render json: tag, status: :ok\n else\n respond_with tag.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @tagging.update(tagging_params)\n format.html { redirect_to @tagging, notice: 'Tagging was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tagging.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tagging = @object\n tag = @tagging.tag\n return unless filter_perms(@auth,tag,['updater'])\n taggable = @tagging.taggable\n return unless filter_perms(@auth,taggable,['updater'])\n\n respond_to do |format|\n if @tagging.update_attributes(params[:tagging])\n flash[:notice] = 'Tagging was successfully updated.'\n format.html { redirect_to tagging_url(@tagging) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tagging.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tag = Tag.find(params[:id])\n @tag.attributes = params[:tag]\n set_user_column @tag\n\n respond_to do |format|\n begin\n @tag.save!\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n rescue ActiveRecord::RecordInvalid\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_follow_tag = UserFollowTag.find(params[:id])\n\n respond_to do |format|\n if @user_follow_tag.update_attributes(params[:user_follow_tag])\n format.html { redirect_to @user_follow_tag, notice: 'User follow tag was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_follow_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n real_post_path = @tag.post\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to post_path(real_post_path), notice: 'updated tag' }\n format.json { render :show, status: :ok, location: @tag }\n else\n format.html { render :edit }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ad_tag = AdTag.find(params[:id])\n\n respond_to do |format|\n if @ad_tag.update_attributes(params[:ad_tag])\n format.html { redirect_to @ad_tag, notice: 'Ad tag was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ad_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(options: {}, **data)\n\n refresh_with(parse(client.put(\"/tags/#{gid}\", body: data, options: options)).first)\n end", "def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to tag_success_path, notice: \"Tag was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tag }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @experience = current_user.experiences.find(params[:id])\n respond_to do |format|\n if @experience.update_attributes(params[:experience])\n current_user.tag(@experience, :with => @experience.tag_list.to_s, :on => :tags)\n\n flash[:notice] = I18n.t('action.update_successfully')\n format.html { \n redirect_to user_home_path(current_user) \n }\n format.xml { head :ok }\n else\n flash[:error] = I18n.t('action.update_fail')\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @experience.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize @organization\n @organization.tag_list.add @tags\n if @organization.save\n render :json => @organization.reload.tags\n else\n error!(:invalid_resource, @organization.errors, \"Tags have not been saved\")\n end\n end", "def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @tag }\n else\n format.html { render :edit }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n if photo_authorize(@photo)\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n taggable_guests = [groom, bride]\n\n taggable_guests.each do |taggable_guest|\n if params.has_key?(:taglist) and params[:taglist][taggable_guest.id.to_s] == \"true\" \n @photo.guests << taggable_guest unless @photo.guests.include?(taggable_guest)\n else\n @photo.guests.delete(taggable_guest) if @photo.guests.include?(taggable_guest)\n end\n end\n format.html { redirect_to photos_path, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to :tags, notice: 'Метка успешно обновлена.' }\n else\n format.html { render action: 'edit' }\n end\n end\n end", "def update\n authorize @ticket\n @ticket.tag_list.add @tags\n if @ticket.save\n render :json => @ticket.reload.tags\n else\n error!(:invalid_resource, @ticket.errors, \"Tags have not been saved\")\n end\n end", "def update\n if @app && @tag\n @tag.update(tag_params)\n if @tag.valid?\n head :no_content\n else\n head :bad_request\n end\n else\n head :not_found\n end\n end", "def update\n\n if params[:tags_id].present?\n arr = params[:tags_id].split(',')\n @poem.tags = Tag.find(arr)\n end\n\n respond_to do |format|\n if @poem.update(poem_params)\n format.html { redirect_to @poem, notice: 'Poem was successfully updated.' }\n format.json { render :show, status: :ok, location: @poem }\n else\n format.html { render :edit }\n format.json { render json: @poem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @climb_tag.update(climb_tag_params)\n format.html { redirect_to @climb_tag, notice: 'Climb tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @climb_tag }\n else\n format.html { render :edit }\n format.json { render json: @climb_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @answer_tag.update(answer_tag_params)\n format.html { redirect_to @answer_tag, notice: 'Answer tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @answer_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity_tag = ActivityTag.find(params[:id])\n\n respond_to do |format|\n if @activity_tag.update_attributes(params[:activity_tag])\n format.html { redirect_to @activity_tag, notice: 'Activity tag was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n tags = params[:tags]\n @piece.taggings.destroy_all\n\n tags.downcase.split(',').each do |tag_name|\n tag = Tag.find_or_create_by(name: tag_name.strip)\n @piece.taggings.create(user_id: current_user.id, tag_id: tag.id)\n end\n\n if @piece.update(piece_params)\n redirect_to @piece, notice: 'Piece was successfully updated.'\n else\n render :edit\n end\n end", "def update\n @tagged_item = TaggedItem.find(params[:id])\n\n respond_to do |format|\n if @tagged_item.update_attributes(params[:tagged_item])\n format.html { redirect_to tagged_items_url, notice: 'Tagged item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tagged_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n @tagarr = params[:post][\"tags_attributes\"][\"0\"][:name].split(\" \")\n puts @tagarr\n @tag = {}\n @tagarr.each_with_index do |tag,i|\n @tag[i] = {:name =>tag}\n end\n\n @tagreset = params[:post]\n @tagreset[\"tags_attributes\"] ={}\n @tagreset[\"tags_attributes\"] = @tag\n @post.tags=[]\n #puts @tagreset\n #render :layout => false\n respond_to do |format|\n if @post.update_attributes(@tagreset)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question_tag = QuestionTag.find(params[:id])\n\n respond_to do |format|\n if @question_tag.update_attributes(params[:question_tag])\n format.html { redirect_to @question_tag, notice: 'Question tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prd_tag.update(prd_tag_params)\n format.html { redirect_to @prd_tag, notice: 'Prd tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @prd_tag }\n else\n format.html { render :edit }\n format.json { render json: @prd_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n tags = equipment_params[:tags]\n\n tags_object_collection = []\n\n tags.each do |tag|\n if tag == ''\n next\n end\n\n tag_obj = Tag.find(tag)\n\n if tag_obj != nil\n tags_object_collection.push(tag_obj)\n end\n end\n\n new_equipment_params = equipment_params.except(:tags)\n\n @equipment = Equipment.find(params[:id])\n @equipment.tags = tags_object_collection\n\n respond_to do |format|\n if @equipment.update_attributes(new_equipment_params)\n format.html { redirect_to equipment_index_path, notice: 'Equipment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @equipment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tag = Tag.find params[:id]\n if !@tag.admin.nil? && @tag.admin != current_user\n render json: { error: '403 requested operation not permitted' }, status: 403\n elsif @tag.update tag_params\n render :show, status: 200\n else\n render json: { error: '422 unprocessable entity' }, status: 422\n end\n end", "def update\n respond_to do |format|\n if @tag_relationship.update(tag_relationship_params)\n format.html { redirect_to @tag_relationship, notice: 'Tag relationship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tag_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instance_eni_tag.update(instance_eni_tag_params)\n format.html { redirect_to @instance_eni_tag, notice: 'Instance eni tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @instance_eni_tag }\n else\n format.html { render :edit }\n format.json { render json: @instance_eni_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @thetag.update(thetag_params)\n format.html { redirect_to @thetag, notice: 'Thetag was successfully updated.' }\n format.json { render :show, status: :ok, location: @thetag }\n else\n format.html { render :edit }\n format.json { render json: @thetag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n #@recipe.ingredients = params[:recipe_ingredients].map {|k, v|\n #ingredient = @recipe.ingredients.find(k) || @recipe.ingredients.build\n #ingredient.update_attributes(:item => Food.find(v[:item_id]), :quantity => v[:quantity]) unless v[:item_id].blank?\n #ingredient\n #}.compact if params[:ingredients]\n\n @recipe.tags = params[:tags].split(/,/).map { |t|\n Tag.find_or_create_by_name(t.strip.downcase)\n }.compact if params[:tags]\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @events_tag = EventsTag.find(params[:id])\n\n respond_to do |format|\n if @events_tag.update_attributes(params[:events_tag])\n format.html { redirect_to @events_tag, notice: 'Events tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @events_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tag_tag = TagTag.find(params[:id])\n\n respond_to do |format|\n if @tag_tag.update_attributes(params[:tag_tag])\n format.html { redirect_to(@tag_tag, :notice => 'Tag tag was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tag_tag.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tag_identity = Identity.find(params[:id])\n\n respond_to do |format|\n if @tag_identity.update_attributes(params[:identity])\n format.html { redirect_to @tag_identity, notice: 'Identity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag_identity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mytag.update(mytag_params)\n format.html { redirect_to root_path, info: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @mytag }\n else\n format.html { render :edit }\n format.json { render json: @mytag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tags = params[:tags].split(',')\n @tagged = []\n for prev in Tagging.where(taggable_id: @profile.user.id, taggable_type: 'User')\n prev.destroy\n end\n @caller = params[:profile][:caller]\n @profile = current_user.profile\n if !params[:ja_birth_yyyy].blank?\n @profile.birthdate = JalaliDate.to_gregorian(params[:ja_birth_yyyy],params[:ja_birth_mm],params[:ja_birth_dd])\n end\n respond_to do |format|\n if @profile.update(profile_params)\n for tag in @tags\n if !tag.blank?\n @tag = Tag.where(title: tag).first\n if @tag.blank?\n @tag = Tag.create(title: tag, user_id: current_user.id)\n end\n @tagging = Tagging.where(taggable_id: @profile.user.id, taggable_type: 'User', tag_id: @tag.id).first\n if @tagging.blank?\n @tagging = Tagging.create(taggable_id: @profile.user.id, taggable_type: 'User', tag_id: @tag.id)\n end\n end\n end\n if params[:caller] == 'reg'\n format.html { redirect_to '/registeration_steps?step=2&name='}\n else\n if params[:profile][:avatar].blank?\n format.html { redirect_to '/profiles?profile_id='+@profile.id.to_s, notice: :Profile_was_successfully_updated }\n else\n format.html { redirect_to '/profiles/cropper/'+@profile.id.to_s}\n end\n end\n format.json { render action: 'crop' }\n if @profile.cropping?\n format.js { render action: 'crop', :locals => {:caller => @caller, :id => @profile.id} }\n else\n format.js { render action: 'update' }\n end\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n tag = @user.tags.find_by_tid(params[:id])\n if tag.nil?\n render json_status_response(404, \"Tag not found\")\n return\n end\n\n if not tag.update_attributes(params[:location])\n render json_status_response(400, \"Could not update tag location\")\n return\n end\n\n render json_status_response(200, \"Successfully updated tag\")\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n \t# update tags\n \t@question.tag_with(params[:question][:tag_list])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @tagihan.update(tagihan_params)\n render json: @tagihan\n else\n render json: @tagihan.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @tag_ref.update(tag_ref_params)\n format.html { redirect_to @tag_ref, notice: 'Zmodyfikowano Tag.' }\n format.json { render :show, status: :ok, location: @tag_ref }\n else\n format.html { render :edit }\n format.json { render json: @tag_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@post = process_tags(@post)\n @post.save\n\n respond_to do |format|\n if @post.update(post_params.except(:tags))\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post_tag.update(post_tag_params)\n format.html { redirect_to @post_tag, notice: 'Tagia muokattu' }\n format.json { render :show, status: :ok, location: @post_tag }\n else\n @alert = @post_tag.errors\n format.html { render :edit }\n format.json { render json: @post_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_conversation_tags(id, tags)\n data = { tags: tags }\n put(\"conversations/#{id}/tags\", { body: data })\n end", "def update\n respond_to do |format|\n if @temporary_tag.update(temporary_tag_params)\n format.html { redirect_to @temporary_tag, notice: 'Temporary tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @temporary_tag }\n else\n format.html { render :edit }\n format.json { render json: @temporary_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(:id)\n @tag_list = configure_account_update_params[:tag_name].split(nil)\n if @user.update_attributes(configure_account_update_params)\n @user.save_tags(@tag_list)\n render json: {status: :success}\n end\n end", "def update!(**args)\n @tags = args[:tags] if args.key?(:tags)\n end", "def update!(**args)\n @tags = args[:tags] if args.key?(:tags)\n end", "def update\n @tag = Tag.find(params[:id])\n @tag.update_attributes(params[:tag])\n respond_to do |format|\n format.js\n end\n end", "def update\n respond_to do |format|\n if @image_tag.update(image_tag_params)\n format.html { redirect_to @image_tag, notice: 'Image tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @image_tag }\n else\n format.html { render :edit }\n format.json { render json: @image_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n set_tags\n\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\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\n @image_tags = ActsAsTaggableOn::Tag.all\n\n tag_list = params[:image][:tag_list]\n @image.tag_list = tag_list.keys.select{|t| tag_list[t] == \"1\"}\n\n\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: \"Image was successfully updated.\" }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @promotion_tag.update(promotion_tag_params)\n format.html { redirect_to @promotion_tag, notice: 'Promotion tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @promotion_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game_tag.update(game_tag_params)\n format.html { redirect_to @game_tag, notice: 'Game tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_tag }\n else\n format.html { render :edit }\n format.json { render json: @game_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respondent = SurveyRespondent.find(params[:respondent_id])\n tag_context = params[:context] # tag context\n tag_list = params[:tags] # comma seperated list of tags\n\n if getTagOwner\n getTagOwner.tag(respondent, :with => tag_list, :on => tag_context)\n else\n respondent.set_tag_list_on(tag_context, tag_list) # set the tag list on the respondent for the context\n end\n \n respondent.save\n \n render :layout => 'content'\n end", "def update\n respond_to do |format|\n if @alternative_tag_name.update(alternative_tag_name_params)\n format.html { redirect_to @alternative_tag_name, notice: \"Alternative tag name was successfully updated.\" }\n format.json { render :show, status: :ok, location: @alternative_tag_name }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @alternative_tag_name.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @taggable.update_attributes(params[:taggable])\n flash[:notice] = t('successfully_updated_taggable')\n format.html { redirect_to(@taggable) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @taggable.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_tag.update(admin_tag_params)\n format.html { redirect_to admin_tags_path, notice: 'Tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_tag }\n else\n format.html { render :edit }\n format.json { render json: @admin_tag.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6664996", "0.6643254", "0.66188973", "0.65276206", "0.649324", "0.6489285", "0.64805245", "0.6435596", "0.6403571", "0.6397", "0.63879144", "0.6385376", "0.6372976", "0.6372242", "0.63689464", "0.63621056", "0.632354", "0.63157797", "0.6311971", "0.6301702", "0.62908125", "0.62908125", "0.6287152", "0.6286131", "0.627933", "0.62771404", "0.6276225", "0.62675846", "0.62642384", "0.6259952", "0.62458646", "0.6232964", "0.6231866", "0.621407", "0.6199135", "0.6176248", "0.6176248", "0.6171069", "0.61639524", "0.61519545", "0.6145203", "0.6145203", "0.6145203", "0.6130322", "0.61142987", "0.6108501", "0.61062235", "0.60964805", "0.609296", "0.6083601", "0.6075347", "0.6058284", "0.6056129", "0.6049654", "0.6048009", "0.6037728", "0.6025172", "0.6023094", "0.6021133", "0.601858", "0.60089", "0.60050255", "0.59955096", "0.59845465", "0.59784234", "0.5976457", "0.5972697", "0.5969941", "0.596761", "0.5965327", "0.59606206", "0.5953099", "0.5947559", "0.5945255", "0.59445673", "0.5944328", "0.5940325", "0.5938248", "0.5935959", "0.593097", "0.5925413", "0.5916223", "0.59158695", "0.5904922", "0.5902488", "0.5895471", "0.5892685", "0.5884449", "0.58794624", "0.58794624", "0.587836", "0.5876851", "0.5867728", "0.58656037", "0.58614904", "0.5860593", "0.58565366", "0.5856234", "0.5854377", "0.5854077" ]
0.71593434
0
DELETE /profile_diet_tags/1 DELETE /profile_diet_tags/1.json
def destroy @profile_diet_tag.destroy respond_to do |format| format.html { redirect_to profile_diet_tags_url, notice: 'Profile diet tag was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tag tag\n delete \"tag/#{tag}\"\n end", "def destroy\n @taggable = current_user.taggables.find(params[:id])\n\n #destroy each tag in the taggable\n @taggable.tags.each do |tag|\n tag.destroy\n end\n\n @taggable.destroy\n\n respond_to do |format|\n format.html { redirect_to taggables_url }\n format.json { head :no_content }\n end\n end", "def delete(tag)\n api_client.tags.multi_delete(resource_hrefs: [api_client.get_instance.href], tags: [tag])\n end", "def destroy\n tag = @user.tags.find_by_tid(params[:id])\n if tag.nil?\n render json_status_response(404, \"Tag not found\")\n return\n end\n\n tag.destroy\n render json_status_response(200, \"Tag removed successfully\")\n end", "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n render json: JSON.parse({msg:\"success\"}.to_json)\n end", "def destroy\n begin\n breed = Tagger.tagged_klass.constantize.find(params[:id])\n breed.destroy\n render json: { message: \"Deleted successfully\" }\n rescue Exception => e\n render json: { error: \"Unprocessable entity\" }, status: 422\n end\n end", "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n \n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n\n end", "def delete()\n\n client.delete(\"/tags/#{gid}\") && true\n end", "def destroy\n @tags_of_novel = TagsOfNovel.find(params[:id])\n @tags_of_novel.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_of_novels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tagging = Tagging.find(params[:id])\n @tagging.destroy\n\n respond_to do |format|\n format.html { redirect_to taggings_url }\n format.json { head :ok }\n end\n end", "def destroy\n # @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n get_status\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tagging.destroy\n respond_to do |format|\n format.html { redirect_to taggings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n tag = tag.find(params[:id])\n\n if tag.destroy\n render json: {\"message\": \"Record was deleted\", status: :ok, }, status: :ok\n else\n render json: {\"message\": \"You are not authorized to delete this tag\"}, status: :unauthorized\n end\n end", "def destroy\n @tag_identity = Identity.find(params[:id])\n @tag_identity.destroy\n\n respond_to do |format|\n format.html { redirect_to tag_identities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ad_tag = AdTag.find(params[:id])\n @ad_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to ad_tags_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tag = Tag.find(params[:id])\n respond_to do |format|\n if @tag.destroy\n format.json { render json: {:id => @tag.id}, status: :ok }\n else\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @tag_one.destroy\n respond_to do |format|\n format.html { redirect_to tag_ones_url, notice: 'Tag one was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_follow_tag = UserFollowTag.find(params[:id])\n @user_follow_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to user_follow_tags_url }\n format.json { head :ok }\n end\n end", "def destroy\n @posttag = Posttag.find(params[:id])\n @posttag.destroy\n\n respond_to do |format|\n format.html { redirect_to posttags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n end", "def destroy\n @api_tag = Api::Tag.find(params[:id])\n @api_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to api_tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tagg = Tagg.find(params[:id])\n @tagg.destroy\n\n respond_to do |format|\n format.html { redirect_to taggs_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityTag( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/tag\",params)\n end", "def destroy\n @tag = Tag.find(params[:id])\n\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_tag = UserTag.find(params[:id])\n @user_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to user_tags_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @tag = Tag.find(params[:id])\n @tag.deleted = 9\n set_user_column @tag\n @tag.save!\n \n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n\n end", "def destroy\n @tag.destroy\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tag_collection = TagCollection.find(params[:id])\n @tag_collection.destroy\n render json: {}\n \n end", "def destroy\n @tagged_item = TaggedItem.find(params[:id])\n @tagged_item.destroy\n\n respond_to do |format|\n format.html { redirect_to all_items_tagged_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @skill_tag = SkillTag.find(params[:id])\n @skill_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to skill_tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo_tag.destroy\n respond_to do |format|\n format.html { redirect_to photo_tags_url, notice: 'Photo tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @diet.destroy\n head :no_content, status: 200\n else\n render json: @diet.errors, status: 405\n end\n end", "def destroy\n BuzzTag.where(:buzz_id => params[:buzz_id], :tag_id => params[:tag_id]).first.destroy\n end", "def destroy\n @post_tag.destroy\n respond_to do |format|\n format.html { redirect_to post_tags_url, notice: 'Tagi poistettu' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_tag = ActivityTag.find(params[:id])\n @activity_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_tags_url }\n format.json { head :ok }\n end\n end", "def remove_tag\n @kyu_entry.tag_list.remove(params[:tag])\n @kyu_entry.save\n render json: true\n end", "def destroy\n\n if @diet.nil?\n send_error_json(nil, \"Failed to delete\", 400)\n return\n end\n\n if @diet.destroy\n send_success_json(@diet.id, { diet_name: @diet.diet_name})\n else\n send_error_json(@diet.id, \"Delete error\", 400)\n end\n\n end", "def destroy\n # If given metadata_id ==> detach tag\n if params[:metadata_id]\n tag = current_user.detach_tag params[:metadata_id], params[:id]\n # Otherwise ==> delete tag\n else\n tag = current_user.delete_tag params[:id]\n end\n _respond_tag_request tag \n end", "def delete\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(tags_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n pet = @user.pets.find(params[:id])\n pet.destroy\n render json: pet\n end", "def destroy\n @tag_relationship.destroy\n respond_to do |format|\n format.html { redirect_to tag_relationships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asset_tag = AssetTag.find(params[:id])\n @asset_tag.destroy\n render json: {}\n \n end", "def destroy\n @tag_pro_profile.destroy\n respond_with(@tag_pro_profile, location: root_url)\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @person.skills.delete_all\n \n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = @tagging.person\n if @tagging.destroy\n flash[:notice] = 'Tag was successfully destroyed forever'\n else\n flash[:alert] = 'Tag could not be destroyed'\n end\n respond_to do |format|\n format.html { redirect_to person_path(@person) }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @user\n @tags = @user.tag_list if @tags.empty?\n @user.tag_list.remove @tags\n if @user.save\n render :json => @user.reload.tags\n else\n error!(:invalid_resource, @user.errors, \"Tags have not been saved\")\n end\n end", "def delete\n @tag.destroy\n redirect_to(tags_url)\n end", "def destroy\n @tagging = Tagging.find(params[:id])\n @tagging.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_taggings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @petprofile.destroy\n respond_to do |format|\n format.html { redirect_to petprofiles_url, notice: 'Petprofile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n real_post_path = @tag.post\n @tag.destroy\n respond_to do |format|\n format.html { redirect_to post_path(real_post_path), notice: 'tag deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n tag_following = current_user.tag_followings.find_by_tag_id( params['id'] )\n \n if tag_following && tag_following.destroy\n respond_to do |format|\n format.any(:js, :json) { render :nothing => true, :status => 204 }\n end\n else\n respond_to do |format|\n format.any(:js, :json) {render :nothing => true, :status => 403}\n end\n end\n end", "def destroy\n @vet_profile.destroy\n respond_to do |format|\n format.html { redirect_to vet_profiles_url, notice: 'Vet profile was successfully removed.' }\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 @tag_ref.destroy\n respond_to do |format|\n format.html { redirect_to tag_refs_url, notice: 'Usunięto Tag z artykułu.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @alternative_tag_name.destroy\n respond_to do |format|\n format.html { redirect_to alternative_tag_names_url, notice: \"Alternative tag name was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\tflash[:error] = @tag.errors[:base]\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @hastags = Hastag.where(:photo_id => @photo.id)\n @hastags.destroy_all\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to '/home', notice: 'You have deleted the picture' }\n format.json { head :no_content }\n end\n end", "def delete\n resource.delete_tags([self])\n nil\n end", "def destroy\n @prd_tag.destroy\n respond_to do |format|\n format.html { redirect_to prd_tags_url, notice: 'Prd tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def pet_delete(pet)\n @db.delete(\"pets\", pet[\"id\"])\n end", "def destroy\n @taggable.destroy\n\n respond_to do |format|\n format.html { redirect_to(taggables_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @has_tag.destroy\n respond_to do |format|\n format.html { redirect_to has_tags_url, notice: 'Has tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tagging = Tagging.find(params[:id])\n @tagging.destroy\n\n respond_to do |format|\n format.html { redirect_to(taggings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @climb_tag.destroy\n respond_to do |format|\n format.html { redirect_to climb_tags_url, notice: 'Climb tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommend_recommend_tag = Recommend::RecommendTag.find(params[:id])\n @recommend_recommend_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to recommend_recommend_tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to badges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer_tag.destroy\n respond_to do |format|\n format.html { redirect_to answer_tags_url }\n format.json { head :no_content }\n end\n end", "def delete\n super \"/templates/#{template_id}.json\", {}\n end", "def destroy\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_path, success: I18n.t(\"admin.flash.tags.success.destroy\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @bookmark_tag = BookmarkTag.find(params[:id])\n @bookmark_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to bookmark_tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @thetag.destroy\n respond_to do |format|\n format.html { redirect_to thetags_url, notice: 'Thetag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instance_eni_tag.destroy\n respond_to do |format|\n format.html { redirect_to instance_eni_tags_url, notice: 'Instance eni tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tagging = Tagging.find(params[:id])\n @tagging.destroy\n\n respond_to do |format|\n format.html { redirect_to(tagging_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mytag.destroy\n respond_to do |format|\n format.html { redirect_to root_path, danger: 'Category was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end", "def destroy\n @tag_relation.destroy\n respond_to do |format|\n format.html { redirect_to tag_relations_url, notice: 'Tag relation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo_tag_reference.destroy\n respond_to do |format|\n format.html { redirect_to photo_tag_references_url, notice: 'Photo tag reference was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_tags(name); end", "def destroy\n @admin_album_tag.destroy\n respond_to do |format|\n format.html { redirect_to admin_album_tags_url, notice: \"#{t 'activerecord.successful.messages.album_tag_deleted'}\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @promotion_tag.destroy\n respond_to do |format|\n format.html { redirect_to promotion_tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tagihan.destroy\n respond_to do |format|\n format.html { redirect_to tagihans_url, notice: 'Tagihan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense_tag = ExpenseTag.find(params[:id])\n @expense_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(expense_tags_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @diet.destroy\n respond_to do |format|\n format.html { redirect_to diets_url, notice: 'Diet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recommend_recommend_ptag = Recommend::RecommendPtag.find(params[:id])\n @recommend_recommend_ptag.destroy\n\n respond_to do |format|\n format.html { redirect_to recommend_recommend_ptags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @diet_ingredient_type.destroy\n respond_to do |format|\n format.html { redirect_to diet_ingredient_types_url, notice: 'Diet ingredient type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_tag = QuestionTag.find(params[:id])\n @question_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to question_tags_url }\n format.json { head :no_content }\n end\n end", "def remove_tag\n \n success = false\n message = \"\"\n \n # Only the owner of the photo, or the tagged person are allowed to remove the tag\n if @user.id == @face.photo.user_id || @user.id == @face.user_id\n \n # Remove tag\n @face.remove_tag\n \n # Action was a success\n success = true\n \n # Notice message\n message = \"Tag was successfully removed\"\n \n end\n \n flash[:notice] = message\n \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { render :json => { :success => success, :message => message } }\n end\n \n end", "def destroy\n @events_tag = EventsTag.find(params[:id])\n @events_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to events_tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tag.destroy\n head :no_content\n end", "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(tags_url(parent: @parent_tag)) }\n format.json { head :ok }\n end\n end", "def destroy\n @tag.destroy\n respond_to do |format|\n format.html { redirect_to tags_url, notice: 'Tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tag.destroy\n respond_to do |format|\n format.html { redirect_to tags_url, notice: 'Tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to :tags, notice: 'Метка успешно удалена.' }\n end\n end" ]
[ "0.69575983", "0.6917325", "0.68746173", "0.68551624", "0.68442327", "0.6834783", "0.6800929", "0.67851555", "0.6774468", "0.6736361", "0.67280346", "0.6727677", "0.67258817", "0.6720031", "0.6709845", "0.6705972", "0.66859263", "0.6683117", "0.6679981", "0.66774035", "0.6661515", "0.6661515", "0.6661515", "0.66606504", "0.66600215", "0.6651333", "0.6625403", "0.66013056", "0.6570435", "0.6553905", "0.6549281", "0.65490055", "0.65470046", "0.65448344", "0.6518234", "0.6516488", "0.65132916", "0.65122074", "0.6500267", "0.6496243", "0.6494851", "0.6490439", "0.64876807", "0.6485582", "0.6484856", "0.64712065", "0.64694047", "0.6437205", "0.6430479", "0.64294195", "0.6418729", "0.64178216", "0.64161223", "0.64042795", "0.640373", "0.63962847", "0.63956404", "0.6395556", "0.6388615", "0.6382142", "0.6381639", "0.63755286", "0.6367705", "0.63585967", "0.6356536", "0.6355874", "0.6354875", "0.6347421", "0.6346474", "0.6345888", "0.63440967", "0.6343443", "0.63404006", "0.63324285", "0.6331544", "0.6329956", "0.632907", "0.63286567", "0.6318909", "0.6317278", "0.63167924", "0.6316559", "0.6309574", "0.6304229", "0.63036776", "0.63012344", "0.62977684", "0.62956697", "0.6291192", "0.6289049", "0.6285577", "0.62839526", "0.6283877", "0.6282004", "0.6278967", "0.62717056", "0.62707543", "0.6263753", "0.6263753", "0.62582576" ]
0.7578931
0
Use callbacks to share common setup or constraints between actions.
def set_profile_diet_tag @profile_diet_tag = ProfileDietTag.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 profile_diet_tag_params params[:profile_diet_tag] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_account @account = Account.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 account_params params.require(:account).permit(:email, :encrypted_password, :salt, :last_sync_at) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
before_filter :update_last_seen_at, :only => :show
def index respond_to do |format| format.html { redirect_to forum_path(params[:forum_id]) } format.xml do @topics = Topic.find_all_by_forum_id(params[:forum_id], :order => 'sticky desc, replied_at desc', :limit => 25) render :xml => @topics.to_xml end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end", "def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end", "def viewed_at\n updated_at\n end", "def show\n @user = User.find(params[:id])\n fresh_when :last_modified => @user.updated_at.utc, :etag => @user\n end", "def last_seen_at() ; info_time(:last_seen) ; end", "def last_updates_viewed\n self.user.extend(Montage::User).last_login\n end", "def just_saw\n\t\t\t@last_seen = Time.now\n\t\tend", "def set_default_last_seen\n self.last_seen = created_at || Time.current\n end", "def authorize\n redirect_to login_path and return unless current_user\n @current_user.touch(:seen_at)\n end", "def stamp\n self.dateChanged = Time.now\n self.changedBy = ApplicationController.application_name\n end", "def stamp\n self.dateChanged = Time.now\n self.changedBy = ApplicationController.application_name\n end", "def stamp\n self.dateChanged = Time.now\n self.changedBy = ApplicationController.application_name\n end", "def update_last_seen_at\n puts \"\", \"Updating last seen at on users\"\n\n DB.exec(\"UPDATE users SET last_seen_at = created_at WHERE last_seen_at IS NULL\")\n DB.exec(\"UPDATE users SET last_seen_at = last_posted_at WHERE last_posted_at IS NOT NULL\")\n end", "def show\n fresh_when(:last_modified => @article.updated_at, :public => true, :etag => @article) if Rails.env.production?\n end", "def index\n get_recent_activity\n if params[:remote]\n render partial: \"subscriptions/summary\"\n else\n #current_user.update_attribute(:feed_last_visited_at, Time.now)\n render \"index\"\n end\n end", "def show\n if current_user\n @last_posted_at = Time.current\n end\n end", "def seen!\n @last_seen = Time.now\n end", "def stamp_changed\n return unless changed?\n\n self.dateChanged = Time.now\n self.changedBy = ApplicationController.application_name\n end", "def update_updated_at_and_by\n #logger.info { \"FILTTERISSÄ: #{response.headers[\"Status\"]}\" }\n if response.headers[\"Status\"] =~ /^20/\n @collection.set_update_info(DateTime.now, (@user ? @user.guid : @client.id))\n # @collection.updated_at = DateTime.now\n # @collection.updated_by = @user ? @user.guid : @client.id\n # @collection.save\n\n end\n end", "def update_last_activity_at\n current_user.last_activity_at = Time.zone.now if current_user\n end", "def index\n @people = Person.scoped\n\n # Add last_modified header based on @people last update time.record\n # public value implies the cache can be stored in a proxy as Rack::Cache\n fresh_when last_modified: @people.maximum(:updated_at), public: true\n end", "def last_seen_date_time\n return @last_seen_date_time\n end", "def last_seen_date_time\n return @last_seen_date_time\n end", "def last_seen_date_time\n return @last_seen_date_time\n end", "def last_visited\n\t Deck.find(params[:id]).update_attribute(:last_visited, DateTime.now)\n\tend", "def last_seen_at\n @data[:last_seen_at]\n end", "def updated_at\n dateChanged\n end", "def seen(user)\n puts \"Should have updated last seen time for %s\" % user.to_s\n @add_seen.execute(user)\n end", "def show\n if @profile.created_at == @profile.updated_at \n redirect_to edit_profile_url(@profile) \n end\n end", "def updated_at_display\n updated_at.in_time_zone(User.new.decorate.h.controller.current_user.timezone).strftime('%b %d, %Y @ %I:%M %p %Z')\n end", "def update_published_at\n update_attribute :published_at, Time.now if total_likes == MIN_LIKES\n end", "def get_last_seen\n last_seen = last_seen_at\n last_seen = current_sign_in_at if last_seen.blank?\n last_seen = last_sign_in_at if last_seen.blank?\n last_seen\n end", "def update_activity\n self.last_activity = Time.now\n end", "def last_updated\n\t\tupdated_at\n\tend", "def show\n if @invite.first_viewed_at < Time.now - 1.year && @invite.created_at < Time.now - 1.hour\n @invite.first_viewed_at = Time.now\n end\n @invite.most_recently_viewed_at = Time.now\n @invite.save\n \n cookies[:user_url] = @invite.url\n end", "def before_save(model)\n model.updated_by = @@current_user if model.respond_to?(\"updated_by\")\n end", "def last_seen\n recently_seen.limit(30)\n end", "def update_last_seen\n m = conversation.conversation_members.where(user_id: sender_id).take\n m.update_column(:last_seen, Time.current) if m\n conversation.conversation_members.where.not(user_id: sender_id).pluck(:user_id).each do |_id| # update total unread cache for all members\n Rails.cache.delete(\"user-unread_messages_count-#{_id}\")\n end\n end", "def online?\n self.last_seen > 15.minutes.ago\n end", "def shown_invite_friends!\n update_column(:invited_friends_at, Time.current)\n end", "def seen\n assign_attributes(last_seen_at: Time.current)\n increment(:seen_count)\n save(validate: false)\n end", "def after_filter; end", "def show\n set_user_activity\n end", "def show\n if @user\n #fresh_when last_modified: @user.updated_at\n #expires_in 2.minutes\n #response.headers[\"Expires\"] = 1.minutes.from_now.httpdate\n puts \"\\e[31minside action\\e[0m\"\n @microposts = @user.microposts.newest.paginate page: params[:page],\n per_page: Settings.app.models.micropost.microposts_per_page\n else\n flash[:danger] = t \"controllers.users_controller.user_not_found\"\n redirect_to :root\n end\n end", "def last_seen_date_time=(value)\n @last_seen_date_time = value\n end", "def last_seen_date_time=(value)\n @last_seen_date_time = value\n end", "def last_seen_date_time=(value)\n @last_seen_date_time = value\n end", "def set_posted_at\n if self.is_public? && self.is_public_changed?\n # becoming public\n self.posted_at = Time.now\n\n elsif !self.is_public? && self.is_public_changed?\n # loosing public\n self.posted_at = nil\n\n end\n\n return true\n end", "def refresh!\n self.update_attributes(:last_logged => Time.now)\n end", "def recent\n @user = User.find params[:id]\n @active_menu = :collections\n @empty_msg = \"As you check out things in RecipePower, they will be remembered here.\"\n response_service.title = \"Recently Viewed\"\n smartrender unless do_stream UserRecentCache\n end", "def saw_notification\n current_user.notice_seen = true\n current_user.save\n end", "def index\n # to do scope to user\n @activities = Activity.all.order('updated_at DESC')\n end", "def after_update(resource)\n #expire_cache_for(resource)\n unless resource.is_a? User and (resource.current_sign_in_at_changed? or resource.last_sign_in_at_changed?)\n expire_cache_for(resource)\n end\n end", "def update_last_activity\n current_user.try(:update_last_activity)\n end", "def edit\n\n # Show CET/CEST time to the user starting from the UTC time in the Database\n # TODO: have a better solution (see create action)\n @feed.date = @feed.date + 2.hour \n\n if @feed.user_id != current_user.id\n err_mex \n elsif @feed.has_been_published == true\n flash[:notice] = \"Non puoi modificare feed gia' pubblicati\"\n render \"show\"\n end\n\n end", "def update_last_user_activity\n now = session[:last_activity] = Time.now\n return if session_is_cloned?\n if ( current_user && (session[:last_activity_saved].nil? || (now - session[:last_activity_saved] > APP_CONFIG[:save_last_activity_granularity_in_seconds].to_i ) ) ) \n logger.info(\"Saved last activity date to #{now} for #{current_user.log_info}\")\n current_user.update_last_activity_date\n session[:last_activity_saved] = now\n end\n end", "def first_seen_date_time\n return @first_seen_date_time\n end", "def first_seen_date_time\n return @first_seen_date_time\n end", "def touch_when_logging\n self.log_updated_at = Time.zone.now\n save\n end", "def show\n @notification.seen = true\n @notification.save\n end", "def before_filter; end", "def user_activity\n current_user.touch(:last_response_at) if signed_in?\n end", "def update_timestamp\n self.fields_last_modified = {\n columns_changeable: columns_changeable,\n columns_visible: columns_visible,\n filters: filters\n }.hash.to_s(36)[1..5]\n end", "def allfeedseen\n\t\tusernews = News.where(:targetuser_id => current_user.id).all\n\t\tusernews.update_all(:seen => 1);\n\t\tusernews.order('created_at DESC').offset(20).destroy_all\n\n\t\trespond_to do |format|\n format.json { render json: {} , status: 200 }\n end\n\tend", "def updated_at\n created_at\n end", "def set_last_reload\n current_dreamer.update_column(:last_reload_at, Time.zone.now) if dreamer_signed_in?\n end", "def update_timestamp\n self.fields_last_modified = {\n columns_changeable: self.columns_changeable,\n columns_visible: self.columns_visible,\n filters: self.filters}.hash.to_s(36)[1..5]\n end", "def autolog_updated\n autolog_event(:updated)\n end", "def show\n# authorize_staff unless api_request?\n\n @fundamental_announcement = Fundamental::Announcement.find(params[:id])\n \n last_modified = @fundamental_announcement.updated_at\n\n render_not_modified_or(last_modified) do\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundamental_announcement, methods: [ :author_name ] }\n end\n end\n end", "def timestamp_attributes_for_update\n ['last_activity']\n end", "def index\n @registeredUsers = Admin.getRegisteredUsers\n @loggedInLastWeek = Admin.getLoginActivity 1.week.ago\n @loggedInLastMonth = Admin.getLoginActivity 1.month.ago\n @recentlyRegistered = Admin.getRecentlyRegistered\n end", "def last_updated_at\n RefreshReportingViews.last_updated_at_facility_daily_follow_ups_and_registrations\n end", "def updated_on\n updated_at\n end", "def newest\n params[:sort] = 'ACTIVATED_AT DESC'\n params[:school_id] = auth_user.current_school_id\n index\n end", "def published_at\n self[:published_at] ||= if created_at?\n created_at\n else\n Time.now.utc\n end\n end", "def ping\n current_user.update_column(:last_action_at, Time.now) if current_user\n render :nothing => true, :status => 204\n end", "def last_edited_time\n begin\n $redis.hget 'last_edit:instrument', self.id\n rescue\n nil\n end\n end", "def history_added; end", "def user_news_by_date\n end", "def feed_after(latest_update) \n\tif latest_update.present? \n\t\tself.feed.where(\"microposts.updated_at > ?\", latest_update)\n\tend\n end", "def show_invitation\n # Get a timestamp for the cache key:\n @max_updated_at = get_timestamp_from_relation_chain() # default: MIR\n end", "def show\n @person = Person.find(params[:id])\n\n # Fix the Cache-Control header value max-age to 1000 seconds by default\n expires_in 1000.seconds\n\n # Set Cache-Control header no-cache\n if params[:id] == '1'\n expires_now\n end\n\n end", "def remember_last_visited_record(record)\n session[:last_admin_edited] = record.id if record.respond_to?(:id)\n end", "def last_modified_by; User.get(self.last_modified_by_id); end", "def last_modified_by; User.get(self.last_modified_by_id); end", "def last_modified_by; User.get(self.last_modified_by_id); end", "def last_modified_by; User.get(self.last_modified_by_id); end", "def last_seen(user)\n seen_when = @db.get_first_value(\"SELECT seen_at FROM last_seen WHERE user = ? COLLATE NOCASE\", user)\n puts \"Last time %s joined was last seen at timestamp \" % [user.to_s, time_ago_in_words(DateTime.parse(seen_when))]\n return \"Last time %s joined was %s ago\" % [user, time_ago_in_words(DateTime.parse(seen_when))]\n end", "def online?\n updated_at > 5.minutes.ago\n end", "def update_status_timestamp\n self.overall_status_modified_at = Time.zone.now\n end", "def update_last_user_activity\n if current_user\n current_user.update_attributes(:last_user_activity => Time.now)\n end\n end", "def updated_by\n if self.logs.where(:action => :update).count > 0\n self.logs.where(:action => :update).desc(:created_at).limit(1).first.user\n end\n end", "def check_if_published_changed\n if \"published\".in? self.changed\n self.published_at = published ? Time.now : nil\n end\n end", "def show\n @query_filter = @account.filters.find(params[:id])\n \n @updates = Update.find_with_ferret(@query_filter.query, {:limit => 200, :sort => Ferret::Search::SortField.new(:message_id, :type => :integer, :reverse => true)})\n @query_filter_name = @query_filter.filter_name\n @members = @account.friends\n @updates.delete_if {|msg| !@members.include?(msg.sender)}\n @members = @updates.group_by(&:sender).keys\n \n # if (@account.last_group_id != @query_filter.id)\n # @account.last_group_id = params[:id]\n # @account.save\n # end\n \n respond_to do |format|\n format.html {render :layout => false} # show.html.erb\n format.xml { render :xml => @query_filter }\n end\n end", "def index\n\n # Analytics::Visitor.recent.with_user.including_events.ordered\n @visitors_with_users = Analytics::Visitor.find(:all, :conditions=>{\n :created_at.gt=>1.month.ago.utc,\n :user_id.ne=>nil,\n }, :order=>'created_at DESC')\n\n # @visitors_without_users = Analytics::Visitor.recent.without_user.ordered\n @visitors_without_users = Analytics::Visitor.find(:all, :conditions=>{\n :created_at.gt=>1.month.ago.utc,\n :user_id=>nil,\n }, :order=>'created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def set_published_at\n self.published_at ||= Time.now if status_id == STATUSES.index('published')\n end", "def last_updated\n time = self.updated_at\n if time < Time.now - (3600 * 24)\n time.strftime(\"%b %-d, %Y\")\n else\n time.strftime(\"%l:%M %p\")\n end\n end", "def show\n @events = Event.where(user_id: current_user.id).order('created_at DESC')\n end", "def touch_recent\n self.recent_activity = Time.now\n self.save(touch: false)\n end", "def show\n @current_user = current_user\n not_found and return unless @timelog.user == @current_user\n end", "def last_updated_at\n if cache\n @last_updated_at ||= remote_last_updated_at\n else\n remote_last_updated_at\n end\n end" ]
[ "0.7009162", "0.7009162", "0.6892341", "0.68316686", "0.6828579", "0.6606349", "0.6562749", "0.64104813", "0.6406043", "0.63564503", "0.63564503", "0.63564503", "0.62944305", "0.62548494", "0.61858785", "0.6168058", "0.6138408", "0.6129267", "0.6103182", "0.6084197", "0.60668945", "0.60537374", "0.60537374", "0.60537374", "0.60146236", "0.59875923", "0.59818363", "0.59786904", "0.5965193", "0.59366363", "0.59288085", "0.5927943", "0.59187984", "0.5908511", "0.5907629", "0.5902946", "0.5902913", "0.5879277", "0.5855556", "0.5853915", "0.58382845", "0.58261937", "0.5817209", "0.57999635", "0.579297", "0.579297", "0.579297", "0.57929575", "0.5775425", "0.57706565", "0.5764861", "0.5751989", "0.5741327", "0.57362056", "0.57342607", "0.5724562", "0.5714012", "0.5714012", "0.5704035", "0.56968063", "0.5689654", "0.5679723", "0.5658195", "0.56561", "0.56559867", "0.5652986", "0.56525046", "0.5648575", "0.56476927", "0.5626224", "0.5624272", "0.561477", "0.5604614", "0.55884254", "0.5583471", "0.5580914", "0.55654943", "0.5564177", "0.55636615", "0.5563187", "0.55586904", "0.55317855", "0.55313647", "0.55274254", "0.55274254", "0.55274254", "0.55274254", "0.551339", "0.5497676", "0.54976296", "0.54942876", "0.54918236", "0.5484717", "0.54759496", "0.547243", "0.54677993", "0.5464446", "0.54607064", "0.5448676", "0.5431067", "0.5423165" ]
0.0
-1
Retrieves a list of the most active, unabused topics
def active options = {} options[:per_page] = 25 options[:select] = "topic.*, (SELECT COUNT(*) from post WHERE post.topic_id = topic.id AND #{Post.abusive_post_conditions} ) AS posts_count" options[:joins] = 'inner join forum on topic.forum_id = forum.id' options[:order] = 'posts_count desc, replied_at DESC' options[:conditions] = Topic.abusive_topic_conditions @topic_pages, @topics = paginate(:topic, options) @users = Sfcontact.find(:all, :select => 'distinct *', :conditions => ['sf_id in (?)', @topics.map { |t| t.posts.first }.collect(&:user_id).uniq]).index_by(&:id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def popular_topics\n topics = []\n results = repository.adapter.select('SELECT t.id, t.name, COUNT(*) count FROM topics t INNER JOIN messages m ON t.id = m.topic_id GROUP BY t.id ORDER BY COUNT(*) DESC')\n \n # Loop over aggregate results\n results.each do |result|\n topic = Topic.get(result.id)\n \n # Skip topic if it has been notified within the window\n notification = *topic.notifications(:source => name, :order => :created_at.desc)\n next if notification && Time.now-Time.parse(notification.created_at.to_s) < window\n\n # Skip topic if it doesn't contain any of the filtered tags\n if tags && tags.length > 0\n found = false\n tags.each do |tag|\n m, tag_type, tag_value = *tag.match(/^(\\w+):(.+)$/)\n \n if topic.tags(:type => tag_type, :value => tag_value).length > 0\n found = true\n break\n end\n end\n next unless found\n end\n \n # If validations have all passed, add the topic to the list\n topics << topic\n end\n\n return topics\n end", "def top_topics\n topics_with_views = Hash.new\n topics.each do |topic|\n topics_with_views[topic] = getViews(topic)\n end\n topics_with_views = topics_with_views.sort_by { |k, v| v }.reverse\n return topics_with_views\n end", "def get_most_recently_visited_topics(org_unit_id) # GET\n query_string = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/content/recent\"\n _get(query_string)\n # Returns: a JSON array of Topic ToC entries.\nend", "def get_topics\n @topics = Topic.all\n end", "def get_topics\n @topics = Topic.all\n end", "def topics\n _topics\n end", "def recent_topics(count: 10)\n Topic.reorder(updated_at: :desc).where(user_id: id).limit(count)\n end", "def index\n @published_topics = current_user.topics.published\n @unpublished_topics = current_user.topics.unpublished\n end", "def all\n data = service.list_topics.to_h[:topics] || []\n load(data)\n end", "def topics\n respond_to?(:topic) ? topic : []\n end", "def all\n data = service.list_topics.body[\"topics\"] || []\n load(data)\n end", "def list_topics\n output = []\n output.push(\"\\e[1;32mTopics:\\e[0m\\n\")\n topics.each_key do |title|\n output.push(\"- \\e[1;37m#{title}\\e[0m\")\n end\n output.join(\"\\n\")\n end", "def index\n @topics = current_user.topics\n end", "def get_last_forum_topics(quantity)\n return ForumTopic.order(created_at: :desc).limit(quantity)\n end", "def list(options = {})\n body = options.has_key?(:query) ? options[:query] : {}\n\n response = @client.get \"/api/topics\", body, options\n\n return response\n end", "def trending_topics\n result = http_get(\"/services/data/v#{self.version}/chatter/topics/trending\")\n result = JSON.parse(result.body)\n result[\"topics\"].collect { |topic| topic[\"name\"] }\n end", "def list_topics\n req_hash = generate_request('ListTopics')\n request_info(req_hash, SnsListTopicsParser.new(:logger => @logger))\n rescue\n on_exception\n end", "def topics\n optional! :order, type: String, default: \"recent\", values: %w[recent likes replies]\n optional! :offset, type: Integer, default: 0\n optional! :limit, type: Integer, default: 20, values: 1..150\n\n @topics = @user.topics.fields_for_list\n @topics =\n if params[:order] == \"likes\"\n @topics.high_likes\n elsif params[:order] == \"replies\"\n @topics.high_replies\n else\n @topics.recent\n end\n @topics = @topics.includes(:user).offset(params[:offset]).limit(params[:limit])\n end", "def index\n @topics = @ip.topics\n end", "def index\n @topics = Topic.includes(:user).includes(:responses).subscribed_by(@user).order('id DESC').page(params[:page])\n end", "def topics\n topics = [\"News\", \"A.I.\", \"V.R.\", \"RMIT\", \"Game\", \"Rails\", \"Go\", \"Web\", \"M.L\", \"Joke\", \"React\", \"Vue\", \"Node\", \"iOS\", \"AWS\"]\n end", "def list_topics\n outputter.print_topics(guides.keys)\n 0\n end", "def recommended_topics(limit = 10)\n visited_topics.joins(:topic).where('topics.language = ?', I18n.locale).group('topic_id').order(\"visits DESC, updated_at DESC\").limit(limit).map(&:topic).map { |t| t.find_related_tags.limit(2) }.flatten.uniq[0...limit]\n end", "def my_topic\n @published_topics = current_user.topics.published\n @unpublished_topics = current_user.topics.unpublished\n end", "def topics\n begin\n case params[:filter].to_i\n when 0: #everyone. unfiltered.\n @topics = @owner.topics.unfiltered\n when 1: #my topics\n @topics = @owner.topics.by_userlist(logged_in_user.id)\n when 2: #my friend's topics\n @topics = @owner.topics.by_userlist(logged_in_user.friends)\n when 3: #topics by classmates\n #@topics = @owner.topics.by_userlist(@logged_in_user.classmates)\n @topics = @owner.topics.unfiltered\n else\n params[:filter] = 0\n @topics = @owner.topics.unfiltered\n end\n case params[:sorter].to_i\n when 0: #latest replies\n @topics.sort! { |x,y| y.latest_post.created_on <=> x.latest_post.created_on}\n when 1: #newest posts\n @topics.sort! { |x,y| y.created_on <=> x.created_on }\n when 2: #most people\n @topics.sort! { |x,y| y.people_count <=> x.people_count }\n when 3: #most posts\n @topics.sort! { |x,y| y.posts.count <=> x.posts.count }\n else\n params[:sorter] = 0\n @topics.sort! { |x,y| y.latest_post.created_on <=> x.latest_post.created_on}\n end\n rescue Exception => e #render_return\n puts e.inspect\n end\n end", "def index\n @topics = Topic.order(updated_at: :desc).all\n end", "def index\n\n\t\t@topics = Topic.all\n\n\t\treturn @topics\n\n\tend", "def index\n @user_topics = UserTopic.all\n end", "def index\n @api_v1_topics = Api::V1::Topic.all\n end", "def get_topics\n @chapter = Chapter.find(params[:id]) unless params[:id].blank?\n if current_user.is?(\"EA\") or current_user.is?(\"IA\")\n list = @chapter.topics.map {|u| Hash[value: u.id, name: u.name]}\n else\n topic_ids = ContentUserLayout.get_unlocked_topics(@chapter,current_user)\n if !topic_ids.nil?\n list = @chapter.topics.where(:id=>topic_ids).map {|u| Hash[value: u.id, name: u.name]}\n else\n list = @chapter.topics.map {|u| Hash[value: u.id, name: u.name]}\n end\n end\n render json: list\n end", "def topic_names\n if topic.blank?\n {}\n else\n @topic_names ||= topic.sub_topics.collect { |t| t.name }.join(' ')\n end\n end", "def index\n @topics = Topic.order('created_at desc')\n end", "def topics(path = nil)\n # NOTE: root url\n platform.topics_at url_for(path: path.to_s)\n end", "def topics\n @topics ||= [cloudenvoy_options_hash[:topic], cloudenvoy_options_hash[:topics]].flatten.compact.map do |t|\n t.is_a?(String) ? { name: t } : t\n end\n end", "def topics(preload: Kazoo::Topic::DEFAULT_PRELOAD_METHODS)\n @topics_mutex.synchronize do\n @topics ||= begin\n topics = zk.get_children(path: \"/brokers/topics\")\n raise Kazoo::Error, \"Failed to list topics. Error code: #{topics.fetch(:rc)}\" unless topics.fetch(:rc) == Zookeeper::Constants::ZOK\n preload_topics_from_names(topics.fetch(:children), preload: preload)\n end\n end\n end", "def topics_count\n object.topics.count\n end", "def forum_get_topics(args={})\n JSON.parse(HelpSpot.api_request('forums.getTopics', 'GET', {:xForumId => args[:forum_id]}.merge(args)))['topic'] rescue []\n end", "def index\n @topics = Admin::Topic.order(date: :desc).paginate(page: params[:page], per_page: 20)\n end", "def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter)\n\t\t\tclient.add_param(kparams, 'pager', pager)\n\t\t\tclient.queue_service_action_call('topic', 'list', 'KalturaTopicListResponse', 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 index\n optional! :type, default: \"last_actived\"\n optional! :node_id\n optional! :offset, default: 0\n optional! :limit, default: 20, values: 1..150\n\n params[:type] = params[:type].downcase\n\n if params[:node_id].blank?\n @topics = Topic\n if current_user\n @topics = @topics.without_nodes(current_user.block_node_ids)\n @topics = @topics.without_users(current_user.block_user_ids)\n else\n @topics = @topics.without_hide_nodes\n end\n else\n @node = Node.find(params[:node_id])\n @topics = @node.topics\n end\n\n current_user&.touch_last_online_ts\n\n @topics = @topics.without_ban.fields_for_list.includes(:node, :user).send(scope_method_by_type)\n if %w[no_reply popular].index(params[:type])\n @topics = @topics.last_actived\n elsif params[:type] == \"excellent\"\n @topics = @topics.recent\n end\n\n @topics = @topics.offset(params[:offset]).limit(params[:limit])\n end", "def index\n topic_breadcrums({})\n @topics = Topic.all\n end", "def all_topics\n topics = Feed.find(params[:feed_id]).topics\n render :json => topics\n end", "def unread_topics user\r\n topics.find_all{|topic| topic.unread_comment?(user) }\r\n end", "def topics_with_cache\n if new_record?\n @associated_topics_cache || []\n else\n self.topics_without_cache\n end\n end", "def list_topics(options = {})\n request({\n 'Action' => 'ListTopics',\n :parser => Fog::Parsers::AWS::SNS::ListTopics.new\n }.merge!(options))\n end", "def get(*topics)\n # FIXME: implement this\n end", "def index\n @topics = Topic.published\n end", "def coarse_topics\n _coarse_topics\n end", "def list_topic_titles\n topics.keys.join(\"\\n\")\n end", "def index\n @topics = Topic.all\n end", "def index\n @topics = Topic.all\n end", "def index\n @topics = Topic.all\n end", "def index\n\n @cloud = Cloud.lookup(params[:cloud_id])\n @messages = Message.where(topic: @cloud).order_by(created_at: :desc).limit(50).reverse\n\n render status: 200\n\n end", "def index\n @topics = Topic.all\n end", "def index\n @class_topics = ClassTopic.all\n end", "def get_bookmarked_topics(org_unit_id) # GET\n query_string = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/content/bookmarks\"\n _get(query_string)\n # Returns: a JSON array of Topic ToC entries.\nend", "def recent_topic\n (recent_topics count: 1)[0]\n end", "def index\n# @topics = Topic.find(:all)\n @new_topics = Topic.find(:all, :order => 'created_at desc', :limit => 10)\n @tags = Topic.tag_counts\n @active_posts = Post.find(:all, :order => 'replied_at desc', :limit => 10)\n @hottest_topics = Topic.find(:all, :order => 'posts_count desc', :limit => 20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @topics }\n end\n end", "def topics\n\t\t\t# Magically make arrays from string Wooooo!\n\t\t\tuid = params[\"uid\"].split(\",\")\n\t\t\ttid = params[\"tid\"].split(\",\")\n\n\t\t\t#request post from usrs AND specific topics ahhhhhhh!\n\t\t\tposts = Post.where('user_id IN (?) OR topic_id IN (?) OR raw LIKE (?)', uid, tid, '%@everyone%' )\n\t\t\t \t\t\t\t\t\t\t\t\t.order(created_at: :desc)\n\t\t\t \t.limit(params[\"total\"])\n\t\t\t\t\t\t\t\t\t\t\t\t.offset(params[\"start\"])\n\n\t\t\t# that cleaned that up\n\t\t\trender_json_dump(serialize_data(posts, PostSerializer))\n\t\t\t#K shows over\n\t\tend", "def get_suggested_topics(assignment_id)\n team_id = TeamsUser.team_id(assignment_id, session[:user].id)\n teams_users = TeamsUser.where(team_id: team_id)\n teams_users_array = Array.new\n teams_users.each do |teams_user|\n teams_users_array << teams_user.user_id\n end\n @suggested_topics = SignUpTopic.where(assignment_id: assignment_id, private_to: teams_users_array)\n end", "def fetch_unread_forums\n sql = \"\n select topics.forum_id\n from posts as posts\n left\n join topics as topics\n on posts.topic_id = topics.id\n left\n join topic_reads as topic_reads\n on posts.topic_id = topic_reads.topic_id\n and topic_reads.user_id = '#{logged_in? ? current_user.id : 0}'\n where (isnull(topic_reads.created_at < posts.created_at) || topic_reads.created_at < posts.created_at) && \n posts.created_at > '#{Time.now - 3.days}' = 1\n group by topics.forum_id\n order by topics.forum_id DESC\n \"\n ActiveRecord::Base.connection.select_values(sql)\n end", "def active_topics_by_subject(opts={})\n h = {}\n \n # Compute local site taggings count for all topics\n Topic.site_topics(self).collect { |t|\n num_taggings = Story.count(:joins => \"JOIN taggings t1 ON t1.taggable_type='Story' AND t1.taggable_id = stories.id AND t1.tag_id = #{t.tag.id} JOIN taggings t2 ON t2.taggable_type='Story' AND t2.taggable_id = stories.id AND t2.tag_id = #{constraint.id}\")\n t.subjects.each { |s|\n h[s.id] ||= []\n h[s.id] << [t.id, num_taggings] if num_taggings >= 3\n }\n }\n\n # Sort by frequency (descending order), and pick first 5\n h.keys.each { |s| h[s].sort! { |v1,v2| v2[1] <=> v1[1] }; h[s]= h[s].take(5) }\n\n return h\n end", "def index\n @topics = Topic.all\n @new_topics = Topic.all.order(created_at: :desc).first(5)\n \n count = Hash.new\n \n Topic.ids.each do |id|\n count[id] = Topic.find(id).comments.count\n end\n \n comment = Hash[ count.sort_by{ |_, v| -v } ]\n \n @many_comments_topics = Topic.find(comment.keys)\n end", "def select_only_subtopics(all_topics)\n all_topics.select { |item| item.fetch(\"internal_name\").include?(\": \") }\n end", "def topics\n @topics ||= import.map { |topic| Topic.parse(topic) }\n end", "def index\n @forum_topics = Forum::Topic.all\n end", "def topics\n r = bills_grouped_by_topic.map do |slug, bills|\n {\n :id => bills.first['id-categoria'],\n :slug => slug,\n :title => ActiveSupport::Inflector.transliterate(bills.first['categoria']),\n :views => bills.map { |b| b['value'] }.inject(:+)\n }\n end\n\n # Sort by views, descending\n r.sort_by! { |b| -b[:views] }\n\n # Set the relative view percentage for each of the topics\n views_total = r.map { |b| b[:views] }.inject(:+)\n\n r.each do |b|\n b[:perc] = b[:views].fdiv(views_total)\n end\n\n # Get the requested topic (if any)\n if params[:topic]\n if params[:topic] =~ /^\\d+$/\n r = r.map { |i| i if i[:id] == params[:topic].to_i }.compact.first\n else\n r = r.map { |i| i if i[:slug] == params[:topic] }.compact.first\n end\n elsif params[:ordered_index]\n # XXX Hack for the Arduino display which shouldn't show the\n # \"other topics\" entry\n r = r.map { |i| i if i[:slug] != 'outros-temas' }.compact\n r = r[params[:ordered_index].to_i]\n\n # They also dont like big jsons\n r.delete(:slug) if r\n end\n\n respond_with r\n end", "def index\n if params[:sort]\n @topics = Topic.includes(:comments).sort_by { |topic| topic.comments.count }.reverse\n elsif params[:sort_upvotes]\n @topics = Topic.includes(:upvotes).sort_by { |topic| topic.upvotes.count}.reverse\n else\n @topics = Topic.all.order('created_at DESC')\n end\n end", "def index\n @topics = Topic.where(:appear => 1).order(\"updated_at DESC, id DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @topics }\n end\n end", "def get_topics_values\n @chapter = Chapter.find(params[:id]) unless params[:id].blank?\n if current_user.is?(\"EA\") or current_user.is?(\"IA\")\n list = @chapter.topics.map {|u| Hash[value: (u.id.to_s+'|'+get_params(u.params.to_s)), name: u.name]}\n else\n topic_ids = ContentUserLayout.get_unlocked_topics(@chapter,current_user)\n if !topic_ids.nil?\n list = @chapter.topics.where(:id=>topic_ids).map {|u| Hash[value: (u.id.to_s+'|'+get_params(u.params.to_s)), name: u.name]}\n else\n list = @chapter.topics.map {|u| Hash[value: (u.id.to_s+'|'+get_params(u.params.to_s)), name: u.name]}\n end\n end\n render json: list\n end", "def list_topics_subscriptions topic, options = {}\n publisher.list_topic_subscriptions topic: topic_path(topic, options),\n page_size: options[:max],\n page_token: options[:token]\n end", "def topics\n client = Comments.discourse\n @topics = client.latest_topics\n respond_to do |fmt|\n fmt.js { }\n end\n end", "def freshest_topic\n topics.select(&:posts_updated_at).max_by(&:posts_updated_at)\n end", "def index\n @subtopics = Subtopic.all\n end", "def index\n @sub_topics = SubTopic.all\n end", "def topic_search\n @topic_search ||= begin\n vals = []\n vals.concat(subject_topics) if subject_topics\n vals.empty? ? nil : vals\n end\n end", "def partitions\n topics.values.flat_map(&:partitions)\n end", "def index\n @tag_topics = TagTopic.all\n end", "def index\n @category = Category.find(params[:id])\n @topic = @category.topics.all\n end", "def topics(usernames)\n get(\"/1/users/topics.json\", :users => [usernames].flatten).users\n end", "def get_activities(filter = Array.new)\n ret_array = Array.new\n if filter.size > 0\n for act in self.activities\n filter.each do |f|\n if act.topic == f\n ret_array.push(act)\n end\n end\n end\n else\n ret_array = activities\n end\n ret_array.sort{|a,b| b.time <=> a.time}\n\n end", "def index\n opts = {\n parent_ids: @site.id,\n status: params[:status],\n headline_level: params[:head],\n rcmd_level: params[:rcmd]\n }.delete_if {|k,v|v.blank?}\n opts[:parent_id] = params[:channel_id] unless params[:channel_id].blank?\n opts[:title] = /.*#{params[:key]}.*/ unless params[:key].blank?\n @topics = Topic.includes(:channel).where(opts).order(id: :desc).page(params[:page])\n end", "def general\n @topics = Topic.non_project.unscheduled.includes(:votes)\n @topics.sort!{|x,y| y.votes.count <=> x.votes.count }\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topics }\n end\n end", "def favorites\n optional! :offset, type: Integer, default: 0\n optional! :limit, type: Integer, default: 20, values: 1..150\n\n @topics = @user.favorite_topics.includes(:user).order(\"actions.id desc\").offset(params[:offset]).limit(params[:limit])\n render \"topics\"\n end", "def latest_topics_rss\r\n @title = \"The Latest Discussions\"\r\n @topics = Topic.paginate_all(20, @cobrand)\r\n render :template => \"common/topics_rss\", :layout => false\r\n end", "def show_new_messages\r\n @topics = Topic.paginate :conditions => [\"last_post > ?\", @usr.last_visit], :page => params[:page], :per_page => Configs.get_config('topperpage'), :order => 'last_post DESC'\r\n if @topics.empty?\r\n redirect_to_info_page t(:redir)\r\n return \r\n end\r\n end", "def real_channels\n results = []\n next_token = ''\n loop do\n resp = sns.list_topics((next_token.empty? ? {} : { next_token: next_token }))\n results.concat(resp.topics.map(&:topic_arn))\n next_token = (resp.next_token.empty? ? '' : resp.next_token)\n break if next_token.empty?\n end\n results\n end", "def view\n get_topic(@current_id, :resolve => false)\n get_complete_topic(@current_id, :resolve => false)\n get_related_for_current\n end", "def index\n @topics = Topic.getCommunityTopic(params)\n respond_with(@topics)\n end", "def index\n @article_topics = ArticleTopic.all\n end", "def topic_ids\n new_record? ? (@associated_topics_cache ? @associated_topics_cache.compact.map(&:id) : []) : self.topics.map(&:id)\n end", "def list_topics\n\tputs \"1. Social Media\"\n\tputs \"2. Tech\"\n\tputs \"3. Business\"\n\tputs \"4. Entertainment\"\n\tputs \"5. World\"\n\tputs \"6. Watercooler\"\n\tputs \" \"\n\tputs \"Which topic interests you most?\"\n\tprint \"Please enter a number 1 through 6 or press any other # to quit: \"\nend", "def list\n @topic = get_topic(params)\n @topic_list = get_topic_list(@topic)\n respond_to do |format|\n format.html\n format.xml { render xml: @topic_list.to_xml }\n format.json { render json: @topic_list.to_json }\n end\n end", "def get_topics_cohort\n # If affect is all, that means all matching tickets should be bulk updated\n if params[:affect].present? && params[:affect] == \"all\"\n if params[:status].present?\n @topics = Topic.where(current_status: params[:status]).all\n elsif params[:q].present?\n @topics = Topic.admin_search(params[:q])\n end\n\n # Select topics from params\n else\n @topics = Topic.where(id: params[:topic_ids]).all\n end\n \n end", "def index\n @topics = @category.topics.preload(:category)\n render 'api/v1/topics/index'\n end", "def get_user_count(id, topic_name)\n timenow = DateTime.now\n if topic_name != \"Main\"\n return Active.where(:channel_id => id, :topic_name => topic_name).where(\"updated > ?\", timenow-5.seconds).size\n else\n return Active.where(:channel_id => id).where(\"updated > ?\", timenow-5.seconds).size\n end\n end", "def index\n @topics = @pool.topics.order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topics }\n end\n end", "def list\n if args.length != 1\n error \"Kafka name required\"\n end\n name, urls = attachment(args)\n get_topics(urls, name)\n display\n end", "def most_active_users\n ids = replies.not_anonymous.count(:user_id,\n :group => :user_id,\n :order => \"count_user_id DESC\",\n :limit => (4 - experts.length)).keys\n User.find(ids.compact)\n end", "def index\n if params[:sort] == \"created_at\"\n @topics = Topic.order(sort_column + ' ' + sort_direction).page(params[:page]).per(8)\n\n else\n @topics = Topic.page(params[:page]).per(8).left_joins(:comments)\n .group(:id)\n .order('COUNT(comments.id) DESC')\n end\n\n end", "def show\n @topics = Topic.find(params[:id])\n @comments = @topics.comments.page(params[:page]).per(10).order(created_at: :desc)\n end" ]
[ "0.7807402", "0.7454949", "0.7272122", "0.7202532", "0.7202532", "0.7189076", "0.71268165", "0.7018799", "0.69083947", "0.6895069", "0.68866915", "0.6846084", "0.682053", "0.67861533", "0.67801267", "0.67687625", "0.67631", "0.67323065", "0.67304164", "0.671745", "0.6689151", "0.66703", "0.6669311", "0.6605171", "0.65505266", "0.65404433", "0.6519364", "0.6505366", "0.64839125", "0.647694", "0.6471221", "0.645936", "0.64582086", "0.6414928", "0.640338", "0.63941294", "0.6393876", "0.6381989", "0.6367033", "0.63639605", "0.6351441", "0.63496554", "0.63119704", "0.63079876", "0.63009906", "0.62914276", "0.6290924", "0.62884283", "0.6261327", "0.62290215", "0.62290215", "0.62290215", "0.6212433", "0.618884", "0.6187875", "0.61848843", "0.61687243", "0.6167229", "0.61662203", "0.61569506", "0.6136475", "0.6135879", "0.61309284", "0.6129448", "0.6127636", "0.61109734", "0.61062586", "0.6091717", "0.6062658", "0.60495514", "0.6015121", "0.59882027", "0.5983157", "0.59438264", "0.5940259", "0.5929604", "0.59155613", "0.5907968", "0.5904628", "0.59008265", "0.5897098", "0.588382", "0.5873223", "0.5851679", "0.58515525", "0.58203083", "0.5808975", "0.58058834", "0.57933307", "0.57898813", "0.57784164", "0.5768759", "0.5761391", "0.573209", "0.57295257", "0.5725701", "0.5722606", "0.57222104", "0.5720753", "0.570216", "0.56896096" ]
0.0
-1
required instance methods for Contactable items
def email nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contact; end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def modify_contact\n\n end", "def contact\n\n end", "def contact\n\n end", "def item; end", "def item; end", "def item; end", "def item; end", "def item; end", "def contact \n\n end", "def contacts\r\n\r\n end", "def contactus\r\n end", "def manage_items\n end", "def contactus\n end", "def app_contact\n end", "def contact_info(contact)\n super # placeholder so that I can add some doc\n end", "def is_contact?(); @type == GRT_CONTACT; end", "def make_item_list\n end", "def contact; Contact.get(self.contact_id); end", "def contact; Contact.get(self.contact_id); end", "def contact; Contact.get(self.contact_id); end", "def contact; Contact.get(self.contact_id); end", "def contact; Contact.get(self.contact_id); end", "def create\n create_params = item_params\n create_params[:created_by] = current_user.id.to_s\n create_params[:updated_by] = current_user.id.to_s\n\n # Picks ContactMethod subclass\n # TODO - should this be broken out into a separate class?\n # At the very least a separate method\n\n # Email\n if create_params[:email]\n @item = EmailAddress.new(create_params)\n\n # Phone\n elsif create_params[:phone]\n @item = PhoneNumber.new(create_params)\n\n # Address\n elsif create_params[:country]\n @item = Address.new(create_params)\n\n # Social\n elsif create_params[:username]\n @item = SocialAccount.new(create_params)\n\n # ELSE\n else\n # TODO - throw exception\n end\n\n @item.save\n # respond_with(@item) # TODO - why isn't this working??\n render template_prefix + '/show'\n\n end", "def contact\n # STUB\n end", "def contact_update(args)\n super # placeholder so that I can add some doc\n end", "def contact_update(args)\n super # placeholder so that I can add some doc\n end", "def item; @item; end", "def item; @item; end", "def item\n super || item_order.item\n end", "def contact_create(contact)\n super # placeholder so that I can add some doc\n end", "def contact_create(contact)\n super # placeholder so that I can add some doc\n end", "def display_contacts\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end", "def display_contacts\n\n # HINT: Make use of this method in the display_all_contacts and search_by_attribute methods to keep your code DRY\n end", "def recipient; end", "def process_item(item)\n raise NotImplementedError\n end", "def scrape_contacts; end", "def item;\n @item;\n end", "def handle_item?(item)\n not_implemented(__method__)\n end", "def before_item(item)\n item\n end", "def saw_item(item); end", "def use_item_to_actors\n $game_party.members[0].item_apply(user, item)\n end", "def fox_item\n @item\n end", "def featured_item(items)\n\n end", "def modify_existing_contact\n self.to_contact.modify_existing_contact.to_contact\n end", "def all_items\n raise NotImplementedError, \"You should implement #{__method__} method\"\n end", "def item_edit\n end", "def being_created?(item = nil)\n # noinspection RubyMismatchedArgumentType\n super(item || self)\n end", "def ensure_item_validity_before(*methods)\n methods.each do |method_name|\n around_method(method_name, prevent_double_wrapping_for: \"EnsureItemValidity\") do |*items|\n ensure_allowed_in_collection!(items)\n\n super(*items)\n end\n end\n end", "def contact\n\t\t@contact\n\tend", "def contact\n\t\t@contact\n\tend", "def validate_item( x )\n fail 'not implemented!'\n end", "def item_add item\n\t\tret = super\n\t\titem.known! if (ret)\n\t\treturn ret\n\tend", "def interested(item, buyer)\n @item = item\n @buyer = buyer\n @greeting = \"Hi\"\n @name = item.owner.name\n\n mail to: item.owner.email\n end", "def populate_from_enquiry_items\n if enquiry_items.present? # not present\n self.food_partner = enquiry_items.first.packageable_item.food_partner # cleanlol\n enquiry_price.populate_price_from_cart\n end\n end", "def common\n #if Contact.where(:organization_id => current_user.organization.id).any?\n # #@users = current_user.organization.contacts.group_by{|u| u.first_name[0]}\n # @users = Contact.where(:organization_id => current_user.organization.id).order(\"name,first_name\")\n #end\n # Contact.all.each do |contact|\n # contact.update_column :created_by, current_user.id\n # end\n begin\n lastcontact = current_user.activities.where(\"activity_status=? and activity_type in (?)\", \"Create\", [\"IndividualContact\", \"CompanyContact\"]).last\n unless lastcontact.present?\n lastcontact = current_user.organization.activities.where(\"activity_status=? and activity_type in (?)\", \"Create\", [\"IndividualContact\", \"CompanyContact\"]).last\n\n end\n if lastcontact.present?\n if lastcontact && lastcontact.activity_type == \"IndividualContact\"\n @contact = IndividualContact.find(lastcontact.activity_id)\n get_contact_attrs\n elsif lastcontact && lastcontact.activity_type == \"CompanyContact\"\n @contact = CompanyContact.find(lastcontact.activity_id)\n get_contact_attrs\n end\n else\n contacts=current_user.organization.individual_contacts\n @contact = contacts.last\n get_contact_attrs\n end\n rescue ActiveRecord::RecordNotFound\n flash[:bowarning]=\"It seems you don't have sufficient privilege to access this item or something went wrong with your account permissions. Please contact Admin to get this fixed.\"\n #redirect_to contacts_path\n end\n\n end", "def hal_about(item)\n self.halable = item\n self.fromable = item.from\n self.course_id = item.course_id \n # item.hals << self\n end", "def require_description_presence?\n self.can_send_email\nend", "def items(); @items || CrateAPI::Items.new(); end", "def is_client?\n self.has_attribute? :point_of_contact\n end", "def get_items\n @items\n end", "def contact_id\n self.id\n end", "def contacted_reviewers()\n return MicrosoftGraph::IdentityGovernance::AccessReviews::Definitions::Item::Instances::Item::ContactedReviewers::ContactedReviewersRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def examine(item)\r\n \r\n end", "def contact\n Notifierrails.contact\n end", "def dispatch_to_default_with_helpdesk\n issue = receive_issue\n roles = issue.author.roles_for_project(issue.project)\n # add owner-email only if the author has assigned some role with\n # permission treat_user_as_supportclient enabled\n if roles.any? {|role| role.allowed_to?(:treat_user_as_supportclient) }\n sender_email = @email.from.first\n #XXX the email_details overrides bellow: there is subroutine call instead\n email_details = \"From: \" + @email[:from].formatted.first + \"\\n\"\n email_details << \"To: \" + @email[:to].formatted.join(', ') + \"\\n\"\n\n custom_field = CustomField.find_by_name('cc-handling')\n custom_value = CustomValue.where(\n \"customized_id = ? AND custom_field_id = ?\", issue.project.id, custom_field.id).first\n\n if (!@email.cc.nil?) && (custom_value.value == '1')\n carbon_copy = @email[:cc].formatted.join(', ')\n email_details << \"Cc: \" + carbon_copy + \"\\n\"\n custom_field = CustomField.find_by_name('copy-to') \n\t custom_value = CustomValue.where(\n \"customized_id = ? AND custom_field_id = ?\", issue.id, custom_field.id).first\n custom_value.value = carbon_copy\n custom_value.save(:validate => false)\n else\n carbon_copy = nil\n end\n\n email_details << \"Date: \" + @email[:date].to_s + \"\\n\"\n email_details = \"<pre>\\n\" + Mail::Encodings.unquote_and_convert_to(email_details, 'utf-8') + \"</pre>\"\n\t email_details = compose_email_details()\n issue.description = email_details + issue.description\n issue.save\n custom_field = CustomField.find_by_name('owner-email')\n custom_value = CustomValue.where(\n \"customized_id = ? AND custom_field_id = ?\", issue.id, custom_field.id).\n first\n custom_value.value = sender_email\n custom_value.save(:validate => false) # skip validation!\n \n # regular email sending to known users is done\n # on the first issue.save. So we need to send\n # the notification email to the supportclient\n # on our own.\n \n HelpdeskMailer.email_to_supportclient(issue, {:recipient => sender_email,\n :carbon_copy => carbon_copy} ).deliver\n # move issue's description onto the new (1-st) journal entry\n journal = Journal.new(:journalized_id => issue.id, :journalized_type => 'Issue', :user_id => issue.author.id, :notes => issue.description, :private_notes => false, :created_on => issue.created_on)\n journal.notify = false # regular email sending to known users is done so no need to notify one more time about this technical operation\n journal.save\n issue.description = ''\n issue.save\n\n end\n after_dispatch_to_default_hook issue\n return issue\n end", "def thanks_to_vendor\n\n end", "def add_item_to_list?(_item)\n raise NoMethodError, \"Subclass must define the #{__method__} method and return true or false\", caller\n end", "def contact\n @contact ||= get_contact(@data_object.user_contact)\n end", "def item_update(item)\n debug \"item update\"\n row = @contacts_rows[item.jid]\n unless row\n add_item_to_roster(item)\n row = @contacts_rows[item.jid]\n end\n fill_model_values_for_item item, row\n end", "def contacts() @contacts ||= Flickr::Contacts.new(self) end", "def contacts\n contact_client.contacts\n end", "def contact_info(xml)\n super # placeholder so that I can add some doc\n end", "def get_contact\n if self.contact_id\n return self.contact\n end\n end", "def enable?(item); true; end", "def contacts\n @contacts ||= DebtorContactProxy.new(self)\n end", "def mailboxer_email(object)\n #Check if an email should be sent for that object\n #if true\n return self.email\n #if false\n #return nil\nend", "def item_added(item)\n @item = item\n\n mail subject: \"New item available!\",\n to: \"nobody@yardsale.com\",\n bcc: User.all.pluck(:email)\n end", "def mail_box; end", "def shipper_contact\n @shipper_contact ||= SimpleShipping::Contact.new(\n :person_name => 'Mister Someone',\n :phone_number => '1234567890'\n )\n end", "def create_thanks \n end", "def by_mail_tracker\n end", "def item_owner\n self\n end", "def validate\n validates_contact\n end", "def associated_with_user\n self.contact_types = [ContactType.user.id]\n end", "def actionable?(c = nil)\n return unless c\n if c == contact \n true\n elsif c.privilege?(AppConstants::PRIVILEGE[:super_user]) and c.company == contact.company\n true\n else\n false\n end\n end", "def contact\n @voucher.customer.nil? ? nil : ContactDrop.new(@voucher.customer.main_contact)\n end" ]
[ "0.65783453", "0.6225204", "0.6225204", "0.6225204", "0.6225204", "0.6225204", "0.6225204", "0.6225204", "0.6225204", "0.6225204", "0.6225204", "0.6225204", "0.6225204", "0.6225204", "0.6225204", "0.61649895", "0.6127475", "0.6127475", "0.6068426", "0.6068426", "0.60682535", "0.60682535", "0.60682535", "0.60294425", "0.60101056", "0.59959394", "0.5970991", "0.5904428", "0.58521116", "0.5801242", "0.56888944", "0.5684518", "0.5680427", "0.5680427", "0.5680427", "0.5680427", "0.5680427", "0.5656527", "0.5655409", "0.5632275", "0.5632275", "0.562803", "0.562803", "0.56017876", "0.5586816", "0.5586816", "0.5550979", "0.5550979", "0.55280083", "0.55169225", "0.55059355", "0.5492464", "0.54812753", "0.5474332", "0.54686314", "0.54477984", "0.5402666", "0.539495", "0.5391938", "0.5383493", "0.5371568", "0.53698707", "0.5355027", "0.5345906", "0.5345906", "0.53446823", "0.5339473", "0.5338259", "0.5321636", "0.5317845", "0.53144217", "0.5280918", "0.5267004", "0.5259244", "0.5237819", "0.52287865", "0.5228325", "0.5223849", "0.5221911", "0.5213079", "0.5212199", "0.5207534", "0.52040124", "0.5134858", "0.5132841", "0.51267016", "0.5113334", "0.51107544", "0.51071763", "0.5104233", "0.5098836", "0.50948346", "0.5091688", "0.5086464", "0.5083976", "0.50659025", "0.5065679", "0.5058926", "0.5055373", "0.50436646", "0.5040096" ]
0.0
-1
TODO: separate apply_changes! and import!
def import! return unless imported? or updated? Outgoing::Workcamp.transaction do import_changes.each do |change| change.apply(self) change.destroy end self.state = nil save! end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_and_import\n transform_files\n import\n end", "def post_import\n end", "def import()\n # TODO\n end", "def import\n end", "def import\n end", "def import\n end", "def import\n end", "def before_import ; end", "def import!\n import_binary_files\n member_ids = []\n source_metadata_adapter.query_service.find_members(resource: source_resource).each do |member|\n member = self.class.import(source_resource: member, source_metadata_adapter: source_metadata_adapter, change_set_persister: change_set_persister)\n # Set this property so derivatives will run, acts like a FileAppender.\n source_change_set.created_file_sets += [member] if member.is_a?(FileSet)\n member_ids << member.id\n end\n # Get rid of non-preserved members. If they're not preserved, it was\n # probably a bug - e.g. page 3 didn't make it into preservation.\n source_change_set.try(:member_ids=, member_ids)\n output = change_set_persister.save(change_set: source_change_set, external_resource: true)\n output\n end", "def after_import_synchronize( instances )\n instances.each { |e| e.reload }\n end", "def import!\n import_binary_files\n member_ids = []\n source_metadata_adapter.query_service.find_members(resource: source_resource).each do |member|\n member = self.class.import(source_resource: member, source_metadata_adapter: source_metadata_adapter, change_set_persister: change_set_persister)\n source_change_set.created_file_sets += [member] if member.is_a?(FileSet)\n member_ids << member.id\n end\n # Get rid of non-preserved members.\n source_change_set.try(:member_ids=, member_ids)\n output = change_set_persister.save(change_set: source_change_set)\n output\n end", "def after_import_synchronize( instances )\n instances.each(&:reload)\n end", "def prepare_pre_import\n end", "def import!\n return selected_importer.import!\n end", "def merge\n notify \"Importing...\"\n @importer.merge\n end", "def import(_, project)\n project.after_import\n report_import_time(project)\n end", "def import!(&block)\n start_time = Time.at(Time.now.to_i.floor)\n yield\n raise LoadError.new(\"No data found\") unless where(\"updated_at >= ?\", start_time).exists?\n where(\"updated_at < ?\", start_time).imported.update_all(status: STATUS_REMOVED)\n end", "def on_change(modified, added, deleted)\n # Modifications and additions are treated the same.\n (modified + added).uniq.each do |path|\n if file = Ichiban::ProjectFile.from_abs(path)\n begin\n @loader.change(file) # Tell the Loader that this file has changed\n file.update\n rescue Exception => exc\n Ichiban.logger.exception(exc)\n end\n end\n end\n \n # Deletions are handled specially.\n deleted.each do |path|\n Ichiban::Deleter.new.delete_dest(path)\n end\n \n # Finally, propagate this change to any dependent files.\n (modified + added + deleted).uniq.each do |path|\n begin\n Ichiban::Dependencies.propagate(path)\n rescue => exc\n Ichiban.logger.exception(exc)\n end\n end\n end", "def updated_source_file; end", "def run\n # Try to get the diff_filename and open it for the comparison\n # And if this is the first time the import is run, there wont be any diff_filename whatsoever, so we loop from the file directly =)\n get_diff_from_previous_file if @diff_filename.nil?\n \n # If this is run for the first time, we are not gonna have the diff_file, so\n # What we are doing is to read all of the lines, and put them under \"added\" section\n if (File.file? @diff_filename)\n # Parse the diff file\n parse_diff \n else\n # We read it from the file directly\n parse_file\n end\n \n # Return with the hash representation of the difference\n return self.line_diff\n end", "def import_diff_file(file_path)\n raise NotImplementedError\n end", "def change_import (libpath, import, newimport)\n log \"\\tchange_import called with libpath: #{libpath}, import: #{import}, newimport: #{newimport}\"\n return if newimport == import\n log \"\\tChange import #{import} to #{newimport}\"\n unless system(\"install_name_tool\", \"-change\", import, newimport, libpath)\n fail \"install_name_tool failed\"\n end\nend", "def update!(**args)\n @import_configs = args[:import_configs] if args.key?(:import_configs)\n end", "def orm_patches_applied; end", "def import!\n Version.transaction do\n Version.delete_all\n records.each do |record|\n begin\n import_record(record)\n rescue ActiveRecord::RecordNotFound\n Rails.logger.warn \"Unable to import #{record.primary_identifier} - no matching Book entry for DCL dcl:#{record.dcl_number}\"\n rescue ActiveRecord::RecordInvalid => e\n Rails.logger.warn \"Unable to import #{record.primary_identifier} - failed validations: #{e}\"\n end\n end\n end\n reindex!\n end", "def source_change(change, filename)\n end", "def setup\n @last_import_data = { string_field: \"import four\", integer_field: 4, extra_field: \" extra\" }\n end", "def modified_files; end", "def import(ovf)\n end", "def orm_patches_applied=(_arg0); end", "def import_into\n raise NotImplementedError, not_implemented_error_message(__method__)\n end", "def process (file, original_path =nil)\n log \"-- #{file} ...\"\n for import in get_imports(file) do\n path = import.to_s\n unless path.start_with?(\"/usr/lib/\") || path.start_with?(\"/System/\")\n dst = copy_lib(import, (original_path || file))\n unless dst.absolute?\n dst = '@loader_path/' + dst.relative_path_from(file.dirname).to_s\n end\n change_import(file.to_s, import.to_s, dst.to_s)\n end\n end\n log \"\\tend #{file}\"\nend", "def altered_files\n parse!\n @altered_files\n end", "def migrate_files_to_external_storage!\n return if stored_externally? || !use_external_diff? || merge_request_diff_files.count == 0\n\n rows = build_merge_request_diff_files(merge_request_diff_files)\n\n transaction do\n MergeRequestDiffFile.where(merge_request_diff_id: id).delete_all\n create_merge_request_diff_files(rows)\n save!\n end\n\n merge_request_diff_files.reset\n end", "def add_import(fn)\n @pending_imports << fn\n end", "def add_import(fn)\n @pending_imports << fn\n end", "def process_updates(table_name, field, rows)\n ActiveRecord::Base.transaction do\n mass_import(rows)\n mass_update(table_name, field)\n end\n end", "def apply_imports\n assert_privileges(\"ops_settings\")\n\n if session[:imports]\n begin\n session[:imports].apply\n rescue => bang\n add_flash(_(\"Error during 'apply': %{error}\") % {:error => bang}, :error)\n @sb[:show_button] = true\n else\n add_flash(_(\"Records were successfully imported\"))\n @sb[:show_button] = false\n session[:imports] = @sb[:imports] = nil\n end\n else\n add_flash(_(\"Use the Choose file button to locate CSV file\"), :error)\n @sb[:show_button] = true\n end\n flash_to_session\n redirect_to(:action => 'explorer', :no_refresh => true)\n end", "def request_import\n end", "def backup \n @labs = Lab.all\n @import = ImportLabs.list_importable_labs\n logger.debug \"\\nimport labs: #{@import}\\n\"\n end", "def altered_files; raw_changeset.files; end", "def do_import\n if(reset)\n TaliaUtil::Util.full_reset\n puts \"Data Store has been completely reset\"\n end\n errors = []\n run_callback(:before_import)\n if(index_data)\n import_from_index(errors)\n else\n puts \"Importing from single data file.\"\n TaliaCore::ActiveSource.create_from_xml(xml_data, :progressor => progressor, :reader => importer, :base_file_uri => @true_root, :errors => errors, :duplicates => duplicates)\n end\n if(errors.size > 0)\n puts \"WARNING: #{errors.size} errors during import:\"\n errors.each { |e| print_error e }\n end\n run_callback(:after_import)\n end", "def delegate_import\n if Rails.env == 'development'\n # use local file path on development\n csv = open(self.import.import_file.products.path)\n else\n # use s3 file on production\n csv = open_tmp_file(self.import.import_file.products.url)\n end\n\n\n # Send file to fnz module using import api\n response = RestClient.post Fnz::HOST + '/api/v0/imports',\n app_key: Fnz::API_KEY,\n import: {\n object: 'Product',\n padma_id: self.import.account.name,\n upload: csv\n }\n if response.code == 201\n # If import was created successfully create a product importer\n #that will show the status of this import\n remote_import_id = JSON.parse(response.body)['id']\n self.update_attributes(status_url: Fnz::HOST + '/api/v0/imports/' + remote_import_id.to_s)\n end\n end", "def import\n redirect_to({:action => :index, :offset => params[:offset]}, :alert => I18n.t('couchbase_i18n.translation.no_import_file_given')) and return unless params[:importfile].present?\n filename = params[:importfile].original_filename\n extension = filename.sub(/.*\\./, '')\n if extension == 'yml'\n hash = YAML.load_file(params[:importfile].tempfile.path) rescue nil\n redirect_to({:action => :index, :offset => params[:offset]}, :alert => I18n.t('couchbase_i18n.translation.cannot_parse_yaml')) and return unless hash\n CouchbaseI18n.traverse_flatten_keys(hash).each do |key, value|\n existing = CouchbaseI18n::Translation.find_by_translation_key(key)\n if existing\n if existing.translation_value != value\n existing.translation_value = value\n existing.translated = true\n existing.save\n end\n else\n CouchbaseI18n::Translation.create :translation_key => key, :translation_value => value\n end\n end \n else\n redirect_to({:action => :index, :offset => params[:offset]}, :alert => I18n.t('couchbase_i18n.translation.no_proper_import_extension', :extension => extension)) and return \n end\n redirect_to({:action => :index, :offset => params[:offset]}, :notice => I18n.t('couchbase_i18n.translation.file_imported', :filename => filename))\n end", "def import_supply_items(filename = self.import_filename)\n # before calling this in a descended class, you must set up these variables:\n # @supplier = The supplier to import for (an AR object)\n SupplyItem.expire_category_tree_cache(@supplier)\n\n ThinkingSphinx::Deltas.suspend :supply_item do\n File.open(filename, \"r:utf-8\").each_with_index do |line, i|\n next if i == 0 # We skip the first line, it only contains header information\n data = parse_line(line)\n next if data == false\n next if data[:supplier_product_code].blank? # The line is incomplete, skip it\n # check if we have the supply item\n local_supply_item = SupplyItem.where(:supplier_id => @supplier.id,\n :supplier_product_code => data[:supplier_product_code]).first\n # We do not have that supply item yet\n if local_supply_item.nil?\n si = new_supply_item(data)\n if si.save\n supplier_logger.info(\"[#{DateTime.now.to_s}] SupplyItem create: #{si.inspect}\")\n else\n supplier_logger.error(\"Failed adding supply item during sync: #{si.inspect.to_s}, #{si.errors.to_s}\")\n end\n # We already have that supply item and need to update that and related product information\n else\n update_supply_item(local_supply_item, data)\n end\n end\n end\n Product.update_price_and_stock # Sync available products to the now changed supply items\n CategoryDispatcher.create_unique_combinations_for(@supplier)\n end", "def updated_source_file?; end", "def post_import(&block)\n Autoproj.post_import(self, &block)\n end", "def delegate_import\n if Rails.env == 'development'\n # use local file path on development\n csv = open(self.import.import_file.time_slots.path)\n else\n # use s3 file on production\n csv = open_tmp_file(self.import.import_file.time_slots.url)\n end\n\n\n # Send file to attendance module using import api\n # The last two headers are: vacancy (it doesn't matter) and school_id (already imported)\n response = RestClient.post Attendance::HOST + '/api/v0/imports',\n app_key: Attendance::API_KEY,\n account_name: self.import.account.name,\n import: {\n object: 'TimeSlot',\n csv_file: csv,\n headers: headers\n }\n if response.code == 201\n # If import was created successfully create a time_slot importer\n #that will show the status of this import\n remote_import_id = JSON.parse(response.body)['id']\n self.update_attributes(status_url: Attendance::HOST + '/api/v0/imports/' + remote_import_id.to_s)\n end\n end", "def calculate_changes\n\t\t@added_properties = []\n\t\t@removed_properties = []\n\t\tall_migrations = find_all_migrations\n\t\tall_migrations.each do |migration_name|\n\t\t\teval File.read(migration_name)\n\t\tend\n\tend", "def apply_imports\n if session[:imports]\n begin\n session[:imports].apply\n rescue => bang\n add_flash(_(\"Error during 'apply': %{error}\") % {:error => bang}, :error)\n @sb[:show_button] = true\n else\n add_flash(_(\"Records were successfully imported\"))\n @sb[:show_button] = false\n session[:imports] = @sb[:imports] = nil\n end\n else\n add_flash(_(\"Use the Choose file button to locate CSV file\"), :error)\n @sb[:show_button] = true\n end\n flash_to_session\n redirect_to(:action => 'explorer', :no_refresh => true)\n end", "def redo_include_and_extend\n reinclude + reextend\n end", "def perform\n import = TransportPassengerImport.find self.id\n import.update_attributes(:status => 1)\n load_all_data\n @rollback = false\n @errors = Array.new\n ActiveRecord::Base.transaction do\n import_csv(import.attachment.to_file)\n raise ActiveRecord::Rollback if @rollback\n end\n if @errors.present?\n import.update_attributes(:status => 4, :last_message => @errors)\n else\n import.update_attributes(:status => 2, :last_message => nil)\n end\n rescue Exception => e\n import.update_attributes(:status => 3, :last_message => ['-', e.message])\n end", "def import_active_stats\n\n end", "def import\n log.debug(\"Importing from #{@location}\")\n id = File.basename(@location)\n record = storage_engine.get_by_id(id)\n raise MainControllerError, \"Cannot import a non-exist record\" if record.nil?\n record.whitelist = file_rw_manager.read(\"#{@location}/whitelist\")\n record.blacklist = file_rw_manager.read(\"#{@location}/blacklist\")\n record.qual = \"true\"\n record.auditor = @auditor\n storage_engine.update(record)\n log.info(\"Qualified record #{id} has been successfully imported\")\n end", "def import(deps)\n @dependencies += deps\n end", "def apply_changes\n\t\t@admin_manager.CommitChanges\n\tend", "def run_on_change(paths)\n copy_all_functions \"Functions have changed, copying over\"\n end", "def run_on_changes(_)\n restart\n end", "def imported\n @imported ||= []\n end", "def imported\n @imported ||= []\n end", "def file_imports_load_from_params(val)\r\n\r\nself.file_imports_was = self.file_imports.all if val\r\ncase val\r\nwhen Hash, HashWithIndifferentAccess\r\n self.file_imports = val.map {|k, v|\r\n if k[/\\A(_|-)\\d+/] # CREATE\r\n elt = FileImport.load_from_params(v)\r\n elt.user_id ||= self.id\r\n if !elt.valid?\r\n self.errors.add(:file_imports, _(\"Invalid file_imports: %{d}\") % {:d => elt.errors.full_messages.join(',')})\r\n nil\r\n else\r\n elt\r\n end\r\n elsif v.is_a? String # UNCHANGED OR DESTROY\r\n if v == \"-1\" #DESTROY\r\n self.file_imports.destroy(k) unless k.to_i == 0\r\n val.delete(k)\r\n nil\r\n else\r\n FileImport.find(k) unless k.to_i == 0\r\n end\r\n else\r\n elt = FileImport.load_from_params(v.merge(:id => k))\r\n if elt.valid?\r\n elt.save if elt.changed?\r\n else\r\n self.errors.add(:file_imports, _(\"Invalid file_imports: %{d}\") % {:d => elt.errors.full_messages.join(',')})\r\n end\r\n elt\r\n end\r\n }.compact\r\nwhen Array\r\n val = val.compact.map(&:to_i).reject{|v| v == 0}\r\n self.file_imports = (val.empty? ? [] : FileImport.find(val))\r\nwhen String, Fixnum\r\n self.file_imports = val.blank? ? nil : [FileImport.find(val)]\r\nwhen nil\r\nelse logger.warn(\"Unexpected params type for 'file_imports': #{val.class}\")\r\nend\r\nend", "def import(deps)\n @dependencies.concat deps\n end", "def update\n if Membership::Level.count > 0\n timestamp = Membership::Level\n .select(:nexudus_updated_at)\n .order(nexudus_updated_at: :desc)\n .first\n .nexudus_updated_at\n\n params = {\n 'from_Tariff_UpdatedOn' => timestamp.iso8601\n }\n else\n params = nil\n end\n\n # Import with given params\n import params\n end", "def import_lines(type, file_name)\n on AccountingLine do |line|\n line.send(\"import_lines_#{type}\")\n line.send(\"account_line_#{type}_file_name\").set($file_folder+file_name)\n line.send(\"add_#{type}_import\")\n update_from_page!(type)\n end\n end", "def process_primary_files_with_changes_only\n # We get the diff only so that we know which files have changed.\n # It's ok to use the reference commits because we're dealing with\n # content AT files only.\n diff = @repository.diff(@from_git_commit, @to_git_commit, context_lines: 0)\n fwc = []\n diff.patches.each { |patch|\n file_name = patch.delta.old_file[:path]\n # Skip non content_at files\n next if !@file_list.include?(file_name)\n # next if !file_name.index('63-0728')\n unless file_name =~ /\\/content\\/.+\\d{4}\\.at\\z/\n raise \"shouldn't get here: #{ file_name.inspect }\"\n end\n\n @logger.info(\" - process #{ file_name }\")\n\n absolute_file_path = File.join(@repository.base_dir, file_name)\n # Initialize content AT file `to` with contents as of `to_git_commit`.\n # It's fine to use the reference sync commit as the sync operation\n # doesn't touch content AT files, only STM CSV ones.\n content_at_file_to = Repositext::RFile::ContentAt.new(\n '_', # Contents are initialized later via `#as_of_git_commit`\n @language,\n absolute_file_path,\n @any_content_type\n ).as_of_git_commit(@to_git_commit)\n\n compute_st_ops_attrs = {\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n prev_last_operation_id: @prev_last_operation_id,\n execution_context: @execution_context,\n }\n\n compute_st_ops_attrs = refine_compute_st_ops_attrs(\n compute_st_ops_attrs,\n {\n from_table_release_version: @from_table_release_version,\n to_table_release_version: @to_table_release_version,\n absolute_file_path: absolute_file_path\n }\n )\n soff = SubtitleOperationsForFile.new(\n content_at_file_to,\n @repository.base_dir,\n compute_st_ops_attrs\n ).compute\n\n if soff.operations.any?\n # Only collect files that have subtitle operations\n @prev_last_operation_id = soff.last_operation_id\n fwc << soff\n end\n }\n\n # Then we add any files that have st_sync_required set to true and are\n # not in fwc already.\n @file_list.each { |content_at_filename|\n # Skip files that we have captured already\n next if fwc.any? { |soff| soff.content_at_file.repo_relative_path == content_at_filename }\n # Skip files that don't have st_sync_required set to true at to_git_commit\n dj_filename = content_at_filename.sub(/\\.at\\z/, '.data.json')\n # We use dj file contents at to_git_commit :at_child_or_ref\n dj_file = Repositext::RFile::DataJson.new(\n '_', # Contents are initialized later via #as_of_git_commit\n @language,\n dj_filename,\n @any_content_type\n ).as_of_git_commit(\n @to_git_commit,\n :at_child_or_ref\n )\n next if(dj_file.nil? || !dj_file.read_data['st_sync_required'])\n # This file is not in the list of fwc yet, and it has st_sync_required.\n # We add an soff instance with no operations. This could be a file\n # that has changes to subtitle timeslices only.\n content_at_file_from = Repositext::RFile::ContentAt.new(\n '_', # Contents are initialized later via `#as_of_git_commit`\n @language,\n content_at_filename,\n @any_content_type\n ).as_of_git_commit(@from_git_commit)\n soff = Repositext::Subtitle::OperationsForFile.new(\n content_at_file_from,\n {\n file_path: content_at_file_from.repo_relative_path,\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n },\n [] # No operations\n )\n fwc << soff\n }\n # Return list of unique files with changes\n fwc.uniq\n end", "def perform_after_commit\n bm_after_commit('Efs::TwitterUser.import_from!') do\n Efs::TwitterUser.import_from!(id, uid, screen_name, profile_text, @reserved_friend_uids, @reserved_follower_uids)\n end\n\n bm_after_commit('InMemory::TwitterUser.import_from') do\n InMemory::TwitterUser.import_from(id, uid, screen_name, profile_text, @reserved_friend_uids, @reserved_follower_uids)\n end\n\n bm_after_commit('S3::Friendship.import_from!') do\n S3::Friendship.import_from!(id, uid, screen_name, @reserved_friend_uids, async: true)\n end\n\n bm_after_commit('S3::Followership.import_from!') do\n S3::Followership.import_from!(id, uid, screen_name, @reserved_follower_uids, async: true)\n end\n\n bm_after_commit('S3::Profile.import_from!') do\n S3::Profile.import_from!(id, uid, screen_name, profile_text, async: true)\n end\n\n status_tweets = @reserved_statuses.map { |t| t.slice(:uid, :screen_name, :raw_attrs_text) }\n favorite_tweets = @reserved_favorites.map { |t| t.slice(:uid, :screen_name, :raw_attrs_text) }\n mention_tweets = @reserved_mentions.map { |t| t.slice(:uid, :screen_name, :raw_attrs_text) }\n\n # S3\n\n bm_after_commit('S3::StatusTweet.import_from!') do\n S3::StatusTweet.import_from!(uid, screen_name, status_tweets)\n end\n\n bm_after_commit('S3::FavoriteTweet.import_from!') do\n S3::FavoriteTweet.import_from!(uid, screen_name, favorite_tweets)\n end\n\n bm_after_commit('S3::MentionTweet.import_from!') do\n S3::MentionTweet.import_from!(uid, screen_name, mention_tweets)\n end\n\n # EFS (Automatically deleted)\n\n # bm_after_commit('Efs::StatusTweet.import_from!') do\n # Efs::StatusTweet.import_from!(uid, screen_name, status_tweets)\n # end\n #\n # bm_after_commit('Efs::FavoriteTweet.import_from!') do\n # Efs::FavoriteTweet.import_from!(uid, screen_name, favorite_tweets)\n # end\n #\n # bm_after_commit('Efs::MentionTweet.import_from!') do\n # Efs::MentionTweet.import_from!(uid, screen_name, mention_tweets)\n # end\n\n # In memory (Automatically deleted)\n\n bm_after_commit('InMemory::StatusTweet.import_from') do\n InMemory::StatusTweet.import_from(uid, status_tweets)\n end\n\n bm_after_commit('InMemory::FavoriteTweet.import_from') do\n InMemory::FavoriteTweet.import_from(uid, favorite_tweets)\n end\n\n bm_after_commit('InMemory::MentionTweet.import_from') do\n InMemory::MentionTweet.import_from(uid, mention_tweets)\n end\n end", "def mass_import(rows)\n self.import([:id, :value], rows, validate: false, timestamps: false)\n end", "def import\n if params[:commit] == 'Cancel'\n session[:people_file_path] = nil\n redirect_to(:action => 'index')\n\n elsif params[:commit] == 'Import'\n Duplicate.delete_all\n path = session[:people_file_path]\n if path.blank?\n flash[:warn] = \"No import file\"\n return redirect_to(admin_people_path)\n end\n \n people_file = PeopleFile.new(File.new(path))\n people_file.import(params[:update_membership], params[:year])\n flash[:notice] = \"Imported #{pluralize(people_file.created, 'new person')} and updated #{pluralize(people_file.updated, 'existing person')}\"\n session[:people_file_path] = nil\n if people_file.duplicates.empty?\n redirect_to admin_people_path\n else\n flash[:warn] = 'Some names in the import file already exist more than once. Match with an existing person or create a new person with the same name.'\n redirect_to duplicates_admin_people_path\n end\n expire_cache\n\n else\n raise \"Expected 'Import' or 'Cancel'\"\n end\n end", "def process_fnz_imports\n ProductImporter.create(import: @import)\n SaleImporter.create(import: @import)\n MembershipImporter.create(import: @import)\n InstallmentImporter.create(import: @import)\n end", "def load_imports\n while fn = @pending_imports.shift\n next if @imported.member?(fn)\n if fn_task = lookup(fn)\n fn_task.invoke\n end\n load!(fn)\n @imported << fn\n end\n end", "def changes_from_template\n changes_from_document(template, false)\n end", "def import_all(path, caller_location = caller(1..1).first)\n Modulation.import_all(path, caller_location)\n end", "def changes_from_clone\n changes_from_document(clone_source, true)\n end", "def importx(file, name, attr=nil)\n\n case File.extname(file)\n when '.csv' then spreadsheet = Roo::Csv.new(file) #, nil, :ignore)\n when '.xls' then spreadsheet = Roo::Excel.new(file, nil, :ignore)\n when '.xlsx' then spreadsheet = Roo::Excelx.new(file) #, nil, :ignore)\n else raise \"Unknown file type: #{file}\"\n end\n\n if name != 'ApplicationRecord'\n begin\n spreadsheet.default_sheet = name\n rescue\n raise \"ya, you're gonna need a spreadsheet tab labeled '#{name}' for this to work\\r\\n\"\n end\n end\n model = name.constantize\n header = spreadsheet.row(1)\n types = spreadsheet.row(2)\n\n #print \"file=#{file}, model=#{model} name=#{name} header=#{header} def=#{spreadsheet.default_sheet}\\n\"\n\n # @todo WISE!! restrict accessible columns for import\n attr = attr.map { |str| str.to_s} if !attr.nil?\n (3..spreadsheet.last_row).each do |i|\n row = Hash[[header, spreadsheet.row(i)].transpose]\n begin\n item = model.find_by_id(row['id']) || model.new\n rescue\n print \"ya, you're gonna need a dB table '#{model.name.downcase.pluralize}' for this to work\\r\\n\"\n exit\n end\n\n item.attributes = attr.nil? ? row : row.to_hash.slice(*attr)\n item.attributes['password'] = item.attributes['password'].to_s if spreadsheet.default_sheet == 'User'\n item.save!\n end\n\n begin\n name = model.name.underscore.pluralize\n result = model.maximum(:id).next\n cmd = \"ALTER SEQUENCE #{name}_id_seq RESTART WITH #{result}\"\n ActiveRecord::Base.connection.execute(cmd)\n puts \"#{spreadsheet.last_row-2} records imported into #{model.name}, #{name}_id_seq=#{result}\"\n rescue\n puts \"Warning: not procesing table #{name.name}. Id is missing?\"\n end\n\n spreadsheet.last_row-2 # this is how many rows we imported\n end", "def replaced_files; end", "def import\n gitpath_import = params['gitpath'] ;\n params['gitpath'] = params['gitpath'].sub(/^.*:[0-9]+/, '') ;\n end", "def import(another)\n merge! configs.import(another)\n end", "def import_exe execution\n raise \"import_exe must be redefined in children classes\"\n end", "def run_on_change(paths)\n UI.info \"Functions have changed, copying over\"\n ::Forge::Guard.builder.clean_functions\n ::Forge::Guard.builder.copy_functions\n ::Forge::Guard.builder.clean_includes\n ::Forge::Guard.builder.copy_includes\n end", "def altered_files\n raise NotImplementedError.new(\"altered_files() must be implemented by subclasses of AbstractChangeset.\")\n end", "def set_doe_util_changes\n\n # there is no bldg_id column for sca projects\n buildings = self.school_buildings\n\n buildings_ids_array = buildings.map {|b| b['bldg_id']}.uniq\n\n doe_significant_utilization_changes = CeqrData::DoeSignificantUtilizationChanges.version(\n data_package.table_for(\"doe_significant_utilization_changes\")\n ).doe_util_changes_matching_with_building_ids(buildings_ids_array)\n\n self.doe_util_changes = doe_significant_utilization_changes.map do |d|\n {\n url: d[:url],\n title: d[:title],\n org_id: d[:org_id],\n bldg_id: d[:bldg_id],\n vote_date: d[:vote_date],\n at_scale_year: d[:at_scale_year],\n at_scale_enroll: d[:at_scale_enroll],\n bldg_id_additional: d[:bldg_id_additional]\n }\n end\nend", "def perform(bulk_action_id, params)\n super\n csv = CSV.parse(params[:csv_file], headers: true)\n with_csv_items(csv, name: \"Import descriptive metadata\", filename: params[:csv_filename]) do |cocina_object, csv_row, success, failure|\n next failure.call(\"Not authorized\") unless ability.can?(:update, cocina_object)\n\n DescriptionImport.import(csv_row:)\n .bind { |description| validate_input(cocina_object, description) }\n .bind { |description| validate_changed(cocina_object, description) }\n .bind { |description| open_version(cocina_object, description) }\n .bind { |description, new_cocina_object| save(new_cocina_object, description) }\n .bind { |new_cocina_object| close_version(new_cocina_object) }\n .either(\n ->(_updated) { success.call(\"Successfully updated\") },\n ->(messages) { failure.call(messages.to_sentence) }\n )\n end\n end", "def load_imports\n while fn = @pending_imports.shift\n next if @imported.member?(fn)\n ext = File.extname(fn)\n loader = @loaders[ext] || @default_loader\n loader.load(fn)\n @imported << fn\n end\n end", "def update_extends\n extends.reject! do |ext|\n mod = ext.module\n\n !(String === mod) && @store.modules_hash[mod.full_name].nil?\n end\n\n extends.uniq!\n end", "def run_on_changes(paths)\n run_all()\n end", "def run_on_change(paths)\n end", "def update!(**args)\n @imported_libraries = args[:imported_libraries] if args.key?(:imported_libraries)\n end", "def update\n respond_to do |format|\n if @import.update_attributes(params[:import])\n format.html { redirect_to(@import,\n :notice => I18n.t('backend.actions.success_update',\n :model => I18n.t('activerecord.capitalized_models.import'))) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @import.errors, :status => :unprocessable_entity }\n end\n end\n end", "def do_feature_import(filename)\n country_type = Category.find_by_title('Nation')\n country_type_id = country_type.id\n current = 0\n feature_ids_with_changed_relations = Array.new\n feature_ids_with_object_types_added = Array.new\n puts \"#{Time.now}: Starting importation.\"\n self.do_csv_import(filename) do\n current+=1\n next unless self.get_feature(current)\n #begin\n self.add_date('features', self.feature)\n self.process_names(44)\n self.process_kmaps(15)\n feature_ids_with_object_types_added += self.process_feature_types(4)\n self.process_geocodes(4)\n feature_ids_with_changed_relations += self.process_feature_relations(15)\n self.process_contestations(3)\n self.process_shapes(3)\n self.process_descriptions(3)\n self.feature.update_attributes({:is_blank => false, :is_public => true})\n #rescue Exception => e\n # puts \"Something went wrong with feature #{self.feature.pid}!\"\n # puts e.to_s\n #end\n if self.fields.empty?\n puts \"#{Time.now}: #{self.feature.pid} processed.\"\n else\n puts \"#{Time.now}: #{self.feature.pid}: the following fields have been ignored: #{self.fields.keys.join(', ')}\"\n end\n end\n puts \"Updating cache...\"\n # running triggers on feature_relation\n feature_ids_with_changed_relations.each do |id| \n feature = Feature.find(id)\n feature.update_cached_feature_relation_categories\n feature.update_hierarchy\n end\n\n # running triggers for feature_object_type\n feature_ids_with_object_types_added.each do |id|\n feature = Feature.find(id)\n feature.update_cached_feature_relation_categories if !feature_ids_with_changed_relations.include? id\n feature.update_object_type_positions\n end\n puts \"#{Time.now}: Importation done.\"\n end", "def update_issue_with_values_from_github\n issue_importer.from_issue(prioritized_issue.issue)\n self.prioritized_issue = prioritized_issue.reload\n end", "def after_save\n df = DataFile.find_by_id(self.orig_data_file_id)\n unless df.blank?\n df.annotations.each do |a|\n a.annotatable = self\n #need to call update without callbacks, otherwise a new version is created\n a.send(:update_without_callbacks)\n\n #versions for annotations are no longer enabled in SEEK - but this code is left here incase they are re-enabled in the future.\n a.versions.each do |av|\n av.annotatable =self\n av.save\n end\n end\n end\n super\n end", "def apply_diff(diff)\n diff.deltas.each do |d|\n case d.status\n when :deleted\n remove_file(d.new_file[:path])\n File.delete(File.join(path, path))\n when :added, :modified\n add_file(d.new_file[:path])\n when :renamed\n remove_file(d.old_file[:path])\n File.delete(File.join(path, path))\n add_file(d.new_file[:path])\n else\n logger.warn(\"File has a status of #{d.status}\")\n end\n end\n end", "def import_data\n # delete all the things, for simplicity\n print 'Deleting existing data...'\n delete_data\n\n print \"Done\\nCalculating date offset...\"\n date_offset\n\n import_clients\n import_projects\n\n puts 'Creating defaults...'\n # re-create the default client and project\n default_client = Client.find_or_create(name: 'default',\n description: 'The default client')\n Project.find_or_create(name: 'default',\n client_id: default_client.id,\n description: 'The default project')\n # import the resources\n import_resources\n end", "def save_changes_from(record)\n self.save_base_attributes(record)\n if record.new_record?\n self.log_type = \"created\"\n end\n self.extract_changes_from(record)\n end", "def import_by_using_cached_keys\n CommitKeyCreator.update_key_associations @blob.keys.to_a, @commit\n end", "def import(week = GameWeek.current.week)\n importing(week) do\n client = Scout::Client.new\n\n updated_players = client.players(:start => 0)\n import_log \"updated_players: #{updated_players.size}\"\n\n lookup = all.inject({}) do |id_to_player, player|\n id_to_player[player.yahoo_key] = player\n id_to_player\n end\n\n import_log \"existing players: #{lookup.keys.size}\"\n\n players_to_save = updated_players.map do |updated_player|\n if existing_player = lookup[updated_player.player_key]\n existing_player.attributes = Player.attributes_from_payload(updated_player)\n if existing_player.changed?\n existing_player\n else\n nil\n end\n else\n Player.from_payload(updated_player)\n end\n end.compact\n\n import_log \"players_to_save: #{players_to_save.size}\"\n players_to_save.each(&:save)\n end\n end", "def import\n att_file_name = File.join(@dir, \"attendance_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.csv\")\n enr_file_name = File.join(@dir, \"enrollment_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.csv\")\n ili_file_name = File.join(@dir, \"ili_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.csv\")\n EnrollmentImporter.new(@enroll_file).import_csv unless @enroll_file.blank?\n AttendanceImporter.new(@attendance_file).import_csv unless @attendance_file.blank?\n IliImporter.new(@ili_file).import_csv unless @ili_file.blank?\n File.rename(@enroll_file, enr_file_name) unless @enroll_file.blank?\n File.rename(@attendance_file, att_file_name) unless @attendance_file.blank?\n File.rename(@ili_file, ili_file_name) unless @ili_file.blank?\n FileUtils.mv(enr_file_name, File.join(@dir, \"archive\")) unless @enroll_file.blank?\n FileUtils.mv(att_file_name, File.join(@dir, \"archive\")) unless @attendance_file.blank?\n FileUtils.mv(ili_file_name, File.join(@dir, \"archive\")) unless @ili_file.blank?\n end", "def import\n update_attribute(:published_at, Time.now)\n @tyra = Tyra.new(0)\n @tyra.import({ \"meta\" => metadata, \"data\" => data })\n end", "def import\n scan_files\n # import non-imported files\n\tto_be_executed = Execution.where(:passerelle_id => @passerelle.id, :statut => \"nex\").order('created_at')\n\tto_be_executed.each{ |execution|\n\t\texecution.statut = \"ece\" #note : En Cours d'Execution\n\t\texecution.save!\n\t}\n\tto_be_executed.each{ |execution|\n\t\n\t\n\tbegin\n\t import_exe execution\n\t statut = \"ok\"\n\trescue Exception => e\n\t\t @rapport_import << \"Fail<\\br>\"\n\t\t @rapport_import << \"Error message => : #{e.message}<\\br>\"\n\t\t @rapport_import << \"Error backtrace => #{e.backtrace}<\\br>\"\n\t\t Logger.send(\"warn\",\"[Passerelle] Import FAIL !\")\n\t\t Logger.send(\"warn\",\"[Passerelle] Rapport : #{@rapport_import}\")\n\t\t statut = \"err\"\n\tend\n\t\t\n\t\texe_to_save = Execution.find execution.id\n\t\texe_to_save.statut = statut\n\t\texe_to_save.description = @result[:description]\n\t\texe_to_save.save!\n\t}\n @passerelle.updated_at = DateTime.now\n @passerelle.save!\n\t\n\tres = Hash.new\n\tres[\"updated\"] = true\n\t# res[\"message\"] = \"desc\"\n\t\n\treturn res\n end" ]
[ "0.652848", "0.6454858", "0.6441292", "0.6432445", "0.6432445", "0.6432445", "0.6432445", "0.6399303", "0.6398597", "0.6259397", "0.62538636", "0.62201315", "0.59568655", "0.59442264", "0.58364415", "0.58067614", "0.5786837", "0.57164264", "0.5630557", "0.5605964", "0.56007123", "0.5540974", "0.55386007", "0.5527673", "0.5527595", "0.5498011", "0.5479051", "0.54657876", "0.54485774", "0.54464084", "0.54433846", "0.5423573", "0.5417106", "0.53904545", "0.5387955", "0.5387955", "0.5357313", "0.535654", "0.5356349", "0.53450745", "0.5339573", "0.53153646", "0.530536", "0.5300907", "0.5296099", "0.5294123", "0.52802795", "0.52498055", "0.5248821", "0.5247604", "0.5244711", "0.52325004", "0.520416", "0.5199412", "0.51946557", "0.5192787", "0.51741105", "0.5168221", "0.51596254", "0.51596254", "0.51593643", "0.5159054", "0.51477605", "0.51324964", "0.511932", "0.5116778", "0.51127887", "0.51118284", "0.5110178", "0.51077956", "0.51043004", "0.5104058", "0.51015204", "0.5096858", "0.5096626", "0.5095142", "0.50940937", "0.507605", "0.5075923", "0.50701183", "0.5068038", "0.5062639", "0.506251", "0.5055485", "0.5054526", "0.5038038", "0.502835", "0.5027844", "0.5024642", "0.5008033", "0.5003811", "0.4997879", "0.49797317", "0.49785864", "0.49752071", "0.497332", "0.4972419", "0.49664256", "0.49626493" ]
0.6985719
1
Use callbacks to share common setup or constraints between actions.
def set_manager_hour @manager_hour = ManagerHour.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def manager_hour_params params.fetch(:manager_hour, {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def 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 special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
puts " "4 + ""1 + " "2 + ""1 puts " "3 + ""2 + " "2 + ""2 puts " "2 + ""3 + " "2 + ""3 puts " "1 + ""4 + " "2 + ""4 puts " "0 + ""5 + " "2 + ""5 end pyramid
def pyramid(height) level = 1 height.times do puts " "*(height-level) + "#"*level + " "*2 + "#"*level level += 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pyramid(height)\n height.times do |n|\n print ' ' * (height - n)\n puts '#' * (2 * n + 1)\n end\n\nend", "def pyramid(n)\n count = 1\n n.times do\n puts (\" \" * (n - count)) + (\"#\" * count)\n count += 1\n end\nend", "def wtf_pyramid\n\tputs \"*\" * 50\n\tputs\"Salut, Bienvenue dans ma super pyramide\"\n\tputs \"Nous allons construire une moitié d'une pyramide\"\n\tputs \"Combien d'etage veux-tu?\"\n\tprint \"||>\"\n\n\tetage = 0\n\n\twhile etage % 2 == 0\n\t\tputs \"Veuiller saisir un nombre impaire :\"\n\t\tprint \"||>\"\n\t\tetage = gets.chomp.to_i \n\tend\n\n\tputs \" Voici la pyramide :\"\n\n\tbase = etage + (etage-1)\n base1 = (base-1)/2 + 1\n base2 = (etage+1)/2\n base3 = (etage-1)/2\n i = 1\n\n # Pyramide d'en haut\n\tbase2.times do \n\n\t\tbase1.times do\n\t\t\tprint \" \"\n\t\tend\n\n\t\ti.times do\n\t\t\tprint \"#\"\n\t\tend\n\n\t\ti+= 2\n\t\tbase1 -= 1\n\t\tputs \" \"\n\n\tend\n\n\t# pyramide d'en bas\n\ti-= 2\n\tbase1 += 1\n\n\tbase3.times do\n\n\t\tbase1 += 1\n\t\ti-= 2\n\n\t\tbase1.times do\n\t\t\tprint \" \"\n\t\tend\n\n\t\ti.times do\n\t\t\tprint \"#\"\n\t\tend\n\n\t\tputs \" \"\n\n\tend\t\nend", "def pyramid(a)\n b = a\n for num in 1..a\n puts (\" \" * (b - 1)) + (\"*\" * (num * 2 - 1))\n b -= 1\n end\nend", "def full_pyramid\n\n#On salut notre visiteur\n\tputs \"Salut, bienvenue dans ma super pyramide ! Combien d'etages veux-tu ?\"\n\tprint \"> \"\n\n#On demande le nombre d'étages\n\tsteps = gets.chomp.to_i\n\n#On affiche la pyramide\n\tputs \"Voici la pyramide :\"\n\tsteps.times do |i|\n\tputs \" \" * (steps - ( i + 1 )) + \"#\" * ( 2 * i + 1) + \" \" * (steps - ( i + 1 ))\nend\nend", "def wtf_pyramid\n\n#On salut notre visiteur\n\tputs \"Salut, bienvenue dans ma super pyramide ! Combien d'etages veux-tu ?\"\n\tprint \"> \"\n\n#On demande le nombre d'étages\n\tsteps = gets.chomp.to_i\n\n#On teste si le nombre est pair\n\tif steps % 2 != 0\n\n#S'il est impair, on affiche la pyramide \n\t\tputs \"Voici la pyramide :\"\n\t\t\tsteps.times do |i|\n\n#Partie haute du losange\n\t\t\t\tif i < steps / 2 \n\t\t\t\tputs \" \" * (steps - ( i + 1 )) + \"#\" * ( 2 * i + 1) + \" \" * (steps - ( i + 1 ))\n\n#Partie basse du losange\n\t\t\t\telse \n\t\t\t\tputs \" \" * i + \"#\" * (2 *steps - (2 *i + 1)) + \" \" * i\n\t\t\t\tend\n\t\t\tend\n\n#S'il est pair, on envoie l'utilisateur bouler\n\telse \n\t\tputs \"NON NON! Tu dois saisir un nombre impair, donc tu dégages et tu relances le programme !\"\n\tend\nend", "def print_horizontal_pyramid(height)\ni=1\nk=height\nt=height\n\ni.upto(k) do\n t.times do\n print ' '\n end\n\n (2 * i - 1).times do\n print '*'\n end\n\n print \"\\n\"\n\n t -= 1\n i += 1\nend\nend", "def wtf_pyramid ###\n\tputs \"Je re-pète...ça pue ! Est-ce que la blanquette est bonne ?\" #####\n\tprint \"> \" ###\n\t\tblank = gets.chomp #Cess64 touch # \n\n\tputs \"Ok, ici Ramses bis, moi je construis des pyramides impaires, parce qu'il faut tuer le pair !! Combien d'étages tu veux ??!\"\n\tprint \"> \" \n\tnumber = gets.chomp.to_i\n\n \tvar = \"#\"\n \tspace = \" \"\n \tnlos = ((number - 1) / 2 ) # je vais diviser le problème entre les deux parties du losange, séparée par un ligne full #\n\n\tif number - ((number / 2) + (number / 2)) != 1 #si t'es pair, met toi au vert !! et pas au verre...\n\t\t\tputs \"T'as cru que tu pouvais prendre Ramsès Bis le Barge pour un pigeon ? QU'ON LUI COUPE LA TETE !!!!!\"\n\n\telse\n\t\t\t\n\t\tfor n in (1..number)\n\t\t\tif (n <= nlos + 1)\n \t\t\t\t[n].each do\n \t\t\t\tputs space * ((number - ((n *2) - 1)) / 2) + var * ((n *2) - 1) + space * ((number - ((n *2) - 1)) / 2) end\n \t\tend\n \t\t\t\t\n \t\t\t\n \t\t\tif(n >= nlos + 2)\n \t\t\t\t[n].each do\n \t\t\t\tputs space * (n - (nlos + 1)) + var * (((number - n) * 2) + 1) + space * (n - (nlos + 1)) end\n \t\t\tend\t\n \t\tend\n \tend\nend", "def full_pyramid\n puts \"Salut, bienvenue dans ma super pyramide! Combien d'étages veux-tu ?\"\n print \">\"\n nbr_etages = gets.chomp.to_i\n while nbr_etages < 1 || nbr_etages > 25\n puts \"Entre un nombre compris entre 1 et 25\"\n print \">\"\n nbr_etages = gets.chomp.to_i\n end\n\n a=\"#\"\n b=\" \"\n count=0\n puts \"Voici la pyramide:\"\n nbr_etages.times do\n count=count+1\n c= nbr_etages - count\n d= b*c + a*(count-1)\n e= a*(count-1) + b*c\n puts d + a + e\n end\nend", "def print_horizontal_pyramid(height)\n n = 1\n h = height\n (1..height).each do |i|\n space = \" \"\n star = \"*\"\n print space * h + star * n\n n = n+2\n h = h-1\n print \"\\n\"\n end\nend", "def pyramid\r\n upper_level = \"1\"\r\n triangle = [upper_level]\r\n 40.times do\r\n triangle << upper_level = lower_level(upper_level)\r\n end\r\n triangle\r\nend", "def print_horizontal_pyramid(height)\n\n (1..height).each do |i|\n spaces = height - i\n stars = (2 * i) - 1\n\n spaces.times { print \" \"}\n stars.times { print \"*\"}\n spaces.times { print \" \"}\n print \"\\n\"\nend\nend", "def full_pyramid\n\n\tputs \"Salut bienvenue dans ma super pyramide ! Combien d'étages veux-tu ?\"\n\tprint \">\"\n\n\tnumber_of_floors = gets.to_i \n\t# fonctionne également avec gets.chomp.to_i\n\n\n\tputs \"Voici la pyramide :\"\n\t\n\t#Condition sur le nombre d'étages de la pyramide qui ne peux excéder 25\n\tif number_of_floors < 26\n\t\tnumber_of_floors.times do |i|\n\t\tblankspace = \" \" * (number_of_floors - (i + 1))\n\t\thastag = \"#\" * (2*i+1)\n\t\tputs \"#{blankspace}#{hastag}\"\n\tend\n\n\telse \n\t\tputs \"Désolé mais une pyramide ne peut avoir que 25 étages maximum.\"\n\tend \n\nend", "def half_pyramid\n puts \"entrer un nombre d'etage de votre choix\"\n nombre = gets.chomp.to_i\n nombre += 1\n\n nombre.times do |j|\n has = \"# \"\n puts \" #{has*=j}\"\n \n end\nend", "def print_horizontal_pyramid(height)\n num_spaces = height - 1 #keeps track of the number of spaces to print before\n # each row of the pyramid\n num_asterisks = 1 #keeps track of the number of asterisks to print\n\n (1..height).each do |i| #prints each row of the pyramid\n print \" \" * num_spaces\n print \"*\" * num_asterisks\n\n print \"\\n\"\n num_spaces -= 1 #adjusts the number of spaces and asterisks\n num_asterisks += 2 # for the next row of the pyramid\n end\nend", "def wtf_pyramid\n\n\tsymbole = \"#\"\n\tcompteur = 1\n\tputs \"Salut, bienvenue dans ma wtf_pyramid ! Combien d'étages veux-tu ?\"\n\tprint \"(entre 1 et 25!) >\"\n\tinput = gets.to_i\n\tinputt = (input/2)+1\n\tinputb = (input/2)\n\n\t\tif input %2 == 0\n\t\t\tthen\n\t\t\tputs \"\"\n\t\t\tputs \"#############################################\"\n\t\t\tputs \"# Un nombre impair s'il te plait !!!! >:( #\"\n\t\t\tputs \"#############################################\"\n\t\t\tputs \"\"\n\t\t\tperform\n\t\telse\n\t\t\tputs \"Voici la pyramide:\"\n\t\t\t#input top pour pyramid du haut\n\t\t\tinputt.times do\n\t\t\t\tputs (symbole * compteur).center(input)\n\t\t\t\tcompteur = compteur + 2\n\t\t\tend\n\t\t\t\n\t\t\t#reset compteur\n\t\t\tcompteur = compteur - 4\n\t\t\t\n\t\t\t#input bottom pour pyramid du haut\n\t\t\tinputb.times do\n\t\t\t\tputs (symbole * compteur).center(input)\n\t\t\t\tcompteur = compteur - 2\n\t\t\tend\n\t\tend\nend", "def half_pyramid\n\n puts \"Salut, bienvenue dans ma super pyramide ! Combien d'étages veux-tu ? \"\n\n nombre= gets.chomp.to_i\n\n #permet de donner une fin à la boucle\n i=0\n #coefficient multiplicateur de #\n f=0\n space=\" \"\n #espacement\n g=nombre\n char=\"#\"\n\n puts \"Voici la pyramide :\"\n #bonus si >25 se comporte comme 25\n if (nombre>25)\n nombre=25\n end\n #crée une pyramide seulement de 1 à 25 étages\n if(nombre<=25 && nombre>=1)\n\n\n while (nombre!=i)\n\n nombre=nombre-1\n f=f+1\n g=g-1\n\n puts space*g+char*f\n\n end\n end\n\n end", "def full_pyramide\n\tputs \"*\" * 50\n\tputs\"Salut, Bienvenue dans ma pyramide\"\n\tputs \"Nous allons construire une pyramide au temps d'Egypte\"\n\tputs \"VCombien d'etage veux-tu?\"\n\tprint \"||>\"\n\n\tetage = gets.chomp.to_i\n\tbase = etage + (etage-1)\n\tbase1 = (base-1)/2 + 1\n i = 1\n \n\tetage.times do \n\n\t\tbase1.times do\n\t\t\tprint \" \"\n\t\tend\n\n\t\ti.times do\n\t\t\tprint \"#\"\n\t\tend\n\n\t\ti+= 2\n\t\tbase1 -= 1\n\t\tputs \" \"\n\tend\n\t\nend", "def wtf_pyramid\n\n\t# Divide by 2 the number input to build the top of the pyramid\n\t$top = ($etages / 2)\n\n\ti = 1\n\tk = $top\n\tt = k + 5\n\n\t# Construct the pyramid from the top to the bottom\n\ti.upto(k) do t.times do\n\t \t\t\t\t\tprint ' '\n\t \t\t\t\t\t end\n\n\t # Print the *\n\t (2 * i - 1).times do\n\t\t\t\t\t\t print '*'\n\t\t\t\t\t\tend\n\t # Return the line for the next stair\n\t print \"\\n\"\n\n\t t -= 1\n\t i += 1\n\t end\n\n\t# Diff the number of stairs with the result above\n\t$bottom = ($etages - $top)\n\n\ti = $bottom\n\tk = 1\n\tt = 5\n\n\t# Construct the pyramid from the bottom to the top\n\ti.downto(k) do t.times do \n\t\t\t\t\t\t\t\tprint ' ' \n\t\t\t\t\t\t end\n\n\t # Print the *\n\t (2 * i - 1).times do \n\t \t\t\t\t\t\t\tprint '*'\n\t \t\t\t\t\tend\n\t \n\t # Return the line for the next stair\n\t print \"\\n\"\n\n\t t += 1\n\t i -= 1\n\tend\nend", "def pyramid(grid)\n puts grid.split(\"\\n\").map { |e| e.split(' ').map { |f| f.to_i } }.flatten.reduce { | sum, num | sum + num }\nend", "def pyramid(n)\n arr = Array.new(n)\n\n for i in 0..arr.length-1\n arr[i] = Array.new(n)\n end\n\n for y in 0..n/2\n if y == n/2\n if arr[y][y] == nil?\n arr[y][y] = y+1\n end\n break\n end\n for x in y..n-2-y\n arr[y][x] = y+1\n arr[x][n-1-y] = y+1\n arr[n-1-y][n-1-y-x] = y+1\n arr[n-1-y-x][y] = y+1\n end\n end\n\n for a in 0..arr.length-1\n for b in 0..arr[a].length-1\n print \"[#{arr[a][b]}]\"\n end\n print \"\\n\"\n end\n\n return arr\nend", "def pyramid(num, row = 0, level = '')\n return if num === row\n\n if 2 * num - 1 === level.length\n puts level\n return pyramid(num, row + 1)\n end\n\n mid_point = (2 * num - 1) / 2\n if mid_point - row <= level.length && mid_point + row >= level.length\n level += '#'\n else\n level += ' '\n end\n\n pyramid(num, row, level)\nend", "def diamond_outline(num)\n puts ''\n outer_spacer = num / 2\n inner_spacer = 0\n lines = 0\n while lines < num / 2\n if outer_spacer == num / 2\n puts ' ' * outer_spacer + '*'\n inner_spacer += 1\n else\n unless outer_spacer < 0\n puts ' ' * outer_spacer + '*' + ' ' * inner_spacer + '*'\n inner_spacer += 2\n end\n end\n outer_spacer -= 1\n lines += 1\n end\n while lines < num\n if outer_spacer < num / 2\n puts ' ' * outer_spacer + '*' + ' ' * inner_spacer + '*'\n inner_spacer -= 2\n else\n puts ' ' * outer_spacer + '*'\n inner_spacer -= 1\n end\n outer_spacer += 1\n lines += 1\n end\n puts ''\nend", "def pyramid(layers)\r\n upper_layer = \"1\"\r\n tower = [\"1\"]\r\n layers.times do\r\n tower << upper_layer = lower_layer(upper_layer)\r\n end\r\n tower\r\nend", "def full_pyramid\n puts \"Salut, bienvenue dans ma super pyramide ! Combien d'étages veux-tu ?\"\n\n @nombre = gets.chomp.to_i\n @nombre = @nombre + 1 #formule pour le nombre d'etage\n base()\nend", "def full_pyramide\n\tputs \"salut!bienvenue dans ma super pyramide!combien d'etage veux-tu?\"\n\ti=1 #1 zany n anombohan le i\n\tprint \">\"\n\tn= gets.chomp.to_i #n correspond le nbre de ligne de la pyramide\n\tputs\"voici la pyramide\"\n\tx=n #nbre de depart anle espace\n\tspace=\" \" #mamaritra n espace\n\twhile i<=n do #tant que i est inferieur ou egal n fait\n\tputs ((space * x)+(\"#\" * (i*2-1))) #rehefa te hahazo chiffre impaire de (i*2-1)\n\tx-=1\n\ti+=1\n\tend\nend", "def pyramid_sum(base)\n\nend", "def ne(length_of_sides)\n spaces = length_of_sides\n accum_num = length_of_sides\n length_of_sides.times do\n puts \"#{' ' * (spaces - accum_num)}#{'*' * accum_num}\"\n accum_num -= 1\n end\nend", "def pyramid(numbers)\n newArr = []\n return newArr if numbers == 0\n count = 1\n numbers.times {\n innerArrs = []\n count.times {\n innerArrs.push(1)\n }\n newArr.push(innerArrs)\n count += 1\n }\n return newArr\nend", "def roll_four_alt\n puts \"...........\n: * * :\n: :\n: * * :\n'''''''''''\n\"\nend", "def roll_five_alt\n puts \"...........\n: * * :\n: * :\n: * * :\n'''''''''''\n\"\nend", "def diamonds(int)\n counter = 1\n until counter == int\n space_string = ((int - counter) / 2)\n puts \"#{' ' * space_string}#{'*' * counter}#{' ' * space_string}\"\n counter += 2\n end\n puts \"#{'*' * counter}\"\n until counter == 1\n counter -= 2\n space_string = ((int - counter) / 2)\n puts \"#{' ' * space_string}#{'*' * counter}#{' ' * space_string}\"\n end\nend", "def reduce_pyramid(pyramid)\n #your code here\nend", "def triangle(length_of_sides)\n spaces = length_of_sides\n accum_num = 1\n length_of_sides.times do\n puts \"#{' ' * (spaces - accum_num)}#{'*' * accum_num}\"\n accum_num += 1\n end\nend", "def triangle(n)\n stars = 1\n spaces = n-1\n n.times do |_|\n puts ( \" \" * spaces) + (\"*\" * stars)\n stars += 1\n spaces -= 1\n end\nend", "def roll_six_alt\n puts \"...........\n: * * :\n: * * :\n: * * :\n'''''''''''\n\"\nend", "def yummie(n)\r\n\r\n print \"(\"\r\n (1..n).each{\r\n print \" \"\r\n }\r\n print \".\"\r\n (1..n).each{\r\n print \" \"\r\n }\r\n print \"v\"\r\n (1..n).each{\r\n print \" \"\r\n }\r\n print \".\"\r\n (1..n).each{\r\n print \" \"\r\n }\r\n print \")\"\r\n\r\nend", "def triangle(length_of_sides)\n spaces = length_of_sides\n accum_num = length_of_sides\n length_of_sides.times do\n puts \"#{' ' * (spaces - accum_num)}#{'*' * accum_num}\"\n accum_num -= 1\n end\nend", "def ex1\n for i in (0..5)\n for j in (1..(6 - i))\n print '#'\n end\n print \"\\n\"\n end\nend", "def diamond(n)\n mid = n/2\n (mid + 1).times do |i|\n puts ' '*(mid - i) + '*'*((i * 2) + 1)\n end\n (mid).times do |i|\n puts ' '*(i + 1) + '*'*(n - 2*(i+1))\n end\nend", "def triangle(num)\n spaces = num - 1\n stars = 1\n\n num.times do |n|\n puts (' ' * spaces) + ('*' * stars)\n spaces -= 1\n stars += 1\n end\n\nend", "def pyramid(n)\n outer_array = []\n 0.upto(n) do |i|\n next if i == 0\n outer_array << Array.new(i, i)\n end\n outer_array\nend", "def triangle(num)\n spaces = num - 1\n stars = 1\n\n num.times do |n|\n puts (' ' * spaces) + ('*' * stars)\n spaces -= 1\n stars += 1\n end\nend", "def triangles(n)\n space_count = n\n star_count = 1\n\n while star_count <= n\n puts \"#{' ' * space_count}#{'*' * star_count}\"\n space_count -= 1\n star_count += 1\n end\nend", "def roll_three_alt\n puts \"...........\n: * :\n: * :\n: * :\n'''''''''''\n\"\nend", "def staircase(n)\n n.times do |i|\n (n-1-i).times { |i| print ' '}\n (i+1).times { |i| print '#'}\n puts\n end\nend", "def staircase(height)\n\t(1..height).each do |i|\n \t(1..height-i).each do |j|\n \t\tprint(\" \") \n \tend\n \t(1..i).each do |k|\n \tif k == i then\n \tputs(\"#\")\n \telse\n \tprint(\"#\")\n \tend\n \tend\n\tend\nend", "def diamond(i) # I hope I didn't name my variables\n spaces_toggle = -1 # the same as the instruction\n spaces = i/2 # This is MY algorithm !\n bling_toggle = 1\n bling = 1\n (i).times do\n spaces.times {print \" \"} \n bling.times {print \"*\"}\n spaces.times {print \" \"} \n print \"\\n\"\n spaces += 1 * spaces_toggle\n bling += 2 * bling_toggle\n if bling == i # Center of function\n bling.times {print \"*\"}\n print \"\\n\"\n spaces += 1\n bling -= 2\n spaces_toggle = 1\n bling_toggle = -1\n end\n end\nend", "def horizontalSpacer(n , text)\n n.times {print \" \"}\n puts text\nend", "def display_upper_semi_diamond(n)\n left_outline = n / 2\n right_outline = left_outline\n\n (n / 2).times do\n row = ' ' * n\n row[left_outline] = '*'\n row[right_outline] = '*'\n\n puts row\n left_outline -= 1\n right_outline += 1\n end\nend", "def show\n length = @last_number.to_s.length + 1\n @spiral.each do |row|\n puts \"\\n\"\n puts row.map { |element| element.nil? ? \" \" * length : element.to_s.rjust(length, \" \") }.join(\" \")\n end\n end", "def star(n)\n outer = 0\n inner = (n-3) / 2\n\n loop do # create top\n puts \"#{\" \" * outer}*#{\" \" * inner}*#{\" \" * inner}*#{\" \" * outer}\"\n break if inner == 0\n outer += 1\n inner -= 1\n end\n\n puts \"*\" * n\n\n loop do # create bottom\n puts \"#{\" \" * outer}*#{\" \" * inner}*#{\" \" * inner}*#{\" \" * outer}\"\n break if outer == 0\n outer -= 1\n inner += 1\n end\n puts \"\"\nend", "def navidad(n)\n result = \"\"\n n.times do |ind| \n i = ind + 1 \n (n-i).times do \n result += \" \"\n end\n i.times do\n result += \"* \" \n end\n result += \"\\n\" \n end\n \n 3.times do |i|\n if i != 2\n n.times do |b|\n if (n+1)/2 == b+1\n result += \"* \"\n else\n result += \" \"\n end \n end\n result += \"\\n\"\n else\n n.times do |b| \n if ((n+1)/2)-2 == b || ((n+1)/2)-1 == b || (n+1)/2 == b\n result += \"* \"\n else\n result += \" \"\n end \n end\n end\n end \n result\nend", "def diamond(num)\n count = 1\n stars = 1\n spaces = 1\n \n loop do\n \n puts (' ' * (num - spaces)) + ('*' * stars)\n break if count == num\n \n if count <= (num / 2)\n stars += 2\n spaces +=1\n else\n stars -= 2\n spaces -= 1\n end\n \n count += 1\n end\nend", "def pyramid(numbers)\n array_of_arrays = []\n if numbers == 0 \n array_of_arrays\n end \n n = 1\n numbers.times do\n array_of_arrays << Array.new(n){1}\n n += 1\n end \n array_of_arrays\nend", "def display_board(board)\n 3.times do |i|\n 3.times do |j|\n print \" #{board[(i+j) + i*2]} #{j < 2 ? '|' : ''}\"\n end\n if i < 2\n puts \"\\n-----------\"\n end\n end\nend", "def diamond(num)\n puts \"this is a #{num} diamond!\\n\\n\"\n star_count = 1\n half_point = (num.to_f/2).floor\n 0.upto(num-1) {|n|\n if n < half_point \n puts \"#{' ' * (half_point - n)}#{'*' * star_count}\"\n star_count += 2\n elsif n == half_point\n puts \"#{'*' * star_count}\"\n star_count -= 2\n elsif n > half_point\n puts \"#{' ' * (n - half_point)}#{'*' * star_count}\"\n star_count -= 2\n end\n }\n \n \" \"\nend", "def print_spacing spaces\n spaces.times do\n puts \"\\n\"\n end\nend", "def triangle(integer)\n stars = 1\n integer.times do \n puts \" \" * (integer - stars) + (\"*\" * stars)\n stars += 1\n end\nend", "def diamond(n)\n s = \"\"\n odd_array = (1..n).select{|num| num.odd?}\n odd_array = odd_array + odd_array.reverse[1..-1]#1,3,5,7,9,7,5,3,1\n (0...n).each do |i| #0,1,2,3,4,5,6,7,8\n empty_spaces = n/2\n odd_array[i].times do |j|#1,3,5,7,9,7,5,3,1\n s = (\" \" * (empty_spaces-i).abs) + (\"*\" * (j+1)) + (\" \" * (empty_spaces-i).abs)\n end\n p s\n s=\"\"\n end\nend", "def display_board\n cell = \" \"\n divider = \"|\"\n demarcator = \"\"\n 11.times { demarcator << \"-\" }\n row = cell + divider + cell + divider + cell\n\n puts row\n puts demarcator\n puts row\n puts demarcator\n puts row\nend", "def triangle(int)\n star_chars = '*'\n int.times do\n puts star_chars.rjust(int, ' ')\n star_chars << '*'\n end\nend", "def triangle(rows)\n 1.upto(rows) { |num| puts \"#{\"*\" * num}\".rjust(rows)}\nend", "def stairs(n)\n\ttext_to_print = \"\"\n\tn.times do |line|\n\t\ttext_to_print += (\" \" * (n-1)) + (\"*\" * (n-(n-1))) \n\t\ttext_to_print << \"\\n\"\n\t\tn -= 1\n\tend\n\ttext_to_print.split(\"\\n\").each{|line| puts line}\nend", "def border(n)\r\n puts \"-\" * n\r\n end", "def triangle(num)\n 1.upto(num) { |n| puts \"#{\"*\" * n}\".rjust(num) }\nend", "def triangle(num)\n count = 1\n while count <= num do\n stars = \"*\" * count\n puts \"#{(stars.rjust(num))}\"\n count += 1\n end\nend", "def print_line(height, num)\n result = \" \" * (height - num)\n num.times do\n result += \"* \"\n end\n puts result\nend", "def space\n 3.times { puts \"\\n\"}\n end", "def print_separator\n\t40.times {print '-'}\n\tputs\nend", "def spacing\n puts \"\"\n puts \"\"\n puts \"\"\n end", "def diamond(n)\n blanks = ' ' * ((n - 1) / 2)\n stars = '*'\n \n loop do\n puts blanks + stars\n break if blanks == ''\n stars << '**'\n blanks.slice!(0)\n end\n \n loop do\n break if stars == '*'\n stars.slice!(0..1)\n blanks << ' '\n puts blanks + stars\n end\n \nend", "def diamond(num)\n\n\treturn nil if num.even? || num < 0 \n\n\todds = (1..num).to_a.select do |num|\n\t\t num.odd?\n\t\t end\n\n\tspaces = odds.length\n\n\todds.each do |num|\n\t\tspaces -= 1\n\t\tputs ' ' * spaces + '*' * num + \"\\n\"\n\tend\n\n\todds.pop\n\todds.reverse!\n\n\tspaces += 1\n\n\todds.each do |num|\n\t\tputs ' ' * spaces + '*' * num + \"\\n\"\n\t\tspaces += 1\n\tend\n\nend", "def triangle(num)\n star_count = 0\n while star_count < num\n star_count += 1\n stars = \"*\" * star_count\n puts stars.rjust(num)\n end\nend", "def triangle(int)\n for i in (0..int)\n puts (\"*\"*i).rjust(int) \n end\nend", "def star(num)\n return puts \"number should be odd and greater than 5\" if num.even? || num < 7\n lines = (num/2).times.with_object([]) do |idx, arr|\n arr << (['*'] * 3).join(' ' * idx).center(num)\n end\n puts lines.reverse, ('*' * num), lines\nend", "def draw\n puts \"* \" * @side_length\n (@side_length-2).times do # times loop will do something X number of times\n print \"*\"+(\" \"*(@side_length*2-3))+\"*\\n\"\n end\n puts \"* \" * @side_length\n end", "def diamond(num)\n stars = 1\n \n num.times do |iteration|\n puts ('*' * stars).center(num)\n iteration < num / 2 ? stars += 2 : stars -= 2\n end\nend", "def printNivel(num)\n\t\tfor i in 1..num\n\t\t\tprint \" \"\n\t\tend\n\tend", "def printboard\n puts \"-123456-\"\n j=0\n for i in (0..8)\n j=i*BRDSZ\n puts \"-\" + @board[j+0].identity + @board[j+1].identity +\n @board[j+2].identity + @board[j+3].identity +\n @board[j+4].identity + @board[j+5].identity + \"-\"\n end\n puts \"-123456-\"\n end", "def print_triangle(rows)\n n = 1\n while n <= rows\n n += 1\n x = 1\n while x < n\t\n \tprint \"*\"\n \tx += 1\n end\n puts ' '\n end \nend", "def diamond(n)\n rows = (1..n).select{ |num| num.odd? }\n rows.each { |row| puts \"#{'*' * row}\".center(n) }\n rows.reverse[1..-1].each { |row| puts \"#{'*' * row}\".center(n) }\nend", "def show_board\n \t@y.times do |y|\n \t\tputs ' '\n \t\t@x.times do |x|\n \t\t\tprint \"#{@board[y][x]} \"\n \t\tend\n \tend \n \tputs ' '\n end", "def diamond(num)\n spaces = (num - 1) / 2\n stars = 1\n\n loop do\n puts \" \"*spaces + \"*\"*stars + \" \"*spaces\n break if stars == num\n spaces -= 1\n stars += 2\n end\n\n unless stars == 1\n loop do\n stars -= 2\n spaces += 1\n puts \" \"*spaces + \"*\"*stars + \" \"*spaces\n break if stars == 1\n end\n end\nend", "def display_board\r\n divider = \"-\" *11\r\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]} \"\r\n puts divider\r\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]} \"\r\n puts divider\r\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]} \"\r\n end", "def letra_x(n)\n result = \"\" \n t = n-1\n (n).times do |i| \n n.times do |b| \n if t == b \n result += \"*\"\n elsif i == b\n result += \"*\"\n else\n result += \" \"\n end\n end \n t -= 1 \n result += \"\\n\"\n end\n result\nend", "def upside_down_triangle(n)\n triangle = []\n stars = n\n spaces = 0\n\n n.times do\n triangle << (' ' * spaces) + ('*' * stars)\n stars -= 1\n spaces += 1\n end\n\n triangle.each { |line| puts line }\nend", "def diamond(num)\n total = num\n iterator = 1\n until iterator > num\n puts \"#{\"*\" * iterator}\".center(total)\n iterator += 2\n end\n loop do\n num -= 2\n break if num < 0\n puts \"#{\"*\" * num}\".center(total)\n end\nend", "def print_separator(repetitions = 18)\n puts '-' * repetitions\nend", "def triangle(integer)\n counter = 0\n until counter > integer\n puts ('*' * counter).rjust(integer)\n counter += 1\n end\nend", "def game_board\n puts \" 1 | 2 | 3 \"\n puts \"___________\"\n puts \" 4 | 5 | 6 \"\n puts \"___________\"\n puts \" 7 | 8 | 9 \"\nend", "def sample_board\n\tputs \" 1 | 2 | 3\"\n puts \"-----------\"\n puts \" 4 | 5 | 6\"\n puts \"-----------\"\n puts \" 7 | 8 | 9\"\n\tend", "def printBoard\n\tkey = 0\n\tfor i in 1..9\n\t\tprint \"[ #{@bo[i-1]} ]\"\n\t\tif i % 3 == 0 then \n\t\t\tprint \" \"\n\t\t\t0.upto(2) do\n\t\t\t\tprint \"[ #{key} ]\"\n\t\t\t\tkey = key + 1\n\t\t\tend\n\t\t\tprint \"\\n\"\n\t\tend\n\tend\n end", "def roll_two_alt\n puts \"...........\n: * :\n: :\n: * :\n'''''''''''\n\"\nend", "def roll_four\n puts %Q{...........}\n puts %Q{: * * :}\n puts %Q{: :}\n puts %Q{: * * :}\n puts %Q{'''''''''''}\nend", "def diamond(n)\n (n / 2).downto(1) { |i| puts (\"*\" * (n - 2 * i)).center(n) }\n puts '*' * n\n 1.upto(n / 2) { |i| puts (\"*\" * (n - 2 * i)).center(n) }\nend", "def diamond(integer)\n spaces = (1..integer).step(2).to_a\n space_line = spaces.reverse\n spaces.shift\n space_line += spaces\n space_line.map! {|num| num / 2}\n\n stars = (1..integer).step(2).to_a\n star_line = stars.reverse\n star_line.shift\n star_line = stars + star_line\n\n counter = 0\n star_line.each do |element|\n line = (\"*\" * element)\n spaces = line.length + space_line[counter]\n full_line = line.rjust(spaces) + (\" \" * space_line[counter])\n puts full_line\n counter += 1\n end\nend", "def sameLineDivider(n)\n n.times {|x| print \"*\"}\nend", "def triangle(n)\n n.times{ |i| puts \"#{' ' * (n-i+1)}#{'*' * (i+1)}\" }\nend", "def triangle(number)\n number_of_spaces = number - 1\n number.times do\n puts (' ' * number_of_spaces) + ('*' * (number - number_of_spaces))\n number_of_spaces -= 1\n end\nend" ]
[ "0.86940897", "0.8581337", "0.8279244", "0.8246566", "0.8187696", "0.79911286", "0.79540455", "0.7868794", "0.78534204", "0.7844643", "0.77921313", "0.7789721", "0.7712014", "0.7622058", "0.7479663", "0.74607706", "0.7357109", "0.7329457", "0.72568244", "0.7231937", "0.71899235", "0.7093274", "0.6968546", "0.6949342", "0.6881739", "0.6815669", "0.67845875", "0.67745787", "0.67701256", "0.6764167", "0.675882", "0.67114055", "0.67049104", "0.6698526", "0.6672707", "0.6659284", "0.66465956", "0.6644411", "0.6644322", "0.6635611", "0.6623544", "0.6622168", "0.66083014", "0.6608198", "0.6602075", "0.66015327", "0.6593938", "0.6588398", "0.6562523", "0.65506625", "0.654431", "0.65397984", "0.65061903", "0.650578", "0.65052265", "0.65041536", "0.64965755", "0.64946026", "0.64870113", "0.6475109", "0.64675033", "0.6454682", "0.6422674", "0.64200187", "0.64179194", "0.64167446", "0.6416357", "0.64035857", "0.63987213", "0.63984615", "0.6395468", "0.63937324", "0.63908076", "0.63796103", "0.6377913", "0.63745165", "0.6369913", "0.63653463", "0.636431", "0.6361062", "0.63588816", "0.6355896", "0.63543624", "0.63511425", "0.6337047", "0.6335639", "0.6328815", "0.6327846", "0.6327236", "0.63246113", "0.63099796", "0.6303335", "0.63029754", "0.6302086", "0.628669", "0.62860817", "0.6280743", "0.627869", "0.62727743", "0.62700677" ]
0.87041426
0
def answer(four_colors) if four_colors == correct p 'Winner!' else p 'Try again, or press q to quit' end end
def random_colors color_array = [] 4.times {color_array.push @colors.sample} color_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boolean_answers_person(player, player_result, right_result, dsp_result)\n # condition matching the player result with right result\n if player_result == right_result\n system(\"clear\")\n view_current\n puts \"You picked: \\n#{dsp_result}\"\n puts Paint[\"Woo! Correct!\" + \" \\u{2705}\" + \" \" + \"\\u{1f600}\", :green]\n system (\"say yay\")\n player.increase_score\n @player_correct << true\n else\n system(\"clear\")\n view_current\n puts \"You picked: \\n#{dsp_result}\"\n puts Paint[\"Fail bro.\" + \" \\u{274c}\" + \" \" + \"\\u{1f625}\", :red]\n system (\"say damn\")\n @player_correct << false\n end\n end", "def player_guess\n print 'Red = 1, '.colorize(:red), 'Green = 2, '.colorize(:green), 'Blue = 3, '.colorize(:blue),\n 'Magenta = 4, '.colorize(:magenta), 'Cyan = 5, '.colorize(:cyan), \"Yellow = 6\\n\".colorize(:light_yellow)\n puts\n puts \"Select four colours or enter 's' to show previous guesses.\"\n colour_selection = gets.chomp\n if colour_selection == 's'\n show_previous_guesses\n player_guess\n elsif colour_selection.length == 4 && !colour_selection.match?(/[^123456]/)\n store_colour_selection(colour_selection)\n else\n puts 'Input four numbers (1-6)'\n player_guess\n end\n end", "def correct_answer\n puts \"Correct! You live to play another round. Your score is #{@current_player[:lives]}.\".green\nend", "def verify_guess(array)\n unless array.all?{|x| $colors_strings.include?(x)} && array.count == 4\n puts \"\\nInvalid guess\"\n guess\n end\n end", "def askGuess\n valid = false\n while (!valid)\n puts \"The choices are: #{'red'.bright_red} #{'yellow'.bright_yellow} #{'green'.green} #{'blue'.cyan} #{'orange'.red} #{'purple'.magenta};\\n\n Please enter your guess for the first color:\"\n c1 = gets.chomp \n puts \"Please enter your guess for the second color:\"\n c2 = gets.chomp\n puts \"Please enter your guess for the third color:\"\n c3 = gets.chomp\n puts \"Please enter your guess for the fourth color:\"\n c4 = gets.chomp\n if (valid?(c1) && valid?(c2) && valid?(c3) && valid?(c4))\n valid = true\n else \n puts \"\\nThere was a problem with your input. Please try again with correct input\\n\"\n end\n end\n @guess = [c1, c2, c3, c4]\n puts \"your guess was #{@guess.to_s}\"\n end", "def check_guess(guess,answer,win)\n\tif win != true #If the player has not won yet\n\t@@answer = \"X\" \n\t\tif @@turns == 0\n\t\t\t@@answer = @@secret_number\n\t\t\t@@secret_number = rand(100)\n\t\t\t@@turns = 5\n\t\t\t@@color = \"white\"\n\t\t\treturn \"GAME OVER!\"\n\t\telsif @@turns != 0\n\t\t\tif guess > 100 or guess < 0\n\t\t\t\t@@turns -= 1\n\t\t\t\treturn \"Invalid input!\"\n\t\t\telsif (guess - answer).abs <= 5 and (guess - answer).abs != 0\n\t\t\t\t@@turns -= 1\n\t\t\t\t@@color = \"#ff9999\"\n\t\t\t\treturn \"You're very close!\"\n\t\t\telsif (guess - answer).abs == 0\n\t\t\t\twin = true\n\t\t\t\t@@color = \"#b2ffb2\"\n\t\t\t\t@@answer = @@secret_number\n\t\t\t\t@@turns = 5\n\t\t\t\t@@secret_number = rand(100)\n\t\t\t\treturn \"You Won! Congrats.\"\n\t\t\telsif (guess - answer).abs <= 10\n\t\t\t\t@@turns -= 1\n\t\t\t\t@@color = \"#ff7f7f\"\n\t\t\t\treturn \"You're close!\"\n\t\t\telsif (guess - answer).abs <= 15\n\t\t\t\t@@color = \"#ff4c4c\"\n\t\t\t\t@@turns -= 1\n\t\t\t\treturn \"Not very close!\"\n\t\t\telsif (guess - answer).abs > 15\n\t\t\t\t@@color = \"#ff0000\"\n\t\t\t\t@@turns -= 1\n\t\t\t\treturn \"You're hopeless!\"\n\t\t\tend\n\t\tend\t\n\telsif win == true\t#If the player won!\n\t\t@@answer = @@secret_number\n\t\t@@secret_number = rand(100)\n\t\t@@turns = 5\n\t\treturn \"You Won!\"\n\tend\nend", "def play_game\n\t\twhile @turn < 13\n\t\t\tputs \"Lets see if you figured out my code!\"\n\t\t\tputs \"Please select four colors as your guess. They can either mix and match or all be the same\"\n\t\t\tputs \"No spaces please!\"\n\t\t\tputs \"Your choices are 'R', 'G', 'B', 'Y', 'H', 'P'.\"\n\t\t\tguess = gets.chomp.upcase\n\t\t\tfeedback = compare(guess)\n\t\t\tif feedback == [\"O\", \"O\", \"O\", \"O\"]\n\t\t\t\tputs \"~~~~~~~~~~~\"\n\t\t\t\tputs \"You won!!!!\"\n\t\t\t\tputs \"~~~~~~~~~~~\"\n\t\t\t\tputs \"You have cracked the code of #{@master_code}\"\n\t\t\t\texit\n\t\t\telse\n\t\t\t\tputs \"Sorry! Guess again\"\n\t\t\t\tputs \"Here is currently what you have right #{feedback}\"\n\t\t\t\tputs \"---------------\"\n\t\t\t\tputs \"---------------\"\n\t\t\t\t@turn += 1\n\t\t\t\tputs \"That was turn number \" + @turn.to_s\n\t\t\t\tplay_game\n\t\t\tend\n\t\t\tputs \"You reached your max of 12 turns....game over!\"\n\t\tend\n\tend", "def verify_answer(answer)\n if answer == @total.to_s\n puts \"Right!\".green\n @current_player.get_point\n else\n puts \"Wrong! The correct answer is #{@total}.\".red\n @current_player.lose_life\n end\n end", "def expect_guess\n print \"Guess ##{turn}. What's your code? \"\n input = gets.chomp\n throw :quit if input == \"q\"\n \n if valid_input? input\n self.last_guess = Code.parse(input)\n puts \"Your guess was #{last_guess}.\"\n else\n puts \"Please enter 4 valid colors.\"\n expect_guess\n end\n end", "def verify_answer(question, current_player)\n\n if question.answer == question.actual_answer\n result = \"won round\"\n current_player.score += 1\n else\n result = \"lost round\"\n current_player.score -= 1\n end\n\n result\n\nend", "def check_answer(player, other_player)\n p_answer = gets.chomp.to_i\n # If the answer is correct, message and proceed\n if p_answer == @q_answer\n puts \" \"\n puts \"✅ #{player.name}: Yes! You are correct! ✅\"\n puts \" \"\n puts \"#{player.identifier}: #{player.lives}/3 vs #{other_player.identifier}: #{other_player.lives}/3\"\n # If answer is incorrect, player either loses a life and proceeds...\n else\n if player.lives > 1\n puts \" \"\n puts \"❌ #{player.name}: That's incorrect! ❌\"\n puts \" \"\n player.lose_life\n puts \"#{player.identifier}: #{player.lives}/3 vs #{other_player.identifier}: #{other_player.lives}/3\"\n # ...Or the lose the game entirely\n else\n player.lose_life\n puts \" \"\n puts \"🏆 #{other_player.name} wins with a score of #{other_player.lives}/3 🏆\"\n puts \" \"\n puts \" ----- GAME OVER ----- \"\n puts \" \"\n puts \"Good bye!\"\n puts \" \"\n end\n end\n end", "def check_guess (guess, secret_number, num_guesses)\n if guess == secret_number\n puts \"You WIN! It was #{guess}!\"\n exit\n elsif num_guesses == 3\n puts \"You LOSE! The secret number was #{secret_number}.\"\n puts \"Sucker.\"\n elsif guess > secret_number\n puts \"The secret number is LOWER than #{guess}.\"\n else\n puts \"The secret number is HIGHER than #{guess}.\"\n end\nend", "def check_answer\n if guess.to_i != question.num1 + question.num2\n puts \"#{@current_player.name}: Nope! That's the wrong answer\"\n @current_player.lives -= 1\n if @current_player.lives == 0\n \n puts \"#{@other_player.name} wins with a score of #{@other_player.lives}/3!\"\n puts \"----- GAME OVER -----\"\n puts \"Good bye!\"\n exit(0)\n else\n puts \"P1: #{player1.lives}/3 vs P2: #{player2.lives}/3\"\n puts \"\"\n puts \"----- NEW TURN -----\"\n end\n else\n puts \"#{@current_player.name}: YES! You are correct\"\n puts \"P1: #{player1.lives}/3 vs P2: #{player2.lives}/3\"\n puts \"\"\n puts \"----- NEW TURN -----\"\n end\n end", "def show_rules(rule_confirmation)\n if rule_confirmation == \"Y\" || rule_confirmation == \"y\"\n puts %Q{\\tHere are the rules of the game:\n 1. You will choose a code made up of 4 colors (there can be duplicates)\n 2. The colors you can choose from are RED, GREEN, ORANGE, YELLOW, BLUE, and PURPLE\n 3. After each turn I take, you will confirm if any of the colors I have chosen are \n correct AND if they are in the correct position by doing the following:\n a. Give me 0 points if the color does not exist in your code\n b. Give me 1 point if the color is in your code, but in the wrong position\n c. Give me 2 points if the color is in your code and in the correct position\n EXAMPLE: My guess is [RED, BLUE, GREEN, ORANGE] and your code is [YELLOW, RED, GREEN, BLUE]\n You'll give me the following score: \"1120\"\n 4. If I can't guess the code in 10 turns, you win!\n\n Let's start playing!\n }\n else\n puts \"Okay, let's start playing!\\n\\n\"\n end\n end", "def input_correct?(guess)\n guess.all? {|i| @color_array.any?{|x| x==i}}\nend", "def need_three_wins\n\n counter = 0\n\n until counter == 3\n random_q = Question.all.sample #this gets us a random question\n question = random_q.question #this is the random question objects's question string\n answer_array_of_strings = random_q.answers.map { |answer_obj| answer_obj.answer} #mapping over our random question's answer objects and returning an array containing their answers as strings\n\n puts question.yellow\n user_input = gets.chomp.downcase\n\n if answer_array_of_strings.include?(user_input) #if our array of answer strings includes the user_input\n counter += 1 #add a point to the counter\n puts \"\\nCorrect! You have answered #{counter} questions correctly. Answer 3 correctly to win!\\n\\n\"\n else\n puts \"\\nTry again!\\n\\n\".red\n end #end if..else statement\n end #end until loop\n\n if counter == 3 #meaning user_input was correct...\n puts \"You win!\"\n exec \"giphy '#{user_input}'\" #YES!!!! show user a random gif related to their correct answer\n #open_gif\n end\n end", "def check_answer_coloring (prompt, color)\n within \".form-answer\", text: prompt do\n page.should have_content prompt\n if color == 0\n page.should_not have_selector \".filled-in-heading.no-error-heading\"\n page.should_not have_selector \".filled-in-heading.error-heading\"\n page.should_not have_selector \".empty-saved-heading.no-error-heading\"\n elsif color == 1\n page.should have_selector \".filled-in-heading.no-error-heading\"\n elsif color == 2\n page.should have_selector \".filled-in-heading.error-heading\"\n elsif color == 3\n page.should have_selector \".empty-saved-heading.no-error-heading\"\n end\n end\n end", "def correct?\n\n if @guess == @card.answer #returned false. Fixed it.\n p true\n elsif @guess != @card.answer\n p false\n end\n end", "def check_answer(player)\n if @answer == @correct\n puts \"YES! You are correct!\"\n else\n puts \"Seriously? No!\"\n player.lives -= 1\n puts \"#{player.name} lives remainining: #{player.lives}\"\n end\n end", "def boolean_answers_computer(computer, com_result, right_result, display_rst)\n if com_result == right_result\n puts \"\\n#{computer.name} selected: \"\n $stdout.flush\n sleep(1.5)\n puts \"#{display_rst}\"\n puts Paint[\"#{computer.name} is catching up!\" + \" \\u{2705}\" + \" \" + \"\\u{1f600}\", :green]\n computer.increase_score\n @computer_correct << true\n else\n puts \"\\n#{computer.name} selected: \"\n $stdout.flush\n # sleep(1.5)\n puts \"#{display_rst}\"\n puts Paint[\"#{computer.name} is falling behind, hurry RUN faster!\" + \" \\u{274c}\" + \" \" + \"\\u{1f625}\", :red]\n @computer_correct << false\n end\n end", "def pick_solution\n \tputs \"Enter your secret code. Choose four colors\"\n \tenter_row\n end", "def bet_on_a_color \n puts \"\\nPlease choose the amount of your bet.\"\n puts \"Your bankroll balance is #{@player.bankroll}.\"\n print \"\\n Your bet amount is: $\"\n @bet_amount = gets.to_i\n player.bankroll = (@player.bankroll - @bet_amount) \n puts \"\\nWhat color would you like to bet on? Red or Black?\"\n puts \n user_color_choice = gets.strip.downcase \n roulette_color_result = @roulette_options.sample[:color]\n puts \n puts \"The wheel landed on #{roulette_color_result}.\" \n if user_color_choice == roulette_color_result\n color_bet_winnings = @bet_amount * 2\n @player.bankroll = @player.bankroll + color_bet_winnings \n puts \"\\n\\tYou win $#{color_bet_winnings}\"\n puts \"\\n\\tYour current balance is $#{@player.bankroll}.\"\n play_again_function \n else \n puts \"\\n\\tSorry, you lose.\"\n play_again_function \n end \n end", "def start_game(states,capitals,correct,incorrect)\n50.times do\n question = rand(0..50)\n puts \"what is the Capitol of \" + states[question]\n answer = gets.chomp\n if answer == capitals[question]\n \t puts \"You ROCKSTAR!\"\n correct += 1\n puts \"You have #{correct} correct answer(s) so far - and #{incorrect} incorrect answer(s)\"\n check_finish(states,capitals,correct,incorrect)\n else\n \t puts \"Learn our map... you UNPATRIOT!\"\n incorrect +=1\n puts \"You have #{incorrect} incorrect answer(s) so far - and #{correct} correct answer(s)\"\n check_finish(states,capitals,correct,incorrect)\n end\n end\nend", "def check_answer(question, answer_hash, user_input)\n #track points in game_session. store correctness?\n correctness = answer_hash[user_input.upcase] == question.correct || user_input.downcase == question.correct.downcase\n system \"clear\"\n bear_mode = correctness ? \"5\" : \"4\"\n print_question(question, bear_mode)\n print_colorized_answers(answer_hash, user_input.upcase, question.correct)\n puts\n\n correct_msg = [\n \"Pawesome!\",\n \"Beary good!\",\n \"More money for your honey!\"\n ]\n wrong_msg = [\n \"Bearly missed it.\",\n \"I hate to be the bearer of bad news...\",\n \"Not this time, Goldilocks.\",\n \"You can still claw your way back.\"\n ]\n\n if correctness\n print correct_msg.sample.colorize(:green)\n else\n print wrong_msg.sample.colorize(:red)\n end\n\n UserGuess.create(\n question_id: question.id,\n game_session_id: $game_session.id,\n correctness: correctness\n )\nend", "def get_guess\n @user_guess = \"\"\n if @count >= 5\n abort(\"You guessed 5 times incorrectly. You Lose\")\n else\n while guess_letters_check\n print \"You must guess exactly 4 colors (R,Y,B,P,O,G).\\nGuess here:\"\n @user_guess = gets.chomp.upcase\n end\n end\n @count += 1\n check_guess(@user_guess)\n end", "def checkGuess(player, guess, answer, test=false)\n super(player, guess, answer, test)\n\n #displays status to player\n if victory?(@blackPegs)\n puts \"Congratulations! You won!\"\n return true\n else\n puts \"\\nYour guess resulted in #{@blackPegs} black pegs and #{@whitePegs} white pegs.\\n\"\n return false\n end \n end", "def incorrect_answer\n puts \"Incorrect! #{@current_player[:name]} answered #{@input} but the answer was #{@question1 + @question2}. Your score is now #{@current_player[:lives]}\".red \nend", "def if_correct(ok_guess, number_guesses, secret_number) \n\tnumber_guesses = number_guesses - 1\t# STEP 6 - Subtracts one of the player's guesses\n\t\tif ok_guess == secret_number\n\t\t\tputs \"Congratulations! You got it right! You win!!!\"\n\t\telsif ok_guess < secret_number \n\t\t\tputs \"Good try, but guess a little higher.\"\n\t\t\tputs guesses_left(number_guesses) # STEP 7 - Tells the player how many guesses s/he has left\n\t\telse ok_guess > secret_number\n\t\t\tputs \"Good try, but guess a little lower.\"\n\t\t\tputs guesses_left(number_guesses) # STEP 7 - Tells the player how many guesses s/he has left\n\t\tend\nend", "def enter_colors\n speak\n guess\n end", "def winner(answer, computers_answer)\n if (answer.downcase == 'rock') && (computers_answer.downcase == 'paper')\n puts 'YOU LOSE'\n elsif (answer.downcase == 'paper') && (computers_answer.downcase == 'rock')\n puts 'WINNER'\n elsif (answer.downcase == 'paper') && (computers_answer.downcase == 'scissors')\n puts 'You Lose'\n elsif (answer.downcase == 'scissors') && (computers_answer.downcase == 'paper')\n puts 'WINNER'\n elsif (answer.downcase == 'scissors') && (computers_answer.downcase == 'rock')\n puts 'You Lose'\n elsif (answer.downcase == 'rock') && (computers_answer.downcase == 'scissors')\n puts 'Winner'\n else\n puts 'You both tied. Go again.'\n rock_paper_scissors_game\n exit\n end\n end", "def check_guess(arr)\n\t\t# If guess equals the answer, show win message\n\t\tif arr == @answer && @master == \"comp\"\n\t\t\tputs \"Congrats, you won!\"\n\t\t\tputs \"You guessed the code of #{@answer.join} in #{@turn} turns!\"\n\t\telsif arr != @answer && @master == \"comp\"\n\t\t\t# Guess wasn't correct, so send through evaluate_guess method to see how close it was\n\t\t\tevaluate_guess\n\t\telsif arr == @answer && @master == \"user\"\n\t\t\t@evaluate << \"4 right, 0 close\"\n\t\t\tshow_board\n\t\t\tputs\n\t\t\tputs \"The computer won!\"\n\t\t\tputs \"Computer guessed the code of #{@answer.join} in #{@turn} turns!\"\n\t\t\treturn true\n\t\telsif arr != @answer && @master == \"user\"\n\t\t\treturn false\n\t\tend\n\tend", "def correct?\n @guess == @card.answer\n end", "def check_winner(player, color)\n if check_horiz(color)\n return true\n elsif check_vert\n return true\n elsif check_diag\n return true\n else\n return false\n end \n end", "def round selected_player \n puts \"#{selected_player.name}: what does #{Question.number1} + #{Question.number2} equal?\"\n value = gets.chomp\n \n #It checks to see if a question is right or not and outputs the corresponding text prompt\n\n Question.output(value) ? \n (puts \"Correct! Wow you are so smart!\") : \n (selected_player.incorrect\n puts \"Seriously? No!\")\n \n #Outputs the score of the game\n\n puts \"#{Player1.name}: #{Player1.life}/3 vs #{Player2.name}: #{Player2.life}/3\"\nend", "def win\n if @guess == $code_strings\n puts Rainbow(\"You win!\").color(:green)\n @board.draw\n true\n else\n false\n end\n end", "def red_correct\n if @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 1\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 2\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 2\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 2\n total = 2\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 2\n total = 2\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 2\n total = 2\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 3\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 3\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 3\n total = 2\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 3\n total = 3\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 3\n total = 3\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 4\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 4\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 4\n total = 2\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 4\n total = 3\n else @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 4\n total = 4\n end\n end", "def code_check(guess)\n @not_guessed = []\n @code_scan = []\n\n 4.times do |i|\n if guess[i] == @code[i]\n @feedback << '|'.white\n @code_scan[i] = nil\n else\n @not_guessed << guess[i]\n @code_scan[i] = @code[i]\n end\n end\n @not_guessed.each do |color|\n @code_scan.each do |code_element|\n next unless code_element == color\n\n @feedback << '|'.red\n color = 'is_somewhere_else'\n @code_element = 'checked'\n end\n end\n end", "def ask_for_answer(curr_question, answer_hash, correct, colorized_ans = nil)\n fifty = $game_session.fifty_fifty == 0 ? \"#{$game_session.fifty_fifty}\".colorize(:red) : \"#{$game_session.fifty_fifty}\"\n phone = $game_session.phone_a_friend == 0 ? \"#{$game_session.phone_a_friend}\".colorize(:red) : \"#{$game_session.phone_a_friend}\"\n puts \" Current bear-bucks: #{$game_session.current_total_score} 50/50: #{fifty} Phone-a-friend: #{phone}\"\n puts\n print \"Enter your answer: \"\n # user_input = gets.chomp\n user_input = get_answer(curr_question)\n\n # Check for use of gameshow helpers\n if (user_input.downcase.start_with?(\"fifty\") || user_input.start_with?(\"50\"))\n if $game_session.fifty_fifty == 0\n no_helper_usage(\"fifty-fifty\", curr_question, answer_hash, correct, colorized_ans)\n else\n colorized_ans = fifty_fifty(answer_hash, correct)\n print_question(curr_question)\n puts colorized_ans\n ask_for_answer(curr_question, answer_hash, correct, colorized_ans)\n end\n elsif (user_input.downcase.start_with?(\"phone\"))\n if $game_session.phone_a_friend == 0\n no_helper_usage(\"phone-a-friend\", curr_question, answer_hash, correct, colorized_ans)\n else\n phone_a_friend(curr_question, answer_hash, colorized_ans)\n ask_for_answer(curr_question, answer_hash, correct, colorized_ans)\n end\n # Else check answer for correctness\n else\n check_answer(curr_question, answer_hash, user_input)\n sleep(3) if !$TEST_MODE\n system \"clear\"\n end\nend", "def correct_answer(answer)\n return true if (/You win the match/ =~ answer)\n return true if (/You loose, computer wins/ =~ answer)\n return true if (/There is a tie/ =~ answer)\n end", "def check_game_over (guess, code)\n red_orb = give_hint(guess,code)[0]\n white_orb = give_hint(guess,code)[1]\n puts \"Red Orb: #{red_orb}, White Orb: #{white_orb}\"\n (give_hint(guess, code)[0] == 4) ? true : false\n end", "def continue?\n @round <= 10 && @guess != @secret_code\n end", "def question_and_answer(with_error, zero_or_one, mistery_num)\n message = \"Do you see your number here: (y)(n). To exit the game enter the letter e.\".colorize(:blue)\n if with_error == true\n puts \"\\nIncorrect Answer. \" + message\n else \n puts \"\\n#{message}\"\n end \n answer = gets.chomp.upcase\n case answer\n when \"Y\", \"YES\"\n if zero_or_one % 2 == 0\n mistery_num +=\"0\"\n else\n mistery_num +=\"1\"\n end\n return mistery_num\n when \"N\", \"NO\"\n if zero_or_one % 2 == 0\n mistery_num +=\"1\"\n else\n mistery_num +=\"0\"\n end\n return mistery_num\n when \"E\"\n return \"break\"\n else\n question_and_answer(true, zero_or_one, mistery_num)\n end \nend", "def correct?(array)\n @correct = Array.new\n array.each do |color|\n @correct.push(color) if $code_strings.index(color) == @guess.index(color)\n end\n end", "def success_case\n\tputs \" - Ok #{@name}, c'est ton choix #{@answer_play}\" \n\tputs \" \"\n end", "def validate_player_input(temp_input, comparison_array = @MAIN_CHOICES)\n validation_results = []\n temp_input.each do |input|\n validation_results << comparison_array.include?(input)\n end\n if (validation_results.all?(true) && (validation_results.length == 4)) == false\n temp_input = request_player_input('Please choose FOUR of the AVAILABLE colors >:(')\n validate_player_input(temp_input, comparison_array)\n else\n temp_input\n end\n end", "def play\n winner = false\n while(!winner)\n puts \"please input a row of four colors\"\n puts \"your options are B: for black, b: for blue\"\n puts \"g: green, y: yellow, r: red , w: white\"\n @grid.board\n input = []\n (4).times { input << gets.chomp}\n #make sure input is a game color\n if((input - @colors).empty?)\n @grid.input(input, @turns)\n else\n \"Please enter an option from the menu below\"\n play\n end\n @turns += 1\n end\n end", "def play_again\n puts (\"Do you want to play another game ? Yes / No\").red\n print \">\"\n decision = gets.chomp\n while decision != \"Yes\" && decision != \"No\"\n puts \"Invalid answer. Do you want to play again ? Please, type 'Yes' or 'No'\"\n print \">\"\n decision = gets.chomp\n end\n return decision\n end", "def corr_input_play_again?(input)\n if input == 3\n return FALSE, input\n else\n return TRUE, input\n end\nend", "def check_winner(guess)\n guess == @code\n end", "def number3(last_guess)\n\t\tlast_guess = gets.chomp\n\n\tif last_guess == secret_number\n\t\tputs \"Yup, #{last_guess} is the Secret Number. You win Secret Number!\"\n\telse \n\t\tputs \"#{last_guess} is not correct. Sorry, you lose the game..the Secret Number was 8.\"\n\tend\n\nend", "def ask_for_guess\n @guess_count += 1\n @guess = get_code(\"Please enter your guess in the format 'color color color color'(to list available color options enter 'options'):\")\n end", "def print_colorized_answers(answers, guess, correct)\n colorized_ans = answers.map do |letter, curr_answer|\n #binding.pry\n if curr_answer == correct\n \"#{letter}. #{curr_answer}\".colorize(:green)\n elsif answers[guess] == curr_answer\n \"#{letter}. #{curr_answer}\".colorize(:red)\n else\n \"#{letter}. #{curr_answer}\"\n end\n end\n\n ans = Terminal::Table.new do |t|\n t.add_row [\n colorized_ans[0],\n colorized_ans[1]\n ]\n t.add_row [\n colorized_ans[2],\n colorized_ans[3]\n ]\n t.style = {:all_separators => true, :width => $GAME_WIDTH}\n end\n puts ans\nend", "def play_again\n\t\tputs \"\"\n\t\tputs \"Play again?\"\n\t\tinput = gets.chomp.strip.downcase\n\t\tcase input\n\t\twhen \"yes\"\n\t\t\tputs \"\"\n\t\t\tConnectFour.new\n\t\twhen \"no\"\n\t\t\tputs \"\"\n\t\t\tputs \"Goodbye!\"\n\t\telse\n\t\t\tputs \"Error: Invalid input. Try again...\"\n\t\t\tplay_again(input)\n\t\tend\n\tend", "def check_guess (guess, answer)\n if guess == answer\n puts 'Correct!'\n return true\n elsif guess < answer\n puts 'Guess higher!'\n return false\n elsif guess > answer\n puts 'Guess lower!'\n return false\n end\nend", "def play\n puts \"I have generated a beginner sequence with four elements made up of: (r)ed,\n (g)reen, (b)lue, and (y)ellow. Use (q)uit at any time to end the game.\n What's your guess?\"\n mastermind = Game.new\n mastermind.game_solution\n amount_of_guesses = 0\n guess = gets.chomp\n user_guess = []\n user_guess << guess.chars\n amount_of_guesses += 1\n mastermind.check_for_correct_letters(user_guess)\n mastermind.check_for_correct_indexes(user_guess, mastermind.solution)\n until guess == \"q\"\n if guess == \"c\"\n puts \"The solution is #{mastermind.solution}\"\n break\n elsif guess.length > 4\n puts \"Your guess was too long.\"\n elsif guess.length < 4\n puts \"Your guess was too short.\"\n elsif guess != mastermind.solution\n puts \"You had #{mastermind.correct_letters} correct colors with #{mastermind.correct_indexes}\n in the correct position.\"\n break\n elsif guess == mastermind.solution.to_s\n \"You won! You guessed #{guess}. You had #{mastermind.correct_letters} correct\n colors in #{mastermind.correct_indexes} correct positions.\n You guessed #{amount_of_guesses.to_s} times.\"\n break\n else\n puts \"Goodbye, quitter.\"\n end\n end\nend", "def correct?\n @card.answer == @guess\n end", "def new_round?\n puts 'Want to play another round? Press y for yes or n for no'\n input = gets.chomp.to_s\n if input == 'y'\n sleep 1\n start_correct_game_flow\n elsif input == 'n'\n puts 'Ok, thanks for playing!'\n sleep 1\n else new_round?\n end\n end", "def check_who_win(user_input, computer_input)\n if user_input == computer_input\n 'Haha! It is draw! You can try again!'\n elsif user_input == 'R'\n if computer_input == 'S'\n 'Wow! Rock smashes Scissors! You Win!'\n elsif computer_input == 'P'\n 'Oh! Paper covers Rock! You Lose!'\n end\n elsif user_input == 'P'\n if computer_input == 'R'\n 'Wow! Paper covers Rock! You Win!'\n elsif computer_input == 'S'\n 'Oh! scissors cuts Paper! You Lose!'\n end\n elsif user_input == 'S'\n if computer_input == 'P'\n 'Wow! Scissors cuts Paper! You Win!'\n elsif computer_input == 'R'\n 'Oh! Rock smashes Scissors! You Lose!'\n end\n end\nend", "def game_over?(player_input, current_move)\n\tif player_input.combination(3).map.any?{|i| WINNER}\n\t\tputs \"Congrats#{player_input}, your a winner!\"\n\telsif current_move == 9\t\n\t\tputs \"It's a draw, suckers!\"\n\tend\nend", "def check_for_winner(message)\n return unless @@direct_matches.length == 4\n puts message\n exit\n end", "def confirm_text\n\n puts \"Is that correct? (yes or no)\".colorize(:cyan).indent(10)\n print \"***>\".indent(10)\n\n case gets.chomp.downcase\n when \"yes\"\n puts\n true\n when \"no\"\n puts \"OK let's try again.\".colorize(:cyan).indent(10)\n puts\n false\n else\n puts \"That's not a valid selection. Let's try again.\".colorize(:cyan).indent(10)\n puts\n false\n end\n\nend", "def guessed_all_correct?\n if self.output == self.word \n puts \"You have guessed the word\"\n end\n end", "def knowTheGameTrick\n\tputs \"Do you wanna know the trick of this game?\"\n\tputs \"If YES then type 1 and if NO then type 2.\"\n\tuserAnswer = gets\n\n\tif userAnswer.to_i == 1\n\t\tputs \"This game is designed according to halving technique (can also be called as Binary Search) where you are given only certain chances.\"\n\t\tputs \"Since computer says you whether the guessed number was high or low, you have to always guess the middle number and go on guessing the middle number everytime the range changes.\"\n\telse\n\t\tputs \"I guess, you probably knew the trick of the game. Thanks for playing. Enjoy!\"\n\tend\n\nend", "def lose\n if @guess_count >= 12\n puts Rainbow(\"You lose!\").color(:red)\n true\n else\n false\n end\n end", "def correct_answer\n new_question\n @label_quess.text = \"That's correct!\"\n @label_quess.textColor = UIColor.blueColor \n # return @scores = 0 if @scores > 10000 \n # @scores += 1\n return @correct = 0 if @correct > 10000\n @correct +=1\n @label_corect.text = \" ✓: \" + @correct.to_s \n\n end", "def result\n if victory? == @player1 || victory? == @player2\n puts \"Congratulations #{victory?.name}, you won!\"\n puts \" \"\n puts '╭━━━┳━╮╱╭┳━━━╮╭━━━┳━━━╮╭━━━┳━━━┳━╮╭━┳━━━╮\n ┃╭━━┫┃╰╮┃┣╮╭╮┃┃╭━╮┃╭━━╯┃╭━╮┃╭━╮┃┃╰╯┃┃╭━━╯\n ┃╰━━┫╭╮╰╯┃┃┃┃┃┃┃╱┃┃╰━━╮┃┃╱╰┫┃╱┃┃╭╮╭╮┃╰━━╮\n ┃╭━━┫┃╰╮┃┃┃┃┃┃┃┃╱┃┃╭━━╯┃┃╭━┫╰━╯┃┃┃┃┃┃╭━━╯\n ┃╰━━┫┃╱┃┃┣╯╰╯┃┃╰━╯┃┃╱╱╱┃╰┻━┃╭━╮┃┃┃┃┃┃╰━━╮\n ╰━━━┻╯╱╰━┻━━━╯╰━━━┻╯╱╱╱╰━━━┻╯╱╰┻╯╰╯╰┻━━━╯\n ╭━━━┳╮╱╱╭━━━┳╮╱╱╭╮╭━━━┳━━━┳━━━┳━━┳━╮╱╭┳━━━╮\n ┃╭━╮┃┃╱╱┃╭━╮┃╰╮╭╯┃┃╭━╮┃╭━╮┃╭━╮┣┫┣┫┃╰╮┃┃╭━╮┃\n ┃╰━╯┃┃╱╱┃┃╱┃┣╮╰╯╭╯┃┃╱┃┃┃╱╰┫┃╱┃┃┃┃┃╭╮╰╯┣╯╭╯┃\n ┃╭━━┫┃╱╭┫╰━╯┃╰╮╭╯╱┃╰━╯┃┃╭━┫╰━╯┃┃┃┃┃╰╮┃┃╱┃╭╯\n ┃┃╱╱┃╰━╯┃╭━╮┃╱┃┃╱╱┃╭━╮┃╰┻━┃╭━╮┣┫┣┫┃╱┃┃┃╱╭╮\n ╰╯╱╱╰━━━┻╯╱╰╯╱╰╯╱╱╰╯╱╰┻━━━┻╯╱╰┻━━┻╯╱╰━╯╱╰╯'\n else\n puts \"Too bad! Tied game...\"\n puts \" \"\n puts '╭━━━┳━╮╱╭┳━━━╮╭━━━┳━━━╮╭━━━┳━━━┳━╮╭━┳━━━╮\n ┃╭━━┫┃╰╮┃┣╮╭╮┃┃╭━╮┃╭━━╯┃╭━╮┃╭━╮┃┃╰╯┃┃╭━━╯\n ┃╰━━┫╭╮╰╯┃┃┃┃┃┃┃╱┃┃╰━━╮┃┃╱╰┫┃╱┃┃╭╮╭╮┃╰━━╮\n ┃╭━━┫┃╰╮┃┃┃┃┃┃┃┃╱┃┃╭━━╯┃┃╭━┫╰━╯┃┃┃┃┃┃╭━━╯\n ┃╰━━┫┃╱┃┃┣╯╰╯┃┃╰━╯┃┃╱╱╱┃╰┻━┃╭━╮┃┃┃┃┃┃╰━━╮\n ╰━━━┻╯╱╰━┻━━━╯╰━━━┻╯╱╱╱╰━━━┻╯╱╰┻╯╰╯╰┻━━━╯\n ╭━━━┳╮╱╱╭━━━┳╮╱╱╭╮╭━━━┳━━━┳━━━┳━━┳━╮╱╭┳━━━╮\n ┃╭━╮┃┃╱╱┃╭━╮┃╰╮╭╯┃┃╭━╮┃╭━╮┃╭━╮┣┫┣┫┃╰╮┃┃╭━╮┃\n ┃╰━╯┃┃╱╱┃┃╱┃┣╮╰╯╭╯┃┃╱┃┃┃╱╰┫┃╱┃┃┃┃┃╭╮╰╯┣╯╭╯┃\n ┃╭━━┫┃╱╭┫╰━╯┃╰╮╭╯╱┃╰━╯┃┃╭━┫╰━╯┃┃┃┃┃╰╮┃┃╱┃╭╯\n ┃┃╱╱┃╰━╯┃╭━╮┃╱┃┃╱╱┃╭━╮┃╰┻━┃╭━╮┣┫┣┫┃╱┃┃┃╱╭╮\n ╰╯╱╱╰━━━┻╯╱╰╯╱╰╯╱╱╰╯╱╰┻━━━┻╯╱╰┻━━┻╯╱╰━╯╱╰╯'\n end\n end", "def menu\n puts \"Select An Option \\n1) Rock \\n2) paper \\n3) Scissors\"\n u = gets.strip.to_i\n c = rand(1..3)\n\n if u == c\n puts \"tie\"\n elsif u == 1 && c == 3 || u == 2 && c == 1 || u == 3 && c == 2\n puts \"You win!\"\n else\n puts \"You lose!\"\n end\nend", "def print_final_message(name_player, win)\n if win\n puts \" #{name_player} you won\".colorize(:cyan)\n else\n puts \" #{name_player} you lost\".colorize(:light_red)\n end\n puts\nend", "def game_win\n puts 'Congratulations! You win!'\n puts \"Your guess: #{@guess}\"\n puts \"Secret code: #{@secret_code}\"\n play_again?\n end", "def compare_codes(guess)\n #make a reference that won't destroy the original secret code\n secret = secret_code.clone\n\n exact = check_exact(guess, secret)\n if exact == 4\n #tell the caller we have a winner\n return true\n else\n partial = check_partial(guess, secret)\n puts \"Correct value and position: #{exact}\\nCorrect value, wrong position: #{partial}\\n\\n\"\n return false\n end\n end", "def verify_winner(opponent_board)\n if opponent_board.ships.all?(&:sunk?)\n @board_turn.player.set_win\n\n if @best_of3 && @boards.map(&:player).any? { |player| player.wins > 1 }\n puts \"*******************************************************\".green\n puts \"Player #{@board_turn.player.name} has won best of 3!!!!\".green\n puts \"********************************************************\".green\n elsif @best_of3 && @boards.map(&:player).any? { |player| player.wins <= 1 }\n puts \"*********************************************\".green\n puts \"Player #{@board_turn.player.name} has won a game of 3!!!!\".green\n puts \"*********************************************\".green\n else\n puts \"*********************************************\".green\n puts \"Player #{@board_turn.player.name} has won a single game!!!!\".green\n puts \"*********************************************\".green\n end\n\n if @random && @best_of3 && @boards.map(&:player).all? { |player| player.wins < 2 }\n print \"#{@board_turn.player.name} wins, enter for next match?: \".cyan\n $stdin.gets.chomp\n\n print \"\\e[H\\e[2J\"\n :new_game\n elsif @random && @boards.map(&:player).any? { |player| player.wins > 1 }\n :finished_game_of3\n elsif @random\n ask_new_game\n else\n :finished\n end\n else\n next_turn\n :hitted\n end\n end", "def winner(p,c)\n if p == c\n output \"It's a Draw!\"\n elsif (\"#{p}\" == 'Rock' && \"#{c}\" == 'Paper')\n output \"Computer wins!\"\n elsif (\"#{p}\" == 'Paper' && \"#{c}\" == 'Scissors')\n output \"Computer wins!\"\n elsif (\"#{p}\" == 'Scissors' && \"#{c}\" == 'Rock')\n output \"Computer wins!\"\n else \"Player wins!\"\n end\nend", "def check_correct_answer\n puts 'Answer was correct!!!!'\n @purses[@current_player] += 1\n current_purses = @purses[@current_player]\n puts \"#{@players[@current_player]} now has #{@purses[@current_player]} Gold Coins.\"\n check_current_player\n current_purses\n end", "def encourage\n r = rand(4)\n if r == 0\n puts \"Watch out world, here comes the next great multiplier!\\n\"\n elsif r == 1\n puts \"I haven't seen these kind of skills since ancient Egypt!\\n\"\n elsif r == 2\n puts \"You're so good you could take on Einstein!\\n\"\n else\n puts\"You're really tearing it up now!\\n\"\n end\nend", "def check_outcome(player)\n case @board.status\n when 1\n puts \"*** #{player.name} Won Congratulations! ***\"\n 1\n when 0\n puts \"*** That's a tie ***\"\n 0\n else\n -1\n end\n end", "def done_or_not(board)\n\tif chk_horizontal(board) == true && chk_vertical(board) == true && chk_region(board) == true\n\t\t'Finished!'\n\telse \n\t\t'Try again!'\n\tend \nend", "def check_guess_count()\n if $guessed.count == 0\n puts \"\"\n elsif $guessed.count == 1\n puts \"So far you have incorrectly guessed the letter #{$guessed}\"\n else\n puts \"So far you have incorrectly guessed the letters #{$guessed}\"\n end\n end", "def guess_code\n guess = gets.chomp.upcase\n until guess =~ /^[RGBWOY]{4}$/\n puts \"Incorrect input. Enter a sequence of 4 letters without separators. Colors: R, G, B, W, O, Y.\"\n puts \"Example: RGBW\"\n guess = gets.chomp.upcase\n end\n return guess\n end", "def check_win\r\n\t\tif @guess_word == @secret_word \r\n\t\t\t@is_over = true \r\n\t\t\tputs \"Congrats! You won!\"\r\n\t\telse\r\n\t\t\tfalse \r\n\t\tend \r\n\r\n\t\tif @num_guess == 0 \r\n\t\t\t@is_over = true\r\n\t\t\tputs \"No more tries! You have lost.\"\r\n\t\telse \r\n\t\t\tfalse\r\n\t\tend \r\n\tend", "def ending_message\n if num_of_guesses == 0\n puts \"You have no more guesses. You lost\"\n elsif round_result == \"equal\"\n puts \"You won!\" \n end\n end", "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 again\n #puts \"You are on round #{@roundcount}\"\n puts \"\\nDo you want to play again? Yes or No?\"\n answer = gets.chomp.capitalize\n case answer\n when \"Yes\"\n game\n when \"Y\"\n game\n when \"No\"\n gameover\n when \"N\"\n gameover\n else\n puts \"\\nYOU NEED TO PUT YES OR NO!\"\n again\n end\nend", "def another_game?\n\n puts \"\"\n puts \"Do you want to play another game? Y/N \"\n\n answer = gets.chomp\n\n return true if answer == 'Y'\n\n false\n\n end", "def record_player_code\n\t\t# Refactor validation to make this + take_turn method DRY\n\t\tputs \"Please enter the secret code you have chosen, typing in 4 color characters. Remember, your options are: Red (R), Green (G), Blue (B), Magenta (M), Cyan (C), and Yellow (Y): \"\n\t\tcode = validate_input_loop\n\t\tcode\n\tend", "def check_winner\n if @guess == @secret_code\n @winner = true\n game_win\n end\n end", "def make_guess\n\t\tget_colors_from_player MAKE_GUESS_PROMPT\n\tend", "def present_test(challenge)\n\n\tConsole_Screen.cls #clear the display area\n\tprint challenge + \"\\n\\n: \" #display the challenge sentence\n\tresult = STDIN.gets #collect the player's input\n\tresult.chop! #remove the end of line marker\n\n\t#analyze the player input and see if it is correct\n\tif challenge == result then\n\n\t#keep track of the number of corretly retyped challenge sentences \n\t$noRight += 1\n\tConsole_Screen.cls #clear the display area\n\t#keep player informed\n\tprint \"Correct!\\n\\nPress Enter to continue.\"\n\tConsole_Screen.pause #pause the game\n\nelse \n\n\tConsole_Screen.cls #clear the diplay area\n\t#keep the player informed\n\tprint \"Incorrect!\\n\\nPress Enter to continue\"\n\tprint \" Correct sentence: \" + challenge.to_s + \"\\tYour sentence: \" + result.to_s \n\tConsole_Screen.pause #clear the game\n\nuntil result != \" \"\n\n\tConsole_Screen.cls #clear the diplay area\n \n #prompt the playwer for permission to bein the test\n print \"You have to type something \"\n\n result = STDIN.gets #collect the player's response \n result.chop! #remove any extra characters appended to the string\t\nend\nend\nend", "def singleColor()\n\n\tcolor = $rng.rand(0..5)\n\tword = $rng.rand(6..11)\n\n\tprintJumble(color, word)\n\n\tentry = gets.chomp\n\n\tif (entry == $arr[color+6])\n\t\t\treturn 1\n\telse\n\t\t\treturn 0\n\tend\n\nend", "def round_result\n @round += 1\n puts \"Round #{format('%02d', @round)}: #{@board.format(@board.breaker)}\nYou got #{@board.matches} matches and #{@board.correct_matches} correct guesses\"\n puts 'Careful, the next one is your last chance!'.red if @round == 11\n end", "def run_test(questions_capital)\n answer = \"\"\n score = 0\n for question in questions_capital\n puts question.prompt\n answer = gets.chomp.upcase\n puts \" \"\n puts \"You've answered: #{answer}\"\n puts \"The correct answer is: #{question.answer}\"\n if answer == question.answer\n score += 1\n puts \"You have answered correctly!\".green\n else\n puts \"Better luck next time!\".red\n end\n puts \" \"\n end\n puts \"You got\" \" \" + score.to_s + \"/\" + questions_capital.length().to_s\n end", "def done(winner_name_array)\n if winner_name_array.count == 1\n puts \"Congratulations, #{winner_name_array[0]}, Ya're not so bad after all .\".yellow\n else\n puts \"Tie Game... You, #{winner_name_array[0]} and #{winner_name_array[1]} #{\"prayin' for me t' properly end it?\".yellow}\"\n end\n\n end", "def player_response\n\n if compare_answer\n return puts \"#{@current_asker.name}: YES! You are correct.\"\n end\n\n puts \"#{@current_asker.name}: Seriously? No!\"\n\n end", "def play_game \n\n @number_guesses = 0\n @start_time = Time.now\n puts \"I have generated a secret code, a sequence of four colors: (R)ed, (G)reen, (B)lue, and (Y)ellow\"\n\n game_over = false \n\n until game_over \n \n guess = get_guess\n\n exit_game if guess.upcase == \"Q\" \n guess = @secret_code if guess.upcase == \"C\" # provide option to cheat\n\n if validate_guess(guess)\n @number_guesses += 1\n # add_guess_to_history(guess_report(guess))\n display_history(guess)\n\n if guess.upcase == @secret_code\n game_over = true \n end_game\n else\n puts \"Please guess again.\" \n end\n end\n end\n end", "def ask_play_again?()\n input = get_input \"Play again?\"\n if input == \"y\"\n 1\n elsif input == \"n\"\n 2\n else\n 3\n end\nend", "def good_guess?(num)\n\n if num == 42\n puts 'true'\n else\n puts 'false'\n end\nend", "def turn()\n\tguess = \"\"\n\tif @human_is_guessing == true\n\t\tputs \"Enter your guess for the secret code\"\n\t\tguess = gets.chomp\n\t\twhile guess.length != 4 || (guess =~ /[^0-5]/)\n\t\t\tputs \" Please enter guess again. Remember it must be 4 numbers and only consist of values 0-5.\"\n\t\t\tguess = gets.chomp\n\t\tend\n\telse #computer is guessing\n\t\t#random guess from array of viable solutions.\n\t\tguess = @solutions.delete_at(rand(@solutions.length)).join.to_s\n\t\t\tputs \" I guess \" + guess\n\t\tend\n\t\tset_guess(guess)\n\t\t@score = compare_guess(guess)\n\t\tputs \"You have correctly guessed \" + @colors_correct.to_s + \" out of 4 digits in the code\" + \" and have \" + @placed_correct.to_s + \" in the right place.\"\n\t\t@solutions.delete_if {|x| compare_guess(x.join.to_s, @guess) != @score }\n\t\t@turns += 1\n\tend", "def quiz_instructions\n puts \"This is a quiz that you can take to test out your programming knowledge and earn valuable spa points, which can be used at the Coder Detox Spa.\\n\\n\".blue\n puts \"You will be presented with a statement on a number of programming concepts, in which you will have provide a response.\\n \n If you believe a statement is correct, please type in 'true'.\\n \n On the other hand, if you believe a statement to be incorrect, please type in 'false'.\\n\\n\".blue\nend", "def display_result(player, computer)\n key = VALID_CHOICES[player] + VALID_CHOICES[computer]\n if %w(12 23 31).include?(key)\n prompt(\"You lose!\")\n elsif %w(21 32 13).include?(key)\n prompt(\"You win!\")\n else\n prompt(\"It's a tie!\")\n end\nend", "def ask_question(player)\n number_1 = rand(1..20)\n number_2 = rand(1..20)\n\n puts \"#{@player.name}: What is #{number_1} + #{number_2}\"\n answer = gets.chomp.to_i\n answer == number_1 + number_2 ? correct_answer : wrong_answer(player)\nend", "def instruction_message\n puts \"\\nMASTERMIND is a color guessing game where the computer generates a \\\nrandom string of four characters representing the base colors #{\"(r)ed\".red}, \\\n#{\"(g)reen\".green}, #{\"(b)lue\".blue}, and/or #{\"(y)ellow\".yellow}. \\\nThe intermediate difficulty level is six characters and adds \\\n#{\"(m)agenta\".magenta} and the advanced difficulty level is eight characters \\\nand adds #{\"(c)yan\".cyan}. \\\nThe string is only guaranteed to contain one color. The player must submit \\\nguesses to try to find the generated combination. Guesses are not case sensitive.\"\n\n puts \"\\nEnter #{\"(p)lay\".green}, #{\"(i)nstructions\".yellow} or #{\"(q)uit\".red}\"\n end", "def correct?\n @correct ||= (answer == correct_answer)\n end" ]
[ "0.7306587", "0.7223264", "0.7190962", "0.71755385", "0.7027915", "0.7003653", "0.68658197", "0.6850116", "0.6820052", "0.6810048", "0.6801524", "0.6763937", "0.673099", "0.66904426", "0.6686171", "0.6658542", "0.66372967", "0.6617681", "0.6617028", "0.6604415", "0.65925765", "0.65650004", "0.6562479", "0.6550341", "0.65226537", "0.6521616", "0.65174973", "0.6506723", "0.6505121", "0.65028685", "0.64983565", "0.64959383", "0.6486916", "0.6480328", "0.6475125", "0.6446038", "0.64426446", "0.6434711", "0.64336777", "0.64214206", "0.64148957", "0.64133304", "0.6403574", "0.6396705", "0.63895035", "0.6384414", "0.63736176", "0.63720614", "0.6362052", "0.63610595", "0.63555276", "0.6341219", "0.63412076", "0.63410085", "0.6338757", "0.6331611", "0.63257927", "0.6309087", "0.63052386", "0.62979454", "0.6296818", "0.62921137", "0.6291572", "0.6288628", "0.6279763", "0.62793016", "0.6275706", "0.6272825", "0.6270755", "0.6269366", "0.626484", "0.62579024", "0.62445134", "0.6235398", "0.623223", "0.6229371", "0.62285805", "0.62277144", "0.6226578", "0.6222132", "0.6220065", "0.6217331", "0.6215827", "0.6214163", "0.62123895", "0.6211111", "0.6209451", "0.62005556", "0.6197723", "0.6197651", "0.6197207", "0.6193429", "0.61909443", "0.6189936", "0.618944", "0.61877126", "0.6187081", "0.6176424", "0.6175477", "0.6172239", "0.6172133" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_photo @photo = Photo.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def photo_params params.require(:photo).permit(:data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def 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 special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
TODO: and numeric digits that occur more than once in the input string. TODO: The input string can be assumed to contain only alphabets (both uppercase and lowercase) and numeric digits.
def duplicate_count(text) # create an array with properly formatted elements letters = text.downcase.split('') # make the hash deafult to 0 so that += will work correctly stats = Hash.new(0) # iterate over the array and count number of times each letter occur letters.each {|letter| stats[letter] += 1} # delete key-value pairs from the hash which occur only once stats.delete_if {|key, value| value == 1} # return the number of remaining key-value pairs return stats.values.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_number(str)\n\t\tif !str.nil? && !str.blank?\n\t\t\tchrs = ('a'..'z').to_a\n\t\t\tchrs << \" \"\n\t\t\tstr.split(\"\").each do |n|\n\t\t\t\treturn false if chrs.include? n\n\t\t\tend\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def string_cleaner(str)\n\tnew_string = \"\"\n\tstr.each_char do |char|\n\t\tif char.match(/[0-9]/)\n\t\t\tnew_string << char\n\t\tend\n\tend\n\treturn new_string\n\t\nend", "def crunch(string)\n string.gsub(/([a-z0-9])\\1+/, \"\\\\1\")\nend", "def NumberSearch(str)\n\n num_sum = str.scan(/(\\d)/).flatten.map {|x| x.to_i }.inject(:+)\n letter_count = str.scan(/[a-zA-Z]/).length\n \n return (num_sum.to_f/letter_count).round\n \nend", "def contains_number (str)\n\n\treturn str =~ /\\d/\n\nend", "def prefixed_with_number_regex(str)\n if str.match(/(\\d+)([a-z]+)$/i)\n str.split(/(\\d+)([a-z]+)$/i).last(2)\n end\n end", "def is_number? word\r\n #using regex - returns false if the inputted string contains anything but a lower case or upper case character of the alphabet\r\n word =~ /[a-zA-Z]/\r\nend", "def increment_string(input)\n return input + '1' if !(input[-1] =~ /[0-9]/)\n split = input.scan(/\\d+|\\D+/)\n no_num = true\n res = ''\n split.each do |item|\n if (item.scan(/\\D/).empty?)\n item = item.next\n no_num = false\n end\n res += item\n end\n return res + '1' if (no_num)\n res\n\nend", "def NumberSearch(str)\n numbers_total = 0\n str.scan(/\\d+/).each {|number| numbers_total += number.to_i}\n total = numbers_total.to_f / str.scan(/[a-zA-Z]/).count.to_f\n total.round\nend", "def validate_number(input)\n digits = input.gsub /[^\\d]/, ''\n digits = \"1#{digits}\" unless digits =~ /^1/\n digits = \"+#{digits}\" unless digits =~ /^\\+/\n digits = nil unless digits.length == 12\n digits\n end", "def word_to_digit(string)\n string.split.each do |word|\n word_only = word.downcase.delete(\"^a-z\")\n if NUMBERS.keys.include?(word_only)\n string.gsub!(/#{word_only}/i, NUMBERS[word_only])\n end\n end\n string\nend", "def repeated_digit number\n raise \"Wrong type of argument\" if !number.is_a? Numeric\n # array = number.to_s.split(\"\").map(&:to_i)\n # array.count{ |item| item != array.first} == 0\n\n # number.to_s.squeeze.length == 1\n\n number.to_s.chars.uniq.length == 1\nend", "def numberfy(string)\n message = string.downcase.split(//)\n message.each do |char|\n (ALPHA.include? char) ? number = ALPHA_HASH[char] : number = char\n @numeric_message << number\n end\n end", "def reformat(s)\n return s if s.size == 1\n \n num_arrays = ('0'..'9').to_a\n alphabetical_array = ('a'..'z').to_a\n \n numbers_array = []\n alpha_array = []\n \n char_hash = Hash.new(0)\n \n s.each_char do |char|\n numbers_array << char if num_arrays.include?(char)\n alpha_array << char if alphabetical_array.include?(char)\n end\n \n str = ''\n \n while !numbers_array.empty? && !alpha_array.empty?\n str << numbers_array.pop\n str << alpha_array.pop\n end\n \n if alpha_array.size > 0\n if num_arrays.include?(str[str.size - 1])\n str << alpha_array.pop\n elsif num_arrays.include?(str[0])\n str.prepend(alpha_array.pop)\n end\n elsif numbers_array.size > 0\n if alphabetical_array.include?(str[str.size - 1])\n str << numbers_array.pop\n elsif alphabetical_array.include?(str[0])\n str.prepend(numbers_array.pop)\n end\n end\n \n str\nend", "def non_unique_letters(string)\n hash = Hash.new(0)\n str_arr = string.split('')\n str_arr.each do |word|\n if word != ' '\n hash[word] += 1\n end\n end\n\n repeat_hash = hash.select do |k,v|\n v > 1\n end\n repeat_hash.map {|el| el[0]}\nend", "def is_valid_number?(string_of_digits, input_string)\n\n # input_string is a string, can be 1 or multiple characters\n # Go from the beginning of input_string to the end\n\n input_string.each do |char|\n digit_valid = is_valid_digit?(string_of_digits, char)\n return false if !digit_valid\n end\n\n true\nend", "def three_numbers(str)\n digits = str.split.map { |word| word.scan(/\\d+/).sort_by(&:size) }\n digits.each do |set|\n if set.size == 2 && set.first.size == 1 && set.last.size == 2\n set[1], set[2] = set.last[0], set.last[1]\n end\n set.map!(&:to_i).uniq!\n return false unless set.size == 3\n end\n true\nend", "def number_acount(string)\r\n \"Número de cuenta: #{string}\" if string =~ /\\d{4}-?\\d{3}-?\\d{3}/\r\nend", "def non_unique_letters(string)\n count_hash = Hash.new(0)\n string.chars.each do |letter|\n count_hash[letter] += 1 unless letter == \" \"\n end\n count_hash.select { |_letter, counts| counts > 1 }.keys.sort\nend", "def get_number_from_string(s)\n s.delete(\"^[0-9]\").to_i\nend", "def non_unique_letters(string)\n alpha = ('a'..'z').to_a\n our_new_letters = []\n counters = Hash.new(0)\n arr = string.downcase.split(\"\").select {|letter| string.count(letter) > 1}\n arr.each do |c|\n counters[c] += 1\n our_new_letters << c if counters[c] <= 1\n end\n our_new_letters.select {|x| alpha.include?(x)}\nend", "def extract_number( val, letter )\n str_num = []\n val.split('').each do | num |\n if num != letter\n str_num << num\n end\n end\n\n return str_num.join()\n end", "def letters_and_digits\n self.to_s.scan(/\\w/).join\n end", "def crunch(string)\n no_duplicates = ''\n string.chars.each do |letter|\n no_duplicates << letter unless no_duplicates[-1] == letter\n end\n no_duplicates\nend", "def check_str(str)\n num=[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"0\"]\n new_str=str.split(\"\")\n new_str.each do |n|\n if num.include?(n)\n return true\n end\n end\n return false\nend", "def valid_looking_string?(str)\n str =~ /\\d/\n end", "def unique_letters(str)\n # store a key/value pair of each letter in a word where\n # key = letter and value = nil or 0 or 1\n letter_count = {}\n has_unique_letters = true\n\n # iterate through each letter of a word\n str.chars.each do |letter|\n # check if the count of the letter has already been incremented\n # if no, add 1\n # if yes, return false\n if letter_count[letter].nil? || (letter_count[letter]).zero?\n letter_count[letter] = 1\n else\n has_unique_letters = false\n end\n end\n\n # return status of a\n has_unique_letters\n end", "def extract_digits(string)\n string.gsub(/\\D/, '').to_i\n end", "def account_number_is(string)\n (/\\d{4}-\\d{3}-\\d{3}/.match string).to_s if /\\d{4}-\\d{3}-\\d{3}/ === string \nend", "def input(number_string)\n\t\tnumber_string = number_string.split(\" \").to_a.uniq!.sort!.map{|num| num.to_i}\n\t\tputs \"Uniqe Values: #{number_string}\"\n\tend", "def first_non_repeating_letter(s)\n return s if s.empty?\n puts s\n \n str = s.split(\"\").each_with_object(Hash.new(0)) do | word, count |\n count[word] += 1\n end\n\n str.each do |k, v|\n if k != ',' && k.match(/\\W+/)\n str.delete(k)\n end\n \n if k.match( /^[[:lower:]]+$/ )\n if str[k.upcase] > 0\n str.delete(k.upcase)\n str.delete( k )\n end\n elsif k.match( /^[[:upper:]]+$/ )\n if str[k.downcase] > 0\n str.delete(k.downcase)\n str.delete( k )\n end\n end\n \n if v > 1\n str.delete( k )\n end\n end\n\n str.empty? ? \"\" : str.to_a.first[0]\nend", "def has_digit(str)\n if str.count(\"0-9\") > 0\n true\n else\n false\n end\nend", "def digits_repeat?(number)\n !(number.to_s.chars.eql? number.to_s.chars.uniq)\nend", "def clean_numbers(original)\n number = original.delete(\"()-. \")\n\n if number.length == 10\n\n elsif number.length == 11\n if number.start_with?(\"1\")\n number = number[1..-1]\n else\n number = INVALID_PHONE\n end\n\n else\n number = INVALID_PHONE\n end\n return number\n end", "def first_non_repeating_letter(string)\n letter_group = letters.split('').group_by{ |x| x.downcase }\n uniqs = letter_group.reject{ |letter, arr| arr.count > 1 }.keys\n for x in 0..uniqs.length\n\n end\n\n\n\n # letters = string.split('')\n # letter_group = letters.group_by{ |x| x.downcase }\n # p letter_group\n # uniqs = letter_group.reject{ |letter, arr| arr.count > 1 }.keys\n # p uniqs\n # '' + uniqs[0].to_s\nend", "def uniq_digits?(num)\n digits = num.to_s.chars\n digits == digits.uniq\nend", "def number_or_string(input) #helper for pick_a_story\n new_input = input.gsub(/[^\\d]/, \"\")\n if new_input.empty?\n input\n else #return a valid number\n new_input.to_i.between?(1,146) ? new_input.to_i : 555\n end\n end", "def filter_string(string)\n string.delete(\"^0-9\").to_i\nend", "def number_is_valid_1?(number)\n number.to_s =~ /(\\d)\\1/\nend", "def acceptable_serial( str )\n # no more than two repeating characters\n return true\n end", "def luck_check (str)\n raise ArgumentError if str.match?(/\\D/) || str.empty?\n middle = str.size / 2\n first_half, second_half = str.split(/(\\d{#{middle}})\\d?(\\d{#{middle}})/).last(2)\n first_half.to_i.digits.sum == second_half.to_i.digits.sum\nend", "def same_digits?(a, b)\n return a != b &&\n a.to_s.split(/(?=.)/).sort == b.to_s.split(/(?=.)/).sort\nend", "def grab_input_number\n string = ''\n string << @input.slice!(0) while input.length != 0 and ('0'..'9').include?(input[0])\n string.to_i\n end", "def non_unique_letters(string)\nend", "def first_non_repeating_letter(string)\n result = ''\n letter_count = Hash.new(0)\n string.chars.each do |letter|\n letter_count[letter.to_sym] += 1\n end\n letter_count.select do |letter, count|\n result = letter if count == 1\n break if result.size == 1\n end\n result.to_s\nend", "def LetterCountI(str)\n\n str = str.split\n repeating_letters = []\n str.each do |word| \n word = word.split(\"\")\n letters = Hash.new(0)\n word.each { |letter| letters[letter] += 1 }\n selected_letters = letters.select { |key, value| value > 1 }\n repeating_letters << selected_letters.keys.length\n end\n if (repeating_letters.select {|l| l >= 1}).empty?\n return -1\n else\n max = repeating_letters.max\n return str[repeating_letters.index(max)]\n end\nend", "def num_search(str)\n str = str.split(\" \").keep_if{|char| char =~ /[0-9]/}\n #puts(str)\n da_sum = str.inject{|sum,n| sum.to_i + n.to_i}\n return da_sum\nend", "def checkForNumbers(word)\n numbers = \"1234567890\"\n word.each_char do |char|\n if numbers.include?(char)\n return true\n end\n end\n return false\nend", "def repeating_letters?(str)\r\n # your code goes here\r\n str = str.downcase.split(\"\")\r\n temp = \"\"\r\n i = 0\r\n while i < str.length\r\n if temp.include?(str[i])\r\n return true\r\n else\r\n temp << str[i]\r\n end\r\n i += 1\r\n end\r\n false\r\nend", "def handleTwoCardSameValue(str)\n max = 0\n list = []\n str.each_char do |i|\n if str.count(i) == 2\n max = replaceCharToNumber(i)\n else\n list.push(replaceCharToNumber(i))\n end\n end\n return [max] + list.sort.reverse\nend", "def number2?(input)\n /\\p{N}/.match(input) || /\\p{Nd}/.match(input)\nend", "def string_increment(string)\n result = string.split(/[a-z]/i)\n new_str = ''\n if string[-1] =~ /[a-z]/i || string == \"\"\n new_str = string + \"1\"\n else\n digits_size = result.last.size\n if ((result.last.to_i + 1).to_s).size < digits_size # means 0 doestn't matter\n new_str = string[0, string.size-result.last.to_i.to_s.size]+(result.last.to_i + 1).to_s\n else\n new_str = string[0, string.size - digits_size] + (result.last.to_i + 1).to_s\n end\n end\n new_str\nend", "def test_and_pass_1919fdjksl3_return_false\r\n\t\tassert_equal(false, all_numeric_digits?(\"1919fdjksl3\"))\r\n\tend", "def first_non_repeating_letter(s) \n counts = Hash.new(0)\n s.split(\"\").reduce(counts) { |k, v| k[v] += 1; k}\n p counts\n counts.key(1).nil? ? \"\" : counts.key(1)\nend", "def test_8_accepts_includes_numbers\n result = includes_number?(\"Hat123!!\")\n assert(result, \"Hat123!! has non alphanumeric, should be valid\")\n end", "def number_is_valid_2?(number)\n str = number.to_s\n str.scan(/(\\d)\\1+/).length - str.scan(/(\\d)\\1\\1+/).length > 0\nend", "def clever_char(string)\n string_hash = Hash.new(0)\n arr = []\n\n string.each_char do |char|\n string_hash[char] += 1\n end\n\n string_hash.each do |key, val|\n if val > 2\n arr << key\n end\n end\n\n return arr\nend", "def no_ending_num?(string)\n true unless string[-1] =~ /[0-9]/\nend", "def get_number_from_word(source_text)\n source_letters = source_text.split (\"\")\n result = \"\"\n \n source_letters.each do |next_letter|\n if [\"a\", \"b\", \"c\"].include?(next_letter)\n next_processed_letter = \"2\"\n \n end\n \n \n result = \"#{result}#{next_processed_letter}\"\n \n end\n \n \n return result\n \nend", "def repeating_letters?(str)\n # your code goes here\n # new_str = str.downcase\n # hash = Hash.new(0)\n\n # new_str.each_char do |char|\n # hash[char] += 1\n # end\n\n # hash.each do |k,v|\n # if v > 1\n # return true\n # end\n # end\n # false\n\n str.downcase.chars.uniq.length != str.length\nend", "def clean\n @number.gsub!(/\\D/,\"\")\n\n if has_11_digits? and starts_with_1?\n @number = @number[1..-1] \n elsif invalid_length?\n @number = nil\n end\n end", "def digit_or_word\n input = gets.strip.downcase\n input.match(/\\d+/).to_s.to_i == 0 ? input : input.to_i \n end", "def check_if_letter(number)\n while number =~ /[a-z]/\n puts \"numbers only please\"\n number = gets.chomp\n end\n number = number.to_i\n return number\nend", "def numbers_to_letters(string)\n convertion_table = ('A'..'Z').to_a\n words = string.split('+')\n words.map do |word|\n word.scan(/\\d+/).map{|letter| convertion_table[letter.to_i - 1]}.join\n end.join(' ')\nend", "def interesting_number(number)\n return false if number.to_s.split(\"\").length < 3 \n number.to_s.split(\"\").sort[0] == \"0\" ? number.to_s.split(\"\").delete_at(0) && number.to_s.split(\"\").push(\"0\") : x = x\n return number.to_s.split(\"\")[0] < number.to_s.split(\"\")[-1] ? number.to_s.split(\"\").sort == number.to_s.split(\"\") || false : number.to_s.split(\"\").sort.reverse == number.to_s.split(\"\") || false\nend", "def select_only_integers(phone_number_str)\n\t#remove all the non integers from the string\n\tphone_number = phone_number_str.gsub(/\\D/, '')\t\n\treturn phone_number\nend", "def includes_number?(string)\n digits = ('0'..'9').to_a\n string.each_char do |char|\n return true if digits.include?(char)\n end\n false\nend", "def count_letters(string)\n i = 0\n \n length = string.length\n count = 1\n \n summary_string = \"\"\n \n while i < length\n if string[i] == string[i+1]\n count += 1\n else\n summary_string << \"#{string[i]}#{count}\"\n count = 1\n end\n i += 1\n end\n \n if summary_string.length < length\n return summary_string\n else\n return string\n end\nend", "def check_input(input)\n if /\\D/.match(input)\n false\n else\n true \n end\nend", "def digit_count(string)\n string = string.split('')\n digit_count = 0\n string.each do |character|\n if 48 <= character.ord && character.ord <= 57\n digit_count += 1 \n end\n end\n digit_count\n end", "def isNumber(character)\n return character.to_i.to_s == character.to_s\nend", "def integer?(num)\n num.to_i.to_s == num # converts num to interger and back to string and then compares this with num.\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend", "def integer?(num)\n num.to_i.to_s == num # converts num to interger and back to string and then compares this with num.\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend", "def get_numbers(str)\n str.scan(/\\d+/)\n end", "def non_unique_letters(string)\n\n result = [] # empty accumulator\n\n string.split(\"\").uniq.each do |uni| # finding character present in the string\n each_char = 0\n\n string.split(\"\").each do |ltr| # iterating array of string\n each_char += 1 if ltr == uni\n end\n result << uni if each_char > 1\n end\n\n result\nend", "def test_is_nummeric\n assert(StringChecker.is_numeric?(\"+20\"))\n assert(StringChecker.is_numeric?(\"-020\"))\n assert(StringChecker.is_numeric?(\"123\"))\n assert(StringChecker.is_numeric?(\"0123\"))\n assert(!StringChecker.is_numeric?(\"1.2\"))\n assert(!StringChecker.is_numeric?(\"asdf\"))\n assert(!StringChecker.is_numeric?(\" \"))\n end", "def string_number?(string)\n string_arr = string.split(//)\n string_num_array = ['-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']\n string_arr.each do |item|\n if string_num_array.include?(item)\n return true\n else\n return false\n end\n end\nend", "def string_sum(string)\n letters = ('a'..'z').to_a\n sum = 0\n string.split(\"\").each{|x| sum += letters.index(x) + 1}\n sum \nend", "def alnum?(str)\n\t\t\tstr.match /^[[:alnum:]]$/\n\t\tend", "def string_sum(string)\n sum = 0\n alphabets = (\"a\"..\"z\").to_a\n string.chars.each do |ch|\n sum += alphabets.index(ch) + 1\n end\n sum\nend", "def extract_id(str)\n str.to_s.scan(/\\d+/)\n end", "def numeric_component(alphanum)\n mtch = alphanum.match(/\\d+/)\n return mtch[0].to_i if mtch\n end", "def string_expansion(str)\n \n return str if str.eql?('') || str.chars.all? {|letter| letter.match?(/[a-z,A-Z]/)} \n \n results = '' \n \n characters = str.chars\n \n current_number = 0\n \n characters.each_with_index do |letter, index|\n if index.eql?(0) && letter.match?(/[a-z,A-Z]/)\n results << letter\n elsif letter.match? (/[0-9]/)\n current_number = letter\n elsif letter.match? (/[a-z,A-Z]/)\n results << letter * current_number.to_i\n end\n end\n \n results\n \nend", "def is_an_account_number?(string)\n /\\d{4}-\\d{3}-\\d{3}/ === string ? true :false\nend", "def alphanumeric?(string)\n string.match /\\A[a-zA-Z\\d]+\\z/\nend", "def solve(s)\n s.each_char do |char|\n if !\"0123456789.\".include?(char)\n return false\n end\n end\n arr = s.split(\".\")\n if arr.length != 4\n return false\n end\n arr.each do |el|\n if !(el.to_i.is_a? Integer) || el.to_i > 255 || (\"a\"..\"z\").include?(el)\n return false\n end\n if el.length > 1 && el[1..-1].include?(\"0\")\n return false\n end\n end\n true\n\nend", "def alphanumeric?(str)\n return false if str.empty? || (str.length == 1 && str[0] == ' ')\n match = (str.match /^[a-zA-Z\\d]+$/)\n match != nil\nend", "def only_alpha(string)\r\n\ts = string.split(\"\")\r\n\tstring1=\"\"\r\n\ts.each do |letter|\r\n\t\tif (letter >= \"a\" && letter <= \"z\") || (letter >= \"A\" && letter <= \"Z\")\r\n\t\t\tstring1 += letter\r\n\t\tend\r\n\tend\r\n\tputs string1\r\nend", "def digits_repeat?(number)\n number.to_s.chars.any? { |s| number.to_s.count(s) > 1 }\nend", "def numeric?(str)\n !str.to_s.match(/^-?[\\d.]+$/).nil?\n # str.to_i.to_s == str\nend", "def NumberAddition(str)\n\n str.gsub!(/[^0-9]/, \" \")\n arr = str.split(\" \")\n sum = 0\n arr.each do |x|\n sum += x.to_i\n end\n return sum\n \nend", "def repeating_letters?(str)\n index = 0\nnew_str = str.split(\"\").sort.join.downcase\n\nwhile index < str.length\n if new_str[index] == new_str[index + 1]\n return true\n end\n index += 1\nend\nfalse\n\nend", "def extract_str( val )\n if val =~ /\\d/\n letter = val.gsub(/[^a-zA-Z]/, '')\n char_list << letter\n num_list << extract_number( val, letter )\n end\n end", "def missing_digit(str)\n equation, result = str.delete(' ').split('=')\n if result =~ /x/\n (0..9).each do |digit|\n return digit if eval(equation) == (result.sub('x', digit.to_s)).to_i\n end\n else\n (0..9).each do |digit|\n next if digit == 0 && equation =~ /\\//\n return digit if eval(equation.sub('x', digit.to_s)) == result.to_i\n end\n end\nend", "def non_unique_letters(string)\n answer = string.chars.select {|char| string.count(char) > 1}\n answer.delete(' ')\n answer.sort.uniq\nend", "def word_to_digit(str)\n num_array = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']\n valid_chars = ('a'..'z').to_a.push(' ')\n\n str_ary = str.downcase.gsub!(/./) {|letter| valid_chars.include?(letter) ? letter : ''}.split\n \n str_ary.each do |word|\n if num_array.include?(word)\n str.gsub!(word, num_array.index(word).to_s)\n end\n end\n \n str\nend", "def repetitionEncryption(letter)\n pattern = /(\\w+)[\\d\\W]+\\1\\b/i\n return letter.scan(pattern).size\nend", "def repeating_letters?(str)\n dStr = str.downcase.chars\n checkStr = \"\"\n\n dStr.each do |char|\n if checkStr.index(char) != nil\n return true\n else\n checkStr += char\n end\n end\n false\nend", "def is_a_number?(str)\n str.match(/\\d/)\nend", "def non_unique_letters(string)\n arr = string.split.join.split('')\n arr.select { |c| c if arr.count(c) > 1 }.uniq.sort\nend", "def split_problem_number_into_letter_and_number(x)\n if x.to_i>0 then return ['',x.to_i] end # for efficiency\n if x=~/([a-z]*)([0-9]+)/ then\n return [$1,$2.to_i]\n else\n fatal_error(\"illegal problem number, #{x}\")\n end\nend" ]
[ "0.66625494", "0.6660337", "0.6615773", "0.65203", "0.650181", "0.64948505", "0.6468896", "0.645902", "0.64578456", "0.64225", "0.6405384", "0.63891083", "0.6350975", "0.6339652", "0.63254076", "0.6251905", "0.6247138", "0.62456745", "0.6244465", "0.62170213", "0.62088597", "0.61982375", "0.61939585", "0.6171829", "0.6163939", "0.61629856", "0.6157453", "0.6142885", "0.6141022", "0.6129962", "0.6123007", "0.6104707", "0.6102615", "0.61003315", "0.6097581", "0.60945266", "0.60885483", "0.6087177", "0.6084446", "0.6079868", "0.6073296", "0.6067232", "0.60669845", "0.6066244", "0.60661274", "0.6060385", "0.605027", "0.6046135", "0.6043689", "0.6039849", "0.60366875", "0.60354793", "0.6035432", "0.60331553", "0.6030396", "0.6019766", "0.6017385", "0.60089225", "0.6006037", "0.60010993", "0.5998225", "0.59968996", "0.5992781", "0.59864825", "0.5985465", "0.59754425", "0.5967637", "0.59653", "0.5956973", "0.59526986", "0.5951612", "0.59428203", "0.59428203", "0.59368074", "0.59327286", "0.5928642", "0.59282595", "0.5924222", "0.59235764", "0.5920455", "0.5920281", "0.59179765", "0.5909918", "0.59068125", "0.5906468", "0.5905597", "0.5897176", "0.589387", "0.5892336", "0.5889583", "0.58872664", "0.5880933", "0.5878459", "0.58772737", "0.58713275", "0.5870577", "0.5869297", "0.5864816", "0.58635145", "0.5863323", "0.58622783" ]
0.0
-1
Keep the minimum value between memo and val, ignoring nil
def _happens(memo, val) memo.nil? ? val : (val.nil? ? memo : (memo < val ? memo : val)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min\n self.reduce('lambda{|memo, item| memo < item ? memo : item }')\n end", "def minimum_value\n @minimum_value || store.min\n end", "def min_value\n if @head.nil?\n return nil\n else\n if head.left\n min_value = min_search(head.left).data\n else\n min_value = head.data\n end\n end\n return min_value\n end", "def min\n empty? ? Float::INFINITY : @list.head.value[1]\n end", "def min\n empty? ? Float::INFINITY : @list.head.value[1]\n end", "def min\n @store.peek[:min] unless empty?\n end", "def min\n\t\tm = self.valor[0]\n\t\tfor i in (0...self.valor.size.to_i)\n\t\t\t\tif (self.valor[i]< m)\n\t\t\t\t\tm = self.valor[i]\n\t\t\t\tend\n\t\tend\n\t\treturn m\n\tend", "def min(&block)\n flag = true # 1st element?\n result = nil\n self.each{|*val|\n val = val.__svalue\n if flag\n # 1st element\n result = val\n flag = false\n else\n if block\n result = val if block.call(val, result) < 0\n else\n result = val if (val <=> result) < 0\n end\n end\n }\n result\n end", "def min\n @v.compact.min\n rescue\n nil\n end", "def my_min_2(list)\n min = nil\n\n list.each do |num|\n min = num if min.nil? || num < min\n end\n\n min\nend", "def min() end", "def my_min(arr)\n smallest = nil\n\n arr.each do |n|\n smallest = n if smallest.nil? || n < smallest\n end\n\n smallest\nend", "def min(value)\n opts[:min] = value\n end", "def my_min_once\n min = first\n each do |num|\n if num < min\n min = num\n end\n end\n min\n end", "def my_min(list)\n smallest_num = nil\n list.each do |num|\n if smallest_num == nil || smallest_num > num\n smallest_num = num\n end\n end\n smallest_num\nend", "def min\n @min || 0;\n end", "def key_for_min_value(hash)\n lowest_key = nil\n #nil means nothing\n lowest_value = nil\n hash.each do |k, v|\n #each of the key,value pairs will do\nif lowest_value == nil || v < lowest_value\n #if the lowest value = nothing or if the value in the hash\n #is lower than nothing excute code below\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "def find_minimum_value\n if self.left_child\n self.left_child.find_minimum_value\n else\n self.value\n end\n end", "def peek_min\n if next_head = self.head.sibling\n current_head = self.head\n while next_head \n next_head < current_head ? @min = next_head : @min = current_head\n current_head = next_head\n next_head = next_head.sibling \n end\n else\n @min = self.head\n end\n @min\n end", "def key_for_min_value(name_hash)\n lowest_key = nil # setting it equal to nil means that it is equal to nothing currently. kinda like = blank \n lowest_value = nil\n name_hash.each do |key, value|\n if lowest_value == nil || value < lowest_value # if our lowest value is equal to nil(blank) OR if our value is less then our curent lowest value we want to keep it \n lowest_value = value # here we are setting our lowest value equal to our value argument \n lowest_key = key \n end\n end \n lowest_key\nend", "def min_record\n min = record(infimum.next)\n min if min != supremum\n end", "def get_min\n @min ||= calculate_min\n end", "def get_min(arr)\n arr.inject do |memo,x|\n if memo < x\n memo\n else\n x\n end\n end\nend", "def minvalue\n MINVALUE\n end", "def key_for_min_value(hash)\n smallest_key = nil\n tiniest_value = nil\n hash.each do |key, value|\n if tiniest_value == nil || value < tiniest_value\n \n # this way, the smallest value in the hash so far always overwrites the existing tiniest value\n \n tiniest_value = value\n smallest_key = key\n end\n end\n smallest_key\nend", "def key_for_min_value(hash)\n if hash.length == 0\n return nil\n else\n smallest = 1000\n printme = \"\"\n hash.each do |thing, number|\n if number < smallest\n smallest = number\n printme = thing\n end\n end\n printme\n end\nend", "def my_min(list)\n\n min = nil\n\n list.each do |ele|\n min ||= ele\n list.each do |ele2|\n if ele2 < min\n min = ele2\n end\n end\n end\n\n min\nend", "def min( value )\n if value < self\n value\n else\n self\n end\n end", "def my_min_better(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def better_min(array)\n min_val = array.first\n\n array.each do |el| #O(n)\n if el < min_val\n min_val = el\n end\n end\n min_val\n end", "def key_for_min_value(hash)\n least_amount = nil\n least_name = nil\n\n hash.each do |name, amount|\n if least_amount == nil || amount < least_amount\n least_amount = amount\n least_name = name\n end\n \n end\n\n least_name\nend", "def my_min_fast(list)\n smallest = list.first\n\n list[1..-1].each { |n| smallest = n if n < smallest }\n smallest\nend", "def key_for_min_value(name_hash)\n lowest_value = nil #do I need to say = nil?\n lowest_key = nil\n name_hash.each do |key, value| \n if lowest_value == nil\n lowest_value = value\n lowest_key = key\n elsif value < lowest_value \n lowest_value = value \n lowest_key = key\nend\nend\nreturn lowest_key\nend", "def minimum_value\n current = self\n \n while current.left_child != nil do\n current = current.left_child\n end\n \n return current.data\n end", "def min(field, opts={})\n opts = ::Hashie::Mash.new(opts)\n all(opts).inject(nil) do |min, item|\n val = item.send(field)\n min = val if !val.nil? && (min.nil? || val < min)\n min\n end\n end", "def find_min\n loc = find_min_locator and loc.value\n end", "def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end", "def key_for_min_value(hash)\n # binding.pry\n lowest_key = nil\n lowest_value = 0\n # binding.pry\n hash.each do |key, value|\n if lowest_key == nil || value < lowest_value\n # binding.pry\n lowest_value = value\n lowest_key = key\n # binding.pry\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n small_key = nil\n small_value = nil\n \n hash.each do |key, value|\n if small_value == nil || value < small_value\n small_value = value\n small_key = key\n end\nend\nsmall_key\nend", "def key_for_min_value(name_hash)\n key = {none: nil}\n name_hash.each do |item, no| \n if key[:none] == nil || no < key[:none]\n key[:low] = item\n key[:none] = no\n end\n end\n key[:low]\nend", "def peekMin()\n @store[1]\n end", "def key_for_min_value(name_hash)\n #my solution used smallest = 1000 because I needed a high number to compare each value to but I found setting it to nil and then assigning value to smallest if it is nil || bigger than value on the solution branch on github and I like this much better\n smallest = nil\n return_key = nil\n name_hash.each do |key, value| \n if smallest == nil || value < smallest\n smallest = value\n return_key = key\n end\n end\n return_key\nend", "def my_min2(array)\n lowest_val = Float::INFINITY\n array.each do |el|\n lowest_val = el if el < lowest_val\n end\n\n lowest_val\nend", "def my_min(list)\n min = list[0]\n\n list.each do |ele| \n case min <=> ele\n when 1\n min = ele\n when 0\n next\n when -1\n min = min \n end\n end\n\n min\nend", "def key_for_min_value(name_hash={})\n if name_hash == {}\n return nil\n else\n lowestvalue = name_hash.flatten[1]\n lowestvaluekey = name_hash.flatten[0]\n #Can't figure out how to set lowestvalue\n name_hash.collect{|name,value| \n if value < lowestvalue \n #if get to last value in hash return the lowestvalue\n lowestvalue = value\n lowestvaluekey = name\n end\n if value == name_hash.flatten[-1]\n return lowestvaluekey\n end\n }\n end\nend", "def key_for_min_value(name_hash)\n # saves the smaller value in memo, and takes the first elem of memo at the end (the key)\n smallest = name_hash.inject do|memo, (k, v)|\n memo = v < memo[1] ? [k,v] : memo\n end\n #handle the empty hash case...\n smallest ? smallest[0] : nil\nend", "def good_my_min(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def key_for_min_value(hash)\n key = nil\n min = nil\n hash.each do |item, price|\n if min.nil? or price < min\n min = price\n key = item\n end\n end\n key\nend", "def key_for_min_value(name_hash)\n if name_hash == {} #if hash is empty then return nil\n return nil\n else\n lowValue = name_hash.first[1] #set lowest value to hash first value\n lowKey = name_hash.first[0] #set key to the lowest value to first position in hash\n name_hash.each do |key, val| #for each key and value do as follows under\n if val < lowValue #if value is less than current lowest value, do under\n lowValue = val #set lowest value to val\n lowKey = key #set lowest key to key\n end\n end\n return lowKey\n \n end\nend", "def my_min(arr) #linear\n arr.reduce do |smallest, num|\n if smallest < num\n smallest\n else\n smallest = num\n end\n end\nend", "def key_for_min_value(name_hash)\n min_v = nil\n min_k = nil #=>set both variables = to nil\nname_hash.each do |key, val|\n if min_v == nil #if min_v = nil return nil for both mins\n min_v = val\n min_k = key\n elsif min_v > val #if value is less than min_v, set variables\n min_v = val\n min_k = key\n end\nend\nmin_k #return the key for the smallest value\nend", "def key_for_min_value(hash)\n min_value = 0\n min_item = nil\n \n hash.each do |item, quantity|\n \n if min_value == 0 || quantity < min_value\n min_value = quantity \n min_item = item\n end\n end\n \n min_item\n\nend", "def my_min(arr)\n\n smallest_value = arr[0]\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n # smallest_value = ele1 if ele1 < smallest_value\n if arr.all?{|ele2| ele1 <= ele2 } #O(n)\n smallest_value = ele1\n end\n end\n\n smallest_value\n\nend", "def key_for_min_value(name_hash)\n# hold the prev value\n\n num = 1000\n x = name_hash.collect do |k,v|\n if v < num\n\n num = v\n k\n # ans\n # puts ans\n end\n end\n\n x.compact!\n x[-1]\nend", "def reset()\n @value = self.min\n end", "def my_min_iterative(array)\n minimum = nil\n\n array.each { |element| minimum = element if minimum.nil? || element < minimum }\n\n minimum\nend", "def my_min_improved(arr)\n min = arr[0]\n\n arr.each do |el|\n min = el if el < min\n end\n\n return min\nend", "def my_min2(arr)\n minimum = arr.first\n arr.each do |num|\n minimum = num if num < minimum\n end\n minimum\nend", "def key_for_min_value(hash)\n smallest_key = nil\n tiny_value = nil\n hash.each do |key, value|\n if tiny_value == nil || value < tiny_value\n tiny_value = value\n smallest_key = key\n end\n end\n smallest_key\nend", "def key_for_min_value(name_hash)\n def key_for_min_value(hash)\n key_of_smallest_value = nil #set it to nil, compare to nil and it will fail\n smallest_value = nil\n hash.each do |k,v| #1. iterate over hash\n\n if smallest_value == nil #2. compare key/value\n smallest_value = v\n key_of_smallest_value = k\n else\n if v < smallest_value #3. capture outcome\n smallest_value = v\n key_of_smallest_value = k\n end\n end\n end\n key_of_smallest_value #4. go back and iterate over hash\nend\nend", "def key_for_min_value(hash)\n smallest = nil\n hash.each do |key, value|\n if smallest == nil\n smallest = key\n end\n if hash[key] < hash[smallest]\n smallest = key\n end\n end\n smallest\nend", "def my_min_2(list) \n min = list.first \n list.each {|num| min = num if min > num }\n min\nend", "def key_for_min_value(hashy)\nlowest_v = Float::INFINITY\nlowest_k = nil\n hashy.each do | object , cost |\n if cost < lowest_v\n lowest_v = cost\n lowest_k = object\n end\n end\n p lowest_k\nend", "def key_for_min_value(hash)\n smallest = nil\n key = nil\n hash.collect do |name, val|\n if smallest == nil || val < smallest\n smallest = val\n key = name\n end\n end\n key\nend", "def key_for_min_value(hash)\n key_var = nil\n value_var = nil\n \n \n hash.each do |key, value|\n \n if value_var == nil || value < value_var\n key_var = key \n value_var = value \n end\n end\n key_var\n \nend", "def find_minimum\n current = @root\n\n while current.left && !current.nil?\n current = current.left\n return current.value if current.left.nil?\n end\n end", "def key_for_min_value(name_hash)\n if name_hash=={} \n # really interesting, when using =(i know its worng but pass nil)\n return nil\n else\n a=(name_hash.collect {|x,y| y}).min\n name_hash.collect {|x,y| return x if y==a}\n end\n \nend", "def key_for_min_value(hash)\n smallest_value = nil\n smallest_key = nil\n hash.each do |name, num|\n if smallest_value == nil || num < smallest_value\n smallest_value = num\n smallest_key = name\n end\n end\n smallest_key\nend", "def key_for_min_value(name_hash)\n smallest = nil\n this_num = 0\n previous_num = 1000000\n name_hash.collect { |item, qty|\n this_num = qty\n if this_num < previous_num\n smallest = item\n previous_num = this_num\n end\n }\n smallest\nend", "def my_min(arr)\n min = arr.first\n\n arr.each do |el|\n min = el if el < min\n end\n\n min\nend", "def key_for_min_value(name_hash)\n smallest_value = 0\n smallest_key = nil\n \n name_hash.each do |key,value|\n #if the smallest_value is in it's intial state \n #or if the value of the current key is less than the smallest_value\n #then: set the smallest_value to value and smallest_key to key\n \nif smallest_value == 0 || value < smallest_value\n smallest_value = value\n smallest_key = key\n end\n end\n smallest_key\nend", "def find_min_brute(nums)\n smallest = nums[0]\n nums.each do |n|\n (smallest = n) if n < smallest \n end\n return smallest\nend", "def key_for_min_value(name_hash)\n\n\t#set initial placeholder variables to compare to each value everytime you iterate\n\n\tmin_value = false\n\tmin_key = false\n\n\tif name_hash.empty? #check outside the loop so that the code in the loop runs\n\t\treturn nil\n\tend\n\n name_hash.each do | key, value | #start loop\n\n\t\tif min_value == false #check to see if it's exactly identical to false first since it is not it will take the value of the first iteration\n\t\t\tmin_value = value #min_value is now equal to false\n\t\t\tmin_key = key\n\t\t\t# we don't want min_value to stay false so we reset it below\n\t\telsif min_value > value # reset and assign the current value to the min value to compare and assign the lowest value\n\t\t\tmin_value = value\n\t\t\tmin_key = key\n \tend\n\tend\n\n return\tmin_key\n\nend", "def key_for_min_value(name_hash)\nlowest_key = nil \nlowest_value = nil \n\nname_hash.each do |name,num|\n if lowest_value === nil || num < lowest_value\n lowest_value = num\n lowest_key = name \n end\nend\nreturn lowest_key\nend", "def find_min(arr)\n smallest_value = arr.first\n for value in arr\n if value <= smallest_value\n smallest_value = value\n end\n end\n smallest_value\nend", "def key_for_min_value(hash)\n num = \n word = nil\n hash.each do |key, value|\n if num == nil || value < num\n num = value\n word = key\n end\n end\n word\nend", "def min(list)\n tiny = list[0]\n list.each do |n|\n if n < tiny\n tiny = n\n end\n end\n puts tiny\nend", "def find_min\r\n return nil if !@head\r\n cursor = @head\r\n min = cursor.data\r\n while cursor\r\n if cursor.data < min\r\n min = cursor.data\r\n end\r\n cursor = cursor.next\r\n end\r\n return min\r\n end", "def best_my_min(arr)\n smallest = arr.shift\n arr.each do |el|\n smallest = el unless el > smallest\n end\n smallest\nend", "def my_min_fast(arr)\n smallest = arr[0]\n arr.each do |ele|\n if ele < smallest\n smallest = ele\n end\n end\n return smallest\nend", "def key_for_min_value(name_hash)\n key_of_smallest_value = \"\"\n smallest_value = 99999\n name_hash.each do |key, value|\n if smallest_value > value\n smallest_value = value\n key_of_smallest_value = key\n end\n end\n if name_hash.size == 0\n key_of_smallest_value = nil\n end\n key_of_smallest_value\nend", "def key_for_min_value(ha)\nans = 999999999\n ha.each do |hash, key|\n if key < ans\n ans = key\n end\n end\n \n ha.each do |hash1, key1|\n if key1===ans\n return hash1\n end\n end\n puts ans\n\nend", "def key_for_min_value(hash)\n min_val = Float::INFINITY\n min_key = nil\n hash.each do |key, value|\n if value < min_val\n min_val = value\n min_key = key\n end\n end\n min_key\nend", "def key_for_min_value(name_hash)\n current_num = nil\n current_val = nil\n name_hash.each do |item,num|\n if current_num == nil || num < current_num\n current_num = num\n current_val = item\n end\n end\ncurrent_val\nend", "def smallest\n # self.compact.sort.first\n self.compact.min\n end", "def key_for_min_value(name_hash)\n key_for_min = nil\n lowest_value = nil\n\nname_hash.each do |key, value| #going to return value\n \n if lowest_value == nil || value < lowest_value\n lowest_value = value\n key_for_min = key \nend\nend\nkey_for_min\nend", "def key_for_min_value(name_hash)\n if name_hash.length == 0\n return nil\n else\n new = \"\"\n smallest = nil\n name_hash.collect do |x,value|\n if(smallest == nil)\n smallest = value\n new = x\n else\n if(smallest>value)\n smallest = value\n new = x\n end\n end\nend\nnew\nend\nend", "def key_for_min_value(name_hash)\nlowest = {lowkey: nil, lowval: 0}\n name_hash.collect do |key, value|\n if value < lowest[:lowval] || lowest[:lowkey] == nil\n lowest[:lowval] = value\n lowest[:lowkey] = key\n end\n end\nlowest[:lowkey]\nend", "def key_for_min_value(hash)\n if hash.count < 2\n return hash[0]\n else \n num = 42\n hash.each do |key, value|\n if value <= num\n num = value\n end\n end\n hash.invert[num] \n end\nend", "def my_min(arr) # Find\n min = arr[0]\n\n arr.each do |el| # Go through array once O(n)\n min = el if el < min # update min while going through if found min\n end\n min\nend", "def key_for_min_value(hash)\n if hash.empty?\n return nil\n end\n ans = [hash.first[0],hash.first[1]]\n hash.each do |k,v|\n if v < ans[1]\n ans[1] = v\n ans[0] = k\n end\n end\n return ans[0]\nend", "def find_min()\r\n self.min\r\n end", "def min\n\n minimo = 0.to_f\n for i in 0...matriz.size \n if matriz[i] != nil \n matriz[i].each do |key, value|\n if matriz[i][key].to_f < minimo\n minimo = matriz[i][key].to_f\n end\n end\n end \n end\n minimo\n\tend", "def key_for_min_value(hash)\n lo_key = nil \n lo_value = nil \n hash.each do |k,v| \n if lo_key == nil || v < lo_value\n lo_key = k \n lo_value = v \n end \n end \n lo_key\n end", "def key_for_min_value(hash)\n key = nil\n lowest_value = nil\n hash.each do |name, value|\n if lowest_value == nil || value < lowest_value\n lowest_value = value\n key = name\n end\nend\nkey\nend", "def my_min(list)\n min = list.first \n\n list.each do |el|\n if el < min \n min = el \n end\n end\n min\nend", "def key_for_min_value(name_hash)\n min_value=-1\n cheapest=nil\n name_hash.collect do |thing, value|\n if min_value==-1\n min_value=value\n cheapest=thing\n elsif min_value>value\n min_value=value\n cheapest=thing\n end\n\n end\n cheapest\nend", "def key_for_min_value(name_hash)\n empty = nil\n min = 0\n index = 0\nname_hash.each do |name, value|\n\n if index == 0 || value < min\n min = value\n empty = name\n index +=1\nelsif name_hash.empty?\n return nil\n end\nend\nempty\nend", "def my_min2(arr)\n min = arr.first\n arr.each { |el| min = el if el < min }\n min\nend", "def key_for_min_value(name_hash)\n smallest = nil\n smallest_value = nil\n name_hash.each do |key, value|\n if smallest_value == nil || value < smallest_value\n smallest_value = value\n smallest = key\n end\n end\n\n smallest\n # name_hash.inject({}) do {|memo, (key,value)| ? key[value]<}\nend" ]
[ "0.6684925", "0.6631327", "0.6519565", "0.6507411", "0.6507411", "0.6402685", "0.6324474", "0.632148", "0.62807685", "0.62409806", "0.62404114", "0.62130827", "0.6205839", "0.6169184", "0.615579", "0.6140642", "0.60934997", "0.6087237", "0.60590863", "0.6050531", "0.60339797", "0.60315466", "0.60260767", "0.60217726", "0.5982447", "0.59778607", "0.5971102", "0.59675705", "0.59644675", "0.59513766", "0.5917634", "0.5914393", "0.5906245", "0.5900444", "0.58954275", "0.5894408", "0.58881235", "0.5884177", "0.5873737", "0.5861493", "0.5861297", "0.5849541", "0.5842449", "0.5841372", "0.58405894", "0.58327395", "0.58316696", "0.58282304", "0.58269924", "0.58177274", "0.58165497", "0.5813074", "0.5811395", "0.5809021", "0.58057266", "0.5804162", "0.57983583", "0.57948333", "0.5781581", "0.5777227", "0.5776503", "0.57710296", "0.5770441", "0.57687277", "0.5765051", "0.57608396", "0.5759237", "0.5745859", "0.5737241", "0.57318056", "0.57307535", "0.5730346", "0.57301635", "0.57162523", "0.57138264", "0.57131463", "0.5712704", "0.5711899", "0.57093173", "0.5703163", "0.5702226", "0.5702015", "0.5701103", "0.5701036", "0.56973815", "0.5696644", "0.5695283", "0.5681144", "0.5680809", "0.5678681", "0.56770796", "0.56749827", "0.5672847", "0.567096", "0.5669902", "0.5668254", "0.5666574", "0.5662042", "0.56611085", "0.56595397" ]
0.61674887
14
Set up the scene
def initialize #Graphics.freeze @closing = false @savequit = false $mouse.change_cursor('Default') sys('open') # Vp @vp = Viewport.new(0,0,$game.width,$game.height) @vp.z = 3500 @snap = Sprite.new(@vp) @snap.z = -101 @snap.bitmap = $game.snapshot # Background @bg = Sprite.new(@vp) @bg.z = -100 #@bg.bitmap = Bitmap.new(640,480) #@bg.bitmap.fill(Color.new(0,0,0,180)) @bg.bitmap = $cache.menu_background("sample") #@bg.bitmap = $cache.menu_background("witch") @bg.opacity = 0 #@bg.y = 30 #@bg.do(seq(go("y",-50,150,:qio),go("y",20,150,:qio))) #self.do(delay(300)) @next_menu = $menu.menu_page $menu.menu_page = nil @menu = nil #Graphics.transition(20,'Graphics/Transitions/trans') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(args)\n # Camera\n position = Engine3D::Vector.new 0.0, 0.0, 0.0, 1.0\n direction = Engine3D::Vector.new 0.0, 0.0,-1.0, 1.0\n args.state.camera = Engine3D::Camera.new position, direction\n \n # Renderer :\n args.state.renderer = Engine3D::Render.new 1280, 720, # viewport size \n args.state.camera, # camera\n 1.0, 300.0 # near and far planes\n\n # Scene :\n args.state.scene = Engine3D::Scene.load args,\n 'data/scenes/scene1.rb',\n SPRITE_SCALE\n\n # Miscellenaous :\n args.state.angle = 0.01\n\n\n args.state.setup_done = true\nend", "def start_scene; end", "def initialize(scene)\n super(800,600, false)\n self.caption = \"Ruby Ren'ai Game Engine\"\n @hidden = false\n @script = Script.new(self)\n @graphics = Graphics.new(self)\n @clickables = Array.new\n @music = Music.new(self)\n @scriptreader = ScriptReader.new(self, scene || \"mainmenu\")\n @time = Gosu::milliseconds\n advance\n end", "def setup(args)\n position = Engine3D::Vector.new 0.0, 0.0, 0.0, 1.0\n direction = Engine3D::Vector.new 0.0, 0.0,-1.0, 1.0\n args.state.camera = Engine3D::Camera.new position, direction\n args.state.renderer = Engine3D::Render.new 1280, 720, args.state.camera, 1.0, 300.0\n\n #args.state.scene = Engine3D::Scene.load 'sprite3dengine/data/scenes/debug.rb'\n #args.state.scene = Engine3D::Scene.load 'sprite3dengine/data/scenes/scene1.rb'\n args.state.scene = Engine3D::Scene.load 'sprite3dengine/data/scenes/demo.rb'\n\n #args.state.angle = 0.01\n #args.state.camera_angle = 0.001\n\n # DEBUG :\n #args.state.frame_counter = 0\n\n args.state.setup_done = true\n\n puts \"setup finished!!!\"\nend", "def start\n # start a timer on scene load\n @timer.reset_timer\n case @scene\n when 'intro'\n start_intro\n when 'level'\n start_level\n when 'transition'\n start_transition\n when 'credits'\n start_credits\n end\n end", "def start!\n @window = Window.new width, height, fullscreen?\n window.caption = name\n window.scene = Scenes.generate(first_scene)\n window.show\n end", "def start!(scene)\n raise \"The game has already started.\" if showing?\n\n Gamework::ENV ||= 'development'\n make_logger(@log_file)\n @logger.info 'Starting the game'\n\n make_window\n add_scene(scene)\n show\n end", "def main\n create_graphics\n curr_scene = $scene\n check_up\n while @running && curr_scene == $scene\n Graphics.update\n update\n end\n dispose\n # Unload title related pictures\n RPG::Cache.load_title(true)\n RPG::Cache.load_interface(true)\n ::Scheduler.start(:on_scene_switch, ::Scene_Title) if !@running && $scene.is_a?(Scene_Map)\n end", "def set_scene\n @scene = Scene.find(params[:id])\n end", "def set_scene\n @scene = Scene.find(params[:id])\n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @title_window = Window_Outline_Title.new(0, 0, 640, 56)\n @content_window = Window_Outline.new(0, 56, 640, 424)\n \n # Create Window \n @list_window = Window_Outline_List.new(0, 0, 400, 400, Vocab::tutorials_strings)\n width_remain = (640 - @list_window.width)/2\n @list_window.x = width_remain.floor\n height_remain = (480 - @list_window.height)/2\n @list_window.y = height_remain.floor\n end", "def initialize(start_scene)\n @start_scene = start_scene\n end", "def setup\n super\n @background = Image['Bg level1.png']\n viewport.lag = 0\n viewport.game_area = [0, 0, 3000, 1000]\n @gilbert = Gilbert.create(x: 50, y: 900, limited: viewport.game_area.width)\n @level = File.join(ROOT, 'levels', self.filename + '.yml')\n load_game_objects(file: @level)\n\n @plataformas = Plataforma2.all\n @music = Song.new('media/Songs/Music Level1.mp3')\n @loser_song = Song.new('media/Songs/gameover.ogg')\n\n @moneda = Moneda.all.first\n\n @meta_on = false\n\n @marco_name = Image['MarcoName.png']\n @marco_score = Image['MarcoPoint.png']\n\n @score = 0\n @msj_name = Chingu::Text.new(@player_name, x: 85, y: 25, size: 30, color: Gosu::Color::WHITE)\n @msj_score = Chingu::Text.new(@score.to_s, x: $window.width - 130, y: 30, size: 35)\n @mensaje = Chingu::Text.new('Has encontrado todas las monedas', x: 320, y: 20, size: 25, color: Gosu::Color::GREEN)\n @mensaje2 = Chingu::Text.new('Encuentra la Meta', x: @msj_name.x, y: 45, size: 30, color: Gosu::Color::YELLOW)\n\n @music.play(true) if @sonido\n end", "def _start_scene\n # Load YAML file\n build_scene(scene_file) if scene_file\n # Call hook method\n start_scene\n # Perform opening transition\n do_transition(transition_options[:start]) if transition_options.try(:[], :start)\n # Mark self as built\n @built = true\n end", "def init primaryStage\n # Sets the window title\n primaryStage.setTitle getWindowTitle\n\n # Create the scene\n setSceneNodes Group.new\n setGameSurface Scene.new getSceneNodes, 640, 580\n primaryStage.setScene getGameSurface\n\n generateManySpheres 150\n\n # Display the number of spheres visible.\n # Create a button to add more spheres.\n # Create a button to freeze the game loop.\n gameLoop = getGameLoop\n stats = VBoxBuilder.create\n .spacing(5)\n .translateX(10)\n .translateY(10)\n .children(HBoxBuilder.create\n .spacing(5)\n .children(\n Label.new(\"Number of Particles: \"),\n @num_sprites_field\n ).build,\n\n # button to build more spheres\n ButtonBuilder.create\n .text(\"Regenerate\")\n .onMousePressed(proc {\n generateManySpheres 150\n }).build,\n\n # button to freeze game loop\n ButtonBuilder.create\n .text(\"Freeze/Resume\")\n .onMousePressed(proc {\n case gameLoop.getStatus\n when Animation::Status::RUNNING\n gameLoop.stop\n when Animation::Status::STOPPED\n gameLoop.play\n end\n }).build\n ).build # (VBox) stats on children\n\n # lay down the controls\n getSceneNodes.getChildren.add stats\n end", "def viewDidLoad\n super\n self.view = sk_view\n # The first time the app is loaded. Present scene one.\n present_scene_zero\n $controller = self\n end", "def setSceneNodes sceneNodes\n @sceneNodes = sceneNodes\n end", "def main\n raise 'You forgot to call super in initialize of your scene' unless @object_to_dispose\n # Store the last scene and store self in $scene\n @__last_scene = $scene if $scene != self\n $scene = self\n yield if block_given? # Ensure we call the on_scene_switch in call_scene\n # Tell the interface is running\n @running = true\n # Main processing\n main_begin\n main_process\n main_end\n # Reset $scene unless it was already done\n $scene = @__last_scene if $scene == self\n Scheduler.start(:on_scene_switch, self.class)\n end", "def run_current\n scene = @scenes.last\n\n scene.scene_arguments = @scene_args.last\n\n scene.setup(*@scene_args.last)\n scene.register_events\n scene.run\n end", "def initialize\n super(WIDTH, HEIGHT)\n self.caption = 'Sector Five'\n @background_image = Gosu::Image.new('images/start_screen.png')\n @scene = :start\n\n @game = GameService.new(self)\n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n create_command_window()\n @status_window = Window_Party_Status.new(0, 0, 480,424, $game_party.members)\n @menu_info_window = Window_Menu_Info.new(0,424,640,56)\n end", "def setup\n\t\tsuper\n\t\t@x = 400\n\t\t@y = 300\n\t\t#@image = Gosu::Image[\"Ship.png\"]\n\t\t self.input = {\n\t\t \tholding_left: :left,\n\t\t \tholding_right: :right,\n\t\t \tholding_up: :up,\n\t\t \tholding_down: :down,\n\t\t \tspace: :fire\n\t\t }\n\t\t@speed = 10\n\t\t@angle = 0\n\t\t@animation = Chingu::Animation.new(:file => \"flame_48x48.bmp\")\n\t\t@animation.frame_names = { :still =>0..1, :up =>2..5, :fire =>6..7}\n# :still =>0..1, :fire =>6..7, :up =>2..5\n\t\t@frame_name = :still\n\t\t@last_x, @last_y = @x, @y\n\tend", "def initialize\n\t\t@t = 0.0\n\n\t\t# bind callback to OSX Trackpad multitouch events\n\t\tTrackpad.clear()\n\t\tTrackpad.connect()\n\t\tTrackpad.bind( lambda{ |i,f| \n\t\t\tif i == 1\n\t\t\telsif i == 2\n\t\t\tend\n\t\t})\n\n\t\tMouse.clear()\n\t\tMouse.use()\n\n\t\tparser = EisenScriptParser.apply(tree())\n\t\t@model = Model.new()\n\t\t@model.material(BasicMaterial.new())\n\t\t@model.material.color.set(0,1,0,1)\n\t\tparser.buildModel(@model)\n\n\t\tMain.setModel(@model)\n\t\t# Main.model.pose.pos.set(-50,0,0)\n\n\tend", "def setup\n \n\t# The size function is a statement that tells the computer \n\t# how large to make the window.\n\t# Each function statement has zero or more parameters. \n\t# Parameters are data passed into the function\n\t# and used as values for specifying what the computer will do.\n\tsize 640, 360\n\t\n\t# The background function is a statement that tells the computer\n\t# which color to make the background of the window \n\tbackground 102\n\t\nend", "def set_scene_object\n @scene_object = SceneObject.find(params[:id])\n end", "def setup\n size 1024,768,P3D\n background 0\n\n @context = SimpleOpenNI.new(self)\n @zoomF =0.5\n @rotX = radians(180) # by default rotate the hole scene 180deg around the x-axis, \n # the data from openni comes upside down\n @rotY = radians(0)\n\n if !@context.isInit\n puts \"Can't init SimpleOpenNI, maybe the camera is not connected!\"\n exit\n end\n\n # disable mirror\n @context.setMirror(false)\n\n # enable depthMap generation \n @context.enableDepth()\n\n # enable skeleton generation for all joints\n @context.enableUser()\n\n stroke(255,255,255)\n smooth()\nend", "def call_load_screen\n SceneManager.call(Scene_Load)\n end", "def initialize \n super(ScreenWidth, ScreenHeight, false)\n self.caption = \"Mad Pokemon\"\n $window = self\n\n @@images = Hash.new\n @@fonts = Hash.new \n load_images\n load_fonts\n\n @@fading_off = false\n @@fading_on = false\n @@end_fade = 0\n @@start_fade = 0\n\n @@change_game_state = nil\n\n @@game_state = MenuState.new\n end", "def draw\r\n $scene.draw\r\n end", "def initialize fps, title\n # The sprite and sound managers.\n @spriteManager = SpriteManager.new\n @soundManager = SoundManager.new 3\n\n # Number of frames per second.\n @framesPerSecond = fps\n\n # Title in the application window.\n @windowTitle = title\n\n # create and set timeline for the game loop\n buildAndSetGameLoop\n end", "def setup\n\t\tsize(1800,900) ; background(20) ; frame_rate 30 #JR\n\t\t# size(1400,850) ; background(20) ; frame_rate 30\n\t\t@w, @h = [width,height].map{|i|i/2.0} ; @i = 0\n \t@m = [235,18,85]\n\n \ttext_font create_font(\"SanSerif\",25) ; stroke(200,200,200)\n \t# @img = loadImage(\"/Users/Jon/Desktop/craigslist_map2.jpg\")\n \t@img = loadImage(\"/Users/Jon/Desktop/full_santa_fe.png\")\n\tend", "def setup\n OpenGL.reset_flags\n end", "def start\n DataManager.create_game_objects\n $game_party.setup_starting_members\n $game_map.setup(Config::Starting_Map_ID)\n $game_player.moveto(Config::X_Pos, Config::Y_Pos)\n $game_player.followers.visible = false\n $game_player.refresh\n $game_player.make_encounter_count\n\n @character_name = $game_player.character_name\n @character_index = $game_player.character_index\n $game_player.set_graphic('', 0)\n\n $game_system.menu_disabled = true\n Graphics.frame_count = 0\n\n super\n create_foreground\n create_background\n create_command_window\n play_title_music\n end", "def main\r\n Graphics.update until @unlocked\r\n $scene = @@class.new(*@@args)\r\n $scene.main\r\n if $scene != self\r\n $scene = nil\r\n @thread.kill\r\n end\r\n rescue Exception\r\n manage_exception\r\n end", "def setup\n\t\tsize(displayWidth, displayHeight)\n\t\tcolorMode(HSB,360,100,100,60)\n\t\t@w, @h = [width/2.0, 0]\n\t\t@i = 0 ; @t = 0\n frame_rate 20\n\t\tbackground(0)\n\n\t\t@monster = Monster.new 7, width, height\n\t\tstroke_width(160)\n\tend", "def get_scene\n SceneManager.scene\nend", "def create\n @project = Project.find(params[:project_id])\n if !@project.owner?(session_obj)\n not_authorized and return\n end\n @scene = @project.scenes.new(params[:scene])\n #load up initial background and music\n @scene.load_initial_events\n respond_to do |format|\n if @scene.save!\n format.html { redirect_to edit_project_scene_path(@project, @scene) }\n format.json { render json: @scene, status: :created, location: @scene }\n else\n flash[:notice] = @scene.errors.full_messages\n format.html { redirect_to :back }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end", "def touchesBegan touches, withEvent: _\n root.present_scene_three\n end", "def set_scene\n @scene = @scenario.scenes.find(params[:id])\n end", "def setup\n\t\ttext_font create_font(\"SanSerif\",10);\n\t\tscreen = [1920,1040] #JackRabbit\n\t\t# product[1920,1040] = 1996800\n\n\t\t# screen = [1500,900] #HOME\n\t\t# product[1500,900] = 1350000\n\n\t\t@it = 0\n\n\t\tsize(*screen)\n\t\t@w,@h = screen.map{|d| d/2}\n\t\t@i, @t = [0] * 2 ; background(0)\n\t\t@colors = (0..3).map{|i|rand(255)}\n\t\tframe_rate 2.5 ; colorMode(HSB,360,100,100)\n\t\tno_fill() ; no_stroke ; @xy = [0,0]\n\t\t\t\n\t\tcl = VERTS.map{|c| rand(30) }\n\t\t@cc = VERTS.map{|r| [(20 + rand(@w)) * 1.9,\n\t\t\t\t\t\t\t\t\t\t\t\t (20 + rand(@h)) * 1.9] }.zip(cl)\n\tend", "def didMoveToView _\n # Set the aspect ratio.\n self.scaleMode = SKSceneScaleModeAspectFit\n\n # Set the background color to white.\n self.backgroundColor = UIColor.whiteColor\n\n # Add instructions for this scene.\n add_label <<-HERE\n This is scene two. This scene shows a spinning sprite.\n\n The sprite code is located in the add_sprite method in scene_two.rb file. Take a look at it. Be sure to read all the comments in the file.\n\n Once you're done reading the code. Tap anywhere to go to the next scene.\n HERE\n\n # Add sprite (which will be updated in the render loop).\n # Assets are located inside of the resources folder.\n @square = add_sprite device_screen_width.fdiv(2),\n device_screen_height.fdiv(2),\n 'square.png'\n end", "def build_scene\n boards = TicTacToeEngine::TTT::CONFIG.boards\n scene.build do\n menu do\n label\n board_selection do\n boards.keys.each do |key|\n if boards[key][:active]\n if key == :'3x3'\n board_3x3 :id => 'board_3x3', :players => 'board_type'\n end\n if key == :'4x4'\n board_4x4 :id => 'board_4x4', :players => 'board_type'\n end\n end\n end\n end\n end\n __install \"options_scene/partial_options.rb\"\n end\n end", "def main\n\t\tstart\n\t\twhile self == SceneManager.scene\n\t\t\tGraphics.update\n\t\t\tController.keyboard.update\n\t\t\tupdate\n\t\t\tController.wait_next_frame\n\t\tend\n\t\tterminate\n\tend", "def game_setup\n end", "def create\n @disable_navp = true\n @scene = Scene.new(scene_params)\n\n respond_to do |format|\n if @scene.save\n format.html { redirect_to edit_scene_path(@scene.id), notice: 'Scene was successfully created.' }\n format.json { render action: 'show', status: :created, location: @scene }\n else\n format.html { render action: 'new' }\n format.json { render json: @scene.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize!\n $sfxengine = SoundEngine.new\n\n GameMode.enter_name_input =\n Text.new(\n Settings.winX/2,\n Settings.winY/2,\n Settings.fontsize,\n Color.new(0, 255, 0, 0.8),\n Settings.fontfile,\n \"\")\n GameMode.enter_name_headline =\n Text.new(\n Settings.winX/2,\n Settings.winY*0.35,\n Settings.fontsize,\n Color.new(0, 255, 0, 0.8),\n Settings.fontfile,\n \"enter name\")\n\n GameMode.fader = Rect.new(0, 0, Settings.winX, Settings.winY)\n GameMode.fader.colors = ColorList.new(4) { |i| Color.new(0, 0, 0, 0.8) }\n\n @ingame_timer = Timer.new\n @external_timer = Timer.new\n @engine_running = true\n @score_object = Score.new\n\n $gfxengine.prepare # TODO put to end, remove things mouse depends on!\n @mouse = Mouse.new(100, 100, Settings.mousedef)\n @score_object.cur_level = 0\n start_level @score_object.cur_level\n @textbuffer = \"\"\n GameMode.set_mode(GameMode::NORMAL)\n end", "def initialize\n\n $scene = self\n\n # Prep model\n @map = Game_Map.new\n @player = Game_Player.new\n\n # Make viewports - Also in the scene\n @vp_under = Viewport.new(0,0,$game.width,$game.height)\n @vp_under.z = 0\n @vp_main = Viewport.new(0,0,$game.width,$game.height) \n @vp_main.z = 1000\n @vp_weather = Viewport.new(0,0,$game.width,$game.height)\n @vp_weather.z = 1999\n @vp_over = Viewport.new(0,0,$game.width,$game.height)\n @vp_over.z = 2000\n @vp_ui = Viewport.new(0,0,$game.width,$game.height)\n @vp_ui.z = 3000\n \n # Make tilemap\n @panoramas = []\n @tilemap = MapWrap.new(@vp_main)\n \n @characters = [] \n @sparks = []\n @pops = []\n\n # weather in map data\n @weather = nil#Weather.new(@vp_over)\n @fogs = []\n\n # Misc Overlay\n @overlay = Sprite.new(@vp_over)\n @overlay.bitmap = Bitmap.new($game.width,$game.height)\n @overlay.bitmap.fill(Color.new(0,0,0))\n @overlay.opacity = 0\n @overlay.z = 999\n\n # Fadeout\n @black = Sprite.new(@vp_over)\n @black.bitmap = Bitmap.new($game.width,$game.height)\n @black.bitmap.fill(Color.new(0,0,0))\n @black.opacity = 0\n @black.z = 1000\n \n # UI\n @hud = nil # Define in sub\n \n end", "def set_scene\n if params[:id].include? '.vtt'\n params[:id].slice! '_thumbs.vtt'\n params[:format] = :vtt\n end\n if params[:id].include? '.jpg'\n params[:id].slice! '_sprite.jpg'\n params[:format] = :jpg\n end\n\n if Scene.find_by(checksum: params[:id])\n @scene = Scene.find_by(checksum: params[:id])\n else\n @scene = Scene.find(params[:id])\n end\n end", "def set_scene\n if params[:id].include? '.vtt'\n params[:id].slice! '_thumbs.vtt'\n params[:format] = :vtt\n end\n if params[:id].include? '.jpg'\n params[:id].slice! '_sprite.jpg'\n params[:format] = :jpg\n end\n\n if Scene.find_by(checksum: params[:id])\n @scene = Scene.find_by(checksum: params[:id])\n else\n @scene = Scene.find(params[:id])\n end\n end", "def set_nowscene\n @nowscene = Nowscene.find(params[:id])\n end", "def return_scene\n $scene = Scene_Menu.new(6)\n end", "def setup\n size(640, 360)\n background(102)\nend", "def initialize\n super ACTUAL_WIDTH, ACTUAL_HEIGHT, fullscreen: FULLSCREEN\n\n Gosu::enable_undocumented_retrofication\n \n Controllers::ControllerSupervisor.window = self\n\n Controllers::MapController.new(nil)\n\n Controllers::DialogueController.new\n Controllers::BackgroundController.new\n Controllers::HudController.new\n Controllers::ParticleController.new\n \n Controllers::MenuController.new\n Controllers::TransitionController.new\n end", "def set_position_scene1\n @position_scene1 = PositionScene1.find(params[:id])\n end", "def set_space_scene\n @space_scene = SpaceScene.find(params[:id])\n end", "def render_scene\n raise NotImplementedError.new 'Must be overridden in derived classes'\n end", "def setup\n \n size 640, 360\n \nend", "def init(primaryStage) end", "def return_scene\n $scene = Scene_Menu.new(5)\n end", "def return_scene\n $scene = Scene_Menu.new(5)\n end", "def main_end\r\n super\r\n # If switching to title screen\r\n if $scene.is_a?(Scene_Title)\r\n # Fade out screen\r\n Graphics.transition\r\n Graphics.freeze\r\n end\r\n end", "def setup\n size 640, 360, P3D\n no_stroke \n @box_size = 40\n @margin = @box_size * 2\n @depth = 400\nend", "def update\r\n $scene.update\r\n end", "def initialize(config_obj)\n @name = config_obj[:name]\n @scene = config_obj[:scene]\n @points = 0.0\n end", "def initialize(viewport,commands,scene)\n @commands = commands\n @scene = scene\n @index = 0\n offset = 0\n @path = \"Graphics/EBDX/Pictures/UI/\"\n @viewport = viewport\n @sprites = {}\n @visibility = [false,false,false,false]\n baseColor = Color.white\n shadowColor = Color.new(0,0,0,192)\n # apply styling from PBS\n self.applyMetrics\n # generate sprites\n @sprites[\"sel\"] = SpriteSheet.new(@viewport,4)\n @sprites[\"sel\"].setBitmap(pbSelBitmap(@path+@selImg,Rect.new(0,0,92,38)))\n @sprites[\"sel\"].speed = 4\n @sprites[\"sel\"].ox = @sprites[\"sel\"].src_rect.width/2\n @sprites[\"sel\"].oy = @sprites[\"sel\"].src_rect.height/2\n @sprites[\"sel\"].z = 99999\n @sprites[\"sel\"].visible = false\n # fill sprites with text\n bmp = pbBitmap(@path+@btnImg)\n for i in 0...@commands.length\n k = @commands.length - 1 - i\n @sprites[\"choice#{i}\"] = Sprite.new(@viewport)\n @sprites[\"choice#{i}\"].x = Graphics.width - bmp.width - 14 + bmp.width/2\n @sprites[\"choice#{i}\"].y = Graphics.height - 136 - k*(bmp.height+4) + bmp.height/2\n @sprites[\"choice#{i}\"].z = 99998\n @sprites[\"choice#{i}\"].bitmap = Bitmap.new(bmp.width,bmp.height)\n @sprites[\"choice#{i}\"].center!\n @sprites[\"choice#{i}\"].opacity = 0\n choice = @sprites[\"choice#{i}\"].bitmap\n pbSetSystemFont(choice)\n choice.blt(0,0,bmp,bmp.rect)\n pbDrawOutlineText(choice,0,8,bmp.width,bmp.height,@commands[i],baseColor,shadowColor,1)\n end\n bmp.dispose\n end", "def start\n super\n create_menu_background\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n \n @item_back_window = Window_Base.new(0, 56, 640, 328)\n @dataviews_window = Window_Dataviews.new(0, 56, 640, 56, MENU_CONFIG::ITEM_DATAVIEWS)\n @dataviews_window.active = false\n @dataviews_window.opacity = 0\n \n @item_window = Window_Item.new(0, 96, 640, 272, $game_party.items, @dataviews_window.selected_view)\n @item_window.opacity = 0\n @item_window.help_window = @help_window\n \n @equip_details_window = Window_EquipDetails.new(0,384,640,96,nil)\n @equip_details_window.visible = false\n @item_details_window = Window_ItemDetails.new(0,384,640,96,nil)\n @item_details_window.visible = false\n update_detail_window(@item_window.selected_item)\n \n @target_window = Window_Party_Status.new(0, 0, 480, 424, $game_party.members)\n hide_target_window\n end", "def start\n super\n create_menu_background\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n \n @item_back_window = Window_Base.new(0, 56, 640, 328)\n @dataviews_window = Window_Dataviews.new(0, 56, 640, 56, MENU_CONFIG::ITEM_DATAVIEWS)\n @dataviews_window.active = false\n @dataviews_window.opacity = 0\n \n @item_window = Window_Item.new(0, 96, 640, 272, $game_party.items, @dataviews_window.selected_view)\n @item_window.opacity = 0\n @item_window.help_window = @help_window\n \n @equip_details_window = Window_EquipDetails.new(0,384,640,96,nil)\n @equip_details_window.visible = false\n @item_details_window = Window_ItemDetails.new(0,384,640,96,nil)\n @item_details_window.visible = false\n update_detail_window(@item_window.selected_item)\n \n @target_window = Window_Party_Status.new(0, 0, 480, 424, $game_party.members)\n hide_target_window\n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @actor = $game_party.members[@actor_index]\n \n @char_image_window = Window_Char_Image.new(-16, 56+16, 640, 424, @actor)\n @char_image_window.opacity = 0\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n \n @skill_back_window = Window_Base.new(200, 56, 440, 328)\n @dataviews_window = Window_Dataviews.new(200, 56, 440, 56, MENU_CONFIG::SKILL_DATAVIEWS)\n @dataviews_window.active = false\n @dataviews_window.opacity = 0\n \n @status_window = Window_Skill_Status.new(0, 0, 200, 128, @actor)\n \n @skill_window = Window_Skill.new(200, 96, 440, 272, @actor, @dataviews_window.selected_view)\n @skill_window.opacity = 0\n @skill_window.help_window = @help_window\n \n @skill_details_window = Window_SkillDetails.new(0,384,640,96,nil)\n @skill_details_window.visible = false\n @skill_window.detail_window = @skill_details_window\n \n @target_window = Window_Party_Status.new(140, 0, 480, 424, $game_party.members)\n hide_target_window\n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @actor = $game_party.members[@actor_index]\n \n @char_image_window = Window_Char_Image.new(-16, 56+16, 640, 424, @actor)\n @char_image_window.opacity = 0\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n \n @skill_back_window = Window_Base.new(200, 56, 440, 328)\n @dataviews_window = Window_Dataviews.new(200, 56, 440, 56, MENU_CONFIG::SKILL_DATAVIEWS)\n @dataviews_window.active = false\n @dataviews_window.opacity = 0\n \n @status_window = Window_Skill_Status.new(0, 0, 200, 128, @actor)\n \n @skill_window = Window_Skill.new(200, 96, 440, 272, @actor, @dataviews_window.selected_view)\n @skill_window.opacity = 0\n @skill_window.help_window = @help_window\n \n @skill_details_window = Window_SkillDetails.new(0,384,640,96,nil)\n @skill_details_window.visible = false\n @skill_window.detail_window = @skill_details_window\n \n @target_window = Window_Party_Status.new(140, 0, 480, 424, $game_party.members)\n hide_target_window\n end", "def return_scene\n $scene = Scene_Menu.new(3)\n end", "def setup_screen\n rl = ResourceLocator.instance\n if rl.is_gem?('kuiper')\n rl.dirs << Gem.loaded_specs['kuiper'].full_gem_path\n end\n rl.dotfile=\".kuiper\"\n repository = Repository.new()\n rl.storage[:repository] = repository\n rl.storage[:visual_log] = [] # Distinct from the rl.logger; this is on-screen\n optpath = rl.dotpath_for(\"options.yml\")\n if File.exists?(optpath)\n options = Options.from_file(optpath)\n else\n options = Options.new(optpath)\n options.save\n end\n rl.storage[:options] = options\n w,h = options.screen_size\n screen = rl.screen( w, h, options.fullscreen )\n icon = rl.image_for(\"kuicon.png\",false,false)\n screen.icon = icon\n screen.title = \"Kuiper\"\n setup_joystick\n return screen\nend", "def didMoveToView _\n # Set the aspect ratio.\n self.scaleMode = SKSceneScaleModeAspectFit\n \n # Set the background color to black.\n self.backgroundColor = UIColor.blackColor\n \n $scene = self\n\n # Add a label to the scene.\n # A little bit of context. The primary class that is used to construct a label\n # is called SKLabelNode. Unfortunately, SKLabelNode does not support multiline text,\n # so some supporting classes have been included to help you create multiline labels,\n # specifically StringWrapper and the `add_label` method. Fun huh?\n add_label <<-HERE\n HERE\n\n @camera = Camera.new self\n @camera.scale_rate = 0.1\n\n # Add sprite (which will be updated in the render loop).\n # Assets are located inside of the resources folder.\n @logo = add_sprite device_screen_width.fdiv(2),\n device_screen_height.fdiv(2),\n 'DVD_Logo.png'\n\n @logo.xScale = 0.5\n @logo.yScale = 0.5\n @logo.colorBlendFactor = 1.0\n @velocity = CGPointMake 1.5, 1.5\n end", "def initialize\n Game.engine.draw(Game.engine.markdown.parse('# Bandit Mayhem'))\n selection = Game.engine.prompt.select('Select an option', 'New game', 'Load game', 'Quit')\n\n case selection\n when 'New game'\n save_name = Game.engine.prompt.ask('Enter save name:', default: 'bandit-mayhem')\n\n Game.player = Player.new(name: 'Nigel', health: 30, x: 1, y: 5, map: BanditMayhem::Map::Map.new('lynwood/strick_household'))\n\n # intro\n Cinematic.new('intro').play\n\n @quit = false\n when 'Load game'\n Game.load_save if File.exist?(DEFAULT_SAVE)\n # TODO fix\n # Game.player = Player.new(name: 'Nigel', health: 30, x: 1, y: 5, map: BanditMayhem::Map::Map.new('lynwood/strick_household'))\n @quit = false\n when 'Quit'\n @quit = true\n end\n end", "def initialize(x, y, width, height)\n @ax, @ay = x, y\n @v = Viewport.new(x,y,width,height)\n @v.z = 99999\n # create the actual sprite\n super(@v)\n # set dimensions\n @width = width\n @height = height\n # create background sprite\n create_background_sprite\n # set position\n self.x, self.y, self.z = 0,0,1000#x, y, 1000\n # store variables\n @active = true\n end", "def game_start\n game_setup\n @console_delegate.show\n end", "def setup_gui\n \n end", "def touchesBegan touches, withEvent: _\n root.present_scene_two\n end", "def get_scene(scene_id:) @scene_handler.scene(scene_id:scene_id) end", "def didMoveToView _\n # Set the aspect ratio.\n self.scaleMode = SKSceneScaleModeAspectFit\n\n $scene = self\n\n # Set the background color to white.\n self.backgroundColor = UIColor.whiteColor\n\n # Add a label to the scene.\n # A little bit of context. The primary class that is used to construct a label\n # is called SKLabelNode. Unfortunately, SKLabelNode does not support multiline text,\n # so some supporting classes have been included to help you create multiline labels,\n # specifically StringWrapper and the `add_label` method. Fun huh?\n add_label <<-HERE\n Sweet. You got the application running. Welcome to the horrible mess that is called SpriteKit.\n\n I'm kidding it isn't that bad (this template will definitely make your life better). Let's get started.\n\n 1. The entry point to an iOS app is app_delegate.rb. There are a few lines in there.\n\n 2. The primary line you want to look at is the initialization of GameViewController.\n\n 3. Read app_delegate.rb and all the great comments. Cool?\n\n 4. Now jump over to game_view_controller.rb. Read that file too.\n\n 5. The prefer.* methods hide ansillary iOS UI and makes your game full screen.\n\n 6. The present_scene_one method is where the magic happens for presenting this scene.\n\n 7. Open scene_one.rb and read the code there.\n\n 8. Alrighty let's do something a bit more interesting then just displaying some text.\n\n 9. Tap anywhere to load the next scene.\n HERE\n end", "def start\n super\n create_menu_background\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, YE::SYSTEM::WINDOW_HELP)\n @system_window = Window_System.new(0, 0, 640, 384)\n \n positions = []\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cWindowSkinsLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucBGMVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucSFXVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucBGSVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cBattleAnimLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cAutoDashLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cInstantTextLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cDifficultyLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cInGameTutoLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cReturnTitleLabel.rect.y, \n @system_window.width-32, 24)))\n \n @command_window = Window_Custom_Selectable.new(0, 0, 640, 384, positions, true)\n @command_window.opacity = 0\n @command_window.visible = true\n @command_window.active = true\n @command_window.z = 1000\n if @menu_index != nil\n @command_window.index = @menu_index\n update_help()\n else\n @command_window.index = 0\n end\n\n @last_index = -1\n end", "def commandnewgame_sceneswitch\r\n # Switch to map screen\r\n $scene = Scene_Map.new\r\n end", "def create\r\n super # Create the windows\r\n show(PLACEMENT_SCREEN) # Make the main window appear\r\n end", "def game_setup\n cls\n print \"----------------\\n\"\n print \"Cinnabar - A Game Of Rocks and Minerals\\n\"\n print \"----------------\\n\\n\"\n\n print \"DISCLAIMER\\n\"\n print \" Cinnabar (c) 1966, 1972, 1980 is a trademark of Naturegraph Publishers, Inc.\\n\"\n print \" No copyright or trademark infringement is intended in using Cinnabar.\\n\\n\"\n\n print \"Welcome to Cinnabar, a digital version of the 1966 card game by Vinson Brown.\\n\"\n print \"Rules can be found in RULES.md, and info can be found in README.md.\\n\"\n print \"Source code can be found at https://www.github.com/Pokeconomist/cinnabar.\\n\\n\"\n end", "def initialize\n super(WIDTH * SCALE, HEIGHT * SCALE, false)\n self.caption = \"Commander Keen in Revenge of the Shikadi!\"\n\n @level = Level.new(self)\n @player = Player.new(self, @level.start_x, @level.start_y)\n\n @menu_options = [\n :Play,\n :Instructions,\n :\"Save/Load\",\n :Quit\n ]\n\n @menu_selection = 0\n\n @state = :menu\n @paused = false\n end", "def setup\n size(640, 360)\n smooth 4\n @loc = Vec2D.new(100, 100)\n @velocity = Vec2D.new(1.5, 2.1)\n @gravity = Vec2D.new(0, 0.2)\n\nend", "def quit\n ::HawkLoginController.load_into @stage, :width => 517,\n :height => 374\n\n @stage.min_width = 500\n @stage.min_height = 300\n\n @stage.size_to_scene\n end", "def initialize(args)\n\n # Keep a handy reference to the args\n @args = args\n\n # On startup we're not running\n @args.state.vertices.running = false\n\n # Set some basic game parameters\n @args.state.vertices.play_ticks ||= 20.seconds\n @args.state.vertices.target_shapes ||= 10\n @args.state.vertices.polygons ||= []\n @polygons = []\n @stars = []\n\n # Need an audio handler\n @audio_handler = Ahnlak::ClassAudio.new\n @audio_handler.play('vertices/sounds/title.ogg')\n\n # Initialise some other bits - again, set some defaults\n @prompt = []\n @prompt << TintedLabel.new(\n visible: true,\n x: @args.grid.center_x, y: 400,\n alignment_enum: 1, size_enum: 15,\n text: 'Click on the shape with the fewest edges',\n font: 'vertices/fonts/Kenney Future Square.ttf'\n )\n @prompt << TintedLabel.new(\n visible: true,\n x: @args.grid.center_x, y: 325,\n alignment_enum: 1, size_enum: 15,\n text: \"Can you clear #{@args.state.vertices.target_shapes} shapes in time?!\",\n font: 'vertices/fonts/Kenney Future Square.ttf'\n )\n @prompt.each do |prompt|\n prompt.colourable_cycle(\n [\n [255, 255, 255, 255],\n [100, 255, 100, 255],\n [255, 100, 255, 255]\n ],\n 30\n )\n end\n @counter = Counter.new(args)\n\n # And load up our sprites\n load_sprites\n\n # The system icons are static\n args.outputs.static_sprites << @audio_sprite\n args.outputs.static_sprites << @music_sprite\n\n end", "def initialize(options = {})\n super()\n $app = App.current = self\n set_sketch_path unless online?\n make_accessible_to_the_browser\n options = {\n :width => 400, \n :height => 400, \n :title => \"\",\n :full_screen => false\n }.merge(options)\n @width, @height, @title = options[:width], options[:height], options[:title]\n @render_mode = P2D\n determine_how_to_display options\n end", "def initialize\r\n\t\t$state=self\r\n\t\treset\r\n @removed=[]\r\n @lights=[]\r\n @camera=Camera.new($screen.width/2,$screen.height/2) #default camera ; variable can't be empty\r\n @dark=Ashton::WindowBuffer.new\r\n \r\n $enable_gui=true #enable using GUI\r\n \r\n @window=GUI::Window.new(0,0,160,240,\"Properites\",#create window, below are objects\r\n [:text,\"Type\",0,0],#the :text is one of customisations, it just shows text\r\n [:text,\"X position\",0,50],\r\n [:text,\"Y position\",0,100],\r\n [:text,\"Scale\",0,150],\r\n [:text,\"Red\",0,205],\r\n [:object,:type,GUI::Dropdown.new(20,25,\"Square\",\"Circle\",\"Triangle\")],#to make another GUI element into window, use :object, give it name and the last thing is this object. Object's position will be relative to GUI window, not absolute.\r\n [:object,:pos_x,GUI::Number.new(20,75,0,640)],\r\n [:object,:pos_y,GUI::Number.new(20,125,0,480)],\r\n [:object,:scale,GUI::Zip.new(20,190,30,4)],\r\n [:object,:red,GUI::Check.new(40,205)]\r\n )\r\n @window.disabled=true #make window invisible\r\n \r\n @new=GUI::Button.new(0,456,\"Add shape\") #make a maker-button\r\n end", "def initialize\n super(RESOLUTION[0], RESOLUTION[1], {:update_interval => UP_MS_DRAW, :fullscreen => ISFULLSCREEN})\n $program = self # global pointer to window creation object\n controls_init # prep the input controls scheme manager\n gl_version = glGetString(GL_VERSION).to_s\n gl_version = gl_version.split(' ')\n @openGL_version = Gem::Version.new(gl_version[0])\n puts(\"Using OpenGL version: #{@openGL_version} On a #{gl_version[1]} Driver Version: #{gl_version[2]}\")\n puts(\"*\" * 70)\n @@active_state = Map.new( { :level => \"\" } )\n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @actor = $game_party.members[@actor_index]\n @char_image_window = Window_Char_Image.new(-16, 56+16, 640, 424, @actor)\n @char_image_window.opacity = 0\n @char_info_window = Window_Char_Info.new(0, 0, 200, 128, @actor)\n \n @status_window = Window_Status.new(200, 40, 440, 440, @actor)\n \n @status_equip_window = Window_Status_Equip.new(415, 40, 225, 272, @actor)\n @status_equip_window.active = false\n \n @equip_details_window = Window_EquipDetails.new(0,384,640,96,nil)\n @equip_details_window.visible = false\n @item_details_window = Window_ItemDetails.new(0,384,640,96,nil)\n @item_details_window.visible = false\n \n positions = []\n positions.push(CursorPosition.new(Rect.new(@status_equip_window.x,\n @status_equip_window.y, \n @status_equip_window.width-32, \n @status_equip_window.height-32)))\n \n @command_window = Window_Custom_Selectable.new(0, 0, 640, 480, positions)\n @command_window.opacity = 0\n @command_window.visible = true\n @command_window.active = true\n @command_window.index = 0\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n @help_window.visible = false\n \n @status_equip_window.help_window = @help_window\n end", "def initialize(anchor, where, slide_direction, disp = 0)\n super()\n @rl = Opal::ResourceLocator.instance\n @bgcolor = Rubygame::Color[:blue]\n @border = Rubygame::Color[:white]\n @anchor = anchor\n @where = where\n @slide_direction = slide_direction\n @displacement = disp\n @slide_offset = 0\n @speed = 120\n \n setup_gui\n hide\n end", "def before_show()\n $ENV = VR::load_yaml(SavableSettings, \"settings.yaml\")\n @builder[:window1].resize $ENV.width, $ENV.height\n refresh()\n end", "def opening_scene()\n return next_scene(@start_scene)\n end", "def setup\n size(displayWidth, displayHeight)\n text_font create_font(\"SanSerif\",20)\n colorMode(HSB,360,100,100,60)\n @w, @h = width/2.0, height/2.0\n stroke_width 1 ; no_stroke\n frame_rate 100\n background 0\n plot_text\n\n fill(100,100,100,100)\n @trajectories = get_trajectories 1\n @delay = [0] * 100 # heuristically found.\n end", "def start\n\t\tinit\n\t end", "def setup (game)\n\t\t# #@height = hgt\n\t\t# #@width = wdth\n\t\t# flash[:notice] = \"hello world\"\n\t\t#super.initialize(game)\n\t\trequire 'Time'\n\t\tt = Time.utc(nil,nil,days,hours,minutes,nil)\n\t\t@turn_speed = t\n\tend", "def initialize(w, h, title)\r\n puts \"Initializing...\"\r\n # Open a window with a drawable area measuring w x h pixels\r\n @screen = Rubygame::Screen.open [w, h]\r\n # Set the title of the window\r\n @screen.title = title\r\n\r\n # Create a queue to receive events+\r\n # + events such as \"the mouse has moved\", \"a key has been pressed\" and so on\r\n @event_queue = Rubygame::EventQueue.new\r\n\r\n # Use new style events so that this software will work with Rubygame 3.0\r\n @event_queue.enable_new_style_events\r\n\r\n setup_clock\r\n\r\n Rubygame::TTF.setup\r\n end", "def viewDidLoad \n super\n self.new_game \n self.init_views\n\n end", "def draw\n\t\t\t\tcurrent_scene and current_scene.draw\n end" ]
[ "0.74931115", "0.7488075", "0.7136221", "0.71030194", "0.7034423", "0.697745", "0.6782637", "0.67093396", "0.6569276", "0.6569276", "0.6566926", "0.6549831", "0.6541761", "0.64757824", "0.63082474", "0.6305286", "0.6287176", "0.6256981", "0.62273306", "0.6183736", "0.61463267", "0.61322904", "0.61141014", "0.61027724", "0.608405", "0.6075532", "0.6070653", "0.60486305", "0.6031454", "0.6023713", "0.60003495", "0.59804153", "0.59550333", "0.5951985", "0.59204775", "0.5909696", "0.58929193", "0.58725446", "0.5842047", "0.5837573", "0.5830824", "0.5804812", "0.5792972", "0.5764016", "0.5754865", "0.57525855", "0.5733475", "0.5730401", "0.5730401", "0.57240474", "0.5722919", "0.5721191", "0.570924", "0.57067895", "0.5701493", "0.5699332", "0.56867105", "0.5667352", "0.5656444", "0.5656444", "0.5655305", "0.565233", "0.56297886", "0.562862", "0.562125", "0.56208813", "0.56208813", "0.5604331", "0.5604331", "0.5601835", "0.55853176", "0.5584888", "0.55834264", "0.5577362", "0.5575484", "0.5572994", "0.5572559", "0.5567806", "0.55666", "0.55443203", "0.5532513", "0.5524764", "0.5520142", "0.55003136", "0.54982775", "0.5496404", "0.5496091", "0.54851365", "0.54829735", "0.54795665", "0.54753685", "0.54747885", "0.5461785", "0.5447758", "0.54374987", "0.5432285", "0.54299027", "0.54287344", "0.5426301", "0.54172623" ]
0.5757769
44
Send text messages to all participants with their assignment.
def notify_participants participants participants.each do |participant| send_message participant.to_participant_message, participant.phone_number puts "#{participant.name} has received a text message at #{participant.phone_number}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def broadcast_message(text)\n @users.each {|u| u.enqueue_message(text) }\n end", "def send_text_to_members(user)\n message = 'appointment hasa been scheduled'\n assignee = assigned_to.full_name\n service_name = service.name\n case progress\n when 'SCHEDULED'\n message = \"appointment has been scheduled for #{service_name}\"\n when 'OTW'\n message = \"#{assignee} is on the way for the #{service_name} service\"\n when 'START'\n message = \"#{assignee} has started the appointment for the #{service_name} service\"\n when 'END'\n message = \"#{assignee} has completed the #{service_name} service\"\n when 'INVOICE'\n message = \"an invoice has been created for #{assignee} for the #{service_name} service\"\n when 'PAID'\n message = \"a payment has been made to #{assignee} for the #{service_name} service\"\n else\n message\n end\n \n TwilioClient.new.send_text(user.phone_number, message)\n end", "def send_message(message_text)\n @selected.send_message(message_text)\n end", "def send_text(text)\n client.api.send_message(id, text)\n end", "def send_message(text)\n end", "def send_to_all\n User.newsletters_allowed.each do |user|\n UserMailer.delay.new_newsletter(user, self)\n end\n end", "def sendgrid_subscriptiontrack_text texts\n @sg_subscriptiontrack_text = texts\n end", "def send(recipients, message)\n players[:x].print(message) if recipients.include? :x\n players[:o].print(message) if recipients.include? :o\n print message if recipients.include? :term and send_output_to_terminal\n end", "def send_text\n\nend", "def send_text\n Rails.logger.info \"Sending \\\"#{text}\\\" to #{number}...\"\n Twilio::Sms.message(TWILIO_CONFIG['caller_id'], number, text)\n end", "def send_it!\n raise \"No conversations found for #{property}\" unless property_conversations\n property_dialogs.each do |dialog|\n dialog.write(sender_type, message)\n end\n end", "def sendChatMessage(a_to, a_text)\n\t\tp 'JabberClient.sendChatMessage'\n\tend", "def send message, targets\n end", "def email_all\n wc = Incoming::Workcamp.find(params[:id])\n addresses = wc.participants.map { |p| p.organization.email.to_s.strip }\n redirect_to \"mailto:#{addresses.join(',')}\"\n end", "def sendMessages\n account_sid = 'ACcadef504f050d32a61aa43b3f3d939da'\n auth_token = ENV['TWILIO_AUTH']\n client = Twilio::REST::Client.new account_sid, auth_token\n\n from = '+14159664302'\n\n participants = {}\n\n self.persons.each do |person|\n participants[\"+1#{person.phone_number}\"] = {name: person.name, password: person.password}\n end\n\n # Example:\n # friends = {\n # '+19255863672' => 'Edgar Barajas'\n # }\n\n participants.each do |key, value|\n client.messages.create(\n from: from,\n to: key,\n body: \"Hey #{value[:name]}, welcome to Secret Santa!\\nVisit http://secret-santa-plus.herokuapp.com/family/#{self.id} to reveal the person you'll be buying a gift for this year, and to fill out your gift suggestions form!\\n\\nYour password is: #{value[:password]}\\n\\nHappy Holidays! :)\"\n )\n end\n end", "def send_messages(target, *strings)\n adapter.send_messages(target, strings.flatten)\n end", "def tell_all(m, message)\r\n if_admin(m) do\r\n @bot.channels.each {|c| c.send(message) }\r\n end\r\n end", "def send_text\n @number_list.each do |number|\n # clock = Alarm.new(2014, 07, 17, 11, 38, 40)\n puts Time.now\n account_sid = 'ACe330ba04d082392df4cb3511dcb72cec'\n auth_token = '2008ea097713e401a16c54029058da82'\n @client = Twilio::REST::Client.new account_sid, auth_token\n # until Time.now > clock.time\n # puts \"It's not time!\"\n # sleep (5)\n # end\n @client.account.messages.create(\n :from => '+18152642023',\n :to => number,\n :body => @body\n )\n end\n end", "def send_to_multiple(receiver_ids, pars)\n @receivers = receiver_ids.reject(&:blank?).map { |id| User.find(id) }\n @messages = @receivers.map do |user|\n Message.create sender: current_user,\n receiver: user,\n content: pars[:content]\n end\n flash[:info] = \"Your message has been sent\"\n end", "def sent\n @messages = Message.sent_by current_user\n end", "def sendout\n # do tricky HL7 and PIT stuff with narrative\n for recipient in self.user.interested_parties\n if recipient.wedgetail != created_by # don't sent back to original sender\n # do tricky encryption and email stuff for recipient\n om = OutgoingMessage.new(:recipient_id=>recipient.wedgetail)\n self.outgoing_messages << om\n om.sendout recipient\n om.save!\n end\n end\n end", "def email_players(recipient, params)\n \n subject = params[:email_subject]\n @text = params[:email_text]\n @game = Game.find(params[:game_id])\n @sender = User.find(params[:sender_id])\n \n mail :to => recipient, :subject => subject\n end", "def message(options)\n @sent_messages << options[:text]\n end", "def send(text)\n super(\"|/pm #{@id}, #{text.to_s}\")\n end", "def text_to_room txt\n each_stuff [Player,NpcFacade] do |other|\n other.view(txt)\n end\n end", "def send_backup_message participants, phone_number\n intro = \"here are the secret santa assignments:\\n\"\n message = intro + participants.map(&:to_backup_message).join(\"\\n\")\n\n send_message message, phone_number\n puts \"a backup of all assignments has been sent to #{phone_number}\"\n end", "def send_message(_target, text) # rubocop:disable Metrics/AbcSize\n url = \"https://api.gitter.im/v1/rooms/#{config.room_id}/chatMessages\"\n uri = URI.parse(url)\n\n Net::HTTP.start(\n uri.host,\n uri.port,\n use_ssl: true,\n verify_mode: OpenSSL::SSL::VERIFY_NONE,\n ) do |http|\n request = Net::HTTP::Post.new(uri.path)\n request.add_field('Content-Type', 'application/json')\n request.add_field('Accept', 'application/json')\n request.add_field('Authorization', \"Bearer #{config.token}\")\n request.body = { 'text' => text }.to_json\n response = http.request(request)\n\n @user_id = MultiJson.load(response.body)['fromUser']['id']\n end\n end", "def send_message(msg, *args)\n speakers = get_speakers(@resource[:name])\n Puppet.debug(\"#{resource[:name]} => #{msg} => #{args}\")\n speakers.each { |s| s.send msg, *args }\n end", "def ask(text)\n say(text)\n @bot.listen do |message|\n return message.text\n end\n end", "def write text=\"\"\n\t\t@message.text = @msg = text.to_s\n\tend", "def send_email_on_human_data(email_data)\n # MAILER: Enable mailer so it can send out the email\n ActionMailer::Base.perform_deliveries = true\n\n # USER: Get user in a list to send\n email_recipients = User.where(username: curation_concern.admin_set.edit_users).map(&:email)\n\n # DELIVER: Delivering the email to the reviewer\n email_recipients.each do |i|\n ScholarsArchive::HumanDataMailer.with(user_mail: i, data: email_data).email_on_human_data.deliver_now\n end\n end", "def distribute_all_answers_if_none_pending\n # only execute if text changed\n if self.changes.keys.include?(\"text\") && self.changes[\"text\"].first.blank?\n answers = self.question.answers\n if answers.pending.count == 0\n AnswerMailer.all_answers(self.question, answers.pluck(:email)).deliver\n end\n end\n end", "def send!(to_array, subject)\n begin\n conversation = Conversation.new\n conversation.subject = subject\n \n conversation.messages << self\n \n self.save!\n conversation.save!\n \n senderconversation = Userconversation.new\n senderconversation.user = self.sender\n senderconversation.readed = true\n senderconversation.conversation = conversation\n senderconversation.hide = false\n senderconversation.save!\n \n to_array.each do |to|\n receiverconversation = Userconversation.new\n receiverconversation.user = to\n receiverconversation.readed = false\n receiverconversation.hide = false\n receiverconversation.conversation = conversation\n receiverconversation.save!\n end\n return true\n rescue\n return false\n end\n end", "def translation_assignment\n user = User.first\n series = Series.first\n episode = Episode.first\n translation = Translation.first\n SeriesMailer.translation_assignment(user, series, episode, translation)\n end", "def text_notification(email)\n content = \"\"\n address = email\n phone = User.where(email: email).first.phone\n Membership.where(email: email).each do |membership|\n Task.where(group_id: membership.group_id).each do |task|\n if task.priority == 3\n content << \"#{task.title}\\n\"\n end\n end\n Subtask.where(group_id: membership.group_id).each do |subtask|\n if subtask.priority == 3\n content << \"#{subtask.task.title}: #{subtask.title}\\n\"\n end\n end\n end\n unless phone.nil?\n if content.empty? == false\n TWILIO_CLIENT.account.sms.messages.create(\n from: TWILIO_NUMBER,\n to: \"+#{phone}\",\n body: content\n )\n end\n end\n end", "def privmsg(dests, text)\n split_send(\"PRIVMSG #{comma_join(dests)} :\", text)\n end", "def participants(*vals)\n\t\t\t@sprint.participants = Array(vals).map{|v| v.to_sym}\n\t\tend", "def send_to_multiple!(recipients)\n message_data = message_data(recipients)\n responses << @mandrill.messages.send_template(template_name, custom_html_data, message_data)\n end", "def send_pending_messages\n self.mailbox.conversations.where(mailboxer_label_id: Mailboxer::Label::INFORMATION.id).each do |conversation|\n # Get the message that should have been sent\n message = conversation.messages.first\n # Select the admin who should receive the message\n recipient = message.recipients.detect{ |recipient| recipient.is_a? Admin }\n MailboxerMessageMailer.delay(queue: 'mailers').new_message_email_to_admin(message, recipient)\n end\n nil\n end", "def send_reminder_for_all(rss_user_id)\n assigned_documents = get_assigned_documents(rss_user_id)\n ids = []\n types = []\n assigned_documents.each do |doc|\n ids << doc['assignmentid']\n types << doc['type']\n end\n reminder_ids = ids.join(',')\n reminder_types = types.join(',')\n send_reminder(rss_user_id, reminder_ids, reminder_types)\n end", "def send_all(messages, dry_run: false)\n raise NotImplementedError\n end", "def text=(value)\n @peer.text = value.to_s\n end", "def action(dests, text)\n msg = \"PRIVMSG #{comma_join(dests)} :\\001ACTION #{text}\"\n msg = truncate(msg, 1)\n send_msg(msg << \"\\001\")\n end", "def send_multiple(content)\n content.each { |e| send_message(e) }\n end", "def send_messages(messages)\n messages.each { |m| write_to_stream m }\nend", "def send_message_email\n requires_user_can :edit, task\n users = User.where(email: params[:recipients])\n sent_to_users = []\n users.each do |user|\n sent_to_users << user.email\n GenericMailer.delay.send_email(\n subject: params[:subject],\n body: params[:body],\n to: user.email,\n task: task\n )\n end\n trigger_email_sent_event(task)\n d = Time.now.getlocal\n initiator = current_user.email\n render json: {\n letter_template: {\n to: sent_to_users,\n from: initiator,\n date: d.strftime(\"%h %d, %Y %r\"),\n subject: params[:subject],\n body: params[:body]\n }\n }\n end", "def welcome_advanced\n # @contest is fetched by CanCan\n\n # Proceed if contest level is such that one can actually advance there\n if @contest.can_be_advanced_to?\n welcome_mail_count = 0\n\n @contest.performances.includes(:participants).each do |performance|\n performance.participants.each do |participant|\n # Send mail to participant asynchronously\n ParticipantMailer.delay.welcome_advanced(participant, performance)\n welcome_mail_count += 1\n end\n end\n\n flash[:success] = \"#{welcome_mail_count} \\\n #{Participant.model_name.human(count: welcome_mail_count)} \\\n wurde(n) erfolgreich benachrichtigt.\"\n else\n flash[:error] = \"Zu diesem Wettbewerb gibt es keine Weiterleitungen.\"\n end\n redirect_to jmd_contest_path(@contest)\n end", "def set_members\n members_ids = params[:message][:recipient_ids].reject(&:empty?)\n members_ids.each do |members_id|\n @message = current_user.messages.create(:conversation_id => members_id , :body => params[:message][:body])\n\n #send notification\n reciver = User.find(members_id)\n if reciver.notification_setting.try(:new_update)\n Notification.create(recepient_id: members_id, user: current_user, body: \"#{current_user.screen_name } has send a message #{@message.topic} \", notificable: @message, :accept => false)\n end\n end\n end", "def sendQuestionnaire\n email=params[:email]\n emails=email.split(\",\")\n description=params[:description]\n questionnaire_id = params[:questionnaire_id]\n emails.each do |one|\n ReviewerInviter.task_invitation(one, description, \"http://localhost:3000/questionnaires/answer_show?id=\"+questionnaire_id).deliver()\n end\n respond_to do |format|\n format.html { redirect_to(:back) } #, flash[:success] = \"holder updated\") \n end\n end", "def send_notifications\n return if participant.nil?\n return unless participant.phone_number.length == 10\n\n # grab first 95 characters of description to serve as a preview\n description_preview = description[0...95]\n send_sms(participant.phone_number,\n \"An event in Binder has been assigned to you: #{description_preview}...\")\n end", "def sent\n @messages = current_user.sent_messages\n end", "def send( text )\n checkConnection()\n @conn.write( text + EOL )\n end", "def send( text )\n checkConnection()\n @conn.write( text + EOL )\n end", "def tweet(text)\n @followers.each do |follower|\n follower.receive_tweet(@name, text)\n end\n end", "def send_to_admins\n @all_recipients = User.where(:receive_admin_email => true)\n raise NoRecipients if @all_recipients.blank?\n @all_recipients.group_by(&:language).each do |lang, users|\n @recipients = users\n mail_with_locale users, lang\n end\n end", "def send_all_invitations\n uu = User.all.reject{|u| u.bounced_at || u.test || u.email =~ /musicalretreat.org/ || u.has_current_registration}\n Rails.logger.info(\"Going to send #{uu.size} invitations\")\n uu.each do |u|\n begin\n RegistrationMailer.invitation(u)\n Rails.logger.info(\"Successfully sent to #{u.email}\")\n rescue StandardError => e\n Rails.logger.error(\"Failed to send to #{u.email} due to #{e}\")\n end\n end\n end", "def broadcast_msg( msg )\n\t\t@users.each do |cl|\n\t\t\tcl.add_output( msg )\n\t\tend\n\tend", "def send_ta_notification(user, msg)\n\t\t@user = user\n\t\t@msg = msg\n\t\tmail( :to => @user.email, :subject => 'You have just been assigned to a course!')\n\tend", "def send_email(user, user_url)\n user.recipients.each do |recipient|\n @recipient = recipient\n @user = user\n @executor = user.executors.first\n @user_url = user_url\n mail( \n :to => @recipient.email,\n :subject => 'Our Condolences') do |format|\n format.html {render 'send_email' }\n format.text { render 'send_plain_email'}\n end\n end\n end", "def notify(doctor ,recipient, subject, text)\n subject += \" sent to: #{recipient}, by: #{doctor.full_name}\" \n\t\tadmin_assists = AdminAssistant.all \n if admin_assists\n admin_assists.each do |adm|\n custom_email(adm, subject, text)\n end\n end\n end", "def say\n send_text \"You just said: #{params}\"\n end", "def send_public text, from\n \n # Given each (username, ClientHandler pair)...\n @circle.each do |username, receiver|\n receiver.receive text, from, true # true means public\n end\n \n # (And yes, this syntax works on a Java Concurrent HashMap.)\n end", "def send!\n self.to_csv.split(/\\n/).each do |line|\n user = User.find_by_email(line.split(/\\t/)[0])\n fields = line.strip.split(/\\t/)[1..-1]\n self.send_message(user, fields)\n end\n end", "def notify_course_teaching_assignment( user , course ) \n @course = course\n @subject = @course.subject \n @school = @subject.school\n @user = user\n mail( :to => user.email, \n :subject => \"potoSchool | Tuga Mengajar pelajaran #{@subject.name}, kelas #{@course.name} \" )\n end", "def send_welcome_email\n subscription = self.subscription\n parent_no_valids = ParentNoValid.where(subscription: subscription)\n parent_no_valids.each do |parent_no_valid|\n ParentNoValidMailer.welcome(parent_no_valid).deliver_now\n end\n end", "def send_message(from, recipients)\n self.sent = true\n self.read = true\n \n if recipients == :all\n self.peer = \"All\"\n else\n if recipients.class.to_s != \"Array\"\n recipients = [recipients]\n end\n self.peer = recipients.join(\", \")\n end \n \n if from == :system\n self.user_id = 0\n else\n sender = User.find_by_username(from)\n if sender\n self.user_id = sender.id\n else\n return\n end \n end\n if self.save\n async_send_message(self.id, recipients)\n end\n end", "def speak(text)\n @conn.post 'speak.json', :message => {:body => text}\n end", "def send_emails\n self.attendees.distinct.each do |attendee|\n UpdatesMailer.updates_mail(attendee, self).deliver_now\n end\n end", "def send_mail_to_associates\n unless self.matter_people.blank?\n user = self.matter_people.assignee\n if(@is_changed && user && User.current_user!=user)\n send_notification_to_responsible(user,self,User.current_user)\n @is_changed = false\n\n true\n end\n end\n end", "def email(defn, participant, assignment)\n defn[:body][:type] = \"Teammate Review\"\n participant = AssignmentParticipant.find(reviewee_id)\n topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)\n defn[:body][:obj_name] = assignment.name\n user = User.find(participant.user_id)\n defn[:body][:first_name] = user.fullname\n defn[:to] = user.email\n Mailer.sync_message(defn).deliver\n end", "def mail_assigned_reviewers\n # Find review mappings for the work done by this participant's team\n mappings = ResponseMap.where(reviewed_object_id: self.assignment.id,\n reviewee_id: self.team.id,\n type: 'ReviewResponseMap')\n unless mappings.nil?\n mappings.each do |mapping|\n reviewer = mapping.reviewer.user\n prepared_mail = MailerHelper.send_mail_to_assigned_reviewers(reviewer, self, mapping)\n prepared_mail.deliver_now\n end\n end\n end", "def send_message(subject:, text:, from: nil)\n super(to: read_attribute(:name), subject: subject, text: text, from: from)\n end", "def spam(*lines)\n @chats.each do |chat|\n post(chat, lines)\n end\n end", "def send_text_message(body)\n app = current_application\n if app.present?\n app.send_text_message body\n end\n end", "def add_participants_to_global_competition\n\t\tusers = User.where({:in_grand_competition=>true})\n\t\t\n\t\tinvitation_count = 0\n\t\tusers.each do |user|\n\t\t\tCompetitionParticipant.add_participant(user.id, self.id)\n\t\t\tinvitation_count += 1\n\t\tend\n\t\tAppMailer.global_race_admin_notify(self.id, users.length, invitation_count).deliver\n\t\t\n\t\treturn \"#{self.name} created. #{invitation_count}/#{users.length} users invited.\"\n\tend", "def send_ta_notification(user)\n\t\t@user = user\n\t\tmail( :to => @user.email, :subject => 'You have just been assigned to a course!')\n\tend", "def index\n @text_messages = TextMessage.all\n end", "def set_text_message\n @text_message = TextMessage.find(params[:id])\n end", "def send_messages(_target, strings)\n strings = Array(strings)\n strings.reject!(&:empty?)\n unless RbConfig::CONFIG[\"host_os\"] =~ /mswin|mingw/ || !$stdout.tty?\n strings.map! { |string| \"\\e[32m#{string}\\e[0m\" }\n end\n puts strings\n end", "def send_email_to_participants(request)\n unless RAILS_ENV == \"test\"\n recipients(last_message.sender).each do |recipient|\n if recipient.settings.email_when_new_comment == 1\n UserMailer.deliver_notification_of_new_message(recipient, last_message, request)\n end \n end\n end\n end", "def notifyRecipients (statusMsgAddress, statusMsgPassword, recipientList, downTitle, downMessage)\n recipientList.length.times do |i|\n msg = \"Subject: #{downTitle}\\n\\n#{downMessage}\"\n smtp = Net::SMTP.new 'smtp.gmail.com', 587\n smtp.enable_starttls\n smtp.start(\"gmail\", statusMsgAddress, statusMsgPassword, :login) do\n smtp.send_message(msg, statusMsgAddress, recipientList[i])\n end\n end\nend", "def send_message(subject:, text:, from: nil)\n super(to: get_attribute(:name), subject: subject, text: text, from: from)\n end", "def send_message(subject:, text:, from: nil)\n super(to: get_attribute(:name), subject: subject, text: text, from: from)\n end", "def say(text, quick_replies: [], user: @user)\n message_options = {\n recipient: { id: user.id },\n message: { text: text }\n }\n if quick_replies && !quick_replies.empty?\n message_options[:message][:quick_replies] = UI::QuickReplies\n .build(*quick_replies)\n end\n\n send_message(message_options)\n end", "def assign_rooms(speakerArray)\n messages = []\n roomNumber = 1\n speakerArray.each do |speaker|\n messages << \"Hello, #{speaker}! You'll be assigned to room #{roomNumber}!\"\n roomNumber+= 1\n end\n messages\nend", "def assign_rooms (names_list)\n\t\nmsgs_with_room_no=names_list.collect.each_with_index{ |current_name,current_index| \"Hello, #{current_name}! You'll be assigned to room #{current_index+1}!\"\n }\n\t\nend", "def send_text(sms, phones)\n phones.each do |phone|\n post_response = Faraday.post do |request|\n request.url \"https://api.twilio.com/2010-04-01/Accounts/#{ACCOUNT_SID}/SMS/Messages.json\"\n request.headers['Authorization'] = \"Basic \" + Base64.strict_encode64(\"#{ACCOUNT_SID}:#{AUTH_TOKEN}\")\n request.body = URI.encode_www_form({'From' => PHONE_NUMBER, 'To' => phone.phone_number, 'Body' => sms.message})\n end\n end\n end", "def assigned\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def peers_send(peers,message)\r\n\t\t\tpeers.each{|peer|\r\n\t\t\t\tsend_peer(peer,message)\r\n\t\t\t}\r\n\t\tend", "def do_notify_all\n number = tiers_list.size\n @report << \"#{number} mail(s) à envoyer\"\n tiers_list.each do |tiers_id|\n subs = to_be_notified_for(tiers_id)\n done = Notifier.new(tiers_id, subs, @mode).notify\n next if done\n number -= 1\n @report << \"notification impossible pour le tiers #{tiers_id}\"\n end\n @report << \"#{number} mails(s) de notification envoyé(s)\"\n end", "def get_recipient_send_message(text)\n (subscribers + friend_list) - blocked_outs\n end", "def send_feedback(email,name,text)\n @email = email\n @name = name\n @text = text\n mail to: \"grandison@mail.ru\", :subject => \"Feedback from email: #{email}, name: #{name}\"\n end", "def send_to_participants(owner,from)\n\t\t# send an email to the owner of the status post, unless the comment is coming from the creator\n\t\tdeliver(\"#{from.name} posted a comment on your status\", owner, from) unless owner.eql? from\n\t\t# iterate through all the collaborators and send an email to all, unless the comment is coming from the creator\n\t\tself.commentable.comments.collaborators.each do |user|\n\t\t\tunless user.eql? owner or user.eql? from\n\t\t\t\tif owner.eql? from\n\t\t\t\t\tdeliver(\"#{from.name} posted a comment on their status\", user, from) \n\t\t\t\telse\n\t\t\t\t\tdeliver(\"#{from.name} posted a comment on #{owner.name} status\", user, from) \n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def participant_admins(participant,school)\n @participant = participant\n @school = school\n admin_user_ids = Participant.where(\"school_id = ? and role_id < ?\",@school.id,3).all.map(&:user_id)\n schooladmins = User.where(id: admin_user_ids).all.map(&:email)\n @applicant = User.find(@participant.user_id)\n applicant_email = \"#{@applicant.fullname} <#{@applicant.email}>\"\n\n mail to: schooladmins,\n from: applicant_email,\n reply_to: applicant_email,\n subject: @applicant.fullname + \" has registered to \" + @school.name + \" and is waiting for acceptance.\"\n end", "def message_sent(type, text, to = nil)\n msg = message_db.add(\n type: type,\n to: to,\n from: username,\n text: text,\n time: nil\n )\n signal_change(type, msg)\n end", "def send(fromIdUser,msg)\n #TODO : add exception for the sender!\n @userList.getcontents.each { |user| \n \n user.receiveFromChannel(@id, fromIdUser, msg)\n \n }\n end", "def broadcastMsg( msg )\n\t\t@users.each {|cl|\n\t\t\tcl.addOutput( msg )\n\t\t}\n\tend", "def broadcast_messages\n @info = ['Gol', 'Zmiana','Żółta Kartka','Druga Żółta Kartka','Czerwona Kartka',]\n end", "def message(text)\n @text_queue.push text\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" ]
[ "0.6158091", "0.6051684", "0.58300364", "0.57916594", "0.5719044", "0.570903", "0.56697273", "0.56584173", "0.56578845", "0.5623198", "0.55914986", "0.5588978", "0.55024636", "0.55012864", "0.5483118", "0.54153556", "0.5413055", "0.5402287", "0.5394616", "0.53877956", "0.53698516", "0.53387654", "0.5337375", "0.53353643", "0.53291035", "0.5280472", "0.5280179", "0.5260851", "0.5243582", "0.5219621", "0.5216837", "0.52139395", "0.5211812", "0.5188929", "0.5188628", "0.51873994", "0.5185321", "0.5184778", "0.5182861", "0.5167195", "0.5158386", "0.51566684", "0.51523924", "0.5130233", "0.51201373", "0.5109889", "0.51070035", "0.51020277", "0.50995946", "0.5093699", "0.50920695", "0.5078246", "0.5078246", "0.50718826", "0.5071507", "0.50708807", "0.50639755", "0.5060741", "0.5050777", "0.5040512", "0.50392234", "0.5033336", "0.5026724", "0.50264037", "0.5025628", "0.5020746", "0.5015206", "0.5013823", "0.5012488", "0.5007927", "0.5006993", "0.50032306", "0.5003183", "0.5002023", "0.50010514", "0.499659", "0.4995796", "0.49941728", "0.4991088", "0.49895772", "0.49845645", "0.49838203", "0.49838203", "0.49796277", "0.49766675", "0.49667153", "0.496494", "0.49636832", "0.49633607", "0.49617592", "0.4961586", "0.49602413", "0.49593258", "0.49531734", "0.49502096", "0.49312413", "0.4927633", "0.49228346", "0.49171203", "0.4914369" ]
0.6919665
0
sends a backup message to a specified phone number with all assignments.
def send_backup_message participants, phone_number intro = "here are the secret santa assignments:\n" message = intro + participants.map(&:to_backup_message).join("\n") send_message message, phone_number puts "a backup of all assignments has been sent to #{phone_number}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backup_request(client, filename, message)\n filename = \"BACKUP_#{filename}\"\n aFile = File.open(filename, 'w+')\n if aFile\n File.write(filename, message)\n puts \"Updated: #{filename}\"\n else\n client.puts \"ERROR: Unable to open file #{filename}\"\n end\n aFile.close\n return\n end", "def backupwallet(destination)\n request(:backupwallet, destination)\n end", "def backup_finished!(info)\n bs = backup_state || build_backup_state\n bs.finished! info\n \n # Email member 1st time there is data for timeline\n if bs.first_time_data_available?\n # Send email in background\n spawn { BackupNotifier.deliver_timeline_ready(self) }\n end\n end", "def send!\n raise \"job #{job.backup_id} has no email option\" unless job.options[:email]\n # define local variables for closure over Mail.new\n from_address = settings['email_from']\n to_address = job.options[:email]\n subject_text = \"Backup of RDS #{job.rds_id} (job ID #{job.backup_id})\"\n body_text = body\n mail = Mail.new do\n from from_address\n to to_address\n subject subject_text\n body \"#{body_text}\\n\"\n end\n mail.deliver!\n end", "def backupwallet(destination)\n @api.request 'backupwallet', destination\n end", "def bms_backup(opts = {})\n data, _status_code, _headers = bms_backup_with_http_info(opts)\n data\n end", "def backup_wallet\n client.make_request('/backup-wallet', 'post', params: {})\n end", "def plan_with_balance(company, company_phone)\n @company = company\n @company_phone = company_phone\n mail(\n to: company_phone.extensions.admin.first.email,\n subject: '¡En GurúComm agradecemos tu recarga!'\n )\n end", "def backupwallet(destination)\n coind.backupwallet destination\n end", "def cmd_backup argv\n setup argv\n command = @hash['command']\n name = @hash['name']\n response = @api.backup(command, name)\n msg response\n return response\n end", "def send phone_number\n account = CLIENT.account \n message = account.sms.messages.create({from: TAKEAWAY_NUMBER , to: phone_number, body: \"Thanks for your order! It shall arrive no later than #{@delivery_time.strftime(\"%H\")}:#{@delivery_time.strftime(\"%M\")}.\"})\n message.body\n end", "def notify!(status)\n send_message \"[Backup::%s] #{@model.label} (#{@model.trigger})\" % status.to_s.capitalize\n end", "def backup\n #EternosBackup::BackupJobPublisher.add_source(self)\n end", "def transfer(transfer)\n @settings = Setting.get('contacts')\n @transfer = transfer\n\n mail to: @settings.emails, subject: \"Заказ трансфера ##{@transfer.id}\"\n end", "def notify!(status)\n name = case status\n when :success then 'Success'\n when :warning then 'Warning'\n when :failure then 'Failure'\n end\n message = '[Backup::%s]' % name\n send_message(message)\n end", "def plan_no_balance(company, company_phone)\n @company = company\n @company_phone = company_phone\n mail(\n to: company_phone.extensions.admin.first.email,\n subject: '¡Tu plan en GurúComm se ha reactivado!'\n )\n end", "def run_backup_job(&block)\n MessageQueue.start(MessageQueue.connect_params(AMQP_BACKUP_CONFIG)) do\n block.call\n MessageQueue.stop\n end\n end", "def deliver(numbers=@numbers, body=@body)\n # NB: message#deliver_sms currently sends numbers as a string, not an array.\n if numbers.is_a? String\n @numbers = numbers.gsub(\"+\",\"\").split(/,\\s*/) # Convert to array so we can do \"each\"\n else\n @numbers = numbers\n end\n @body = body # ...\n raise('No phone numbers given') unless @numbers\n raise('No message body') unless @body\n iron_worker_client ||= IronWorkerNG::Client.new\n @numbers.each do |number|\n#puts \"****Delivering to number=#{number}\"\n begin\n iron_worker_client.tasks.create(\"twilio_worker\",\n {:sid => @account_sid,\n :token => @auth_token,\n :from => @phone_number,\n :to => number.with_plus,\n :message => @body\n }\n )\n end \n end\n AppLog.create(:code => \"SMS.sent.#{@gateway_name}\", :description=>\"Queued #{@numbers.count} messages.\")\n @gateway_reply = nil\n super\n end", "def request_backup(db)\r\n\t\tdb.execute(\"SELECT * FROM playgroups WHERE kids>=5\")\r\n\t\tputs \"We'll need backup!!!\"\r\n\tend", "def contact_pub_copy(n)\n @offer = n.item\n @user = n.user\n @msg = n.msg\n @trade = n.trade\n headers['X-SMTPAPI'] = '{\"category\": \"Publisher contacts offerer copy\"}'\n mail(:to => n.user.email, :subject => \"You sent a message!\", :from => 'TradeYa <AdminRobot@TradeYa.com>', :content_type => \"text/html\")\n end", "def backup account\n backup_file File.join(@ssh_home, @ssh_id), File.join(@ssh_home, account + \".identity\")\n backup_file File.join(@ssh_home, @ssh_id + \".pub\"), File.join(@ssh_home, account + \".identity.pub\")\n @shell.say \"SSH identity backed up to account: #{account}.\"\n end", "def massmail(title, email, bericht, sent_at = Time.now)\n @bericht = bericht\n mail(to: email, bcc: 'info@xposers.nl', subject: title)\n end", "def backup(path_to_backup_file) \n logger.info \"Uploading backup to FTP: #{worker.user_host_and_dir}\"\n @worker.connect_and_put_file path_to_backup_file\n end", "def backup(from: nil, to: nil)\n\n if @debug then\n puts 'ready to perform backup' \n puts \"from: %s to: %s\" % [from, to]\n end\n \n instructions = \"rsync -akL -e ssh %s %s\" % [from, to]\n\n puts 'instructions: ' + instructions if @debug \n \n # note: compression is not enabled since this is aimed at \n # single board computers which have limited CPU capability\n\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n puts 'r: ' + r.inspect if @debug\n \n # since it's running in the background, an empty string will be returned\n \n end", "def backup!(file=nil)\n file = file || FILENAME\n dir = root + BACKUP_DIRECTORY\n FileUtils.mkdir(dir.dirname) unless dir.dirname.directory?\n FileUtils.mkdir(dir) unless dir.directory?\n save!(dir + FILENAME)\n end", "def on_backup_complete(info={})\n unless info[:errors]\n # Reset error notification count after succesful backups\n update_attributes(:error_notifications_sent => 0, :auth_error => nil)\n end\n update_last_backup_times\n \n member.backup_finished!(info)\n end", "def set_backup\n current_user.backup = Farmer.find_by_id(params[:id]).email\n current_user.save\n redirect_to current_user\n end", "def set_backup\n @backup = Backup.find(params[:id])\n end", "def transfer\n\t\tattributes = super\n\t\tself.last_backup_date = Date.today\n\t\tset_next_backup_date\n\t\tself.save\n\t\tlog_transfer(attributes)\n\tend", "def send_info\n WorkerMailer.send_info(@worker).deliver\n redirect_to admins_path, notice: \"Worker information has been successfully sent.\"\n end", "def backup_jobs\n totals = Hash.new(0)\n errors = Hash.new(0)\n members_data = {}\n sources = []\n members = []\n source_failures = Hash.new(0)\n source_errors = {}\n all_errors = Hash.new(0)\n \n jobs = BackupJob.by_date Date.yesterday\n totals[:group_backup_jobs] = jobs.size\n # Group by member\n jobs.reject{|j| j.member.nil?}.each do |job|\n members << job.member.id\n source_jobs = job.backup_source_jobs\n sources << source_jobs.map(&:backup_source_id)\n totals[:source_backup_jobs] += source_jobs.size\n \n # Save per-backup source stats\n source_jobs.each do |s|\n if s.backup_source.consecutive_failed_backup_jobs > 100\n source_failures[s.backup_source_id] += 1\n end\n if s.successful? \n totals[:successful_source_jobs] += 1\n elsif s.has_errors?\n totals[:failed_source_jobs] += 1\n s.error_messages.each do |e|\n err = short_error(e) # truncate error string\n \n source_errors[s.backup_source_id] ||= {}\n unless source_errors[s.backup_source_id][err]\n all_errors[err] += 1\n else\n source_errors[s.backup_source_id][err] = 1\n end \n end\n end\n end\n # Save every kind of error\n if job.error_messages\n job.error_messages.each do |err|\n errors[short_error(err.to_s)] += 1\n end\n end\n end\n totals[:members] = members.uniq.size\n totals[:backup_sources] = sources.uniq.size\n totals[:backup_sources_failed_at_least_100_times] = source_failures.size\n \n report = {:totals => totals, :job_errors => errors, :source_errors => all_errors}\n #ActionMailer::Base.delivery_method = :sendmail\n BackupReportMailer.deliver_daily_jobs_report(report)\n end", "def notification_per_succ_ref(smb, code_id, customer, friend, campaign)\n @smb = smb\n @customer = customer\n @friend = friend\n @campaign = campaign\n @code_id = code_id\n mail(:to => smb.email, :subject => \"Successful Referral Notification\")\n end", "def notify!(status)\n name = case status\n when :success then 'Success'\n when :warning then 'Warning'\n when :failure then 'Failure'\n end\n message = \"[Backup::%s] #{@model.label} (#{@model.trigger}) (@ #{@model.time})\" % name\n send_message(message)\n end", "def system_backup\n\n\n end", "def save(*)\n super.tap { |result| send_pending_email if result }\n end", "def capture\n db = resolve_db(:allow_default => true)\n\n from_url = db[:url]\n from_name = db[:name]\n to_url = nil # server will assign\n to_name = \"BACKUP\"\n opts = {:expire => extract_option(\"--expire\")}\n\n backup = transfer!(from_url, from_name, to_url, to_name, opts)\n\n to_uri = URI.parse backup[\"to_url\"]\n backup_id = to_uri.path.empty? ? \"error\" : File.basename(to_uri.path, '.*')\n display \"\\n#{db[:pretty_name]} ----backup---> #{backup_id}\"\n\n backup = poll_transfer!(backup)\n\n if backup[\"error_at\"]\n message = \" ! An error occurred and your backup did not finish.\"\n message += \"\\n ! The database is not yet online. Please try again.\" if backup['log'] =~ /Name or service not known/\n message += \"\\n ! The database credentials are incorrect.\" if backup['log'] =~ /psql: FATAL:/\n abort(message)\n end\n end", "def generate_backup\n if Export.launch_export!\n current_user.update(\n last_backup_at: Time.zone.now,\n last_backup_entry_id: current_user.last_entry_id\n )\n redirect_to backup_succeeded_path\n else\n redirect_to backup_failed_path\n end\n end", "def notify!(status)\n name, color = case status\n when :success then ['Success', success_color]\n when :warning then ['Warning', warning_color]\n when :failure then ['Failure', failure_color]\n end\n message = \"[Backup::%s] #{@model.label} (#{@model.trigger})\" % name\n send_message(message, color)\n end", "def backup_file\n \"#{options[:file]}.bak\"\n end", "def notify_business\n business.add_message_to_queue(\"Hey #{business.name}, we've just deposited #{amount} into your account! Thanks for being great!\")\n end", "def backuphosts(session,hosts)\n\trandom = sprintf(\"%.5d\",rand(100000))\n\tprint_status(\"Making Backup of the hosts file.\")\n\tsession.sys.process.execute(\"cmd /c copy #{hosts} #{hosts}#{random}.back\",nil, {'Hidden' => true})\n\tprint_status(\"Backup loacated in #{hosts}#{random}.back\")\nend", "def booking_email(reservation) #customer, host, reservtion_id\n @user = reservation.user #appoint reservation user id(email,name)\n @host = reservation.listing.user #appoint listing user(email,name)\n @listing = reservation.listing #appoint reservation. listing(which id)\n\n mail(to: @user.email, subject: \"Thank you for your booking.\") #after all info appointed, send an email to user(customer)\n end", "def backup account\n return unless valid_argument?(account, \"backup\")\n @heroku_credentials.backup account\n @ssh_identity.backup account\n end", "def backup \n begin\n check_if_db_exists\n is_allowed = @conn.exec(\"select datallowconn from pg_catalog.pg_database where datname='#{@options[:database]}'\")[0]['datallowconn']\n if is_allowed == 'f'\n # unquiece temporarily\n set_dataallowcon_to true\n end\n\n # Check to see if the directory for backups exists and if not, create it with parents\n unless File.exist?(@options[:bkdir])\n FileUtils.mkdir_p @options[:bkdir]\n end\n filename = \"postgresbk_#{@options[:database]}_#{Time.new.strftime(\"%m%d%y%H%M%S\")}.dump\"\n\n # The below system call assumes you have passwordless access as the user passed into the executable tool\n # either due to ~/.pgpass or pg_hba.conf has your user as a 'trust' auth method\n `pg_dump -U #{@options[:user]} #{@options[:database]} -F c -f #{@options[:bkdir]}/#{filename}`\n\n rescue Exception => e\n raise e\n ensure\n if is_allowed == 'f'\n # re quiesce \n set_dataallowcon_to false\n end\n end\n end", "def view_worker\n @fresh_worker = MtCompanyWorker.find(params[:id]);\n @return_to = params[:ref];\n @return_to ||= \"worker_list\";\n security_breach( @return_to) if (@fresh_worker.mt_company != @mt_company )\n if ( request.post? )\n if ( params[:reason] == \"send_sms\" )\n begin\n SMS::deliver_sms(@fresh_worker.mobile, params[:sms_text]);\n add_confirmation \"SMS SENT\";\n rescue Exception=>e\n add_error e\n end\n end \n end\n end", "def send_free_confirmation(phone_number, iphone)\n service_layer.send_message(phone_number, MessageBuilder::free_confirmation, false)\n iphone.increment!(:sent)\n end", "def deliver(numbers=@numbers, body=@body, message_id=nil, log=nil)\n # NB: message#deliver_sms currently sends numbers as a string, not an array.\n#puts \"**** Delivering Twilio with @background=#{@background}, numbers=#{numbers}\"\n if numbers.is_a? String\n @numbers = numbers.gsub(\"+\",\"\").split(/,\\s*/) # Convert to array so we can do \"each\"\n else\n @numbers = numbers\n end\n @body = body # ...\n raise('No phone numbers given') unless @numbers\n raise('No message body') unless @body\n # Use delivery system based on the parameter @background [i.e. background processing type]\n case @background\n when /iron/i\n @numbers.count > 1 ? deliver_ironworker : deliver_direct(message_id)\n when /dj|delay.*job/i\n @numbers.count > 1 ? deliver_delayed_job(message_id) : deliver_direct(message_id)\n else\n deliver_direct(message_id)\n end\n AppLog.create(:code => \"SMS.deliver.#{@gateway_name}\", :description=>\"background=#{@background || 'none'}, count = #{@numbers.count} messages\")\n super\n end", "def backup_params\n params.require(:backup).permit(:path, :user_id, :host_id)\n end", "def deliver_sms(params)\n#puts \"**** Message#deliver_sms; params=#{params}\"\n sms_gateway = params[:sms_gateway]\n phone_number_array = @contact_info.map {|c| c[:phone]}.compact.uniq\n phone_numbers = phone_number_array.join(',')\n assemble_sms()\n#puts \"**** sms_gateway.deliver #{sms_gateway} w #{phone_numbers}: #{sms_only}\"\n #******* CONNECT TO GATEWAY AND DELIVER MESSAGES \n gateway_reply = \n sms_gateway.deliver(phone_numbers, sms_only)\n#puts \"**** gateway_reply=#{gateway_reply}\"\n #******* PROCESS GATEWAY REPLY (INITIAL STATUSES OF SENT MESSAGES) \n gtw_msg_id = nil\n if phone_number_array.size == 1\n # SINGLE PHONE NUMBER \n if gateway_reply =~ /ID: (\\w+)/\n gtw_msg_id = $1\n gtw_msg_id = gateway_reply[4..99] # Temporary workaround as $1 doesn't work on Heroku\n msg_status = MessagesHelper::MsgSentToGateway\n else\n gtw_msg_id = gateway_reply # Will include error message\n msg_status = MessagesHelper::MsgError\n end\n # Mark the message to this member as being sent\n self.sent_messages[0].update_attributes(:gateway_message_id => gtw_msg_id, \n :msg_status => msg_status)\n else\n # MULTIPLE PHONE NUMBERS\n # Get the Clickatell reply and parse into array of hash like {:id=>'asebi9xxke...', :phone => '2345552228372'}\n#puts \"**** gateway_reply=#{gateway_reply}\"\n msg_statuses = gateway_reply.split(\"\\n\").map do |s|\n if s =~ /ID:\\s+(\\w+)\\s+To:\\s+([0-9]+)/\n {:id => $1, :phone => $2} \n else\n {:id => nil, :phone => nil, :error => s}\n end\n end\n # Make array to associate members with their numbers\n @member_phones = self.members.map {|m| {:phone => m.primary_phone, :member => m} }\n # Update the sent_message records to indicate which have been accepted at Gateway \n msg_statuses.each do |s|\n#puts \"**** s[:id]=#{s[:id]}, s[:phone]=#{s[:phone]}\"\n if s[:id] && s[:phone]\n # Find the right member by matching phone numbers\n member = @member_phones.find{|m| m[:phone]==s[:phone]}[:member]\n # Find the right sent_message by matching member & message\n sent_message = SentMessage.where(:member_id=>member.id, :message_id=>self.id).first\n # Update the sent_message\n sent_message.update_attributes(\n :gateway_message_id => s[:id], \n :msg_status=> MessagesHelper::MsgSentToGateway\n )\n end\n end\n # Any sent_messages not now marked with gateway_message_id and msg_status must have errors\n sent_messages.each do |m| \n m.update_attributes(:msg_status=> MessagesHelper::MsgError) if m.msg_status.nil?\n end\n end\n end", "def backup(id)\n server = @connection.servers.get(id)\n ssh(server,'~/backup.sh')\n server.scp_download('backup/current.tar.gz','backup.tar.gz')\n end", "def backup(job)\n write_thread_var :job, job\n write_thread_var :source, job.backup_source\n\n worker = BackupWorker::WorkerFactory.create_worker(workitem.source_name, job)\n\n unless worker.authenticate\n auth_failed worker.errors.to_s\n return false\n end\n\n # We must disable ThinkingSphinx in every thread!\n turn_off_thinking_sphinx\n \n worker.run workitem.options\n\n save_error worker.errors.to_s if worker.errors.any?\n # Return backup success status\n worker.errors.empty?\n end", "def backups\n if args.count == 0\n list_backups\n else\n command = shift_argument\n case command\n when 'list' then list_backups\n when 'info' then backup_status\n when 'capture' then capture_backup\n when 'restore' then restore_backup\n when 'public-url' then public_url\n when 'cancel' then cancel_backup\n when 'delete' then delete_backup\n when 'schedule' then schedule_backups\n when 'unschedule' then unschedule_backups\n when 'schedules' then list_schedules\n else abort \"Unknown pg:backups command: #{command}\"\n end\n end\n end", "def copy_delivery_address(address)\n copy_address(:delivery, address)\n end", "def call\n \n # generate a unique code\n code = generate_code\n while Pass.find_by(redemption_code: code) do\n code = generate_code\n end \n \n @pass.redemption_code = code\n @pass.save\n \n recipient = @pass.account.phone_number\n sender = @pass.purchaser.phone_number\n message = \"Hi. You've got a drink waiting for you at TooU courtesy of #{sender}. Download the app and used the redemption code #{code} to get your drink.\"\n \n if MessageSender.new.send_message(recipient, message)\n Log.create(log_type: Log::INFO, context: SendRedemptionCode.name, current_user: @pass.purchaser.id, message: \"Redemption code sent from #{sender} to #{recipient}\")\n else\n Log.create(log_type: Log::ERROR, context: SendRedemptionCode.name, current_user: @pass.purchaser.id, message: \"Error sending redemption code from #{sender} to #{recipient}\")\n end\n end", "def send_bulk_sms(message)\n client = IronWorkerNG::Client.new\n client.tasks.create('master_email', payload)\n payload = {}\n payload['message'] = message\n client.tasks.create('master_sms', payload)\nend", "def successful_ballot(user, round, allocation)\n @round = round\n @locker = allocation.locker\n @user = user\n mail(to: user.email, reply_to: 'connect@nuscomputing.com', subject: '[Locker Ballot] Locker Ballot Successful') if user.email\n end", "def backup!(file=nil)\n file = file || FILENAME\n dir = root + BACKUP_DIRECTORY\n FileUtils.mkdir(dir.dirname) unless dir.dirname.directory?\n FileUtils.mkdir(dir) unless dir.directory?\n save!(dir + DOTRUBY_FILENAME)\n end", "def send_sms(number, subject, carrier, message)\n SMSMailer.sms_mailer(number, subject, carrier, message).deliver_now\n end", "def smb_confirm(user)\n @smb = user\n mail(:to => user.email, :subject => \"Registration Confirmation\")\n end", "def sent_to_applicant\n ApplicateMailer.with(applicate: Applicate.first).sent_to_applicant\n end", "def polled_delivery( recipient_email , pending_deliveries )\n @recipient_email = recipient_email \n @user = User.find_by_email @recipient_email \n @pending_deliveries = pending_deliveries\n time = Time.now\n \n mail( :to => recipient_email, \n :subject => \"pilipoto | Updates (#{pending_deliveries.count}): #{time}\", \n :bcc => [\"rajakuraemas@gmail.com\"] )\n \n end", "def set_backup\n if params[:id] && !params[:id].blank?\n @backup = Backup.new(nil, current_user.id)\n @backup.id_from_epoch(params[:id])\n else\n @backup = Backup.new(nil, current_user.id)\n end\n end", "def send_text(number, message)\n @client.api.account.messages.create(\n to: number,\n from: 'add phone number',\n body: message\n )\n end", "def backup_file\n \"#{@file}.bak\"\n end", "def bar(to,a,b)\n @a = a\n @b = b\n mail :to => to\n end", "def create\n @backup = Backup.new(backup_params)\n @backup = @client.backups.build(backup_params)\n \n respond_to do |format|\n if @backup.save\n #format.html { redirect_to [@client, @backup], notice: 'Backup was successfully created.' }\n format.html { redirect_to [@client, @backup], notice: 'Backup was successfully created.' }\n format.json { render :show, status: :created, location: @backup }\n else\n format.html { render :new }\n format.json { render json: @backup.errors, status: :unprocessable_entity }\n end\n end\n end", "def notify(message, phone, date, errors)\n @message = message\n @phone = phone\n @date = date\n @errors = errors\n #@class_name = class_name\n #@method = method || nil\n\n mail(to: 'apimail@payquick-cm.com', subject: 'Erreur creation compte PAYQUICK')\n end", "def bms_backup_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VnfsApi.bms_backup ...'\n end\n # resource path\n local_var_path = '/bms/1.0.0/backup'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'backuprequest'])\n auth_names = ['oAuth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Backup')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VnfsApi#bms_backup\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def send_joke\r\n client = Twilio::REST::Client.new Rails.application.secrets.twilio_account_sid, Rails.application.secrets.twilio_auth_token\r\n message = client.messages.create from: '347-933-6917', to: params[:phone_number], body: Joke.pick_joke\r\n redirect_to :back\r\n end", "def dump(path, backup_id)\n raise NotImplementedError\n end", "def order_budget()\n \n @greeting = \"Hi\"\n\n mail :to => \"docs1006@prodigy.net.mx\", :subject => 'Pragmatic Store Order Confirmation'\n end", "def mail; end", "def perform(to,from,data,isuser)\n \tif isuser\n \tScratchMailer.send_scratch(to,from,data).deliver\n else\n \tScratchMailer.new_user(to,from,data).deliver\n end\n end", "def balance_reminder(company_phone, total_current_balance)\n env_days_parameter = 'REMAINING_DAYS_TO_EXPIRE_MINUTE_PLANS'\n days_before_expire_minute_plan = ENV[env_days_parameter].to_i\n @remaining_balance = total_current_balance\n @company_phone = company_phone\n @company = @company_phone.company\n @days_before_expire = days_before_expire_minute_plan\n mail(\n to: @company_phone.extensions.admin.first.email,\n subject: 'GurúComm | Recordatorio no pierdas tu saldo'\n )\n end", "def upload\n EmailsWorker.async_process_backup_email(:id => self.id)\n end", "def backup_config(name,format='binary')\n @log.info(\"Backup MikroTik configuration\")\n if format == 'binary'\n send_command(\"/system backup save name=#{name}\")\n elsif format == 'script'\n send_command(\"/export file=#{name}\")\n end\n @ssh_connect.close\n end", "def send_sms(to_phone_number, message)\n # message = {to:, from:, body: \"Hello\\n\\nWorld\"}\n # binding.pry\n @@client.messages.create(\n from: @@from,\n to: to_phone_number,\n body: message\n )\n end", "def create_outgoing_message(phone_number, body, message_id = nil, outgoing_count = nil)\n if phone_number.can_receive_email? && allow_email_gateway? &&\n (! allow_commercial_gateway? || prefer_email? )\n to = \"#{phone_number.number}@#{phone_number.provider_email}\"\n from = \"#{name}@mmptext.info\"\n elsif allow_commercial_gateway? && phone_number.can_receive_gateway? && incoming_phone_number.present?\n to = phone_number.number\n from = incoming_phone_number.phone_number\n else\n raise \"List & subscriber settings make sending message impossible for number #{phone_number.number} [list: #{name}].\"\n end\n\n Resque.enqueue(OutgoingMessageJob, id, to, from, body, message_id, outgoing_count)\n end", "def twilio_broadcast_queue!(client,members)\n client.account.sms.messages.list.each do |sms|\n\t\t\t# only look at messages that twilio has recieved\n\t\t\tif sms.direction == 'inbound'\n \tif TextMessages.count(:sms_id => sms.sid) == 0\n \t# spam it to others\n \tmembers.each do |name,info|\n \tif info[:phone] != sms.from\n \ttwilio_send_text_message!(client,info[:phone],sms.body)\n \tend\n \tend\n \t\tTextMessages.create(:sms_id => sms.sid)\n \t\tend\n\t\t\tend\n end\n end", "def fallback_to_twilio\n sms.output = :twilio\n sms.deliver\n end", "def send_text\n @number_list.each do |number|\n # clock = Alarm.new(2014, 07, 17, 11, 38, 40)\n puts Time.now\n account_sid = 'ACe330ba04d082392df4cb3511dcb72cec'\n auth_token = '2008ea097713e401a16c54029058da82'\n @client = Twilio::REST::Client.new account_sid, auth_token\n # until Time.now > clock.time\n # puts \"It's not time!\"\n # sleep (5)\n # end\n @client.account.messages.create(\n :from => '+18152642023',\n :to => number,\n :body => @body\n )\n end\n end", "def email_blast(subject,message)\n @students = Student.all.where(:sms_ok => true,:disabled => nil).where.not(telephone: [nil,\"\"],carrier_id: [nil])\n @email_list = []\n @students.each do |s|\n email = s.smsAddress\n if email != \"\"\n @email_list << email\n end\n end\n @email_list = @email_list.uniq\n @subj = subject\n mail(:bcc => @email_list, :subject => @subj, :body => message)\n end", "def createBackup\n fetch(\"#{@backupUrl}\", 3000)\n $LOG.info(\"#{@name} : Backupfile created\") \n sleep 120\n end", "def new_record_notification(message_info, contacts, sender)\n @message_info = message_info\n @sender = sender.email\n contacts.each do |contact|\n @reciever = contact.email\n mail(to: @reciever, subject: @message_info.subject) unless @reciever == @sender\n end\n end", "def backup_params\n params.require(:backup).permit(:id, :notes, :client_id, :signup_date, :renewal_date, :assigned_to_id, :backup_account, :backup_size, \n :size_used, :used_percent, :alerts, :devices, :rim_client, :service_type_id, :service_list_id, :client_first_name, \n :client_last_name, :client_full_name, :status_id, :it_service_id, :qty, :price, :total_price, :service_date, :next_service_date,\n :contact_date1, :contact_date2, :contact_date3, :contact_done1, :contact_done2, :contact_done3, :rim_computer,\n :rim_service, :rim_email, :rim_phone, :rim_client, :primary_backup, :secondary_backup, :todo_list_id, :todo_list_complete, :residential, :business, :user_name,\n :password,\n todo_lists_attributes: [:id, :name, :complete, :_destroy ], tasks_attributes: [:id, :done, :description, :_destroy ],\n backup_pcs_attributes: [:id, :notes, :active, :name, :external_hd, :serial, :backup_id, :labtech_computer_id, :labtech_client_id, :client_id, :labtech_computer_id, :service_list_id, :contract_service_id],\n clients_attributes: [:client_id, :company, :first_name, :last_name, :full_name ] )\n end", "def send_confirmation_sms\n SmsApi.send_sms \"+1#{self.phone}\", \"Your confirmation code for StreetEats is #{self.phone_confirmation_code}\"\n end", "def deliver(sms)\n create_sms(sms).submit()\n end", "def send_free_page(phone_number, iphone)\n service_layer.send_message(phone_number, MessageBuilder::free_page, false)\n iphone.increment!(:sent)\n end", "def huzzah\n # ===========================================================================\n # 6. Send an SMS Message to 415-555-1212\n # uses a HTTP POST, and a new variable t for the information (because it needs \"Body\")\n \n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n \n t = {\n 'From' => CALLER_ID,\n 'To' => phone,\n 'Body' => message\n }\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n \"POST\", t)\n end", "def restore\n db = resolve_db(:allow_default => true)\n to_name = db[:name]\n to_url = db[:url]\n\n backup_id = args.shift\n\n if backup_id =~ /^http(s?):\\/\\//\n from_url = backup_id\n from_name = \"EXTERNAL_BACKUP\"\n from_uri = URI.parse backup_id\n backup_id = from_uri.path.empty? ? from_uri : File.basename(from_uri.path)\n else\n if backup_id\n backup = pgbackup_client.get_backup(backup_id)\n abort(\"Backup #{backup_id} already deleted.\") if backup[\"destroyed_at\"]\n else\n backup = pgbackup_client.get_latest_backup\n to_uri = URI.parse backup[\"to_url\"]\n backup_id = File.basename(to_uri.path, '.*')\n backup_id = \"#{backup_id} (most recent)\"\n end\n\n from_url = backup[\"to_url\"]\n from_name = \"BACKUP\"\n end\n\n message = \"#{db[:pretty_name]} <---restore--- \"\n padding = \" \" * message.length\n display \"\\n#{message}#{backup_id}\"\n if backup\n display padding + \"#{backup['from_name']}\"\n display padding + \"#{backup['created_at']}\"\n display padding + \"#{backup['size']}\"\n end\n\n if confirm_command\n restore = transfer!(from_url, from_name, to_url, to_name)\n restore = poll_transfer!(restore)\n\n if restore[\"error_at\"]\n message = \" ! An error occurred and your restore did not finish.\"\n message += \"\\n ! The backup url is invalid. Use `pgbackups:url` to generate a new temporary URL.\" if restore['log'] =~ /Invalid dump format: .*: XML document text/\n abort(message)\n end\n end\n end", "def send_pending; end", "def save_safetynet_delivery(address, channel, method)\n Safetynet::History.create({\n address: address,\n method: method,\n channel: channel.to_s,\n created_at: Time.now\n })\n end", "def send_sms_to_fundaraiser(don_name_param,don_amt_param, fundraiser_phone_no)\n msg = \"Donation of Rs. \" + don_amt_param + \" from \" + don_name_param +\" has been added to Donut. Thank you.\"\n self.send_sms(fundraiser_phone_no, msg)\n end", "def your_parking(correo, numspace, floorspace)\n @numspace = numspace\n @floorspace = floorspace\n mail(to: correo, subject: 'Your car parking')\n end", "def save\n c = @data_object\n\n c.con_mail = mail.save\n\n if c.con_ship_to_mail\n\n c.con_ship = c.con_mail\n @ship = get_address(c.con_mail)\n\n else\n\n # if they were previously the same, but aren't now, force the\n # shipping address to we written out independently\n if ship.add_id == mail.add_id && ship.existing_record?\n ship.force_insert\n end\n\n c.con_ship = ship.save\n end\n\n if c.con_ship.nil?\n c.con_ship = c.con_mail\n c.con_ship_to_mail = true\n end\n\n super\n end", "def distribute(client)\n client.account.messages.create(\n :from => '+16412438808',\n :to => contact.Phone_Number,\n :body => message.contents)\n end", "def backup\n # solve override problem\n if backup_exist? && !@opt[:bkp_args][:quiet]\n while true\n print \"Already have backup in #{@cfg[:backup]},override?(y/n)\"\n opt = gets\n case opt\n when /^y/i\n break\n when /^n/i\n return\n else\n next\n end\n end\n end\n \n # do backup\n FileUtils.mkdir_p @cfg[:backup] unless File.directory? @cfg[:backup]\n CommonUtils.copy_files @cfg[:local_files], File.join(__dir__, @cfg[:backup]) do |src, dest|\n @logger.debug \"Copying #{src} to #{dest}\"\n puts \"Backup: #{File.basename src}\" unless @opt[:bkp_args][:quiet]\n end\n @logger.debug('Backup completed')\n puts \"Backup completed, saved in: #{@cfg[:backup]}\" unless @opt[:bkp_args][:quiet]\n end", "def twilio\n @number = params[:phone_number]\n \n #Text message info\n t = {\n \n 'From' => CALLER_ID,\n 'To' => @number,\n 'Body' => (\"Visit uhpartments.com when you walk through an apartment\")\n }\n\n begin\n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n 'POST',\n t)\n resp.error! unless resp.kind_of? Net::HTTPSuccess\n rescue StandardError => bang\n #This area will be called if an error happens with the Twilio API\n flash[:alert] = \"Bad number.\"\n redirect_to({ :action => :home })\n \n return\n end\n\n redirect_to({ :action => :home, :alert => \"SMS sent.\" })\n end", "def create_and_copy_backup(backup_options = nil,backup_name = nil)\n\n end", "def broadcast(contact)\n self.processing!\n ApplicationMailer.newsletters(contact, self).deliver_now rescue self.failed!\n self.sent!\n end" ]
[ "0.5719056", "0.57009673", "0.5626111", "0.5570714", "0.5550205", "0.53960043", "0.53849936", "0.53594387", "0.5324955", "0.52405137", "0.52265096", "0.5200432", "0.51921225", "0.5185178", "0.51113886", "0.50760955", "0.50602907", "0.5048155", "0.50281817", "0.50161755", "0.50011784", "0.49511382", "0.49482918", "0.49424815", "0.4941915", "0.488578", "0.48837686", "0.48772857", "0.48728392", "0.4858975", "0.48496994", "0.48488265", "0.48473552", "0.48462492", "0.48119968", "0.48046467", "0.4803804", "0.47894594", "0.47684458", "0.47641036", "0.47410327", "0.4738756", "0.47349277", "0.47251382", "0.47170487", "0.47058246", "0.4702435", "0.4700961", "0.46943521", "0.46662918", "0.46632", "0.46592817", "0.46518", "0.4650054", "0.46488994", "0.4641029", "0.46401545", "0.4639867", "0.46348134", "0.4630021", "0.46282956", "0.46274075", "0.46263438", "0.46221665", "0.46184325", "0.4617272", "0.46136376", "0.46017733", "0.46000516", "0.4594088", "0.45909208", "0.45878133", "0.4587701", "0.4583174", "0.45757428", "0.45756063", "0.45624176", "0.4552587", "0.45525765", "0.4549779", "0.454622", "0.4545493", "0.45451543", "0.45439678", "0.45338812", "0.4533777", "0.45299864", "0.4515989", "0.45111418", "0.44989052", "0.4496921", "0.44935703", "0.44874677", "0.44843772", "0.44831064", "0.44830316", "0.4479913", "0.44778654", "0.44763714", "0.44760334" ]
0.7917469
0
TODO Improve function. Avoid using global vars after it works. Specialize and simplify. (it's a prototoype so no pressure to have great code for now... just explore until it works the way I want, then improve.
def parse(parser,i=0,previous_level=0,parent=nil) if i < parser.headlines.count hl = parser.headlines[i] #str = hl.to_s.gsub('*','').gsub(' ','') str = hl.to_s level = hl.level if (level - previous_level == 1) && previous_level != 0 parent = parser.headlines[i-1] $last_parent[level] = parent elsif level == previous_level || level < previous_level parent = $last_parent[level] else parent = nil end #TODO Fix order hl.body_lines.shift #remove title $headlines << {:id => Digest::MD5.hexdigest(hl.to_s), :title => str, :body => hl.body_lines.join("\n"), :level => hl.level, :parent => Digest::MD5.hexdigest(parent.to_s), :tags => hl.tags} if parent unless $children[Digest::MD5.hexdigest(parent.to_s)] $children[Digest::MD5.hexdigest(parent.to_s)] = [] end $children[Digest::MD5.hexdigest(parent.to_s)] << {:title => str, :body => hl.body_lines.join("\n"), :parent => Digest::MD5.hexdigest(parent.to_s)} end parse(parser,i+1,level,parent) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probers; end", "def anchored; end", "def suivre; end", "def terpene; end", "def private; end", "def common\n \n end", "def intensifier; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def schubert; end", "def global; end", "def stderrs; end", "def custom; end", "def custom; end", "def romeo_and_juliet; end", "def global?; end", "def berlioz; end", "def rassoc(p0) end", "def local_variables() end", "def gounod; end", "def ext=(_arg0); end", "def ext=(_arg0); end", "def ext=(_arg0); end", "def probers=(_arg0); end", "def globals; end", "def globals; end", "def rossini; end", "def global_variables() end", "def beautify; end", "def beautify; end", "def fallbacks=(_arg0); end", "def malts; end", "def villian; end", "def formation; end", "def ibu; end", "def spice; end", "def jack_handey; end", "def loc; end", "def loc; end", "def loc; end", "def too_complex; end", "def generate_comprehensive\n\n end", "def refutal()\n end", "def trd; end", "def tiny; end", "def PO114=(arg)", "def global?; true end", "def ismn; end", "def user_os_complex\r\n end", "def isolated; end", "def isolated; end", "def p15\n\t\nend", "def intern() end", "def PO109=(arg)", "def bellini; end", "def reset_vars\n $lvl_1 = [\"foodless\", \"attained\", \"auspices\", \"thriving\", \"charters\", \"spiffier\", \"styrenes\", \"singlets\", \"timbrels\", \"hidalgos\", \"tentacle\", \"sufficed\", \"deaconed\", \"peacocks\", \"beshamed\", \"tapeless\", \"goldeyes\", \"gavelled\", \"pinkness\", \"nonfatal\", \"citrated\", \"outscorn\", \"warpwise\", \"adjoined\", \"stifling\", \"oosperms\", \"innately\", \"prunable\", \"imploded\", \"overstir\", \"opposite\", \"automata\", \"whomever\", \"skewbald\", \"premolds\", \"goombays\", \"freakily\", \"deadwood\", \"savaging\", \"hereaway\", \"wabblers\", \"hazarded\", \"bowering\", \"pastrami\", \"seraglio\", \"unquotes\", \"cymosely\", \"sunbaked\", \"petering\", \"eeriness\"]\n $lvl_2 = [\"criticism\", \"incapable\", \"frequency\", \"strategic\", \"agreement\", \"direction\", \"modernize\", \"leftovers\", \"candidate\", \"secretary\", \"operation\", \"reception\", \"craftsman\", \"colleague\", \"conductor\", \"intensify\", \"dimension\", \"permanent\", \"disappear\", \"radiation\", \"objective\", \"education\", \"paragraph\", \"ambiguous\", \"discovery\", \"butterfly\", \"authorise\", \"neighbour\", \"coalition\", \"overwhelm\", \"exception\", \"represent\", \"hilarious\", \"recommend\", \"housewife\", \"reconcile\", \"committee\", \"attention\", \"earthflax\", \"available\", \"underline\", \"extension\", \"favorable\", \"encourage\", \"community\", \"effective\", \"depressed\", \"admission\", \"adventure\", \"talkative\"]\n $lvl_3 = [\"negligence\", \"goalkeeper\", \"proportion\", \"opposition\", \"articulate\", \"literature\", \"retirement\", \"commitment\", \"provincial\", \"profession\", \"acceptance\", \"settlement\", \"girlfriend\", \"excitement\", \"incredible\", \"reputation\", \"prediction\", \"difference\", \"dictionary\", \"repetition\", \"helicopter\", \"withdrawal\", \"projection\", \"accountant\", \"overcharge\", \"substitute\", \"psychology\", \"unpleasant\", \"deficiency\", \"conclusion\", \"perception\", \"correction\", \"acceptable\", \"philosophy\", \"gregarious\", \"relinquish\", \"houseplant\", \"confidence\", \"reasonable\", \"tournament\", \"depression\", \"presidency\", \"background\", \"hypothesis\", \"foundation\", \"redundancy\", \"experiment\", \"correspond\", \"restaurant\", \"enthusiasm\"]\n # $lvl_3 = [\"hatchability\", \"interdetermination\", \"thunderclap\"]\n $current_word = \"\"\n player_attempt = \"\"\n $player_score = 0\n $level_counter = 0\n $word_count = 0\n $current_lvl = $lvl_1\n $hide_speed = 1.5\n $time_limit = 7\n $no_of_enemies = 10\n $used_passes = 0\n $prompt = TTY::Prompt.new\n $player = nil\nend", "def local?; end", "def who_we_are\r\n end", "def blg; end", "def expanded; end", "def autofinish=(_arg0); end", "def isolated=(_arg0); end", "def isolated=(_arg0); end", "def parslet; end", "def parslet; end", "def parslet; end", "def parslet; end", "def weber; end", "def transformations; end", "def whiny=(_arg0); end", "def ravel; end", "def g; end", "def g; end", "def silly_adjective; end", "def main_variable ; end", "def strain; end", "def external; end", "def schumann; end", "def prep_variables\n end", "def PRF04=(arg)", "def PO106=(arg)", "def PO108=(arg)", "def preproc; end", "def PO107=(arg)", "def wrapper; end", "def operations; end", "def operations; end", "def standalone=(_arg0); end", "def verdi; end", "def PO104=(arg)", "def internal; end", "def lsi; end", "def king_richard_iii; end", "def herald; end", "def same; end", "def parts; end", "def parts; end", "def parts; end", "def rest_positionals; end" ]
[ "0.57370806", "0.55737996", "0.5562205", "0.5500893", "0.54700345", "0.5440704", "0.5410965", "0.535144", "0.535144", "0.535144", "0.535144", "0.53456765", "0.53363", "0.5297218", "0.5167552", "0.5167552", "0.51637214", "0.50997955", "0.5094833", "0.50877243", "0.50777376", "0.50755066", "0.5073739", "0.5073739", "0.5073739", "0.50732404", "0.5018265", "0.5018265", "0.5001439", "0.49945942", "0.49755007", "0.49755007", "0.4967949", "0.49577606", "0.4956977", "0.49497595", "0.49470627", "0.49213368", "0.49118003", "0.49091932", "0.49091932", "0.49091932", "0.4908284", "0.48977083", "0.48816437", "0.48790765", "0.48783472", "0.48489115", "0.48482183", "0.48452485", "0.48433354", "0.48421797", "0.48421797", "0.4840689", "0.4839139", "0.48339936", "0.48270175", "0.48201492", "0.48184025", "0.4817625", "0.48006335", "0.47997805", "0.47996375", "0.479937", "0.479937", "0.47974998", "0.47974998", "0.47974998", "0.47974998", "0.4796724", "0.47966778", "0.47936738", "0.47927386", "0.47912896", "0.47912896", "0.47909445", "0.4786417", "0.47855806", "0.47841147", "0.4777854", "0.4777404", "0.47765827", "0.47761256", "0.4767757", "0.47647375", "0.47501707", "0.47487682", "0.47485158", "0.47485158", "0.47447526", "0.47338542", "0.47324112", "0.4730496", "0.47279617", "0.47257927", "0.47247213", "0.4717605", "0.47125244", "0.47125244", "0.47125244", "0.47121403" ]
0.0
-1
(re) init with given args and frame types
def init(arguments_type, frame_type) raise "Wrong argument type, expect Type not #{arguments_type.class}" unless arguments_type.is_a? Type raise "Wrong frame type, expect Type not #{frame_type.class}" unless frame_type.is_a? Type @arguments_type = arguments_type @frame_type = frame_type @binary = BinaryCode.new(0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(*args); end", "def build(args={})\n klass = FRAME_TYPE_MAP[args[:type].to_i]\n if(klass == FrameType::Response)\n klass.new(:response => args[:data])\n elsif(klass == FrameType::Error)\n klass.new(:error => args[:data])\n elsif(klass == FrameType::Message)\n unpacked = args[:data].unpack(\"Q>s>a16a#{args[:size]}\")\n klass.new(\n Hash[*([:timestamp, :attempts, :message_id, :message].zip(unpacked).flatten)]\n )\n else\n raise TypeError.new \"Unknown frame type received: #{args[:type].inspect} - #{klass.inspect}\"\n end\n end", "def initialize(*rest) end", "def initialize(*); end", "def initialize(*args)\n set_instance_variables args if args.size > 0\n end", "def initialize args\n hash_make args, BlockState::ARG_SPECS\n end", "def initial_frame(bindings); end", "def initialize( type, parser, state )\n\t\t@args = []\n\t\t@pureargs = []\n\t\tsuper\n\tend", "def local_init(args)\n end", "def initialize(*args)\n set_instance_variables args\n end", "def initialize(*args)\n end", "def initialize(args)\n\t\t\tsuper(args)\n\t\t\t\n\t\t\t@apply_to = args.fetch(:apply_to, [])\n\t\t\t@is_a = args.fetch(:is_a, nil)\n\t\t\t@mixins = args.fetch(:mixins, [])\n\t\t\t@class_uri = args.fetch(:class_uri, nil)\n\t\t\t@defining_slots = args.fetch(:defining_slots, [])\n\t\t\t@slot_usage = args.fetch(:slot_usage, [])\n\t\t\t@slots = args.fetch(:slots, [])\n\t\t\t@subclass_of = args.fetch(:subclass_of, nil)\n\t\t\t@union_of = args.fetch(:union_of, [])\n\n\t\t\t@apply_to = [@apply_to] unless @apply_to.is_a?(Array)\n\t\t\t@mixins = [@mixins] unless @mixins.is_a?(Array)\n\t\t\t@defining_slots = [@defining_slots] unless @defining_slots.is_a?(Array)\n\t\t\t@slot_usage = [@slot_usage] unless @slot_usage.is_a?(Array)\n\t\t\t@slots = [@slots] unless @slots.is_a?(Array)\n\t\t\t@union_of = [@union_of] unless @union_of.is_a?(Array)\n\t\t\t\n\t\t\t@apply_to = nil unless @apply_to.is_a?(Biolinkml::ClassDefinition)\n\t\t\t@is_a = nil unless @is_a.is_a?(Biolinkml::Definition)\n\t\t\t\n\t\t\t@apply_to.each do |a|\n\t\t\t\t@apply_to.delete(a) unless a.is_a?(Biolinkml::ClassDefinition)\n\t\t\tend\n\t\t\t@mixins.each do |a|\n\t\t\t\t@mixins.delete(a) unless a.is_a?(Biolinkml::ClassDefinition)\n\t\t\tend\n\t\t\t@defining_slots.each do |a|\n\t\t\t\t@defining_slots.delete(a) unless a.is_a?(Biolinkml::SlotDefinition)\n\t\t\tend\n\t\t\t@slot_usage.each do |a|\n\t\t\t\t@slot_usage.delete(a) unless a.is_a?(Biolinkml::SlotDefinition)\n\t\t\tend\n\t\t\t@slots.each do |a|\n\t\t\t\t@slots.delete(a) unless a.is_a?(Biolinkml::SlotDefinition)\n\t\t\tend\n\t\t\t@union_of.each do |a|\n\t\t\t\t@union_of.delete(a) unless a.is_a?(Biolinkml::ClassDefinition)\n\t\t\tend\n\t\t\t\n\t\t \t\t \n\t\tend", "def initialize(*args)\n if args.size == 1\n from_matrix(args[0]) if args[0].is_a? Matrix\n from_arrays(args[0]) if args[0].is_a? Array and args[0].first\n elsif args.size == 3\n\t\t\tfrom_hash(args[0], args[1], args[2]) if args[0].is_a? Hash\n\t\tend\n end", "def initialize args = {}\n hash_make args, Block::ARG_SPECS\n @initial_params = collect_params\n end", "def initialize(args)\n end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(owner_class, *args, &block); end", "def types=(_arg0); end", "def initialize(*args)\n end", "def initialize(*frames)\n if frames.last.respond_to?(:fetch)\n opts = frames.pop\n @encoding = opts[:encoding]\n @frame_separator = opts[:frame_separator]\n end\n\n @frames = frames\n super(@frames)\n end", "def initialize(argument_types, block)\n @argument_types = argument_types\n @number_of_arguments = argument_types.size\n @block = block\n end", "def initialize(*args)\n # This deals with all possible types of arguments that could be given.\n args = sanitize_args(*args)\n node_value, child1, child2 = args\n\n # At this point the first argument should be a symbol, and the rest LambdaExpressions.\n case args.length\n when 1\n @kind = :variable\n @value = node_value\n when 2\n @kind = :abstraction\n @bound_var = node_value\n @body = child1\n when 3\n @kind = :application\n @function = child1\n @argument = child2\n else raise ArgumentError, \"Wrong number of arguments. (Should be caught earlier.)\"\n end\n\n end", "def initialize(*args, **kwargs, &block)\n if kwargs.has_key? :type\n @type = kwargs[:type]\n kwargs.delete :type\n else\n @type = :*\n end\n \n @args = args\n @kwargs = kwargs\n @codeblock = block\n \n @kwargs.keys\n .reject{ |m| [:kwargs, :args, :codeblock].include? m }\n .each { |m| singleton_class.send(:define_method, m) { @kwargs[m] } }\n end", "def initialize(*args)\n if args[0].is_a?(String)\n hex_initialize(*args)\n else\n rgba_initialize(*args)\n end\n end", "def initialize(type: nil, args: [])\n @type = type\n @args = args\n end", "def init args\n\n # Create the various objects\n args.state.world = World.new args\n args.state.player = Player.new args\n args.state.turrets = Array.new\n args.state.bullets = Array.new\n\nend", "def initialize(**args)\n self.args = args\n self.args.freeze\n\n parse_arguments\n validate_arguments!\n\n end", "def initialize(*args)\n @args = args\n end", "def initialize(args)\n @globals = set_config(args)\n end", "def initialize hashed_args\n hash_make hashed_args, Signal::ARG_SPECS\n end", "def initialize(type, *args, &block)\n super(type, *args)\n @init = block\n end", "def initialize(*a); super; end", "def initialize(*a); super; end", "def initialize(*args)\n @args = args\n assign_attributes\n end", "def mpt_init=(_arg0); end", "def initialize(type, *args)\n @type = self.class.const_get(type.to_s.upcase)\n @data = args\n end", "def initialize(args)\n @args = args\n end", "def initialize ( _caller, *list )\n super\n end", "def initialize ( _caller, *list )\n super\n end", "def initialize(*args, &block)\n self.__init_core(block, *args)\n end", "def initialize args={}\n assign(args)\n end", "def init_fields(args={})\n args[:type] = @int32.new(args[:type] || PcapNG::EPB_TYPE.to_i)\n args[:block_len] = @int32.new(args[:block_len] || MIN_SIZE)\n args[:interface_id] = @int32.new(args[:interface_id] || 0)\n args[:tsh] = @int32.new(args[:tsh] || 0)\n args[:tsl] = @int32.new(args[:tsl] || 0)\n args[:cap_len] = @int32.new(args[:cap_len] || 0)\n args[:orig_len] = @int32.new(args[:orig_len] || 0)\n args[:data] = StructFu::String.new(args[:data] || '')\n args[:options] = StructFu::String.new(args[:options] || '')\n args[:block_len2] = @int32.new(args[:block_len2] || MIN_SIZE)\n args\n end", "def initialize(p0, *rest) end", "def initialize(*)\n end", "def initialize(*)\n end", "def initialize args={}\n @args = args\n\n @context = @args[:context]\n @route_context = @args[:route_context]\n\n @router = @args[:router] || method(:df_route)\n @router_type = @args[:router_type]\n\n @proxies = OpenStruct.new\n @station = MailStation.new args\n\n @state = :state_inited\n end", "def initialize(*args)\n params_init # paramable\n array_init(*args)\n end", "def initialize(attributes)\n hash = attributes.dup\n @name = hash.delete(:name) or raise ArgumentError\n @lib = hash.delete(:lib) or raise ArgumentError\n # since MethodInspector scrapes arguments from file by default\n @file_parsed_args = true\n INIT_ATTRIBUTES.each do |e|\n instance_variable_set(\"@#{e}\", hash.delete(e)) if hash.key?(e)\n end\n\n after_initialize(hash)\n\n if (args = hash.delete(:args))\n if args.is_a?(Array)\n @args = args\n elsif args.to_s[/^\\d+/]\n @arg_size = args.to_i\n elsif args == '*'\n @args = [['*args']]\n end\n end\n @config = Util.recursive_hash_merge hash, hash.delete(:config) || {}\n end", "def initialize(payload); end", "def initialize(*args)\n @input, @environment, @options = case args.first\n when String, IO, StringIO\n Tools.varargs(args, [args.first.class, Environment, Hash])\n else\n Tools.varargs(args, [String, Environment, Hash])\n end\n @options = self.class.const_get(:DEFAULT_OPTIONS).merge(@options || {}) \n end", "def initialize(*args)\n\t\tEnv.log.error(\"Wrong number of arguments! At least 1 is needed!\") if args.length < 1\n\t\tif args.length == 1\n\t\t\tif args[0].is_a?(Fixnum)\n\t\t\t\thex = args[0].dup.to_s(16)\n\t\t\telsif args[0].is_a?(String)\n hex = args[0].dup\n\t\t\t\thex.gsub!(\"#\", \"\") if hex.include?(\"#\")\n\t\t\tend\n\t\t\tEnv.log.error(\"Wrong type of argument given!\") if !hex\n\t\t\tr = hex[0...2].to_i(16)\n\t\t\tg = hex[2...4].to_i(16)\n\t\t\tb = hex[4...6].to_i(16)\n\t\telsif args.length == 3\n\t\t\tr, g, b = *args\n\t\tend\n\t\treturn init_org(r, g, b) if r && g && b\n\t\treturn init_org(*args)\n\tend", "def initialize(obj); end", "def initialize(*args) #:nodoc:\n end", "def initialize(*) \n end", "def init ( m )\n raise TypeError, m.class.to_s + ': Incorrectly types for <init> method of <ParserState>.' unless\n\tm.instance_of? Method\n \n @init = m\n end", "def frame_args(frame_position=0)\n #This is a stub, used for indexing\n end", "def initialize(*args)\n super(*([0] + args))\n end", "def initialize(args = {})\n pre_initialize(args)\n default_args! args\n\n @kind = args.fetch(:kind)\n @location = args.fetch(:location)\n @attributes = args.fetch(:attributes)\n @mixins = args.fetch(:mixins)\n @actions = args.fetch(:actions)\n\n post_initialize(args)\n end", "def initialize(frame)\n @id = frame[\"id\"]\n @timestamp = frame[\"timestamp\"]\n @raw = frame\n\n @hands = Artoo::Drivers::Leapmotion::Hand.list(frame)\n @gestures = Artoo::Drivers::Leapmotion::Gesture.list(frame)\n @pointables = Artoo::Drivers::Leapmotion::Pointable.list(frame)\n\n @rotation = {\n axis: frame['r'][0],\n angle: frame['r'][1],\n matrix: frame['r'][2]\n }\n\n @scale_factor = frame[\"s\"]\n @translation = frame[\"t\"]\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 initialize(*argv)\n case argv.length\n when 1\n if argv[0].kind_of? Array; super(argv[0])\n elsif argv[0].respond_to? :rect; super(argv[0])\n end\n when 2\n super(argv[0].concat(argv[1]))\n when 4\n super(argv)\n end\n return self\n end", "def initialize(args = {})\n parse_args(args)\n end", "def initialize args\n index = 0\n puts args\n #iterates through all the instance variables declared at the time\n #of class creation and sets \n self.class.instance_variables.each do |instance_variable|\n\n #To set instance_variable as per new object values \n self.class.instance_variable_set( \"#{ instance_variable}\", args[ index ] )\n \n #To get value of class_variable i.e. returns array\n class_variable_array = self.class.class_variable_get( \"@#{ instance_variable }\" )\n \n #To push new args value into class variable\n self.class.class_variable_set( \"@#{ instance_variable }\", class_variable_array.push( \"#{ args[ index ] }\" ) ) \n index += 1\n end\n puts self.is_a? Sourcedetails\n end", "def prepare_parsed_frame frame\n end", "def initialize(start_frame, end_frame, fragment_seq = nil)\n @start_frame = start_frame\n @end_frame = end_frame\n @fragment_seq = fragment_seq\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 init_fields(args={})\n args[:timestamp] = Timestamp.new(:endian => args[:endian]).read(args[:timestamp])\n args[:incl_len] = args[:incl_len].nil? ? @int32.new(args[:data].to_s.size) : @int32.new(args[:incl_len])\n args[:orig_len] = @int32.new(args[:orig_len])\n args[:data] = StructFu::String.new.read(args[:data])\n end", "def initialize *args, &block\n @init_args = args\n @init_block = block\n @recorded_messages = []\n end", "def init_fields(args={})\n args[:type] = @int32.new(args[:type] || PcapNG::IDB_TYPE.to_i)\n args[:block_len] = @int32.new(args[:block_len] || MIN_SIZE)\n args[:link_type] = @int16.new(args[:link_type] || 1)\n args[:reserved] = @int16.new(args[:reserved] || 0)\n args[:snaplen] = @int32.new(args[:snaplen] || 0)\n args[:options] = StructFu::String.new(args[:options] || '')\n args[:block_len2] = @int32.new(args[:block_len2] || MIN_SIZE)\n args\n end", "def initialize(*args)\r\n @resolver_em = nil\r\n @resolver_ruby = nil\r\n @src_address = nil\r\n reset_attributes\r\n \r\n # Process args\r\n if (args.length==1)\r\n if (args[0].class == Hash)\r\n args[0].keys.each do |key|\r\n begin\r\n if (key == :config_info)\r\n @config.set_config_info(args[0][:config_info])\r\n elsif (key==:nameserver)\r\n set_config_nameserver(args[0][:nameserver])\r\n else\r\n send(key.to_s+\"=\", args[0][key])\r\n end\r\n rescue Exception\r\n TheLog.error(\"Argument #{key} not valid\\n\")\r\n end\r\n end\r\n elsif (args[0].class == String)\r\n set_config_nameserver(args[0]) \r\n elsif (args[0].class == Config)\r\n # also accepts a Config object from Dnsruby::Resolv\r\n @config = args[0]\r\n end\r\n else\r\n # Anything to do?\r\n end\r\n if (@single_resolvers==[])\r\n add_config_nameservers\r\n end\r\n update\r\n end", "def initialize(args)\n\t\targs = defaults.merge(args)\n\t\t@rim = args[:rim]\n\t\t@tire = args[:tire]\n\tend", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize(extrs)\n # v = new Extractor[extrs.length];\n # System.arraycopy(extrs, 0, v, 0, extrs.length);\n @v = extrs.dup\n initTypes\n end", "def initialize_bef_aft(call_type,*args)\n\n cal_method = [] #Will contain list of methods to be called before \n flag = 0\n args.each do |method| \n if method.class == Hash\n if method.has_key?(:only)\n flag = 1\n initialize_only_except(call_type,method[:only],cal_method,\"only\")\n elsif method.has_key?(:except)\n flag = 1\n initialize_only_except(call_type,method[:except],cal_method,\"except\") \n else\n abort(\"undefine attributes send to method #{call_type}\")\n end\n \n else\n cal_method << method\n end\n end\n\n if flag == 0 # if :only and :except both are not given then it should be called before all functions \n initialize_only_except(call_type,Array.new,cal_method,:except)\n end \n\n end", "def initialize(*args)\n #This is a stub, used for indexing\n end", "def initialize( sender_id, conn_id, body='' )\n\t\t\t@frame = Mongrel2::WebSocket::Frame.new( body )\n\t\t\tsuper( sender_id, conn_id, @frame.payload )\n\t\tend", "def initialize(args)\n @args = args\n @options = OpenStruct.new\n\n parse\n validate\n end", "def initialize( * )\n\t\t\tsuper\n\n\t\t\tpayload = self.body.read\n\t\t\tself.body.rewind\n\n\t\t\t@frame = Mongrel2::WebSocket::Frame.new( payload, self.headers.flags )\n\t\tend", "def initialize args\n hash_make args, InPort::ARG_SPECS\n @link = nil\n end", "def initialize_states(object, options = T.unsafe(nil), attributes = T.unsafe(nil)); end", "def initialize(args = {})\n @args = args\n @args[:headers] ||= {}\n @body = args[:body] || \"\"\n @debug = args[:debug]\n @request = args.fetch(:request)\n end" ]
[ "0.67121077", "0.6652466", "0.6518489", "0.643161", "0.642996", "0.62745786", "0.6259297", "0.6256564", "0.6185408", "0.6180649", "0.6157157", "0.6140022", "0.6109725", "0.6101269", "0.60784936", "0.6067755", "0.6067755", "0.6067755", "0.6067755", "0.6067755", "0.6046578", "0.6027939", "0.6022652", "0.60149264", "0.59698564", "0.59573716", "0.59516644", "0.5943063", "0.5939146", "0.5930171", "0.5923263", "0.5917844", "0.59111995", "0.5903489", "0.5899639", "0.5876434", "0.5876434", "0.58674204", "0.5848284", "0.5845178", "0.58348334", "0.58316016", "0.58316016", "0.5827379", "0.5816718", "0.5815553", "0.58125436", "0.58112335", "0.58112335", "0.58024645", "0.5796396", "0.5793298", "0.57873297", "0.5780843", "0.57767963", "0.57760227", "0.5761653", "0.57580966", "0.57538307", "0.573191", "0.57298833", "0.57214254", "0.5721356", "0.57157594", "0.56986773", "0.569863", "0.56964546", "0.5680069", "0.5671467", "0.5669666", "0.5669666", "0.5669666", "0.5669666", "0.5669666", "0.5669666", "0.5669666", "0.5669666", "0.5669666", "0.5669666", "0.5669666", "0.5669666", "0.5669666", "0.5662145", "0.5659252", "0.5646535", "0.56398237", "0.56394684", "0.5637407", "0.5637407", "0.5637407", "0.5637407", "0.5627983", "0.5626642", "0.5618664", "0.5616466", "0.5611626", "0.5610385", "0.5601678", "0.5596843", "0.5592198" ]
0.74155045
0
determine if method has a local variable or tmp (anonymous local) by given name
def has_local( name ) raise "has_local #{name}.#{name.class}" unless name.is_a? Symbol @frame_type.variable_index( name ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_local name\n raise \"has_local #{name}.#{name.class}\" unless name.is_a? Symbol\n index = self.locals.index_of(name)\n index = self.tmps.index_of(name) unless index\n index\n end", "def has_local name\n raise \"has_local #{name}.#{name.class}\" unless name.is_a? Symbol\n max = self.locals.get_length\n counter = 1\n while( counter <= max )\n if( self.locals.get(counter).name == name)\n return counter\n end\n counter = counter + 1\n end\n return nil\n end", "def in_scope?(name)\n ret = true if @callable.arguments_type.variable_index(name)\n ret = @callable.frame_type.variable_index(name) unless ret\n ret\n end", "def has_var name\n raise \"has_var #{name}.#{name.class}\" unless name.is_a? Symbol\n index = has_arg(name)\n return index if index\n has_local(name)\n end", "def local?; !!@local end", "def method_local? m\n self.respond_to?(m) && self.method(m).owner == self\n end", "def method\n local_variable = \"Hi, I'm local only to this method\"\nend", "def local_variable_defined_for_node?(node, name); end", "def instance_method_local? m\n self.method_defined?(m) && self.instance_method(m).owner == self\n end", "def foo\n local_variables = 10\n puts \"local variables: #{local_variables}\"\n puts defined?(local_variables)\nend", "def local?(*names, &block)\n names.collect { |name| local(name) }.compact.length == names.length\n end", "def local_variable_defined_for_node?(node, name)\n match(node) do |current|\n current.include?(name)\n end\n end", "def local?; end", "def variable_exists(name)\n assert_type name, :String, :name\n bool(environment.caller.var(name.value))\n end", "def local?\n @local\n end", "def get_local_var\n p $local_var #this is different than...\n local_var = \"Local Var\"\n p local_var #...this.\nend", "def local!(name)\n value = local(name)\n error(\"Undefined local `#{name}`.\") if value.nil?\n value\n end", "def thread_variable?(key)\n _locals.has_key?(key.to_sym)\n end", "def find_local_symbol(symbol)\n find_method_named(symbol) or\n find_constant_named(symbol) or\n find_attribute_named(symbol) or\n find_module_named(symbol) or\n find_file_named(symbol)\n end", "def getlocal() end", "def local?\n @local\n end", "def local?\n @local\n end", "def find_local_symbol(symbol)\n find_method_named(symbol) or\n find_constant_named(symbol) or\n find_attribute_named(symbol) or\n find_external_alias_named(symbol) or\n find_module_named(symbol) or\n find_file_named(symbol)\n end", "def local?\n @local == true\n end", "def local_method\n :local_method\n end", "def local(name)\n @locals[name.to_s.to_sym]\n end", "def local_variables() end", "def method(local)\n puts local\nend", "def is_namevar?\n @is_namevar\n end", "def locals\n\t\t# \"typical\" example without name clashing\n\t\tlocal_var = 10 #1 [:setlocal, 2]\n\t\tputs(local_var) #2 [:getlocal, 2]\n\t\tlocal_var #3 has no effect and is skipped by compiler\n\n\t\tputs(method_call) #4 [:send, :method_call, 0, nil, 24, nil]\n\t\tmethod_call #5 [:send, :method_call, 0, nil, 24, nil]\n\t\tmethod_call() #6 [:send, :method_call, 0, nil, 8, nil]\n\tend", "def local?\n false\n end", "def local?\n true\n end", "def local?\n jiak.object.local?\n end", "def test_get_local\n assert_equal [\n PUSH_NUMBER, 0, # 1 stack = [1]\n SET_LOCAL, 0, # a stack = []\n GET_LOCAL, 0, # a stack = [1]\n RETURN\n ], @compiler.compile(\"a=1; a\")[:instructions]\n end", "def method_var\n __method__ == :method_var or raise\n end", "def local?\n false\n end", "def forward_checkable?\n vars = uninstantiated_variables\n vars.length == 1 ? vars[0] : nil\n end", "def foo\n # puts name # you can get the outside variable name\n puts \"foo\"\n end", "def local?(dep_name) # :nodoc:\n spec, _ = @local[dep_name]\n\n spec\n end", "def variable?\n any? {|op| op.respond_to?(:variable?) && op.variable?}\n end", "def say_my_name\n\t# my_name is a local variable\n\t# variable is not initialized!\n\t# doesn't have any value!\n\t# And doesn't have a type \n\tputs my_name\nend", "def find(name, remote=false)\n found = check(name)\n return found if found || remote\n @variables[name.to_sym] = :var\n found\n end", "def checkNode (node, names)\n unless node.nil?\n if([\"module\", \"class\"].include? node.type.to_s and node.children[0].loc.name.source.eql? names[0])\n if(node.children[1].nil?)\n a = getFunctionAux(node.children[2], names[1])\n else\n a = getFunctionAux(node.children[1], names[1])\n end\n unless a.nil?\n return a\n end\n end\n end\n return\n end", "def if_fn(name)\n ivar_name = \"@#{name}\".to_sym\n lambda do |opts|\n if opts[:user_options] && opts[:user_options][:skip_undefined]\n if respond_to?(:key?)\n self.key?(name) || instance_variable_defined?(ivar_name)\n else\n instance_variable_defined?(ivar_name)\n end\n else\n true\n end\n end\n end", "def defined?(name); end", "def defined?(name); end", "def blah()\n my_var = \"my var has been defined\"\nend", "def local\n @local\n end", "def has_local?\n local.exist?\n end", "def isVariable(let)\n\t\t(0..@vars.size-1).each do |j| \n\t\t\tif let==@vars[j] \n\t\t\t\treturn(j)\n\t\t\tend\n\t\tend\n\t\treturn(-1)\n\tend", "def variable?\n not constant?\n end", "def named?\n !unnamed?\n end", "def strict_locals?\n strict_locals!\n end", "def local(*args); end", "def you_rang?\n # How many bindings are on the callstack?\n p caller.size # => 1\n\n # Where did we call it from?\n p caller # => [\"practice.rb:823:in `<main>'\"]\nend", "def invariable?\n false\n end", "def hasVar?( name )\n\t\t\t\tArgTest::type( \"name\", name, String )\n\t\t\t\tname.strip!()\n\t\t\t\tArgTest::stringLength( \"name\", name, 1 )\n\t\t\t\treturn @vars.has_key?( name )\n\t\t\tend", "def check(name)\n return true if @variables[name.to_sym]\n !!(@parent && @parent.check(name))\n end", "def some_method # Scope gate\n v2 = 2\n p local_variables\n end", "def class_variable_defined?(sym) end", "def get_variable( var_name)\n\t\tvar = Vim::evaluate(\n\t\t\t\"exists(\\\"#{var_name}\\\") ? #{var_name} : \\\"__NIL__\\\"\"\n\t\t)\n\n\t\tvar == '__NIL__' ? nil : var\n\tend", "def var_exist?(name, scope=@@scope_no)\n scope.downto(0).each do |idx|\n if @@variable_list.at(idx).has_key?(name) then return idx end\n end\n return -1\nend", "def one_local(name)\n nil\n end", "def local_scope; @scope = :local end", "def named?\n !anonymous?\n end", "def instance_variable_defined?(p0) end", "def get_local(locals: {}, key: \"\", alt: false ) \n\t\t_local = alt\n\t\tif locals.has_key?(key.to_sym)\n\t\t\t_local = locals[key.to_sym]\n\t\telsif locals.has_key?(key.to_s)\n\t\t\t_local = locals[key.to_s]\n\t\tend\n\n\t\treturn _local \n\tend", "def block_it?(tp)\n if @cond.track_params\n return true if negative_check(tp)\n if positives_check(tp)\n return !tp.binding.eval('local_variables').any? do |v|\n tp.binding.local_variable_get(v).object_id == @cond.track_params\n end\n end\n else\n return true if negative_check(tp)\n return false if positives_check(tp)\n end\n true # default is blocked the tp\n end", "def caller?(meth)\n return @context.caller?(meth,self)\n end", "def slot_type_for(name)\n if index = @callable.arguments_type.variable_index(name)\n slot_def = [\"arg#{index}\".to_sym]\n elsif index = @callable.frame_type.variable_index(name)\n slot_def = [\"local#{index}\".to_sym]\n elsif index = @method.arguments_type.variable_index(name)\n slot_def = [:caller , :caller , \"arg#{index}\".to_sym]\n elsif index = @method.frame_type.variable_index(name)\n slot_def = [:caller ,:caller , \"local#{index}\".to_sym ]\n elsif\n raise \"no variable #{name} , need to resolve at runtime\"\n end\n return slot_def\n end", "def isNamed\r\n \"#{@name}\"\r\nend", "def search_local(name)\n if variable = variables[name]\n return variable.nested_reference\n end\n\n if variable = search_scopes(name)\n variables[name] = variable\n return variable.nested_reference\n end\n end", "def find_local_symbol(symbol)\n find_class_or_module_named(symbol) || super\n end", "def method_missing( sym, *args, &block )\n\t\t\treturn super unless sym =~ /^\\w+$/\n\t\t\treturn @locals[ sym ].nil? ? @fragments[ sym ] : @locals[ sym ]\n\t\tend", "def parent_variable_access?(name)\n # if this scope has a \"var x = 1\" type of declaration for this name,\n # it is not referencing a parent scope.\n return false if scope_variable?(name)\n\n # otherwise, if there is a variable access for this name, it's\n # referencing a parent scope.\n variable_access?(name)\n end", "def test_local_basic\n lst = compile( \"foo = 1 ; foo\")\n assert_equal ScopeStatement , lst.class\n assert_equal LocalVariable , lst.statements[1].class\n end", "def available_variable?(name)\n # if the current scope is already using the variable, it's\n # unavailable.\n return false if variable?(name)\n\n # if any of the child scopes reference the variable as a\n # parent variable, it's not available.\n !any_child_references_parent_variable?(name)\n end", "def local_variable_reads(node); end", "def search_local(name)\n if variable = variables[name]\n return variable.nested_reference\n end\n\n if variable = search_scopes(name)\n variables[name] = variable\n return variable.nested_reference\n end\n end", "def find_local_symbol(symbol)\n find_class_or_module(symbol) || super\n end", "def locals; end", "def locals; end", "def locals; end", "def resolve_variable(name)\n func = @current_func\n link = 0\n while func != nil\n idx = func.formal_index(name)\n if idx != -1\n return [:formal, link, idx]\n end\n idx = func.lvar_index(name)\n if idx != -1\n return [:lvar, link, idx]\n end\n func = func.outer_func\n link += 1\n end\n return nil\n end", "def variable(node)\n while %i[call field method_add_arg method_add_block].include?(node.receiver.sexp_type)\n node = node.receiver\n end\n return if %i[fcall hash].include?(node.receiver.sexp_type)\n\n node.receiver\n end", "def key?(name)\n ::Kernel.raise TypeError, \"name #{name} must convert to_sym\" unless name and name.respond_to?(:to_sym)\n @locals.has_key?(name.to_sym)\n end", "def amethod\n localvar = 10\n puts( localvar )\n puts( $globalvar )\nend", "def on_block(token)\n token.parameters.each do |param|\n if scope.lookup(param.type, param.name)\n warning(\n \"shadowing outer local variable #{param.name}\",\n param.line,\n param.column\n )\n end\n end\n end", "def ivar(name)\n var_name = \"@_#{name}\"\n if instance_variable_defined?(var_name)\n return instance_variable_get(var_name)\n else\n false\n end\n end", "def variable?(item)\n return (!self.operator?(item) and !self.param?(item)) ? true : false\n end", "def ivar(name)\n if instance_variable_defined?(\"@#{name}\")\n return instance_variable_get(\"@#{name}\")\n else\n false\n end\n end", "def local_variable_declaration(method)\n\n\n\n \t dummy_variable = LocalVariableDefinition.new\n \t local_variables = []\n\n\n # 149:7: variable_modifier type[dummy_variable] local_variable_list[dummy_variable, local_variables, method] ';'\n variable_modifier()\n\n type(dummy_variable)\n\n local_variable_list(dummy_variable, local_variables, method)\n\n match(:SEMICOLON)\n\n local_variables.each do |local_variable|\n method.add_local_variable(local_variable)\n end\n local_variables.each do |local_variable|\n method.add_use_of(local_variable.name, local_variable.line) if local_variable.was_initialized?\n end\n \n\n\n\n end", "def call_some_proc(pr)\n a = \"Irrelevant 'a' in method scope\"\n puts a\n pr.call\nend", "def remove_ivar(name)\n if instance_variable_defined?(\"@_#{name}\")\n return remove_instance_variable(\"@_#{name}\")\n else\n false\n end\n end", "def variable_get(name)\n assert_type name, :String, :name\n environment.caller.var(name.value)\n end", "def variable_definition?\n @variable\n end", "def ivar_defined?(name)\n instance_variable_defined?(\"@#{name}\")\n end", "def clean_thread_locals(which = T.unsafe(nil)); end", "def test_local\n result = 1 + 2\n result.times do |x|\n puts a = x + 1\n p local_variables\n end\n p local_variables\nend", "def find_var(name, depth = 0)\n if slot = @variables[name]\n LocalReference.new(slot, depth)\n else\n @parent.find_var(name, depth)\n end\n end" ]
[ "0.7665879", "0.70041084", "0.6953241", "0.68916005", "0.67192", "0.6613709", "0.6534072", "0.6519087", "0.6473429", "0.6448009", "0.63289285", "0.63084507", "0.61489034", "0.6125273", "0.6074033", "0.60447836", "0.6017613", "0.6014759", "0.5972813", "0.593316", "0.5914293", "0.5914293", "0.59024477", "0.58507514", "0.58183086", "0.5804117", "0.5797864", "0.5797825", "0.5750993", "0.5750341", "0.57095695", "0.56792104", "0.5638237", "0.56011933", "0.5578175", "0.55627114", "0.5553751", "0.55395687", "0.5537969", "0.5504728", "0.54724777", "0.54672885", "0.54539347", "0.54319215", "0.5415364", "0.5415364", "0.5410649", "0.5405546", "0.5402025", "0.538992", "0.5366637", "0.5348737", "0.53449035", "0.53438747", "0.533044", "0.5328786", "0.53252834", "0.5321842", "0.5321249", "0.5317463", "0.53168225", "0.53128433", "0.53082", "0.53038013", "0.5293894", "0.52936554", "0.52767867", "0.52629864", "0.5260871", "0.5258097", "0.5247701", "0.52464205", "0.5216202", "0.5206187", "0.5202517", "0.5201331", "0.5198691", "0.5194379", "0.5189821", "0.5189666", "0.51873374", "0.51873374", "0.51873374", "0.5180105", "0.5168038", "0.5160283", "0.5153831", "0.5145485", "0.5129906", "0.512713", "0.5096091", "0.50919783", "0.5074434", "0.507168", "0.5053811", "0.50529665", "0.5049448", "0.50298095", "0.5028585", "0.50259763" ]
0.7292292
1
GET /child_development_periods GET /child_development_periods.json
def index @child_development_periods = ChildDevelopmentPeriod.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_child_development_period\n @child_development_period = ChildDevelopmentPeriod.find(params[:id])\n end", "def index\n @child_developments = ChildDevelopment.all\n end", "def create\n @child_development_period = ChildDevelopmentPeriod.new(child_development_period_params)\n\n respond_to do |format|\n if @child_development_period.save\n format.html { redirect_to @child_development_period, notice: 'Child development period was successfully created.' }\n format.json { render :show, status: :created, location: @child_development_period }\n else\n format.html { render :new }\n format.json { render json: @child_development_period.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @child_development_period.update(child_development_period_params)\n format.html { redirect_to @child_development_period, notice: 'Child development period was successfully updated.' }\n format.json { render :show, status: :ok, location: @child_development_period }\n else\n format.html { render :edit }\n format.json { render json: @child_development_period.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_periods\n @periods = current_user.periods.all.order(created_at: :desc)\n render json: @periods\n end", "def index\n periods = current_user.school.periods.all\n\n render json: periods\n end", "def destroy\n @child_development_period.destroy\n respond_to do |format|\n format.html { redirect_to child_development_periods_url, notice: 'Child development period was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def child_development_period_params\n params.require(:child_development_period).permit(:date_contol, :weight, :size, :head_circunference, :child_id, :child_development_id, :medical_center_id, :doctor_id)\n end", "def index\n @periods = @organism.periods.order(:close_date)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @periods } \n end\n end", "def show\n period = current_user.school.periods.find(params[:id])\n render json: period\n end", "def get_inactive_periods\n @periods = current_user.periods.where(is_active: false).order(created_at: :desc)\n render json: @periods\n end", "def show\n @period = Period.find(params[:id])\n\n render json: @period\n end", "def index\n @registration_periods = RegistrationPeriod.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registration_periods }\n end\n end", "def index\n @depts = Dept.roots.includes(:children)\n render json: @depts, each_serializer: V1::DeptSerializer, root: false\n end", "def index\n @periods = Period.all\n end", "def child_development_params\n params.require(:child_development).permit(:name, :months)\n end", "def index\n @breadcrumbs = [[t(:wage_periods), wage_periods_path],\n [@wage_period.name, wage_period_path(@wage_period.id)],\n [t(:wages)]]\n @wage_periods = current_organization.wage_periods.order('id')\n if !params[:wage_period_id] && @wage_periods.count > 0\n params[:wage_period_id] = @wage_periods.first.id\n end\n @wages = current_organization.wages.where('wage_period_id=?', params[:wage_period_id])\n @wages = @wages.page(params[:page]).decorate\n end", "def children\n parent_id = params['parent_id']\n\n children = Child.includes(:bursts).where(parent_id: parent_id).map{ |child|\n last_burst = child.bursts.last\n burst_rate = last_burst.present? ? calc_burst_rate(last_burst) : 0\n\n {\n id: child.id,\n name: child.name,\n burst_rate: burst_rate\n }\n }\n\n render json: children\n end", "def index\n @vacation_periods = VacationPeriod.all\n end", "def index\r\n @product_periods = ProductPeriod.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @product_periods }\r\n end\r\n end", "def index\n @breadcrumbs = [['Wage periods', wage_periods_path],\n [@wage_period.name, wage_period_path(@wage_period.id)],\n ['Wages']]\n @wage_periods = current_organization.wage_periods.order('id')\n if !params[:wage_period_id] && @wage_periods.count > 0\n params[:wage_period_id] = @wage_periods.first.id\n end\n @wages = current_organization.wages.where('wage_period_id=?', params[:wage_period_id])\n @wages = @wages.page(params[:page]).decorate\n end", "def index\n @time_periods = TimePeriod.all\n end", "def index\n @schedule_cohort_periods = ScheduleCohortPeriod.all\n end", "def index\n @activity_developments = ActivityDevelopment.all\n end", "def show\n @tb_period = TbPeriod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tb_period }\n end\n end", "def show\n @title = \"Show Resources Periods\"\n @resource_period = ResourcePeriod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @resource_period }\n end\n end", "def set_child_development\n @child_development = ChildDevelopment.find(params[:id])\n end", "def index\n @work_periods = WorkPeriod.all\n end", "def index\n @dis_doseperiods = DisDoseperiod.all\n end", "def schedule_periods\n\t\t@periods = Period.all\n\tend", "def all_periods\n res = Array.new\n res.concat periods_as_admin\n res.concat assignments.map{|a| a.period}\n res.concat groups_as_coach.map{|g| g.period}\n #res.concat teams_as_leader.map{|t| t.period}\n return res.uniq\n end", "def index\n @periods = Period.find(:all, :include => { :talks => :users })\n @periods_by_time_and_scene = Hash.new\n for p in @periods\n @periods_by_time_and_scene[p.time_id] ||= Hash.new\n @periods_by_time_and_scene[p.time_id][p.scene_id] = p \n end\n\n @time_ids = @periods.collect { |p| p.time_id }.sort.uniq\n \n @edit = params[:edit] && admin?\n @all_talks = Talk.all_pending_and_approved if @edit\n @all_talks.sort!{|t1,t2|t1.id <=> t2.id}\n\n respond_to do |format|\n format.html {render :layout => 'plain' }# index.html.erb\n format.xml { render :xml => @periods }\n end\n end", "def dates\n render json: @standings\n end", "def get_periods(id, starts: nil, ends: nil, threshold:, operation:)\n params = {:start => starts, :end => ends, :threshold => threshold, :op => operation}\n params.delete_if { |k, v| v.nil? }\n @client.http_get(\"/#{@resource}/#{id}/periods?\"+URI.encode_www_form(params))\n end", "def periods\n @periods ||= @data['properties']['periods'].map { |row|\n ::WeatherSage::Weather::Period.new(@ctx, row)\n }\n end", "def new\n @workday = Workday.new\n 2.times do\n @workday.periods.build\n end\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workday }\n end\n end", "def index\n @teaching_periods = TeachingPeriod.all\n end", "def index\n @pay_periods = PayPeriod.all\n end", "def index\n @pay_periods = PayPeriod.all\n end", "def check_active_period\n render json: @active_period\n end", "def create_period\n periods_checked = current_user.periods.active.count\n puts \"The user has #{periods_checked} active periods, trying to create a #{params[:nduration].to_i} days period\"\n if periods_checked == 0\n puts \"The user hasn't active periods\"\n @period = current_user.periods.new(is_active: true, is_updated: false, duration: params[:nduration].to_i, start_date: Date.today.to_s, end_date: (Date.today+params[:nduration].to_i).to_s)\n puts @period\n if @period.save\n render json: @period, status: :created, location: @period\n else\n render json: @period.errors, status: :unprocessable_entity\n end\n else\n puts \"The user has active periods\"\n # render json: @period.errors, status: :unprocessable_entity\n render json: { status: 'ERROR', message: \"The user has an active period\"}, status: :unprocessable_entity\n end\n end", "def index\n @authorization_periods = AuthorizationPeriod.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @authorization_periods }\n end\n end", "def create\n @child_development = ChildDevelopment.new(child_development_params)\n\n respond_to do |format|\n if @child_development.save\n format.html { redirect_to @child_development, notice: 'Child development was successfully created.' }\n format.json { render :show, status: :created, location: @child_development }\n else\n format.html { render :new }\n format.json { render json: @child_development.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @dec_form_children = DecFormChild.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dec_form_children }\n end\n end", "def index\n @reporting_periods = ReportingPeriod.order(date: :desc)\n .includes(:full_reports).page params[:page]\n @data = ::Api::Charts::ReportingPeriod.new(@reporting_periods)\n .reporting_periods_cost_data\n end", "def show\n @dec_form_child = DecFormChild.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dec_form_child }\n end\n end", "def index\n @api_v1_frequency_periods = Api::V1::FrequencyPeriod.all\n end", "def getAllPeriods()\n aggregateQuery = [\n @dsObj.groupByPeriods(),\n {:$sort => {\"_id.fiscal_year\" => -1, \"_id.fiscal_quarter\" => -1, \"_id.fiscal_month\" => -1, \"_id.fiscal_week\" => -1}}\n ]\n aggregateCursor = @bookingDumpColl.aggregate(aggregateQuery)\n\n yearArray = []; quarterArray = []; monthArray = []; weekArray = [];\n periodsArray = [] \n periodDict = {}\n\n aggregateCursor.each do |doc|\n subDoc = doc[:_id]\n yearArray << subDoc[:fiscal_year]\n quarterArray << subDoc[:fiscal_quarter]\n monthArray << subDoc[:fiscal_month]\n weekArray << subDoc[:fiscal_week]\n periodDict = {\n :periods => {\n :year => subDoc[:fiscal_year],\n :quarter => subDoc[:fiscal_quarter],\n :month => subDoc[:fiscal_month],\n :week => subDoc[:fiscal_week]\n }\n }\n periodsArray << periodDict\n end\n yearArray = yearArray.uniq; yearArray = yearArray.sort\n quarterArray = quarterArray.uniq; quarterArray = quarterArray.sort\n monthArray = monthArray.uniq; monthArray = monthArray.sort\n weekArray = weekArray.uniq; weekArray = weekArray.sort\n\n arrayHash = {\n :yArray => yearArray,\n :qArray => quarterArray,\n :mArray => monthArray,\n :wArray => weekArray,\n :pArray => periodsArray\n }\n return arrayHash\n \n end", "def planning_periods\n return [] if plannings.empty? or course.nil?\n\n periods = []\n course.plannings.each do |planning|\n next if planning.week_day.nil? or Date::DAYNAMES[planning.week_day].nil?\n course_day = Date::DAYNAMES[planning.week_day].downcase\n periods += planning.periods.map { |period| \"#{course_day}-#{period}\" }\n end\n\n periods.uniq\n end", "def show\n @project_phase = ProjectPhase.find(params[:id])\n @lifecycle_phase = @project_phase.lifecycle_phase\n @project_phase_deliverables = []\n @project_phase.stock_deliverable_types.each do |stock|\n stock.deliverables.each do |d|\n @project_phase_deliverables << d\n end\n end\n\n @project_phase.custom_deliverable_types.each do |custom|\n custom.deliverables.each do |d|\n @project_phase_deliverables << d\n end\n end\n\n respond_to do |format|\n format.json { render :json => { :lifecycle_phase_container => @lifecycle_phase,\n :deliverables_container => @project_phase_deliverables,\n :project_phase_estimated_effort => @project_phase.estimated_effort,\n :project_phase_logged_effort => @project_phase.logged_effort} }\n end\n end", "def index\n @scholarship_periods = ScholarshipPeriod.all\n end", "def index\n @cycles = Cycle.where(group_id: params[:group_id])\n\n render json: @cycles\n end", "def check_for_active_periods\n # puts \"answer #{ @active_period.count() > 0 }\"\n render json: { 'activePeriod': @active_period.count() > 0 }\n end", "def show\n @free_periods = @vending_machine.free_periods.sort {|p,q| p.start_time.hour <=> q.start_time.hour}\n end", "def show\n @toyota_epc_part_number_application_to_models_child = ToyotaEpc::PartNumberApplicationToModelsChild.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @toyota_epc_part_number_application_to_models_child }\n end\n end", "def index\n @concept_groups = ConceptGroup.find_all_by_parent_id(nil)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concept_groups }\n end\n end", "def index\n @fdn_org_hierarchies = Fdn::OrgHierarchy.paginate(:page => params[:page]).order(\"created_by DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fdn_org_hierarchies }\n end\n end", "def show\n @division = Division.find(params[:id])\n @representatives = DivisionRep.where(:division_id => params[:id])\n @games = Game.where(:division_id => params[:id]).order('start ASC')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @division }\n end\n end", "def show\n render json: @day, include: [:activities]\n end", "def periods_params\n params.require(:period).permit(:name, :comment, :start_date, :end_date, :budget_id)\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @registration_period }\n end\n end", "def get_tenant_maintenance_window(args = {}) \n get(\"/tenants.json/maintenance/#{args[:tenantId]}\", args)\nend", "def update\n respond_to do |format|\n if @child_development.update(child_development_params)\n format.html { redirect_to @child_development, notice: 'Child development was successfully updated.' }\n format.json { render :show, status: :ok, location: @child_development }\n else\n format.html { render :edit }\n format.json { render json: @child_development.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\r\n @product_period = ProductPeriod.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @product_period }\r\n end\r\n end", "def index\n\n add_breadcrumb \"Funding Requests\"\n\n @fiscal_years = get_fiscal_years\n\n # Start to set up the query\n conditions = []\n values = []\n\n # Check to see if we got an organization to sub select on.\n @org_filter = params[:org_id]\n conditions << 'organization_id IN (?)'\n if @org_filter.blank?\n values << @organization_list\n else\n @org_filter = @org_filter.to_i\n values << [@org_filter]\n end\n\n # See if we got fiscal year\n @fiscal_year = params[:fiscal_year]\n unless @fiscal_year.blank?\n @fiscal_year = @fiscal_year.to_i\n conditions << 'fy_year = ?'\n values << @fiscal_year\n end\n\n # See if we got a capital project type\n @capital_project_type_id = params[:capital_project_type_id]\n unless @capital_project_type_id.blank?\n @capital_project_type_id = @capital_project_type_id.to_i\n conditions << 'capital_project_type_id = ?'\n values << @capital_project_type_id\n end\n\n # See if we got a capital project state\n @capital_project_state = params[:capital_project_state]\n unless @capital_project_state.blank?\n conditions << 'state = ?'\n values << @capital_project_state\n end\n\n # Get the funding source filter if there is one\n @funding_source_id = params[:funding_source_id]\n if @funding_source_id.blank?\n @funding_source_id = 0\n else\n @funding_source_id = @funding_source_id.to_i\n end\n\n # We have to build the list of funding requests by iterating through the\n # set of matching capital projects\n @funding_requests = []\n projects = CapitalProject.where(conditions.join(' AND '), *values).order(:fy_year, :capital_project_type_id)\n projects.each do |project|\n project.activity_line_items.each do |ali|\n ali.funding_requests.each do |request|\n # If we got a funding source fitler, check that this request is for that source\n if @funding_source_id > 0\n if request.federal_funding_line_item.funding_source_id == @funding_source_id or request.state_funding_line_item.funding_source_id == @funding_source_id\n @funding_requests << request\n end\n else\n # no funding source filter\n @funding_requests << request\n end\n end\n end\n end\n\n unless params[:format] == 'xls'\n # cache the set of object keys in case we need them later\n cache_list(@funding_requests, INDEX_KEY_LIST_VAR)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render :json => @funding_requests }\n format.xls\n end\n\n end", "def production\n temporal_range 'dataProductionPeriod/startDate', 'dataProductionPeriod/endDate'\n end", "def index\n @allocation_dates = AllocationDate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @allocation_dates }\n end\n end", "def index\n @financing = Financing.find(params['financing_id'])\n @apr_stages = @financing.apr_stages\n end", "def get_active_period\n # puts 'ejecutando get_active_period'\n @active_period = current_user.periods.active\n # puts 'get_active_period ejecutado'\n end", "def children\n objs = @caldav_backend.scheduling_objects(@principal_uri)\n children = []\n objs.each do |obj|\n # obj['acl'] = self.get_acl\n obj['principaluri'] = @principal_uri\n children << SchedulingObject.new(@caldav_backend, obj)\n end\n\n children\n end", "def show\n @subdepartment = Subdepartment.find(params[:id])\n @courses = @subdepartment.courses\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @courses.to_json(include: :subdepartment) }\n end\n end", "def division\n @divisions = @company.divisions\n respond_to do |format|\n format.json { render json: @divisions}\n end\n end", "def district_events\n start = Time.now\n\n # action is in app controller\n\t\tjson = get_district_events\n\n respond_to do |format|\n format.json { render json: json}\n end\n\t\tlogger.debug \"@ time to render district events json: #{Time.now-start} seconds\"\n end", "def index\n @upcoming_harvests = Harvest.upcoming\n @past_harvests = Harvest.past\n\n if params[:person_id]\n @person = Person.find(params[:person_id])\n @upcoming_harvests = @person.upcoming_harvests\n @past_harvests = @person.past_harvests\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvests }\n end\n end", "def index\n @receipt_periods = ReceiptPeriod.all\n end", "def index\n @schedule_entries = ScheduleEntry.all\n current_date = Date.today\n monday = current_date.monday\n dates_this_week = [monday, monday.next, monday.next.next, monday.next.next.next, monday.next.next.next.next]\n @grouped_periods = Period.where(:date => dates_this_week).group_by {|period| period.num}.values\n end", "def get_paged_org_unit_children(org_unit_id, bookmark = '')\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/#{org_unit_id}/children/paged/\"\n path += \"?bookmark=#{bookmark}\" if bookmark != ''\n _get(path)\n # return json of org_unit children\nend", "def show\n @toyota_epc_part_number_list_child = ToyotaEpc::PartNumberListChild.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @toyota_epc_part_number_list_child }\n end\n end", "def index\n page_number = params[:page] ? params[:page][:number] : 1\n per_page = params[:per_page] ? params[:per_page] : 10\n\n @standings = Standing.paginate(page: page_number, per_page: per_page)\n\n render json: @standings\n end", "def get_current_tenant_maintenance_window \n get(\"/tenants.json/maintenance\")\nend", "def show\n @period_list = [['7 days',7],['14 days',14],['31 days',30],['3 months',90],['6 months',180]]\n\n # get description data\n @transaction_group = TransactionGroup.find(params[:id])\n @transaction_group.transaction_group_items.all\n \n # get the period, default is 7 days\n @period_curr = params[:period].to_i\n @period_curr = 180 if @period_curr.nil? || @period_curr == 0\n\n mgr = GraphTransactionGroup.new\n mgr.getData(@transaction_group, @period_curr)\n @google_url = mgr.write\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction_group }\n end\n end", "def index\n streaks = Streak.active.all\n render_jsonapi(streaks)\n end", "def availabilities_booking_for_list\n @expert = Expert.find(params[:id])\n respond_to do |format|\n format.json { render json: @expert.availabilities_booking_for(params[:date]), status: 200 }\n end\n end", "def index\n state = params[:tab]\n if state == 'outdated'\n @activities = @group.activities.outdated.order(started_at: :desc)\n else\n @activities = @group.activities.recents.order(started_at: :asc)\n end\n end", "def past\n @topic_groups = Topic.scheduled.past_grouped_by_date\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topic_groups }\n end\n end", "def show\n load_plan\n load_curriculum_for_show_and_edit\n authorize! :read, @curriculum\n\n @competences = Competence.where(:curriculum_id => @curriculum.id, :parent_competence_id => nil).includes([{:children => :localized_description}, :localized_description]).all\n #@competences = @curriculum.competences.joins(:competence_descriptions).includes(:localized_description, :skills => [:localized_description]).where(:parent_competence_id => nil, :competence_descriptions => {:locale => I18n.locale}) .order('competence_descriptions.name')\n @competences.sort! { |competence, other| competence.localized_name <=> other.localized_name }\n\n if @study_plan\n @chosen_competence_ids = @study_plan.competence_ids.to_set\n else\n @chosen_competence_ids = []\n end\n \n respond_to do |format|\n format.html { render :action => :show, :layout => 'fixed' }\n end\n \n log(\"view_competences\")\n end", "def index\n @campaigns = site.campaigns.by_campaign_and_day.all\n render :json => @campaigns\n end", "def show_timeline_by_desig\n desig = params[:designation].sub(\"-\", \".\")\n @project = Project.where(designation: desig).first!\n render \"show_timeline\"\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def list_audit_logs_for_date_range_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/auditlog\", args)\nend", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def get_team_history_districts ( team_key )\n get_api_resource \"#{@@api_base_url}team/#{team_key}/history/districts\"\n end", "def maintenance_list(statuspage_id)\n request :method => :get,\n :url => @url + 'maintenance/list/' + statuspage_id\n end", "def index\n @incidents = apply_scopes(Incident).order(\"occured_on\").page(params[:page]).per(50)\n @location_groups = LocationGroup.all\n\n if params[:location] && params[:location] > \"\"\n location = Location.find(params[:location])\n @location_name = location.name\n end\n\n @start_date = params[:by_period].try(:[], :start_date).try(:to_date) ||\n Incident.default_period_range.first\n @end_date = params[:by_period].try(:[], :end_date).try(:to_date) ||\n Incident.default_period_range.end\n @incident_types = Incident.uniq.order(\"incident_type\").pluck(:incident_type)\n logger.debug @incident_types\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @incidents }\n end\n end", "def get_league_standings_by_league(league_id)\n response = parse_api_request(\"#{BASE_URL}standings/#{league_id}\")[\"standings\"]\nend", "def destroy\n @child_development.destroy\n respond_to do |format|\n format.html { redirect_to child_developments_url, notice: 'Child development was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @endorsements = Endorsement.active_and_inactive.by_recently_created(:include => [:user,:priority]).paginate :page => params[:page], :per_page => params[:per_page]\n respond_to do |format|\n format.html { redirect_to yours_priorities_url }\n format.xml { render :xml => @endorsements.to_xml(:include => [:user, :priority], :except => NB_CONFIG['api_exclude_fields']) }\n format.json { render :json => @endorsements.to_json(:include => [:user, :priority], :except => NB_CONFIG['api_exclude_fields']) }\n end\n end", "def activities\n get_call(\"1/activities.json\")\n end", "def show\n @dailyStanding = DailyStanding.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @dailyStanding }\n end\n end", "def show\n @schedule = Schedule.find(params[:id])\n @client_branches\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedule }\n end\n end" ]
[ "0.69758034", "0.640947", "0.6390286", "0.61557466", "0.6085102", "0.6001446", "0.59693027", "0.590505", "0.573719", "0.57259434", "0.5722979", "0.5598566", "0.55977863", "0.55829626", "0.55794066", "0.55002415", "0.5474265", "0.54159534", "0.5414544", "0.5394703", "0.53660935", "0.53614014", "0.5336402", "0.5314127", "0.5313838", "0.5298954", "0.5296529", "0.5277412", "0.52564883", "0.5219933", "0.5174081", "0.51606745", "0.5156601", "0.514621", "0.5138195", "0.5129874", "0.51228124", "0.50963706", "0.50963706", "0.5074151", "0.5033083", "0.5029976", "0.50277454", "0.50193906", "0.49968627", "0.49941388", "0.4981621", "0.4974823", "0.49651116", "0.49553105", "0.49434388", "0.4942105", "0.49263734", "0.49074134", "0.4898038", "0.48863947", "0.48835048", "0.48778322", "0.48764148", "0.4872387", "0.4871309", "0.48599163", "0.4858753", "0.48540625", "0.484971", "0.4846912", "0.48436594", "0.4839355", "0.48339742", "0.48317558", "0.48317224", "0.4828055", "0.48245376", "0.48216045", "0.48206526", "0.48200324", "0.48024464", "0.48016417", "0.47917593", "0.4790197", "0.47895235", "0.4783573", "0.4780872", "0.47774145", "0.47656524", "0.47650403", "0.4764541", "0.47640023", "0.4756687", "0.47565928", "0.4755533", "0.47440332", "0.47430336", "0.47408807", "0.4740734", "0.47359675", "0.47324085", "0.47252735", "0.47245824", "0.47167608" ]
0.8194255
0
GET /child_development_periods/1 GET /child_development_periods/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @child_development_periods = ChildDevelopmentPeriod.all\n end", "def set_child_development_period\n @child_development_period = ChildDevelopmentPeriod.find(params[:id])\n end", "def create\n @child_development_period = ChildDevelopmentPeriod.new(child_development_period_params)\n\n respond_to do |format|\n if @child_development_period.save\n format.html { redirect_to @child_development_period, notice: 'Child development period was successfully created.' }\n format.json { render :show, status: :created, location: @child_development_period }\n else\n format.html { render :new }\n format.json { render json: @child_development_period.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @child_development_period.update(child_development_period_params)\n format.html { redirect_to @child_development_period, notice: 'Child development period was successfully updated.' }\n format.json { render :show, status: :ok, location: @child_development_period }\n else\n format.html { render :edit }\n format.json { render json: @child_development_period.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @child_developments = ChildDevelopment.all\n end", "def destroy\n @child_development_period.destroy\n respond_to do |format|\n format.html { redirect_to child_development_periods_url, notice: 'Child development period was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n @period = Period.find(params[:id])\n\n render json: @period\n end", "def show\n period = current_user.school.periods.find(params[:id])\n render json: period\n end", "def child_development_period_params\n params.require(:child_development_period).permit(:date_contol, :weight, :size, :head_circunference, :child_id, :child_development_id, :medical_center_id, :doctor_id)\n end", "def get_periods\n @periods = current_user.periods.all.order(created_at: :desc)\n render json: @periods\n end", "def index\n periods = current_user.school.periods.all\n\n render json: periods\n end", "def index\n @periods = @organism.periods.order(:close_date)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @periods } \n end\n end", "def set_child_development\n @child_development = ChildDevelopment.find(params[:id])\n end", "def show\n @title = \"Show Resources Periods\"\n @resource_period = ResourcePeriod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @resource_period }\n end\n end", "def show\n @tb_period = TbPeriod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tb_period }\n end\n end", "def index\n @registration_periods = RegistrationPeriod.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registration_periods }\n end\n end", "def new\n @workday = Workday.new\n 2.times do\n @workday.periods.build\n end\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workday }\n end\n end", "def child_development_params\n params.require(:child_development).permit(:name, :months)\n end", "def index\n @periods = Period.all\n end", "def index\r\n @product_periods = ProductPeriod.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @product_periods }\r\n end\r\n end", "def index\n @activity_developments = ActivityDevelopment.all\n end", "def index\n @depts = Dept.roots.includes(:children)\n render json: @depts, each_serializer: V1::DeptSerializer, root: false\n end", "def show\n @dec_form_child = DecFormChild.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dec_form_child }\n end\n end", "def get_inactive_periods\n @periods = current_user.periods.where(is_active: false).order(created_at: :desc)\n render json: @periods\n end", "def create\n @child_development = ChildDevelopment.new(child_development_params)\n\n respond_to do |format|\n if @child_development.save\n format.html { redirect_to @child_development, notice: 'Child development was successfully created.' }\n format.json { render :show, status: :created, location: @child_development }\n else\n format.html { render :new }\n format.json { render json: @child_development.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\r\n @product_period = ProductPeriod.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @product_period }\r\n end\r\n end", "def index\n @schedule_cohort_periods = ScheduleCohortPeriod.all\n end", "def check_active_period\n render json: @active_period\n end", "def index\n @vacation_periods = VacationPeriod.all\n end", "def index\n @breadcrumbs = [[t(:wage_periods), wage_periods_path],\n [@wage_period.name, wage_period_path(@wage_period.id)],\n [t(:wages)]]\n @wage_periods = current_organization.wage_periods.order('id')\n if !params[:wage_period_id] && @wage_periods.count > 0\n params[:wage_period_id] = @wage_periods.first.id\n end\n @wages = current_organization.wages.where('wage_period_id=?', params[:wage_period_id])\n @wages = @wages.page(params[:page]).decorate\n end", "def show\n @toyota_epc_part_number_application_to_models_child = ToyotaEpc::PartNumberApplicationToModelsChild.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @toyota_epc_part_number_application_to_models_child }\n end\n end", "def show\n @project_phase = ProjectPhase.find(params[:id])\n @lifecycle_phase = @project_phase.lifecycle_phase\n @project_phase_deliverables = []\n @project_phase.stock_deliverable_types.each do |stock|\n stock.deliverables.each do |d|\n @project_phase_deliverables << d\n end\n end\n\n @project_phase.custom_deliverable_types.each do |custom|\n custom.deliverables.each do |d|\n @project_phase_deliverables << d\n end\n end\n\n respond_to do |format|\n format.json { render :json => { :lifecycle_phase_container => @lifecycle_phase,\n :deliverables_container => @project_phase_deliverables,\n :project_phase_estimated_effort => @project_phase.estimated_effort,\n :project_phase_logged_effort => @project_phase.logged_effort} }\n end\n end", "def show\n @dailyStanding = DailyStanding.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @dailyStanding }\n end\n end", "def children\n parent_id = params['parent_id']\n\n children = Child.includes(:bursts).where(parent_id: parent_id).map{ |child|\n last_burst = child.bursts.last\n burst_rate = last_burst.present? ? calc_burst_rate(last_burst) : 0\n\n {\n id: child.id,\n name: child.name,\n burst_rate: burst_rate\n }\n }\n\n render json: children\n end", "def show\n render json: @day, include: [:activities]\n end", "def index\n @work_periods = WorkPeriod.all\n end", "def index\n @cycles = Cycle.where(group_id: params[:group_id])\n\n render json: @cycles\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @registration_period }\n end\n end", "def index\n @time_periods = TimePeriod.all\n end", "def update\n respond_to do |format|\n if @child_development.update(child_development_params)\n format.html { redirect_to @child_development, notice: 'Child development was successfully updated.' }\n format.json { render :show, status: :ok, location: @child_development }\n else\n format.html { render :edit }\n format.json { render json: @child_development.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @dis_doseperiods = DisDoseperiod.all\n end", "def dates\n render json: @standings\n end", "def show\n @development = Development.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @development }\n end\n end", "def new\n @title = \"New Resources Periods\"\n @resource_period = ResourcePeriod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @resource_period }\n end\n end", "def show\n @schedule = Schedule.includes(:pill_times).find(params[:id])\n @patient = @schedule.patient\n @statistic = SchedulePresenter.new(@schedule)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedules }\n end\n end", "def index\n @breadcrumbs = [['Wage periods', wage_periods_path],\n [@wage_period.name, wage_period_path(@wage_period.id)],\n ['Wages']]\n @wage_periods = current_organization.wage_periods.order('id')\n if !params[:wage_period_id] && @wage_periods.count > 0\n params[:wage_period_id] = @wage_periods.first.id\n end\n @wages = current_organization.wages.where('wage_period_id=?', params[:wage_period_id])\n @wages = @wages.page(params[:page]).decorate\n end", "def show\n @toyota_epc_part_number_list_child = ToyotaEpc::PartNumberListChild.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @toyota_epc_part_number_list_child }\n end\n end", "def show\n @fundamentals_history = @company.fundamentals_histories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundamentals_history }\n end\n end", "def show\n # @applicant_job_history = ApplicantJobHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applicant_job_history }\n end\n end", "def index\n @allocation_dates = AllocationDate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @allocation_dates }\n end\n end", "def index\n @reporting_periods = ReportingPeriod.order(date: :desc)\n .includes(:full_reports).page params[:page]\n @data = ::Api::Charts::ReportingPeriod.new(@reporting_periods)\n .reporting_periods_cost_data\n end", "def create_period\n periods_checked = current_user.periods.active.count\n puts \"The user has #{periods_checked} active periods, trying to create a #{params[:nduration].to_i} days period\"\n if periods_checked == 0\n puts \"The user hasn't active periods\"\n @period = current_user.periods.new(is_active: true, is_updated: false, duration: params[:nduration].to_i, start_date: Date.today.to_s, end_date: (Date.today+params[:nduration].to_i).to_s)\n puts @period\n if @period.save\n render json: @period, status: :created, location: @period\n else\n render json: @period.errors, status: :unprocessable_entity\n end\n else\n puts \"The user has active periods\"\n # render json: @period.errors, status: :unprocessable_entity\n render json: { status: 'ERROR', message: \"The user has an active period\"}, status: :unprocessable_entity\n end\n end", "def show\n @division = Division.find(params[:id])\n @representatives = DivisionRep.where(:division_id => params[:id])\n @games = Game.where(:division_id => params[:id]).order('start ASC')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @division }\n end\n end", "def show_timeline_by_desig\n desig = params[:designation].sub(\"-\", \".\")\n @project = Project.where(designation: desig).first!\n render \"show_timeline\"\n end", "def show\n @allocation_date = AllocationDate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @allocation_date }\n end\n end", "def show\n @periodismo = Periodismo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @periodismo }\n end\n end", "def index\n @api_v1_frequency_periods = Api::V1::FrequencyPeriod.all\n end", "def show\n @schedule = Schedule.find(params[:id])\n @client_branches\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedule }\n end\n end", "def show\n @period = Period.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @period }\n end\n end", "def show\n @period = Period.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @period }\n end\n end", "def show\n @doctorsheduling = Doctorsheduling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @doctorsheduling }\n end\n end", "def show\n @activities = Activity.where('schedule_id': params[:id])\n render json: @activities.as_json\n end", "def show\n @breakdown = Breakdown.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @breakdown }\n end\n end", "def show\n @thermo_oil_production = ThermoOilProduction.find(params[:id])\n @thermo_oil_production_years = ThermoOilProductionYear.find_all_by_thermoOilProduction_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thermo_oil_production }\n end\n end", "def show\n @child = Child.find(params[:id])\n #used to determine layout used\n @child_crud = true\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @child }\n end\n end", "def index\n @concept_groups = ConceptGroup.find_all_by_parent_id(nil)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concept_groups }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_demand_breakdowns }\n end\n end", "def show\n @subdepartment = Subdepartment.find(params[:id])\n @courses = @subdepartment.courses\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @courses.to_json(include: :subdepartment) }\n end\n end", "def show\n @environment = Environment.find(params[:id])\n @last_deployment_log = @environment.deployment_logs.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @environment }\n end\n end", "def index\n @dec_form_children = DecFormChild.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dec_form_children }\n end\n end", "def show\n @daily_horoscope = DailyHoroscope.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daily_horoscope }\n end\n end", "def new\n @period = @cursus.periods.build\n\n respond_to do |format|\n format.html { render :layout => false }\n format.xml { render :xml => @period }\n end\n end", "def index\n @periods = Period.find(:all, :include => { :talks => :users })\n @periods_by_time_and_scene = Hash.new\n for p in @periods\n @periods_by_time_and_scene[p.time_id] ||= Hash.new\n @periods_by_time_and_scene[p.time_id][p.scene_id] = p \n end\n\n @time_ids = @periods.collect { |p| p.time_id }.sort.uniq\n \n @edit = params[:edit] && admin?\n @all_talks = Talk.all_pending_and_approved if @edit\n @all_talks.sort!{|t1,t2|t1.id <=> t2.id}\n\n respond_to do |format|\n format.html {render :layout => 'plain' }# index.html.erb\n format.xml { render :xml => @periods }\n end\n end", "def show\n @period_list = [['7 days',7],['14 days',14],['31 days',30],['3 months',90],['6 months',180]]\n\n # get description data\n @transaction_group = TransactionGroup.find(params[:id])\n @transaction_group.transaction_group_items.all\n \n # get the period, default is 7 days\n @period_curr = params[:period].to_i\n @period_curr = 180 if @period_curr.nil? || @period_curr == 0\n\n mgr = GraphTransactionGroup.new\n mgr.getData(@transaction_group, @period_curr)\n @google_url = mgr.write\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction_group }\n end\n end", "def index\n @teaching_periods = TeachingPeriod.all\n end", "def show\n load_plan\n load_curriculum_for_show_and_edit\n authorize! :read, @curriculum\n\n @competences = Competence.where(:curriculum_id => @curriculum.id, :parent_competence_id => nil).includes([{:children => :localized_description}, :localized_description]).all\n #@competences = @curriculum.competences.joins(:competence_descriptions).includes(:localized_description, :skills => [:localized_description]).where(:parent_competence_id => nil, :competence_descriptions => {:locale => I18n.locale}) .order('competence_descriptions.name')\n @competences.sort! { |competence, other| competence.localized_name <=> other.localized_name }\n\n if @study_plan\n @chosen_competence_ids = @study_plan.competence_ids.to_set\n else\n @chosen_competence_ids = []\n end\n \n respond_to do |format|\n format.html { render :action => :show, :layout => 'fixed' }\n end\n \n log(\"view_competences\")\n end", "def show\n @com_dates_appt = ComDatesAppt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @com_dates_appt }\n end\n end", "def availabilities_booking_for_list\n @expert = Expert.find(params[:id])\n respond_to do |format|\n format.json { render json: @expert.availabilities_booking_for(params[:date]), status: 200 }\n end\n end", "def get_tenant_maintenance_window(args = {}) \n get(\"/tenants.json/maintenance/#{args[:tenantId]}\", args)\nend", "def get_current_tenant_maintenance_window \n get(\"/tenants.json/maintenance\")\nend", "def show\n @toyota_epc_part_number_application_to_models_parent = ToyotaEpc::PartNumberApplicationToModelsParent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @toyota_epc_part_number_application_to_models_parent }\n end\n end", "def destroy\n @child_development.destroy\n respond_to do |format|\n format.html { redirect_to child_developments_url, notice: 'Child development was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\r\n @org = Org.from_param(params[:abbr])\r\n # @jobs = Job.find(Curation.where(:org_id => @org.id).pluck(:job_id))\r\n @jobs = @org.jobs\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @org }\r\n end\r\n end", "def show\n @stage_duration = StageDuration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stage_duration }\n end\n end", "def index\n @upcoming_harvests = Harvest.upcoming\n @past_harvests = Harvest.past\n\n if params[:person_id]\n @person = Person.find(params[:person_id])\n @upcoming_harvests = @person.upcoming_harvests\n @past_harvests = @person.past_harvests\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvests }\n end\n end", "def reports_schedule_detail\n @reports = ReportSchedule.find(params[:schedule_id]).reports.order(:id).reverse[0..50]\n\n respond_to do |format|\n format.json { render json: @reports} \n end\n end", "def index\n\n add_breadcrumb \"Funding Requests\"\n\n @fiscal_years = get_fiscal_years\n\n # Start to set up the query\n conditions = []\n values = []\n\n # Check to see if we got an organization to sub select on.\n @org_filter = params[:org_id]\n conditions << 'organization_id IN (?)'\n if @org_filter.blank?\n values << @organization_list\n else\n @org_filter = @org_filter.to_i\n values << [@org_filter]\n end\n\n # See if we got fiscal year\n @fiscal_year = params[:fiscal_year]\n unless @fiscal_year.blank?\n @fiscal_year = @fiscal_year.to_i\n conditions << 'fy_year = ?'\n values << @fiscal_year\n end\n\n # See if we got a capital project type\n @capital_project_type_id = params[:capital_project_type_id]\n unless @capital_project_type_id.blank?\n @capital_project_type_id = @capital_project_type_id.to_i\n conditions << 'capital_project_type_id = ?'\n values << @capital_project_type_id\n end\n\n # See if we got a capital project state\n @capital_project_state = params[:capital_project_state]\n unless @capital_project_state.blank?\n conditions << 'state = ?'\n values << @capital_project_state\n end\n\n # Get the funding source filter if there is one\n @funding_source_id = params[:funding_source_id]\n if @funding_source_id.blank?\n @funding_source_id = 0\n else\n @funding_source_id = @funding_source_id.to_i\n end\n\n # We have to build the list of funding requests by iterating through the\n # set of matching capital projects\n @funding_requests = []\n projects = CapitalProject.where(conditions.join(' AND '), *values).order(:fy_year, :capital_project_type_id)\n projects.each do |project|\n project.activity_line_items.each do |ali|\n ali.funding_requests.each do |request|\n # If we got a funding source fitler, check that this request is for that source\n if @funding_source_id > 0\n if request.federal_funding_line_item.funding_source_id == @funding_source_id or request.state_funding_line_item.funding_source_id == @funding_source_id\n @funding_requests << request\n end\n else\n # no funding source filter\n @funding_requests << request\n end\n end\n end\n end\n\n unless params[:format] == 'xls'\n # cache the set of object keys in case we need them later\n cache_list(@funding_requests, INDEX_KEY_LIST_VAR)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render :json => @funding_requests }\n format.xls\n end\n\n end", "def show\n @monitor_child_relationship = MonitorChildRelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monitor_child_relationship }\n end\n end", "def new\n @tb_period = TbPeriod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tb_period }\n end\n end", "def index\n @historicals = @project.historical\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @historicals }\n end\n end", "def show\n @plan = Plan.find(params[:id])\n @plan_days = @plan.plan_days\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plan }\n end\n end", "def new\n \n @project = Project.new\n @orientadores = User.find_all_by_role(\"Orientador\")\n \n @periodos = Duedate.find(:all, :conditions => ['orientation_start <= ? AND orientation_end >= ?', Date.today, Date.today])\n @periodo = @periodos[0]\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n \n \n \n\n \n end", "def index\n @pay_periods = PayPeriod.all\n end", "def index\n @pay_periods = PayPeriod.all\n end", "def check_for_active_periods\n # puts \"answer #{ @active_period.count() > 0 }\"\n render json: { 'activePeriod': @active_period.count() > 0 }\n end", "def subcategories\n\t\trespond_to do |format|\n\t \tformat.json {\n\t \t\tparam = params[:payload]\n\n\t\t\t\tcategory = RequirementCategory.find_by_id(param[:target_id])\n\t\t\t\tputs category.id\n\n\t\t\t\t@subcategory = category.requirement_subcategories\n\t \t\trender :json => @subcategory\n\t \t}\n\t end\t\t\n\tend", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_development_costs }\n end\n end", "def show\n @time_gap = TimeGap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_gap }\n end\n end", "def maintenance_list_by_id(statuspage_id)\n request :method => :get,\n :url => @url + 'maintenances/' + statuspage_id\n end", "def index\n @authorization_periods = AuthorizationPeriod.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @authorization_periods }\n end\n end", "def show\n @project = @expense_period.project\n end" ]
[ "0.7934444", "0.7211188", "0.65740633", "0.63557047", "0.633685", "0.60424984", "0.5898331", "0.5854599", "0.5839756", "0.57877547", "0.5761473", "0.5726164", "0.5636131", "0.5629196", "0.5533334", "0.5504973", "0.5401757", "0.53844196", "0.53558743", "0.53556937", "0.53438354", "0.5332093", "0.5323837", "0.53200793", "0.53139955", "0.52115303", "0.51970863", "0.51910037", "0.5185498", "0.5180018", "0.51799357", "0.5160581", "0.51542944", "0.51505363", "0.5133815", "0.513315", "0.51325834", "0.5119842", "0.51155436", "0.5108744", "0.5085333", "0.5084649", "0.50827336", "0.5070457", "0.5068656", "0.50673556", "0.5060897", "0.5048985", "0.50475055", "0.504663", "0.50408494", "0.50313944", "0.5012102", "0.5008187", "0.5006223", "0.50036144", "0.50034964", "0.50018525", "0.4966141", "0.4966141", "0.49511632", "0.49468765", "0.49433824", "0.4937954", "0.4936969", "0.49367428", "0.49201834", "0.49137813", "0.49083796", "0.49071905", "0.4905863", "0.4905093", "0.4897108", "0.4892807", "0.48890254", "0.48868", "0.48806497", "0.48768505", "0.48765656", "0.48751038", "0.48746145", "0.48732468", "0.48724735", "0.48713538", "0.48672202", "0.48619238", "0.48605692", "0.4858537", "0.4858115", "0.48580694", "0.4853814", "0.48499078", "0.48488322", "0.48488322", "0.484434", "0.48441672", "0.48436245", "0.48368713", "0.48354316", "0.4833328", "0.48298907" ]
0.0
-1
POST /child_development_periods POST /child_development_periods.json
def create @child_development_period = ChildDevelopmentPeriod.new(child_development_period_params) respond_to do |format| if @child_development_period.save format.html { redirect_to @child_development_period, notice: 'Child development period was successfully created.' } format.json { render :show, status: :created, location: @child_development_period } else format.html { render :new } format.json { render json: @child_development_period.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_child_development_period\n @child_development_period = ChildDevelopmentPeriod.find(params[:id])\n end", "def index\n @child_development_periods = ChildDevelopmentPeriod.all\n end", "def child_development_period_params\n params.require(:child_development_period).permit(:date_contol, :weight, :size, :head_circunference, :child_id, :child_development_id, :medical_center_id, :doctor_id)\n end", "def child_development_params\n params.require(:child_development).permit(:name, :months)\n end", "def update\n respond_to do |format|\n if @child_development_period.update(child_development_period_params)\n format.html { redirect_to @child_development_period, notice: 'Child development period was successfully updated.' }\n format.json { render :show, status: :ok, location: @child_development_period }\n else\n format.html { render :edit }\n format.json { render json: @child_development_period.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @child_development = ChildDevelopment.new(child_development_params)\n\n respond_to do |format|\n if @child_development.save\n format.html { redirect_to @child_development, notice: 'Child development was successfully created.' }\n format.json { render :show, status: :created, location: @child_development }\n else\n format.html { render :new }\n format.json { render json: @child_development.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @child_development_period.destroy\n respond_to do |format|\n format.html { redirect_to child_development_periods_url, notice: 'Child development period was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create_period\n periods_checked = current_user.periods.active.count\n puts \"The user has #{periods_checked} active periods, trying to create a #{params[:nduration].to_i} days period\"\n if periods_checked == 0\n puts \"The user hasn't active periods\"\n @period = current_user.periods.new(is_active: true, is_updated: false, duration: params[:nduration].to_i, start_date: Date.today.to_s, end_date: (Date.today+params[:nduration].to_i).to_s)\n puts @period\n if @period.save\n render json: @period, status: :created, location: @period\n else\n render json: @period.errors, status: :unprocessable_entity\n end\n else\n puts \"The user has active periods\"\n # render json: @period.errors, status: :unprocessable_entity\n render json: { status: 'ERROR', message: \"The user has an active period\"}, status: :unprocessable_entity\n end\n end", "def create\n period = current_user.school.periods.create(period_params)\n\n if period.save\n render json: period, status: :created, location: period\n else\n render json: {errors: period.errors}, status: :unprocessable_entity\n end\n end", "def index\n @child_developments = ChildDevelopment.all\n end", "def set_child_development\n @child_development = ChildDevelopment.find(params[:id])\n end", "def child_params\n params.require(:child).permit(:fName, :middle, :lName, :dob, :fundSrc, :trans, :startDate, :terminationDate, :provider_id)\n end", "def periods_params\n params.require(:period).permit(:name, :comment, :start_date, :end_date, :budget_id)\n end", "def create\n @periods_group = PeriodsGroup.new(periods_group_params)\n\n respond_to do |format|\n if @periods_group.save\n format.html { redirect_to company_periods_group_path(@company, @periods_group), notice: 'Periods group was successfully created.' }\n format.json { render :show, status: :created, location: @periods_group }\n else\n format.html { render :new }\n format.json { render json: @periods_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @workday = Workday.new\n 2.times do\n @workday.periods.build\n end\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workday }\n end\n end", "def create_new_period(period)\n JSON.generate(period)\n File.open(\"./files/periods/#{period[:name]}.json\", \"w\") do |f|\n f.write(period.to_json)\n end\nend", "def create\n @period = Period.new(params[:period])\n\n if @period.save\n render json: @period, status: :created, location: @period\n else\n render json: @period.errors, status: :unprocessable_entity\n end\n end", "def build_blank_child_resources\n @travel_pattern_service_schedules[:weekly_schedules] << @travel_pattern.travel_pattern_service_schedules.build(overides_other_schedules: false)\n @travel_pattern_service_schedules[:extra_service_schedules] << @travel_pattern.travel_pattern_service_schedules.build(overides_other_schedules: false)\n @travel_pattern_service_schedules[:reduced_service_schedules] << @travel_pattern.travel_pattern_service_schedules.build(overides_other_schedules: true)\n\n @travel_pattern_purposes += [@travel_pattern.travel_pattern_purposes.build]\n\n @travel_pattern_funding_sources += [@travel_pattern.travel_pattern_funding_sources.build]\n end", "def create\n @period = @cursus.periods.build(params[:period])\n\n respond_to do |format|\n if @period.save\n format.html { redirect_to( cursus_periods_path(@cursus) ) }\n format.xml { render :xml => @period, :status => :created, :location => @period }\n else\n format.js do\n render :status => 500, :partial => \"error_partial\"\n end\n format.xml { render :xml => @period.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @dec_form_child = DecFormChild.new(params[:dec_form_child])\n\n respond_to do |format|\n if @dec_form_child.save\n format.html { redirect_to @dec_form_child, notice: 'Dec form child was successfully created.' }\n format.json { render json: @dec_form_child, status: :created, location: @dec_form_child }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dec_form_child.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_parent_to_org_unit(parent_ou_id, child_ou_id)\n # Must follow structure of data\n # (course <-- semester <== org -->custom dept--> dept -->templates--> courses)\n # Refer to valence documentation for further structural understanding..\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/#{child_ou_id}/parents/\"\n _post(path, parent_ou_id)\nend", "def periods_group_params\n params.require(:periods_group).permit(:period_type, :main_company_periods => [], :competitive_companies => [])\n end", "def create\n respond_to do |format|\n # Handle given FHIR in either JSON or XML format\n if request.content_type.include? 'json'\n response = RestClient.post \"http://localhost:8080/nightingale\", request.body.string, {content_type: 'application/fhir+json'}\n contents = JSON.parse(response.body)\n elsif request.content_type.include? 'xml'\n response = RestClient.post \"http://localhost:8080/nightingale\", request.body.string, {content_type: 'application/fhir+xml'}\n contents = JSON.parse(response.body)\n end\n\n # Grab the certifier\n user = User.find_by(first_name: 'Example', last_name: 'Certifier')\n\n # Create new record\n workflow = Workflow.where(initiator_role: user.roles.first.name).order('created_at').last\n step_flow = workflow.step_flows.first\n @death_record = DeathRecord.new(creator: user,\n owner: user,\n workflow: workflow,\n step_flow: step_flow)\n step_status = StepStatus.create(death_record: @death_record,\n current_step: step_flow.current_step,\n next_step: step_flow.next_step,\n previous_step: step_flow.previous_step)\n @death_record.step_status = step_status\n @death_record.save\n steps_content_hash = @death_record.separate_step_contents(contents)\n @death_record.steps.each do |step|\n if steps_content_hash[step.name]\n StepContent.update_or_create_new(death_record: @death_record,\n step: step,\n contents: steps_content_hash[step.name],\n editor: user)\n end\n end\n @death_record.notify = true\n @death_record.save(validate: false)\n\n format.json { render json: { status: :ok, message: 'Created ID: ' + @death_record.id.to_s } }\n format.xml { render xml: { status: :ok, message: 'Created ID: ' + @death_record.id.to_s } }\n end\n end", "def child_params\n params.require(:child).permit(:created_at, :updated_at, :last_name, :first_name, :gender, :dob, :age_years, :age_months, :age_total_months, :location, :no_parent_present, :parental_permission_given, :allergies, :allergies_information, :immunization_utd, :dtap, :hib, :pneumovax, :hepa, :hepb, :influenza, :mmr, :immunization_needed, :revelant_information, :absences, :height_feet, :height_inches, :height_total_inches, :height_total_cm, :weight_lbs, :weight_oz, :weight_kg, :bmi_result, :bmi_percentile, :systolic_1, :diastolic_1, :systolic_2, :diastolic_2, :systolic_3, :diastolic_3, :hemoglobin, :blood_glucose, :hearing_hz_left_1, :hearing_db_left_1, :ear_left_pass_1, :hearing_hz_right_1, :hearing_db_right_1, :ear_right_pass_1, :hearing_hz_left_2, :hearing_db_left_2, :ear_left_pass_2, :hearing_hz_right_2, :hearing_db_right_2, :ear_right_pass_2, :hearing_hz_left_3, :hearing_db_left_3, :ear_left_pass_3, :hearing_hz_right_3, :hearing_db_right_3, :ear_right_pass_3, :hearing_comments, :vision_acuity_left_1, :vision_acuity_right_1, :vision_acuity_both_1, :vision_acuity_right_2, :vision_acuity_left_2, :vision_acuity_both_2, :vision_acuity_right_3, :vision_acuity_left_3, :vision_acuity_both_3, :vision_color_blindness, :cover_test_left, :cover_test_right, :cover_test_both, :wears_corrective_lenses, :vision_comments, :general_appearance, :general_appearance_c, :head, :head_c, :skin, :skin_c, :eyes, :eyes_c, :ears, :ears_c, :nose, :nose_c, :mouth, :mouth_c, :throat, :throat_c, :thyroid, :thyroid_c, :lymph_all_normal, :lymph_pre_auricular, :lymph_post_auricular, :lymph_anterior_cervical, :lymph_posterior_cervical, :lymph_occipital, :lymph_axillary, :lymph_c, :vascular, :vascular_c, :heart, :heart_c, :lungs, :lungs_c, :abdomen, :abdomen_c, :musculoskeletal, :musculoskeletal_c, :scoliosis, :scoliosis_c, :neuro, :neuro_c, :well_child_check, :children_01, :children_02, :children_03, :children_04, :children_05, :children_06, :children_07, :children_08, :children_09, :children_10, :follow_up_01, :follow_up_02, :follow_up_03, :follow_up_04, :follow_up_05, :follow_up_06, :follow_up_07, :follow_up_08, :follow_up_09, :follow_up_10, :text, :guidance, :chart_complete, :np_signature, :faculty_signature, :other_np_signature, :form_id_number)\n end", "def create\n @nvs_subsystem = NvsSubsystem.new(params[:nvs_subsystem])\n @nvs_subsystem.project_id = session[:project_id]\n\n respond_to do |format|\n if @nvs_subsystem.save\n unless params['depts_project_ids'].nil?\n params['depts_project_ids'].each do |dp|\n dp = NvsDeptProject.find(dp) #get dept_project selected.\n dp.nvs_subsystem = @nvs_subsystem\n dp.nvs_dept_id = 0 if dp.nvs_dept_id.nil?\n dp.project_id = session[:project_id]\n dp.save\n end\n end\n\n format.html { redirect_to @nvs_subsystem, notice: 'Nvs subsystem was successfully created.' }\n format.json { render json: @nvs_subsystem, status: :created, location: @nvs_subsystem }\n else\n prepare_combos\n get_related_projects\n format.html { render action: \"new\" }\n format.json { render json: @nvs_subsystem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_period = TimePeriod.new(time_period_params)\n\n if @time_period.save\n render :show, status: :created, location: @time_period\n else\n render json: @time_period.errors, status: :unprocessable_entity\n end\n end", "def child_params\n params.require(:child).permit(:id_fundation, :grade, :phone_secure, :entry, :egress, :profile_id)\n end", "def create\n @toyota_epc_part_number_application_to_models_child = ToyotaEpc::PartNumberApplicationToModelsChild.new(params[:toyota_epc_part_number_application_to_models_child])\n\n respond_to do |format|\n if @toyota_epc_part_number_application_to_models_child.save\n format.html { redirect_to @toyota_epc_part_number_application_to_models_child, :notice => 'Part number application to models child was successfully created.' }\n format.json { render :json => @toyota_epc_part_number_application_to_models_child, :status => :created, :location => @toyota_epc_part_number_application_to_models_child }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @toyota_epc_part_number_application_to_models_child.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @condominium_child = CondominiumChild.new(condominium_child_params)\n respond_to do |format|\n if @condominium_child.save\n format.json { render :show, status: :created, object: @condominium_child }\n else\n format.json { render json: @condominium_child.errors, status: :unprocessable_entity }\n end\n end\n end", "def period_params\n params.require(:period).permit(:name, :start_at, :end_at, :school_id)\n end", "def add_child_org_unit(org_unit_id, child_org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/#{org_unit_id}/children/\"\n _post(path, child_org_unit_id)\nend", "def period_discipline_params\n params.require(:period_discipline).permit(:graduation_semester_id, :discipline_id, :instructor_id, period: [:start, :end])\n end", "def create\n @resource_period = ResourcePeriod.new(params[:resource_period])\n\n respond_to do |format|\n if @resource_period.save\n format.html { redirect_to(@resource_period, :notice => 'Resource period was successfully created.') }\n format.json { render :json => @resource_period, :status => :created, :location => @resource_period }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @resource_period.errors, :status => :unprocessable_entity }\n end\n end\n end", "def doseperiod_params\n params.require(:doseperiod).permit(:name, :is_common, :abbrev, :status_id, :datasource_id)\n end", "def update\n respond_to do |format|\n if @child_development.update(child_development_params)\n format.html { redirect_to @child_development, notice: 'Child development was successfully updated.' }\n format.json { render :show, status: :ok, location: @child_development }\n else\n format.html { render :edit }\n format.json { render json: @child_development.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @toyota_epc_part_number_list_child = ToyotaEpc::PartNumberListChild.new(params[:toyota_epc_part_number_list_child])\n\n respond_to do |format|\n if @toyota_epc_part_number_list_child.save\n format.html { redirect_to @toyota_epc_part_number_list_child, :notice => 'Part number list child was successfully created.' }\n format.json { render :json => @toyota_epc_part_number_list_child, :status => :created, :location => @toyota_epc_part_number_list_child }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @toyota_epc_part_number_list_child.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @klass = Klass.new(klass_params)\n respond_to do |format|\n if @klass.save\n format.html { redirect_to management_klasses_path }\n format.json { render :json => @klass.to_json(include: :period), status: :created }\n else\n format.html { render :new }\n format.json { render json: @klass.errors, status: :unprocessable_entity }\n end\n end\n end", "def child_params\n params.require(:child).permit(:code, :family_id, :notes, :given_name1, :given_name2, :family_name1, :family_name2, :preferred_name, :dob, :status, :gender)\n end", "def create\n @orig_play = Play.find(production_params[:play_id])\n @production = @theater.productions.build(production_params)\n\n @dup_play = RailsDeepCopy::Duplicate.create(@orig_play, changes: { canonical: false, production_id: @production.id })\n\n @production.play = @dup_play\n @production.play.characters.each do |character|\n @production.jobs.build(:character_id => character.id, :specialization_id => 2, :theater_id => @production.theater.id, :start_date => @production.start_date, :end_date => @production.end_date) # THIS VALUE FOR ACTOR IS HARD CODED AND THAT IS BAD. In current instance, Specialization.find(2) = Actor. How can I make this dynamic without querying it constantly?\n end\n\n respond_to do |format|\n if @production.save\n format.html { redirect_to @production, notice: 'Production was successfully created.' }\n format.json { render :show, status: :created, location: @production }\n else\n format.html { render :new }\n format.json { render json: @production.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tb_period = TbPeriod.new(params[:tb_period])\n\n respond_to do |format|\n if @tb_period.save\n format.html { redirect_to @tb_period, notice: 'Tb period was successfully created.' }\n format.json { render json: @tb_period, status: :created, location: @tb_period }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tb_period.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timing = Timing.new(params[:timing].slice(:start, :stop, :days, :parent_class, :parent_id, :active))\n if @timing.save\n render json: @timing\n else\n render json: { error: 'error: could not save timing' }\n end\n end", "def create\n @traumatized_child = TraumatizedChild.new(traumatized_child_params)\n\n respond_to do |format|\n if @traumatized_child.save\n format.html { redirect_to @traumatized_child, notice: \"Traumatized child was successfully created.\" }\n format.json { render :show, status: :created, location: @traumatized_child }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @traumatized_child.errors, status: :unprocessable_entity }\n end\n end\n end", "def expense_period_params\n params.require(:expense_period).permit(:start, :finish, :name)\n end", "def attendant_params\n params.require(:attendant).permit(:cpf, :name, :birth_date, :hiring_date, :unit_id)\n end", "def create_grading_periods(interval, year, ed_org_id)\n grading_periods = []\n grading_periods << {\"type\" => :END_OF_YEAR, \"year\" => year, \"interval\" => interval, \"ed_org_id\" => ed_org_id}\n grading_periods\n end", "def child_fatality_params\n params.require(:child_fatality).permit(:dod, :gender, :age, :county, :priorChild, :priorVerChild, :priorTwelve, :priorFive, :priorFiveServices, :causal, :narrative)\n end", "def create\n today = Date.today # Today's date %>\n days_from_this_week = (today.at_beginning_of_week..today.at_end_of_week).map\n\n employee = Employee.where(:id => params[\"work_duration\"][\"eid\"]).first\n\n # First iterate over all the vendors this employee has\n for vendor in employee.vendors\n # Project is the relationship between employee and vendor, also workDuration record is attached to this relationship so we need to fetch it first\n project = employee.projects.where(:vendor_id => vendor.id).first\n\n # Next iterate over all the hours each day has\n (today.at_beginning_of_week..today.at_end_of_week).map.each_with_index do |day, index|\n\n # extract the number of hours for each \n hours_worked = params[\"work_duration\"][[\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\"][index]+vendor.id.to_s]\n\n\n # Try to fetch the work duration object for the day that we are iterating over\n @work_duration = project.work_durations.where(work_day:day).first\n\n # if we did not find a pre existing work duration create new one else update oldone\n if @work_duration == nil\n @work_duration = project.work_durations.create(hours:hours_worked, work_day:day)\n else\n @work_duration.update_attributes(:hours => hours_worked)\n end\n end\n end\n #@work_duration = WorkDuration.new(work_duration_params)\n\n respond_to do |format|\n if @work_duration.save\n format.html { redirect_to employee, notice: 'Work duration was successfully created.' }\n format.json { render :show, status: :created, location: @work_duration }\n else\n format.html { render :new }\n format.json { render json: @work_duration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@equity.customer_id = params[:customer_id]\n @equity = Equity.new(equity_params)\n @equity.equity_period = (Date.current - 20.years)..(Date.current + 25.years)\n #@equity.equity_period = \"1997-01-01,2030-01-01\"\n\n respond_to do |format|\n if @equity.save\n format.html { redirect_to admin_risk_equities_path(@equity.risk_id), notice: 'Equity was successfully created.' }\n format.json { render :show, status: :created, location: @equity }\n else\n format.html { render :new }\n format.json { render json: risk_equities_path(@equity.errors), status: :unprocessable_entity }\n end\n end\n end", "def create\n @child = Child.new(params[:child])\n @child_crud = true\n\n respond_to do |format|\n if @child.save\n format.html { redirect_to children_url, notice: 'Child was successfully created.' }\n format.js { @current_child = @child}\n format.json { render json: @child, status: :created, location: @child }\n else\n format.html { render :layout => false, action: \"new\"}\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n end", "def period_params\n params.require(:period).permit(:number, :code, :explanation, :start_date, :end_date)\n end", "def post_bva_dta_decision_status_details\n issue_list = remanded_sc_decision_issues\n {\n issues: api_issues_for_status_details_issues(issue_list),\n bva_decision_date: decision_event_date,\n aoj_decision_date: remand_decision_event_date\n }\n end", "def child_params\n params.require(:child).permit(:name, :student, :foster, :hmr, :hs, :pay, :ss, :tru, :pen, :ann, :sm, :household_id)\n end", "def create\n @dis_doseperiod = DisDoseperiod.new(dis_doseperiod_params)\n\n respond_to do |format|\n if @dis_doseperiod.save\n format.html { redirect_to @dis_doseperiod, notice: 'Dis doseperiod was successfully created.' }\n format.json { render :show, status: :created, location: @dis_doseperiod }\n else\n format.html { render :new }\n format.json { render json: @dis_doseperiod.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fdn_org_hierarchy = Fdn::OrgHierarchy.new(fdn_org_hierarchy_params)\n\n respond_to do |format|\n if @fdn_org_hierarchy.save\n @time = Time.now\n @org = Fdn::Organization.find @fdn_org_hierarchy.org_id\n @fdn_org_hierarchy.org_hie_elements.create(FactoryGirl.attributes_for(:main_element, p: @org, r: @org, c: @org, d: 0))\n #在有组织树变动的时候记录变动时间点\n Fdn::OrgTreeChange.create(hierarchy_id: @fdn_org_hierarchy.id, change_time: @time)\n format.html { render :js => view_context.close_window_show_tips('parent.MAIN_LAYER_WINDOW', '组织架构创建成功!') }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fdn_org_hierarchy.errors, status: :unprocessable_entity }\n end\n end\n end", "def period_params\n params.require(:period).permit(:first_day, :last_day, :holiday_id, :periodable_id, :periodable_type)\n end", "def create\n @child = Child.new(child_params)\n\n respond_to do |format|\n if @child.save\n format.html { redirect_to @child, notice: \"Child was successfully created.\" }\n format.json { render :show, status: :created, location: @child }\n format.js {}\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n end", "def create\n @sampling = Sampling.new(params[:sampling])\n\n #used for NESTED Model\n @wf = Wfilter.all()\n\n @valid = false\n if @sampling.sampling_site.nil?\n flash.now[:error] = \"No sampling site set for this sampling\"\n @valid = true\n end\n if @sampling.partner.nil?\n flash.now[:error] = \"No partner found for this sampling\"\n @valid = true\n end\n\n if @valid\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sampling.errors, :status => :unprocessable_entity }\n end\n end\n\n @pt = get_partner\n @sampling.code = get_code(@pt, @sampling.samplingDate, nil)\n\n @title = \"Sampling\"\n \n respond_to do |format|\n if @sampling.save\n\n #Change the child code attribute here because the parent code is yet created\n @fs = FilterSample.count(:all, :conditions => ['sampling_id = ' + @sampling.id.to_s ])\n print ('----Change childs attributes here -------- parent (id-'+@sampling.id.to_s+') code is: '+@sampling.code+'. Childs are -['+@fs.to_s+']-\\n' )\n\n unless @fs.nil? and @fs > 0\n #generate the Microaqua code for all child yet created to this parent\n @fs = FilterSample.all(:conditions => ['sampling_id = ' +@sampling.id.to_s ])\n @fs.each_with_index do |child, index|\n print('----Change childs Old code: (-%s)\\n', child.code)\n #child.code = child.code[0..11] + (\"-F%02d\" % (index + 1))\n child.code = @sampling.code + (\"-F%02d\" % (index + 1))\n print('----Change childs New code: (-%s)\\n' , child.code)\n child.save()\n end \n end \n\n format.html { \n flash[:notice] = 'Sampling was successfully created.'\n redirect_to :action => \"index\" } \n else\n #@partners = Partner.find(:all)\n @codegen = @sampling.code\n @attr_index = 1\n @pt = get_partner\n format.html { \n flash[:notice] = \"Sampling was not created!!\"\n redirect_to :action => :index } \n end\n end\n end", "def destroy\n @child_development.destroy\n respond_to do |format|\n format.html { redirect_to child_developments_url, notice: 'Child development was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create_payment_stages_for(project)\n created_payment_profiles = []\n while @start_date < @end_date do\n \n if frequency == '0'\n end_period = (@start_date + 1.month) - 1.day\n elsif frequency == '1'\n end_period = (@start_date + 2.weeks) - 1.day\n elsif frequency == '2'\n end_period = (@start_date + 1.week) - 1.day\n end\n \n # Check period end date is not greater than the provided end date\n end_period = @end_date if end_period > @end_date\n \n scheduled_days = Entry.get_number_of_days_scheduled_for_project_by_period(project, @start_date, end_period)\n \n # Create Payment stage\n created_payment_profiles = self.create_payment_profile_entry(project, scheduled_days, @start_date, end_period, created_payment_profiles)\n \n # Move on to next period\n if frequency == '0'\n @start_date += 1.month\n elsif frequency == '1'\n @start_date += 2.weeks\n elsif frequency == '2'\n @start_date += 1.week\n end\n end\n return created_payment_profiles\n end", "def schedule_cohort_period_params\n params.require(:schedule_cohort_period).permit(:schedule_id, :cohort_period_id)\n end", "def period_params\n params.require(:period).permit(:is_active, :is_updated, :duration, :start_date, :end_date)\n end", "def create\n @period = Period.new(period_params)\n\n respond_to do |format|\n if @period.save\n format.html { redirect_to periods_path, notice: 'Periode Telah Dibuat.' }\n format.json { render :show, status: :created, location: @period }\n else\n format.html { render :new }\n format.json { render json: @period.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n cycleParams = ActionController::Parameters.new(title: (cycle_params[:title] ? cycle_params[:title] : nil),\n group_id: cycle_params[:group_id],\n start_time: cycle_params[:weeks].first[:delivery_date],\n end_time: cycle_params[:weeks].last[:delivery_date]\n )\n\n @cycle = Cycle.new(cycleParams.permit(:title,:group_id, :start_time, :end_time))\n if @cycle.save\n #TODO validate that weeks do not overlap. i.e.,\n cycle_params[:weeks].each do |t|\n weekParams = ActionController::Parameters.new({cycle_id: @cycle.id, delivery_date: t[:delivery_date],\n location: (t[:location] ? t[:location] : nil)})\n week = Week.new(weekParams.permit(:cycle_id, :delivery_date, :location))\n week.save()\n #TODO check for errors\n end\n render json: @cycle.as_json(include: [:weeks]), status: :created, location: @cycle\n else\n render json: @cycle.errors, status: :unprocessable_entity\n end\n end", "def dis_doseperiod_params\n params.require(:dis_doseperiod).permit(:name, :is_common, :abbrev, :status_id, :datasource_id)\n end", "def create\n @child = Child.new(child_params)\n\n respond_to do |format|\n if @child.save\n format.html { redirect_to children_path, notice: \"Child was successfully created.\" }\n format.json { render :show, status: :created, location: @child }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @child = Child.new(child_params)\n\n respond_to do |format|\n if @child.save\n format.html { redirect_to @child, notice: 'Child was successfully created.' }\n format.json { render :show, status: :created, location: @child }\n else\n format.html { render :new }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @child = Child.new(child_params)\n \n respond_to do |format|\n if @child.save\n format.html { redirect_to @child, notice: 'Child was successfully created.' }\n format.json { render action: 'show', status: :created, location: @child }\n else\n format.html { render action: 'new' }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def vacation_period_params\n params.require(:vacation_period).permit(:start_date, :end_date, :vacation_periodable_type, :vacation_periodable_id, :vacation_type_id, :description, :state)\n end", "def create\n @patient = Patient.find(params[:patient_id])\n @schedule = @patient.schedules.create(params[:schedule])\n\n # TODO can improve it to use nested attributes\n params[:pill_time].each do |pill_time|\n @schedule.pill_times.build(pill_time)\n end\n\n @pill_times = @schedule.pill_times\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to [@patient, @schedule],\n notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule,\n status: :created,\n location: [@patient, @schedule] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def leaf_params\n params.require(:leaf).permit(:name, :period, :desc, :status, :group1, :group2, :group3)\n end", "def growth_params\n params.require(:growth).permit(:name, :status, :createdOn)\n end", "def create\n @reporting_period = ReportingPeriod.new(reporting_period_params)\n if params[:copy_reporting_period_id]\n source = ReportingPeriod.find(params[:copy_reporting_period_id])\n @reporting_period.copy_reports_from source\n end\n\n respond_to do |format|\n if @reporting_period.save\n format.html { redirect_to :reporting_periods, notice: \"Reporting period was successfully created.\" }\n format.json { render :show, status: :created, location: @reporting_period }\n else\n format.html do\n @reporting_periods = ReportingPeriod.order(date: :desc)\n render :new\n end\n format.json { render json: @reporting_period.errors, status: :unprocessable_entity }\n end\n end\n end", "def production_params\n params.require(:production).permit(:start_date, :end_date, :play_id, :theater_id, jobs_attributes: [:id, :production_id, :specialization_id, :user_id, :theater_id, :character_id])\n end", "def new\n @patient = Patient.find(params[:patient_id])\n current_schedule = @patient.current_schedule\n if current_schedule\n current_schedule.terminated_at = Date.today\n current_schedule.save\n end\n @schedule = @patient.schedules.build\n @pill_times = [@schedule.pill_times.build]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schedule }\n end\n end", "def create_payment_profile_entry(project, scheduled_days, start_period, end_period, created_payment_profiles)\n if scheduled_days > 0\n new_payment_profile = project.payment_profiles.new\n new_payment_profile.attributes = {\n :name => \"#{start_period.strftime(\"%d %b %Y\")} - #{end_period.strftime(\"%d %b %Y\")}\", \n :expected_payment_date => end_period, \n :generate_cost_from_time => true, \n :expected_days => scheduled_days\n }\n \n if new_payment_profile.save\n \n # Add service types too (Taken from project level) \n # if project.rate_card_projects.present?\n # project.rate_card_projects.each do |rate_card_project|\n # new_payment_profile.rate_card_payment_profiles.new(:rate_card_id => rate_card_project.rate_card_id, :percentage => rate_card_project.percentage)\n # end\n # new_payment_profile.save!\n # end\n \n # Add to return array\n created_payment_profiles << new_payment_profile\n end\n end\n created_payment_profiles\n end", "def create\n\n @company = current_user.companies.find(params[:company_id])\n @report = @company.labors.new(params[:reportings_labor])\n @report.period = Date.civil(params[:period][:year].to_i, params[:period][:month].to_i, params[:period][:day].to_i)\n respond_to do |format|\n if @report.valid? && @report.save_and_update_parents\n format.html { redirect_to company_reportings_labor_path(params[:company_id],@report), notice: 'Balance was successfully created.' }\n format.json { render json: @report, status: :created, location: @report }\n else\n format.html { render action: \"new\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n current_account.parties.create(params[:parties].values)\n @date = params[:parties].values.first[:created_at].to_time\n @parties = current_account.parties.by_month(@date.month, :year => @date.year)\n @daily = @parties.select{|p| p.created_at.to_date == @date.to_date}.group_by(&:game)\n @count = @parties.size\n find_yours(@parties)\n @games = compute_monthly_played(@parties, @date.beginning_of_month)\n respond_to do |format|\n format.js\n end\n end", "def create\n @enrollment = @parent.enrollments.build enrollment_params\n if @enrollment.save\n render :show, status: :created, location: api_v1_mutant_enrollment_url(@enrollment.mutant_id, @enrollment)\n else\n render json: @enrollment.errors, status: :unprocessable_entity\n end\n end", "def create\n @teaching = Teaching.new(params[:teaching])\n if params[:curriculum_id]\n curriculum = Curriculum.find(params[:curriculum_id])\n end\n optional = false\n optional = true if params[:isOptional]\n period = Period.find_by_subperiod_and_year(params[:subperiod], params[:year])\n if period\n @teaching.period = period\n end\n respond_to do |format|\n @teaching.save\n if curriculum && @teaching.belongs.build(:curriculum => curriculum, :isOptional => optional) && @teaching.save\n flash[:notice] = 'Insegnamento creato correttamente.'\n format.html { redirect_to select_teacher_teaching_url(@teaching) }\n format.js{render(:update) {|page| page.redirect_to select_teacher_teaching_url(@teaching)}}\n else\n @graduate_courses = @current_user.graduate_courses\n @year = Period.find(:all, :select => \"DISTINCT year\")\n @subperiod = Period.find(:all, :select => \"DISTINCT subperiod\")\n format.html { render :action => \"new\" }\n format.js{}\n end\n end\n end", "def create\n @test_booking_child = TestBookingChild.new(params[:test_booking_child])\n\n respond_to do |format|\n if @test_booking_child.save\n format.html { redirect_to(@test_booking_child, :notice => 'TestBookingChild was successfully created.') }\n format.xml { render :xml => @test_booking_child, :status => :created, :location => @test_booking_child }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_booking_child.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @doctorsheduling = Doctorsheduling.new(params[:doctorsheduling])\n\n respond_to do |format|\n if @doctorsheduling.save\n format.html { redirect_to(@doctorsheduling, :notice => 'Doctorsheduling was successfully created.') }\n format.xml { render :xml => @doctorsheduling, :status => :created, :location => @doctorsheduling }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @doctorsheduling.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ministry_child = MinistryChild.new(ministry_child_params)\n\n respond_to do |format|\n if @ministry_child.save\n format.html { redirect_to @ministry_child, notice: 'Ministry child was successfully created.' }\n format.json { render :show, status: :created, location: @ministry_child }\n else\n format.html { render :new }\n format.json { render json: @ministry_child.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vacation_period = VacationPeriod.new(vacation_period_params)\n\n respond_to do |format|\n if @vacation_period.save\n format.html { redirect_to @vacation_period, notice: 'Vacation period was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vacation_period }\n else\n format.html { render action: 'new' }\n format.json { render json: @vacation_period.errors, status: :unprocessable_entity }\n end\n end\n end", "def dag_params\n params.permit(:name, :cron, :enable, :environments => {})\n end", "def period_params\n params.require(:period).permit(:start_date, :end_date, :user_id)\n end", "def create\n @goal = current_user.goals.build(goal_params)\n\n # iterate throught dates\n puts goal_params[:start_date]\n puts goal_params[:duration]\n\n if goal_params[:start_date] != \"\" && goal_params[:duration] != \"\"\n start_date = Date.parse(goal_params[:start_date])\n end_date = start_date + goal_params[:duration].to_i - 1\n\n start_date.upto(end_date) do |date|\n @goal.activities.build({done: false, due_date: date})\n end\n end\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to goals_path, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity_development = ActivityDevelopment.new(activity_development_params)\n\n respond_to do |format|\n if @activity_development.save\n format.html { redirect_to @activity_development, notice: 'Activity development was successfully created.' }\n format.json { render :show, status: :created, location: @activity_development }\n else\n format.html { render :new }\n format.json { render json: @activity_development.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @deadline = Deadline.new(deadline_params)\n\n respond_to do |format|\n if @deadline.save\n format.html { redirect_to @deadline.listing, notice: 'Deadline was successfully created.' }\n format.json { render :show, status: :created, location: @deadline }\n else\n format.html { redirect_to(@deadline.listing || listings_url) }\n format.json { render json: @deadline.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n study_period_params.permit!\n @study_period = StudyPeriod.new(study_period_params)\n @study_period.study_year = @year\n\n respond_to do |format|\n if @study_period.save\n format.html { redirect_to new_study_year_study_process_graphic_path(current_user.current_year, @study_period), notice: 'Учебный отрезок успешно создан.' }\n format.json { render action: 'show', status: :created, location: @study_period }\n else\n format.html { render action: 'new' }\n format.json { render json: @study_period.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schedule_cohort_period = ScheduleCohortPeriod.new(schedule_cohort_period_params)\n\n respond_to do |format|\n if @schedule_cohort_period.save\n format.html { redirect_to @schedule_cohort_period}\n format.json { render action: 'show', status: :created, location: @schedule_cohort_period }\n else\n format.html { render action: 'new' }\n format.json { render json: @schedule_cohort_period.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @child_record = ChildRecord.new(child_record_params)\n\n respond_to do |format|\n if @child_record.save\n format.html { redirect_to @child_record, notice: 'Child record was successfully created.' }\n format.json { render :show, status: :created, location: @child_record }\n else\n format.html { render :new }\n format.json { render json: @child_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_class_period_work_orders(edOrgType, edOrgId)\n\n std_time = [ [ \"08:45:00\", \"09:25:00\" ],\n [ \"09:30:00\", \"10:15:00\" ],\n [ \"10:20:00\", \"11:00:00\" ],\n [ \"11:05:00\", \"11:50:00\" ],\n [ \"13:05:00\", \"13:45:00\" ],\n [ \"13:50:00\", \"14:30:00\" ],\n [ \"14:35:00\", \"15:10:00\" ],\n [ \"15:15:00\", \"16:00:00\" ],\n [ \"16:05:00\", \"16:35:00\" ],\n ]\n\n # Before school\n periods = [ { :name => \"Early Morning Period\",\n :start_time => \"07:15:00\",\n :end_time => \"07:45:00\"\n } ]\n\n # Regular day\n nperiod = @scenarioYAML['NUM_CLASS_PERIODS']\n for p in 0 .. (nperiod-1)\n periods.push( { :name => \"Class Period No. \" + (p + 1).to_s(),\n :start_time => std_time[p][0],\n :end_time => std_time[p][1],\n })\n end\n\n # After school\n periods.push( { :name => \"After School Athletic Session\",\n :start_time => \"16:00:00\",\n :end_time => \"18:00:00\" })\n periods.push( { :name => \"Detention\",\n :start_time => \"15:30:00\",\n :end_time => \"16:30:00\" })\n \n # Add class periods\n periods.each do |period|\n @queue.push_work_order({:type => ClassPeriod, :class_period_name => period[:name], :ed_org_id => edOrgId})\n end\n\n periods\n end", "def create\n @campaign = Campaign.create!(name: params[:name], dm_id: params[:dm_id], theme: params[:theme], setting: params[:setting], calendar_id: params[:calendar_id], starting_level: params[:starting_level], skillset_id: params[:skillset_id], custom_notes: params[:custom_notes], starting_month: params[:month], starting_weekday: params[:weekday], starting_day: params[:day], starting_year: params[:year], starting_age: params[:age], current_month: params[:month], current_weekday: params[:weekday], current_day: params[:day], current_year: params[:year], current_age: params[:age])\n\n params[:race_ids].each do |ri|\n CampaignRace.create!(campaign_id: @campaign.id, race_id: ri)\n end\n\n params[:klass_ids].each do |ki|\n CampaignKlass.create!(campaign_id: @campaign.id, klass_id: ki)\n end\n\n render json: @campaign, status: 201\n\n end", "def child_params\n params.require(:child).permit(:first_name, :last_name, :birthday, :sex, :dni_number)\n end", "def ministry_child_params\n params.require(:ministry_child).permit(:name, :contact_person, :contact_email, :description, :display_rank, :ta1, :ta2, :ta3, :ta4, :ta5, :advert_main_page, :ministry_id, :slug)\n end", "def create\n @discipline = Discipline.new(discipline_params)\n respond_to do |format|\n if @discipline.save\n format.html { redirect_to management_disciplines_path }\n format.json { render :json => @discipline.to_json(include: :department), status: :created }\n else\n format.html { render :new }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @period = Period.new(period_params)\n\n respond_to do |format|\n if @period.save\n format.html { redirect_to @period.school, notice: 'Period was successfully created.' }\n format.json { render :show, status: :created, location: @period.school }\n else\n format.html { render :new }\n format.json { render json: @period.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n respond_to do |format|\n if @registration_period.save\n format.html { redirect_to @registration_period, notice: 'Registration period was successfully created.' }\n format.json { render json: @registration_period, status: :created, location: @registration_period }\n else\n format.html { render action: \"new\" }\n format.json { render json: @registration_period.errors, status: :unprocessable_entity }\n end\n end\n end", "def period_params\n params.require(:period).permit(:start, :end, :buget, :activ, :nr_stud, :min_salary)\n end", "def create\n @three_child_history = ThreeChildHistory.new(three_child_history_params)\n @patient = Patient.find(params[:patient_id])\n @clinic_history = ClinicHistory.find(params[:clinic_history_id])\n respond_to do |format|\n if @three_child_history.save\n format.html { redirect_to patient_clinic_history_tool_tests_path(@clinic_history.patient_id,@clinic_history.id), notice: 'Three child history was successfully created.' }\n format.json { render :show, status: :created, location: @three_child_history }\n else\n format.html { render :new }\n format.json { render json: @three_child_history.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7117874", "0.70029455", "0.6716167", "0.63868314", "0.63679063", "0.63424206", "0.60324746", "0.58875847", "0.5619923", "0.5458914", "0.5419847", "0.5407736", "0.5393691", "0.53787434", "0.5371079", "0.53701997", "0.5340205", "0.52444357", "0.5240653", "0.5239106", "0.52282745", "0.52006495", "0.51779985", "0.5157317", "0.5147025", "0.5144853", "0.51020485", "0.5101268", "0.50982684", "0.5097415", "0.5089957", "0.5081113", "0.5059494", "0.5057193", "0.50567067", "0.50439394", "0.50264394", "0.502157", "0.5013821", "0.5007743", "0.5003295", "0.500131", "0.49762303", "0.4968712", "0.49501365", "0.49409422", "0.49356884", "0.49352956", "0.49239126", "0.49031493", "0.48905733", "0.4887194", "0.48857316", "0.48845017", "0.48767087", "0.48727676", "0.4870939", "0.48707476", "0.48705435", "0.48664135", "0.4860146", "0.48594505", "0.4858723", "0.48512003", "0.4843673", "0.48413268", "0.48299366", "0.48218176", "0.4819607", "0.48131433", "0.4811765", "0.48092002", "0.48055872", "0.48023567", "0.48021308", "0.47918534", "0.4777427", "0.4776159", "0.47755688", "0.47741714", "0.47707042", "0.47677386", "0.47622138", "0.47603267", "0.4758017", "0.47541314", "0.47513333", "0.47502676", "0.47498918", "0.4745384", "0.47443628", "0.4738717", "0.47386447", "0.47334066", "0.47294548", "0.4727084", "0.47260207", "0.47208902", "0.4720821", "0.47205907" ]
0.7651888
0
PATCH/PUT /child_development_periods/1 PATCH/PUT /child_development_periods/1.json
def update respond_to do |format| if @child_development_period.update(child_development_period_params) format.html { redirect_to @child_development_period, notice: 'Child development period was successfully updated.' } format.json { render :show, status: :ok, location: @child_development_period } else format.html { render :edit } format.json { render json: @child_development_period.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_child_development_period\n @child_development_period = ChildDevelopmentPeriod.find(params[:id])\n end", "def update\n respond_to do |format|\n if @child_development.update(child_development_params)\n format.html { redirect_to @child_development, notice: 'Child development was successfully updated.' }\n format.json { render :show, status: :ok, location: @child_development }\n else\n format.html { render :edit }\n format.json { render json: @child_development.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dec_form_child = DecFormChild.find(params[:id])\n\n respond_to do |format|\n if @dec_form_child.update_attributes(params[:dec_form_child])\n format.html { redirect_to @dec_form_child, notice: 'Dec form child was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dec_form_child.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @child_development_period = ChildDevelopmentPeriod.new(child_development_period_params)\n\n respond_to do |format|\n if @child_development_period.save\n format.html { redirect_to @child_development_period, notice: 'Child development period was successfully created.' }\n format.json { render :show, status: :created, location: @child_development_period }\n else\n format.html { render :new }\n format.json { render json: @child_development_period.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @child_development_periods = ChildDevelopmentPeriod.all\n end", "def update\n respond_to do |format|\n if @child.update(child_params)\n format.html { redirect_to @child, notice: 'Child was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update\n @child = @enrollment.child\n\tputs enrollment_params\n respond_to do |format|\n if @enrollment.update(enrollment_params)\n format.html { redirect_to @enrollment, notice: tr(\"enrollment_updated\") }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n @toyota_epc_part_number_application_to_models_child = ToyotaEpc::PartNumberApplicationToModelsChild.find(params[:id])\n\n respond_to do |format|\n if @toyota_epc_part_number_application_to_models_child.update_attributes(params[:toyota_epc_part_number_application_to_models_child])\n format.html { redirect_to @toyota_epc_part_number_application_to_models_child, :notice => 'Part number application to models child was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @toyota_epc_part_number_application_to_models_child.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @child.update(child_params)\n format.html { redirect_to @child, notice: 'Child was successfully updated.' }\n format.json { render :show, status: :ok, location: @child }\n else\n format.html { render :edit }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @child.update(child_params)\n format.html { redirect_to @child, notice: 'Child was successfully updated.' }\n format.json { render :show, status: :ok, location: @child }\n else\n format.html { render :edit }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @child.update(child_params)\n format.html { redirect_to @child, notice: \"Child was successfully updated.\" }\n format.json { render :show, status: :ok, location: @child }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n period = current_user.school.periods.find(params[:id])\n\n if period.update(period_params)\n render json: period, status: :accepted\n else\n render json: {errors: period.errors}, status: :unprocessable_entity\n end\n end", "def set_child_development\n @child_development = ChildDevelopment.find(params[:id])\n end", "def update\n @nvs_subsystem = NvsSubsystem.find(params[:id])\n\n respond_to do |format|\n if @nvs_subsystem.update_attributes(params[:nvs_subsystem])\n\n #Remove relations if any\n dp2remove = @project_related.map{|x| \"#{x[1]}\"} - params['project_related_ids'].to_a\n dp2remove.each do |dp|\n dp = NvsDeptProject.find(dp)\n dp.nvs_subsystem_id = 0\n dp.save\n end\n #Add new relations if any\n unless params['depts_project_ids'].nil?\n params['depts_project_ids'].each do |dp|\n dp = NvsDeptProject.find(dp) #get dept_project selected.\n dp.nvs_subsystem = @nvs_subsystem\n dp.nvs_dept_id = 0 if dp.nvs_dept_id.nil?\n dp.project_id = session[:project_id]\n dp.save\n end\n end\n\n format.html { redirect_to @nvs_subsystem, notice: 'Nvs subsystem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nvs_subsystem.errors, status: :unprocessable_entity }\n end\n end\n end", "def child_development_period_params\n params.require(:child_development_period).permit(:date_contol, :weight, :size, :head_circunference, :child_id, :child_development_id, :medical_center_id, :doctor_id)\n end", "def update\n respond_to do |format|\n if @child.update(child_params)\n format.html { redirect_to children_path, notice: \"Child was successfully updated.\" }\n format.json { render :show, status: :ok, location: @child }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @toyota_epc_part_number_list_child = ToyotaEpc::PartNumberListChild.find(params[:id])\n\n respond_to do |format|\n if @toyota_epc_part_number_list_child.update_attributes(params[:toyota_epc_part_number_list_child])\n format.html { redirect_to @toyota_epc_part_number_list_child, :notice => 'Part number list child was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @toyota_epc_part_number_list_child.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @child = Child.find(params[:id])\n\n respond_to do |format|\n if @child.update_attributes(params[:child])\n format.html { redirect_to children_url, notice: 'Child was successfully updated.' }\n format.js { @current_child = @child}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ministry_child.update(ministry_child_params)\n format.html { redirect_to @ministry_child, notice: 'Ministry child was successfully updated.' }\n format.json { render :show, status: :ok, location: @ministry_child }\n else\n format.html { render :edit }\n format.json { render json: @ministry_child.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @condominium_child.update(condominium_child_params)\n format.json { render :show, status: :ok, object: @condominium_child }\n else\n format.json { render json: @condominium_child.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ministry_child = MinistryChild.find(params[:id])\n\n respond_to do |format|\n if @ministry_child.update_attributes(params[:ministry_child])\n format.html { redirect_to ministry_path(@ministry_child.ministry.id), notice: 'Ministry child was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ministry_child.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @child.update(child_params)\n format.html { redirect_to :back, notice: 'Child was successfully updated.' }\n format.json { render :show, status: :ok, location: @child }\n else\n format.html { render :edit }\n format.json { render json: @child.errors, status: :unprocessable_entity }\n end\n end\n end", "def child_development_params\n params.require(:child_development).permit(:name, :months)\n end", "def update\n respond_to do |format|\n if @traumatized_child.update(traumatized_child_params)\n format.html { redirect_to @traumatized_child, notice: \"Traumatized child was successfully updated.\" }\n format.json { render :show, status: :ok, location: @traumatized_child }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @traumatized_child.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @periods_group.update(periods_group_params)\n format.html { redirect_to company_periods_group_path(@company, @periods_group), notice: 'Periods group was successfully updated.' }\n format.json { render :show, status: :ok, location: @periods_group }\n else\n format.html { render :edit }\n format.json { render json: @periods_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @child_record.update(child_record_params)\n format.html { redirect_to @child_record, notice: 'Child record was successfully updated.' }\n format.json { render :show, status: :ok, location: @child_record }\n else\n format.html { render :edit }\n format.json { render json: @child_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = current_user.companies.find(params[:company_id])\n @report = @company.labors.find(params[:id])\n @report.period = Date.civil(params[:period][:year].to_i, params[:period][:month].to_i, params[:period][:day].to_i)\n params[:reportings_labor][:period]=@report.period\n respond_to do |format|\n if @report.valid? && @report.update_attributes_and_update_parents(params[:reportings_labor])\n format.html { redirect_to company_reportings_labor_path(params[:company_id],@report), notice: 'Labor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_booking_child = TestBookingChild.find(params[:id])\n\n respond_to do |format|\n if @test_booking_child.update_attributes(params[:test_booking_child])\n format.html { redirect_to(@test_booking_child, :notice => 'TestBookingChild was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_booking_child.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @resource_period = ResourcePeriod.find(params[:id])\n\n respond_to do |format|\n if @resource_period.update_attributes(params[:resource_period])\n format.html { redirect_to(@resource_period, :notice => 'Resource period was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @resource_period.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\trespond_to do |format|\n\t \t\tif @parent_child.update(parent_child_params)\n\t\t\t\tformat.html { redirect_to @parent_child, notice: 'Parent child was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @parent_child }\n\t \t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @parent_child.errors, status: :unprocessable_entity }\n\t \t\tend\n\t\tend\n \tend", "def update\n # Expecting the following format:\n # {\n # \"dmp\": {\n # \"dmp_id\": {\n # 'type': 'doi',\n # 'identifier': '10.234/erfere.234d'\n # },\n # \"contributor\": [{\n # \"name\": 'Jane Doe',\n # \"mbox\": 'jane.doe@example.org',\n # \"roles\": 'https://credit.org/roles/program_officer',\n # \"affiliation\": {\n # \"name\": 'National Science Foundation (NSF)'\n # },\n # }],\n # \"project\": {\n # \"start_on\": '2020-05-15 10:34:21 UCT',\n # \"end_on\": '2022-05-15 10:34:21 UCT',\n # \"funding\": [{\n # \"name\": \"Example Funder\",\n # \"funder_id\": {\n # 'typer':'ROR',\n # 'identifier': 'http://ror.org/45y4545'\n # },\n # \"grant_id\": {\n # 'type': 'url',\n # 'identifier': 'http://awards.example.org/1234'\n # }\n # \"funding_status\": \"granted\"\n # }]\n # }\n # }\n # }\n @funding = Funding.where(id: params[:id]).first\n if @funding.present? && funding_params.fetch('dmp_id', {}).any? &&\n funding_params['dmp_id']['identifier'].present? &&\n funding_params.fetch('project', {})['funding'].present?\n\n dmp = DataManagementPlan.find_by_doi(funding_params['dmp_Id']['identifier']).first\n if @funding.project.data_management_plans.first.id == dmp.id\n prepare_project_for_update(params: funding_params['project'])\n prepare_funding_for_update(params: funding_params['project']['funding'].first)\n\n if funding_params.fetch('contributor', []).any? && authorize_person_assertions\n DataManagementPlan.contributors_from_json(\n provenance: current_client[:name],\n dmp: dmp,\n json: funding_params\n )\n end\n\n if dmp.save && @funding.project.save && @funding.save\n head :no_content, location: landing_page_url(id: dmp.dois.first&.value)\n\n else\n project_errs = @funding.project.errors.collect { |e, m| { \"#{e}\": m } } || []\n funding_errs = @funding.errors.collect { |e, m| { \"#{e}\": m } } || []\n errs = (project_errs + funding_errs).join(', ')\n Rails.logger.warn \"Error saving Project + Funding during api/v0/fundings#update: #{errs}\"\n render_error errors: \"Unable to assert your Funding: #{errs}\", status: :unprocessable_entity\n end\n else\n render_error errors: 'Unauthorized', status: :unauthorized\n end\n else\n render_error errors: 'Unauthorized', status: :unauthorized\n end\n end", "def update\n @patient = Patient.find(params[:patient_id])\n @clinic_history = ClinicHistory.find(params[:clinic_history_id])\n if @clinic_history.four_child_state != true && @clinic_history.four_child_created_at == nil\n\n @clinic_history.four_child_created_at = Date.today\n @clinic_history.four_child_state = false\n @clinic_history.save\n \n\n end \n respond_to do |format|\n if @three_child_history.update(three_child_history_params)\n format.html { redirect_to patient_clinic_history_tool_tests_path(@clinic_history.patient_id,@clinic_history.id), notice: 'Three child history was successfully updated.' }\n format.json { render :show, status: :ok, location: @three_child_history }\n else\n format.html { render :edit }\n format.json { render json: @three_child_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @child_resource = ChildResource.find(params[:id])\n # require modify permissions for this object\n require_privilege(Alberich::Privilege::MODIFY, @child_resource)\n\n respond_to do |format|\n if @child_resource.update_attributes(params[:child_resource])\n format.html { redirect_to @child_resource, notice: 'Child resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @child_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @toyota_epc_part_number_application_to_models_parent = ToyotaEpc::PartNumberApplicationToModelsParent.find(params[:id])\n\n respond_to do |format|\n if @toyota_epc_part_number_application_to_models_parent.update_attributes(params[:toyota_epc_part_number_application_to_models_parent])\n format.html { redirect_to @toyota_epc_part_number_application_to_models_parent, :notice => 'Part number application to models parent was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @toyota_epc_part_number_application_to_models_parent.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schedule_cohort_period.update(schedule_cohort_period_params)\n format.html { redirect_to @schedule_cohort_period}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @schedule_cohort_period.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_child_devices\n if self.parent_id.blank? && !['assigned', 'instock'].include?(self.status)\n params_attr = {status: 'instock', parent_id: nil} \n else\n params_attr = {status: self.status, parent_id: self.id}\n end\n self.child_devices.update_all(params_attr)\n end", "def update\n @period = Period.find(params[:id])\n\n if @period.update(params[:period])\n head :no_content\n else\n render json: @period.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @parent_of.update(parent_of_params)\n format.html { redirect_to @parent_of, notice: 'Parent of was successfully updated.' }\n format.json { render :show, status: :ok, location: @parent_of }\n else\n format.html { render :edit }\n format.json { render json: @parent_of.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @child_development_period.destroy\n respond_to do |format|\n format.html { redirect_to child_development_periods_url, notice: 'Child development period was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @patient = Patient.find(params[:patient_id])\n @schedule = @patient.schedules.find(params[:id])\n @pill_times = @schedule.pill_times\n\n # TODO can improve it to use nested attributes\n if params[:pill_time]\n params[:pill_time].each_with_index do |pill_time, idx|\n if @pill_times[idx]\n @pill_times[idx].update_attributes(pill_time)\n else\n @pill_times.create(pill_time)\n end\n end\n end\n\n # remove unused pill times\n if params[:pill_time]\n diff = @pill_times.size - params[:pill_time].size\n @pill_times.destroy(@pill_times.last(diff)) if diff > 0\n end\n\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to [@patient, @schedule],\n notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def update\n @tb_period = TbPeriod.find(params[:id])\n\n respond_to do |format|\n if @tb_period.update_attributes(params[:tb_period])\n format.html { redirect_to @tb_period, notice: 'Tb period was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tb_period.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @corporate_health_package_child = CorporateHealthPackageChild.find(params[:id])\n\n respond_to do |format|\n if @corporate_health_package_child.update_attributes(params[:corporate_health_package_child])\n format.html { redirect_to(@corporate_health_package_child, :notice => 'CorporateHealthPackageChild was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @corporate_health_package_child.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @discipline.update(discipline_params)\n format.html { redirect_to management_disciplines_path }\n format.json { render :json => @discipline.to_json(include: :department), status: :created }\n else\n format.html { render :edit }\n format.json { render json: @discipline.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @childmaster = Childmaster.find(params[:id])\n\n respond_to do |format|\n if @childmaster.update_attributes(params[:childmaster])\n format.html { redirect_to @childmaster, notice: 'Childmaster was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @childmaster.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fieldset_child = DynamicFieldsets::FieldsetChild.find(params[:id])\n respond_to do |format|\n if @fieldset_child.update_attributes(params[:dynamic_fieldsets_fieldset_child])\n format.html { redirect_to(dynamic_fieldsets_children_dynamic_fieldsets_fieldset_path(@fieldset_child.root_fieldset), :notice => \"Successfully updated a child\")}\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @key_donor_child.update(key_donor_child_params)\n format.html { redirect_to @key_donor_child, notice: 'Key donor child was successfully updated.' }\n format.json { render :show, status: :ok, location: @key_donor_child }\n else\n format.html { render :edit }\n format.json { render json: @key_donor_child.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n ap = absence_params\n reason_id = ap[:reason_id].try('to_i')\n if reason_id.present?\n ap[:project_id]=0 if ![2, 3].include?(reason_id)\n ap[:target_id]=0 if reason_id != 2\n end\n\n abs_params\n respond_to do |format|\n if @absence.update(ap)\n format.html { redirect_to absences_url, notice: 'Отсутствие успешно обновлено.' }\n format.json { render :edit, status: :ok, location: @absence }\n else\n format.html { render :edit }\n format.json { render json: @absence.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @doctorsheduling = Doctorsheduling.find(params[:id])\n\n respond_to do |format|\n if @doctorsheduling.update_attributes(params[:doctorsheduling])\n format.html { redirect_to(@doctorsheduling, :notice => 'Doctorsheduling was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @doctorsheduling.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @pharmacy_payment_child = PharmacyPaymentChild.find(params[:id])\n\n respond_to do |format|\n if @pharmacy_payment_child.update_attributes(params[:pharmacy_payment_child])\n format.html { redirect_to(@pharmacy_payment_child, :notice => 'PharmacyPaymentChild was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pharmacy_payment_child.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @parent_app.update(parent_app_params)\n format.html { redirect_to @parent_app, notice: 'Parent app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @parent_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @schedule = Schedule.find(params[:id])\n @client_branches = ClientBranch.where(:client_id => params[:schedule][:client_id])\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @foster_parent.update(foster_parent_params)\n format.html { redirect_to @foster_parent, notice: 'Foster parent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foster_parent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n sub_obj_non_attributes = study_params.select { |key| !key.to_s.match(/_attributes$/) }\n\n @study = Study.find(session[:current_study_id])\n\n \n if ! sub_obj_non_attributes.empty?\n @study.update(sub_obj_non_attributes.to_h.except('_destroy', 'id', 'rec_id', 'updated', 'rec_delete'))\n end\n \n traverse_study_attr(study_params.select { |key| key.to_s.match(/_attributes$/)}, @study)\n \n respond_to do |format|\n format.html { redirect_to study_steps_path}\n format.json { render action: 'show', status: :created, location: @study }\n\n end\n\n end", "def update\n redirect_to(root_url) && return unless current_user.can_edit_patient?\n\n content = params.require(:patient).permit(:id).merge!(allowed_params)\n patient = current_user.get_patient(content[:id])\n\n # If we failed to find a subject given the id, redirect to index\n redirect_to(root_url) && return if patient.nil?\n\n # Propagate desired fields to household except jurisdiction_id\n propagated_fields = params[:propagated_fields]\n unless propagated_fields.empty?\n propagated_content = content.select { |field| propagated_fields.include?(field) && field != 'jurisdiction_id' }\n patient.dependents_exclude_self.update(propagated_content)\n end\n\n # If the assigned jurisdiction is updated, verify that the jurisdiction exists and that it is assignable by the current user, update history and propagate\n if content[:jurisdiction_id] && content[:jurisdiction_id] != patient.jurisdiction_id\n if current_user.jurisdiction.subtree_ids.include?(content[:jurisdiction_id].to_i)\n old_jurisdiction = patient.jurisdiction[:path]\n new_jurisdiction = Jurisdiction.find(content[:jurisdiction_id])[:path]\n transfer = Transfer.new(patient: patient, from_jurisdiction: patient.jurisdiction, to_jurisdiction_id: content[:jurisdiction_id], who: current_user)\n transfer.save!\n comment = \"User changed Jurisdiction from \\\"#{old_jurisdiction}\\\" to \\\"#{new_jurisdiction}\\\".\"\n history = History.monitoring_change(patient: patient, created_by: current_user.email, comment: comment)\n if propagated_fields.include?('jurisdiction_id')\n dependents_exclude_hoh = patient.dependents_exclude_self\n dependents_exclude_hoh.update(jurisdiction_id: content[:jurisdiction_id])\n dependents_exclude_hoh.each do |group_member|\n propagated_history = history.dup\n propagated_history.patient = group_member\n propagated_history.comment = \"System changed Jurisdiction from \\\"#{old_jurisdiction}\\\" to \\\"#{new_jurisdiction}\\\" because User updated Jurisdiction\n for another member in this recipient's household and chose to update this field for all household members.\"\n propagated_history.save\n propagated_transfer = transfer.dup\n propagated_transfer.patient = group_member\n propagated_transfer.save\n end\n end\n else\n content[:jurisdiction_id] = patient.jurisdiction_id\n end\n end\n\n # If the assigned user is updated, update history and propagate\n if content[:assigned_user] && content[:assigned_user] != patient.assigned_user\n old_assigned_user = patient.assigned_user || ''\n new_assigned_user = content[:assigned_user] || ''\n comment = \"User changed Assigned User from \\\"#{old_assigned_user}\\\" to \\\"#{new_assigned_user}\\\".\"\n history = History.monitoring_change(patient: patient, created_by: current_user.email, comment: comment)\n if propagated_fields.include?('assigned_user')\n dependents_exclude_hoh = patient.dependents_exclude_self\n dependents_exclude_hoh.update(assigned_user: content[:assigned_user])\n dependents_exclude_hoh.each do |group_member|\n propagated_history = history.dup\n propagated_history.patient = group_member\n propagated_history.comment = \"System changed Assigned User from \\\"#{old_assigned_user}\\\" to \\\"#{new_assigned_user}\\\" because User updated Assigned\n User for another member in this recipient's household and chose to update this field for all household members.\"\n propagated_history.save\n end\n end\n end\n\n # Reset symptom onset date if moving from isolation to exposure\n reset_symptom_onset(content, patient, :system) if !content[:isolation].nil? && !content[:isolation]\n\n # Update patient history with detailed edit diff\n patient_before = patient.dup\n Patient.detailed_history_edit(patient_before, patient, current_user.email, allowed_params) if patient.update(content)\n\n render json: patient\n end", "def update\n @monitor_child_relationship = MonitorChildRelationship.find(params[:id])\n\n respond_to do |format|\n if @monitor_child_relationship.update_attributes(params[:monitor_child_relationship])\n format.html { redirect_to @monitor_child_relationship, notice: 'Monitor child relationship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monitor_child_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@auto_scaling_trigger = AutoScalingTrigger.find(params[:id], :include => [ :auto_scaling_group ])\n\t\t@auto_scaling_group = @auto_scaling_trigger.auto_scaling_group\n\t\tast_params = params[:auto_scaling_trigger]\n\t\t\n\t\tunless ast_params.nil?\n\t\t\tast_params.each do |k,v|\n\t\t\t\tast_params[k] = v.chomp\n\t\t\tend\n\t\tend\n\t\t\n\t\trespond_to do |format|\n\t\t\tif @auto_scaling_trigger.update_attributes(ast_params)\n\t\t\t\tp = @auto_scaling_group\n\t\t\t\to = @auto_scaling_trigger\n\t\t\t\tAuditLog.create_for_parent(\n\t\t\t\t\t:parent => p,\n\t\t\t\t\t:auditable_id => o.id,\n\t\t\t\t\t:auditable_type => o.class.to_s,\n\t\t\t\t\t:auditable_name => o.name,\n\t\t\t\t\t:author_login => current_user.login,\n\t\t\t\t\t:author_id => current_user.id,\n\t\t\t\t\t:summary => \"updated '#{o.name}'\",\n\t\t\t\t\t:changes => o.tracked_changes,\n\t\t\t\t\t:force => false\n\t\t\t\t)\n\t\t\telse\n\t\t\t\t@error_messages = @auto_scaling_trigger.errors.collect{ |attr,msg| \"#{attr.humanize} - #{msg}\" }\n\t\t\t\tflash[:error] = @error_messages.join('<br/>')\n\t\t\tend\n\t\t\tformat.json { render :json => @auto_scaling_trigger }\n\t\tend\n\tend", "def update\n # if ((@plant.start_date..@project.end_date).cover?(params[:plant][:foreman_start_date]))\n respond_to do |format|\n # if @plant.foreman_id.eql?(params[:plant][:foreman_id])\n if @plant.update(plant_params)\n\n format.html {redirect_to \"/projects/#{@project.id}/plants\", notice: 'Plant was successfully updated.'}\n format.json {render :show, status: :ok, location: @plant}\n else\n format.html {render :edit}\n format.json {render json: @plant.errors, status: :unprocessable_entity}\n end\n\n end\n\n end", "def update\n @commission_fixing = CommissionFixing.find(params[:id])\n if @commission_fixing.update_attributes(params[:commission_fixing])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@commission_fixing.errors)\n end \n end", "def update\n if @backlog_item.item_type == \"sprint\"\n if params.has_key?(\"start_date\") && params.has_key?(\"end_date\")\n @backlog_item.update(info: {start_date: params[:start], end_date: params[:end]}.to_json)\n end\n\n if params[:backlog_item][:status] == 'failed'\n @stories = BacklogItem.where(\n \"item_type = 'story' AND (NOT status = 'product') AND parent_id = ?\",\n params[:id]\n )\n\n @stories.each do |story|\n story.update(status: \"product\", parent_id: @backlog_item[:parent_id])\n end\n end\n else\n if @backlog_item.item_type == \"task\" && params[:status] == \"done\"\n @tasks = BacklogItem.where(\n \"item_type = 'task' AND (Not status = 'done') AND parent_id = ? AND id !=?\",\n params[:parent_id], params[:id]\n )\n if(@tasks.size == 0)\n @story = BacklogItem.where(\n \"id = ?\", params[:parent_id]\n ).take\n time = Time.now.strftime(\"%Y/%m/%d %H:%M:%S\")\n @story.update(info: {end_date: time}.to_json)\n end\n end\n end\n\n respond_to do |format|\n if @backlog_item.update(backlog_item_all_params)\n format.html { redirect_to @backlog_item, notice: 'Backlog item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @backlog_item.errors, status: :unprocessable_entity }\n end\n end\n\n if @backlog_item.item_type == \"story\"\n if params[:backlog_item][:status] == 'done'\n time = Time.now.strftime(\"%Y/%m/%d %H:%M:%S\");\n @backlog_item.update(info: {end_date: time}.to_json)\n end\n end\n end", "def update\n if @time_period.update(time_period_params)\n render :show, status: :ok, location: @time_period\n else\n render json: @time_period.errors, status: :unprocessable_entity\n end\n end", "def update\n @job = Job.find(params[:id])\n #@job.last_finish = nil\n @job.started_once = false\n respond_to do |format|\n if @job.update_attributes(params[:job])\n if @job.childs\n recursive_change_supplier(@job, @job.supplier)\n end\n format.html { redirect_to(@job.parent.present? ? supplier_job_path(params[:supplier_id], @job.parent.id) : supplier_jobs_path(params[:supplier_id]), :notice => 'Задача успешно обновлена') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n if @bill.update_attributes(params[:period])\n format.html { redirect_to @bill, notice: t('activerecord.attributes.bill.successfully') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n sub_cluster = params[\"dtcstaff\"][\"sub_cluster\"]\n @dtc_staff.subcluster(sub_cluster) \n respond_to do |format|\n if @dtc_staff.update(params[:dtc_staff])\n format.html { redirect_to dtc_staffs_url, notice: 'Route Updated' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dtc_staff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @parent_types = ParentType.all\n @parent_type = ParentType.find(params[:id])\n\n @parent_type.update_attributes(parent_type_params)\n\n=begin\n respond_to do |format|\n if @parent_type.update(parent_type_params)\n format.html { redirect_to @parent_type, notice: 'Parent type was successfully updated.' }\n format.json { render :show, status: :ok, location: @parent_type }\n else\n format.html { render :edit }\n format.json { render json: @parent_type.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "def update\n @period = @cursus.periods.find(params[:id])\n\n respond_to do |format|\n if @period.update_attributes(params[:period])\n flash[:notice] = 'Period was successfully updated.'\n format.html { redirect_to( cursus_periods_path(@cursus) ) }\n format.xml { head :ok }\n else\n format.js do\n render :status => 500, :partial => \"error_partial\"\n end\n format.xml { render :xml => @period.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @klass.update(klass_params)\n format.html { redirect_to management_klasses_path }\n format.json { render :json => @klass.to_json(include: :period), status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @klass.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, CompetenceTierGroup\n \n @competence_tier_group.update!(competence_tier_group_params)\n render json: {status: :ok}\n end", "def update\n respond_to do |format|\n if @franchisee.update(franchisee_params)\n @franchisee.parent = params[:parent] if params[:parent] \n @franchisee.update(parent: @franchisee.parent)\n @franchisee.update(no_of_owners: FranchiseeOwner.where(franchisee_id: @franchisee.id).count, latest_renewal: @franchisee.franchisee_agreement.renewal_date)\n @franchisee.franchisee_agreement.update(no_of_installment: InstallmentDetail.where(franchisee_id: @franchisee.id).count.to_i)\n format.html { redirect_to franchisees_url, notice: 'Franchisee was successfully updated.' }\n format.json { render :show, status: :ok, location: @franchisee }\n else\n format.html { render :edit }\n format.json { render json: @franchisee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # { subsection:\n # {\n # \"id\" : id\n # \"subsection_datum_id\":references\n # }\n # }\n if @subsection.update_attributes(params[:module])\n head :no_content\n else\n render json: @subsection.errors.full_messages,\n status: :unprocessable_entity\n end\n end", "def update\n redirect_to(root_url) && return unless current_user.can_edit_patient?\n\n content = params.require(:patient).permit(:id).merge!(allowed_params)\n patient = current_user.get_patient(content[:id])\n laboratory = params.permit(laboratory: %i[id lab_type specimen_collection report result])[:laboratory]\n common_exposure_cohorts = params.permit(common_exposure_cohorts: [%i[id cohort_type cohort_name cohort_location]])[:common_exposure_cohorts]\n other_updates = {}\n # If we failed to find a subject given the id, redirect to index\n redirect_to(root_url) && return if patient.nil?\n\n # Update first positive lab if present\n if laboratory.present?\n # If the laboratory id is not provided, redirect to index\n redirect_to(root_url) && return unless laboratory.key?(:id)\n\n # If we failed to find a laboratory given the id, redirect to index\n first_positive_lab = patient.laboratories.find(laboratory[:id])\n redirect_to(root_url) && return if first_positive_lab.blank?\n\n first_positive_lab.update(laboratory)\n History.lab_result(patient: patient, created_by: current_user.email, comment: \"User edited a lab result (ID: #{laboratory[:id]}).\")\n end\n\n # Update common exposure cohorts if present (need to use nil? check instead of empty?/present? for deletions)\n unless common_exposure_cohorts.nil?\n original_cohort_ids = patient.common_exposure_cohorts.pluck(:id)\n updated_cohort_ids = common_exposure_cohorts.pluck(:id)\n deleted_cohort_ids = original_cohort_ids - updated_cohort_ids\n\n # Save old cohort data for history\n deleted_cohorts = patient.common_exposure_cohorts.where(id: deleted_cohort_ids)\n other_updates[:common_exposure_cohorts] = { created: [], updated: [], deleted: deleted_cohorts.map(&:attributes).map(&:symbolize_keys) }\n\n # Update cohorts\n common_exposure_cohorts.each do |cohort|\n sanitized_cohort = cohort.slice(*%i[cohort_type cohort_name cohort_location])\n if cohort[:id]\n other_updates[:common_exposure_cohorts][:updated] << [patient.common_exposure_cohorts.find_by(id: cohort[:id]), sanitized_cohort]\n patient.common_exposure_cohorts.find_by(id: cohort[:id]).update(sanitized_cohort)\n else\n other_updates[:common_exposure_cohorts][:created] << patient.common_exposure_cohorts.create(sanitized_cohort)\n end\n end\n\n # Delete cohorts\n deleted_cohorts.destroy_all\n end\n\n # Propagate desired fields to household except jurisdiction_id\n propagated_fields = params[:propagated_fields]\n unless propagated_fields.empty?\n propagated_content = content.select { |field| propagated_fields.include?(field) && field != 'jurisdiction_id' }\n patient.dependents_exclude_self.update(propagated_content)\n end\n\n # If the assigned jurisdiction is updated, verify that the jurisdiction exists and that it is assignable by the current user, update history and propagate\n if content[:jurisdiction_id] && content[:jurisdiction_id] != patient.jurisdiction_id\n if current_user.jurisdiction.subtree_ids.include?(content[:jurisdiction_id].to_i)\n old_jurisdiction = patient.jurisdiction[:path]\n new_jurisdiction = Jurisdiction.find(content[:jurisdiction_id])[:path]\n transfer = Transfer.create!(patient: patient, from_jurisdiction: patient.jurisdiction, to_jurisdiction_id: content[:jurisdiction_id], who: current_user)\n comment = \"User changed Jurisdiction from \\\"#{old_jurisdiction}\\\" to \\\"#{new_jurisdiction}\\\".\"\n history = History.monitoring_change(patient: patient, created_by: current_user.email, comment: comment)\n if propagated_fields.include?('jurisdiction_id')\n dependents_exclude_hoh = patient.dependents_exclude_self\n dependents_exclude_hoh.update(jurisdiction_id: content[:jurisdiction_id])\n dependents_exclude_hoh.each do |group_member|\n propagated_history = history.dup\n propagated_history.patient = group_member\n propagated_history.comment = \"System changed Jurisdiction from \\\"#{old_jurisdiction}\\\" to \\\"#{new_jurisdiction}\\\" because User updated Jurisdiction\n for another member in this monitoree's household and chose to update this field for all household members.\"\n propagated_history.save\n propagated_transfer = transfer.dup\n propagated_transfer.patient = group_member\n propagated_transfer.save\n end\n end\n else\n content[:jurisdiction_id] = patient.jurisdiction_id\n end\n end\n\n # If the assigned user is updated, update history and propagate\n if content[:assigned_user] && content[:assigned_user] != patient.assigned_user\n old_assigned_user = patient.assigned_user || ''\n new_assigned_user = content[:assigned_user] || ''\n comment = \"User changed Assigned User from \\\"#{old_assigned_user}\\\" to \\\"#{new_assigned_user}\\\".\"\n history = History.monitoring_change(patient: patient, created_by: current_user.email, comment: comment)\n if propagated_fields.include?('assigned_user')\n dependents_exclude_hoh = patient.dependents_exclude_self\n dependents_exclude_hoh.update(assigned_user: content[:assigned_user])\n dependents_exclude_hoh.each do |group_member|\n propagated_history = history.dup\n propagated_history.patient = group_member\n propagated_history.comment = \"System changed Assigned User from \\\"#{old_assigned_user}\\\" to \\\"#{new_assigned_user}\\\" because User updated Assigned\n User for another member in this monitoree's household and chose to update this field for all household members.\"\n propagated_history.save\n end\n end\n end\n\n # Update patient history with detailed edit diff\n patient_before = patient.dup\n\n render(json: patient.errors, status: :unprocessable_entity) and return unless patient.update(content)\n\n allowed_fields = allowed_params&.keys&.reject { |apk| %w[jurisdiction_id assigned_user].include? apk }\n Patient.detailed_history_edit(patient_before, patient, allowed_fields, other_updates, current_user.email)\n # Add a history update for any changes from moving from isolation to exposure\n patient.update_patient_history_for_isolation(patient_before, content[:isolation]) unless content[:isolation].nil?\n\n render json: patient\n end", "def update\n @fdn_org_hierarchy = Fdn::OrgHierarchy.find(params[:id])\n\n respond_to do |format|\n if @fdn_org_hierarchy.update_attributes(fdn_org_hierarchy_params)\n format.html { render :js => view_context.close_window_show_tips('parent.MAIN_LAYER_WINDOW', '组织架构修改成功!') }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fdn_org_hierarchy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @child_dupa2 = ChildDupa2.find(params[:id])\n\n respond_to do |format|\n if @child_dupa2.update_attributes(params[:child_dupa2])\n format.html { redirect_to(@child_dupa2, :notice => 'Child dupa2 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @child_dupa2.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n @bookid = params[:id]\n @childid = params[:hire][:childid]\n\n respond_to do |format|\n if @hire.update(hire_params)\n format.html { redirect_to @hire, notice: \"Updated! Nice work.\" }\n format.js.coffee { }\n format.json { render :show, status: :ok, location: @hire }\n else\n format.html { render :edit }\n format.json { render json: @hire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n\n respond_to do |format|\n if @early_pregnancy.update_attributes(params[:early_pregnancy])\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n begin\n cp = child_params\n cp[:code] = cp[:code].strip\n updated = @child.update(cp)\n rescue ActiveRecord::RecordNotUnique => e\n @child.errors[:base] << e.message\n updated = false\n rescue => e\n @child.errors[:base] << e.message\n updated = false\n end\n if updated\n format.html { redirect_to @child, notice: tr(\"child_updated\")}\n else\n format.html { render :edit }\n end\n end\n end", "def update\n @updateTenants = []\n Tenant.all.each do |t|\n if @expense.year == t.expenseyear\n @updateTenants << t\n end\n end\n\n respond_to do |format|\n if @expense.update(expense_params)\n b_id = Building.search(@expense.buildinginfo)\n Building.find_by(id: b_id).expenses << @expense\n @updateTenants.each do |t|\n t.expenseyear = @expense.year\n t.save\n end\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @period.update(period_params)\n format.html { redirect_to school_period_path(@period.school, @period), notice: 'Period was successfully updated.' }\n format.json { render :show, status: :ok, location: school_period_path(@period.school, @period) }\n else\n format.html { render :edit }\n format.json { render json: @period.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @periods = args[:periods] if args.key?(:periods)\n end", "def update!(**args)\n @periods = args[:periods] if args.key?(:periods)\n end", "def update!(**args)\n @periods = args[:periods] if args.key?(:periods)\n end", "def update!(**args)\n @periods = args[:periods] if args.key?(:periods)\n end", "def update\n @req_breakdown = ReqBreakdown.find(params[:id])\n\n respond_to do |format|\n if @req_breakdown.update_attributes(params[:req_breakdown])\n flash[:notice] = 'ReqBreakdown was successfully updated.'\n format.html { redirect_to(admin_req_breakdown_url(@req_breakdown)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @req_breakdown.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @registration_period.update_attributes(registration_period_params)\n format.html { redirect_to @registration_period, notice: 'Registration period was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @registration_period.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prd_attribute = PrdAttribute.find(params[:id])\n\n @prd_attribute.code = params[:prd_attribute]['code']\n @prd_attribute.name = params[:prd_attribute]['name']\n @prd_attribute.rollover = params[:prd_attribute]['rollover']\n @prd_attribute.description = params[:prd_attribute]['description']\n @prd_attribute.status_id = params[:prd_attribute]['status'].to_i\n @prd_attribute.prd_type = params[:prd_attribute]['prd_type']\n @prd_attribute.bill_type_id = params[:prd_attribute]['bill_type'].to_i\n\n @prd_attribute.service_type_id = params[:prd_attribute]['service_type'].to_i\n @prd_attribute.monthly_fee = params[:prd_attribute]['monthly_fee']\n @prd_attribute.subscription_fee = params[:prd_attribute]['subscription_fee']\n @prd_attribute.target_user = params[:prd_attribute]['target_user']\n @prd_attribute.start_date = params[:prd_attribute]['start_date']\n @prd_attribute.end_date = params[:prd_attribute]['end_date']\n\n respond_to do |format|\n format.html { \n \t\tif @prd_attribute.update_attributes(params[:prd_attribute]) \n\t\t\t\tredirect_to(@prd_attribute, :notice => 'PrdAttribute was successfully updated.') \n\t\t\telse \n \t\tformat.html { render :action => \"edit\" }\n\t\t\tend\n\t\t}\n format.xml { \n \t\tif @prd_attribute.update_attributes(params[:prd_attribute]) \n\t\t\t\thead :ok \n\t\t\telse \t\t\n \t\tformat.xml { render :xml => @prd_attribute.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\t}\n format.json {\n\n # bundle일 때에는 해당하는 product id들을 저장\n #\n if params[:prd_attribute]['prd_type'].upcase == 'BUNDLE'\n product_ids = []\n\t\t\t params[:prd_attribute]['ref_products'].each do |product_id|\n\t\t\t product_ids << product_id['product_id'].to_s\n\t\t end\n\t\t @prd_attribute.ref_products = product_ids.join(\",\")\n end \n\t\t @prd_attribute.save\n\n # product devices 저장\n #\n if not params[:prd_attribute]['devices'].blank?\n params[:prd_attribute]['devices'].each do |device|\n prd_attribute_device = PrdAttributeDevice.new\n prd_attribute_device.code_factor_id = device['device'].to_i\n prd_attribute_device.prd_attribute_id = @prd_attribute.id\n prd_attribute_device.product_id = @prd_attribute.products[0].id\n prd_attribute_device.save!\n end\n end\n\n \t#render :json => @prd_attribute.errors, :status => :unprocessable_entity\n\t\t\thead :ok\n\t }\n end\n end", "def update\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.find(params[:id])\n\n respond_to do |format|\n if @absence_request.update_attributes(params[:absence_request])\n format.html { redirect_to(@absence_request, :notice => 'Absence request was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @absence_request.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @submission = Submission.find(params[:submission_id])\n @award_deadline = Deadline.order(\"created_at\").last\n respond_to do |format|\n if @submission_detail.update(submission_detail_params)\n format.html { redirect_to submission_submission_detail_path(@submission, @submission_detail), notice: 'Document was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @submission_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @child_guardian_relationship = ChildGuardianRelationship.find(params[:id])\n\n respond_to do |format|\n if @child_guardian_relationship.update_attributes(params[:child_guardian_relationship])\n format.html { redirect_to @child_guardian_relationship, notice: 'Child guardian relationship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @child_guardian_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @period.update(period_params)\n format.html { redirect_to @period, notice: 'Period was successfully updated.' }\n format.json { render :show, status: :ok, location: @period }\n else\n format.html { render :edit }\n format.json { render json: @period.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @parent.update(parent_params)\n format.html { redirect_to @parent, notice: 'Parent was successfully updated.' }\n format.json { render :show, status: :ok, location: @parent }\n else\n format.html { render :edit }\n format.json { render json: @parent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @parent.update(parent_params)\n format.html { redirect_to @parent, notice: 'Parent was successfully updated.' }\n format.json { render :show, status: :ok, location: @parent }\n else\n format.html { render :edit }\n format.json { render json: @parent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @parent.update(parent_params)\n format.html { redirect_to @parent, notice: 'Parent was successfully updated.' }\n format.json { render :show, status: :ok, location: @parent }\n else\n format.html { render :edit }\n format.json { render json: @parent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @parent.update(parent_params)\n format.html { redirect_to @parent, notice: 'Parent was successfully updated.' }\n format.json { render :show, status: :ok, location: @parent }\n else\n format.html { render :edit }\n format.json { render json: @parent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @parent.update(parent_params)\n format.html { redirect_to @parent, notice: 'Parent was successfully updated.' }\n format.json { render :show, status: :ok, location: @parent }\n else\n format.html { render :edit }\n format.json { render json: @parent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n # workflow_attributes = workflow_params\n # step_definitions_attributes = workflow_attributes.delete(\"step_definitions\")\n\n # StepDefinition.updateStepDefinitions(step_definitions_attributes)\n\n respond_to do |format|\n if @workflow.update(workflow_params)\n format.html { redirect_to @workflow, notice: 'Workflow was successfully updated.' }\n format.json { render :show, status: :ok, location: @workflow }\n else\n format.html { render :edit }\n format.json { render json: @workflow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, :notice => 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @list = HqProc.all(:order => :name)\n @object = HqProc.find(params[:id])\n \n \n params[:hq_proc][:new_hq_rsrc_usage_attributes] ||= {}\n params[:hq_proc][:existing_hq_rsrc_usage_attributes] ||= {}\n params[:hq_proc][:assigned_hq_rsrc] ||= {}\n \n @hq_proc = HqProc.find(params[:id])\n respond_to do |format|\n if @hq_proc.update_attributes(params[:hq_proc])\n @objects = HqProc.all(:order => 'name ASC')\n flash[:notice] = 'Process was successfully updated.'\n format.js if request.xhr?\n format.html { redirect_to :action => \"edit\", :template => 'reflected/edit' }\n format.xml { head :ok }\n else\n messages = '<ul>Error:'\n @hq_proc.errors.full_messages.each {|msg| messages += '<li>'+msg+'</li>'}\n messages += '</ul>'\n flash[:notice] = messages\n format.html { redirect_to :action => \"edit\", :template => 'reflected/edit' }\n format.xml { render :xml => @hq_proc.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.67845225", "0.65882975", "0.5952047", "0.5906064", "0.5891917", "0.58800197", "0.5846184", "0.5816103", "0.57868135", "0.57868135", "0.5779291", "0.57763153", "0.57748663", "0.57711303", "0.5764872", "0.57530135", "0.569453", "0.569018", "0.5684128", "0.56793714", "0.56503886", "0.56448567", "0.56442106", "0.564324", "0.5639619", "0.56338304", "0.56324697", "0.5618143", "0.5586726", "0.55772746", "0.5568726", "0.5564062", "0.5560729", "0.55572414", "0.5534116", "0.5530247", "0.55279136", "0.55122864", "0.54810584", "0.5475093", "0.54738915", "0.54643273", "0.5459419", "0.544591", "0.54346853", "0.54311955", "0.5412134", "0.53973275", "0.5393608", "0.53919435", "0.5388229", "0.5369303", "0.5369183", "0.53594637", "0.5343638", "0.53340745", "0.53337336", "0.5331089", "0.53244895", "0.53139436", "0.53110105", "0.53104657", "0.5309157", "0.5306864", "0.530372", "0.5299285", "0.5297759", "0.5293528", "0.5288552", "0.52749884", "0.5269173", "0.5262951", "0.5260991", "0.52505875", "0.5249206", "0.52480763", "0.52395034", "0.52333635", "0.52319455", "0.52236825", "0.522153", "0.5217846", "0.5217846", "0.5217846", "0.5217846", "0.52165216", "0.52159864", "0.5212011", "0.52079225", "0.5207122", "0.5205394", "0.51981455", "0.51934284", "0.51934284", "0.51934284", "0.51934284", "0.51934284", "0.5189234", "0.51888514", "0.5186095" ]
0.7338058
0
DELETE /child_development_periods/1 DELETE /child_development_periods/1.json
def destroy @child_development_period.destroy respond_to do |format| format.html { redirect_to child_development_periods_url, notice: 'Child development period was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @child_development.destroy\n respond_to do |format|\n format.html { redirect_to child_developments_url, notice: 'Child development was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_period.destroy\n format.json { head :no_content }\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @tb_period = TbPeriod.find(params[:id])\n @tb_period.destroy\n\n respond_to do |format|\n format.html { redirect_to tb_periods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @schedule_cohort_period.destroy\n respond_to do |format|\n format.html { redirect_to schedule_cohort_periods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @periods_group.destroy\n respond_to do |format|\n format.html { redirect_to company_periods_groups_path(@company), notice: 'Periods group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @period.destroy\n\n head :no_content\n end", "def destroy\n @incrustation_tmp = @incrustation.dup\n @incrustation.destroy\n record_activity(@incrustation_tmp)\n respond_to do |format|\n format.html { redirect_to admin_incrustations_url, notice: 'Вставка была успешно удалена.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dev_activity.destroy\n respond_to do |format|\n format.html { redirect_to dev_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource_period = ResourcePeriod.find(params[:id])\n @resource_period.destroy\n\n respond_to do |format|\n format.html { redirect_to(resource_periods_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @weekly_expectation = WeeklyExpectation.find(params[:id])\n @weekly_expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to weekly_expectations_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 @condominium_child.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete\n # mark each version of the history as deleted, not just the most recent one\n @patient.histories\n .where(original_comment_id: @history.original_comment_id)\n .update_all({ deleted_by: current_user.email, delete_reason: params.permit(:delete_reason)[:delete_reason], updated_at: DateTime.now })\n end", "def destroy\n @daily_step.destroy\n respond_to do |format|\n format.html { redirect_to daily_steps_url, notice: 'Daily step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @doseperiod.destroy\n respond_to do |format|\n format.html { redirect_to doseperiods_url, notice: 'Combination dose was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacation_period.destroy\n respond_to do |format|\n format.html { redirect_to vacation_periods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dec_form_child = DecFormChild.find(params[:id])\n @dec_form_child.destroy\n\n respond_to do |format|\n format.html { redirect_to dec_form_children_url }\n format.json { head :ok }\n end\n end", "def destroy\n @lifespan = Lifespan.find(params[:id])\n @lifespan.destroy\n\n respond_to do |format|\n format.html { redirect_to lifespans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @child.destroy\n respond_to do |format|\n format.html { redirect_to children_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @child_record.destroy\n respond_to do |format|\n format.html { redirect_to child_records_url, notice: 'Child record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @req_breakdown = ReqBreakdown.find(params[:id])\n @req_breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { head :ok }\n end\n end", "def maintenance_delete(statuspage_id, maintenance_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['maintenance_id'] = maintenance_id\n\n request :method => :post,\n :url => @url + 'maintenance/delete',\n :payload => data\n end", "def destroy\n @downtime.destroy\n respond_to do |format|\n format.html { redirect_to downtimes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @period = Period.find(params[:id])\n @period.destroy\n\n head :no_content\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @batch_day.destroy\n respond_to do |format|\n format.html { redirect_to batch_days_url, notice: 'Batch day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend", "def destroy\n @period_milk_production.destroy\n respond_to do |format|\n format.html { redirect_to period_milk_productions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @traumatized_child.destroy\n respond_to do |format|\n format.html { redirect_to traumatized_children_url, notice: \"Traumatized child was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @three_child_history.destroy\n respond_to do |format|\n format.html { redirect_to three_child_histories_url, notice: 'Three child history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @business_dash.destroy\n respond_to do |format|\n format.html { redirect_to business_dashes_url, notice: 'Business dash was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_award_cfg.destroy\n respond_to do |format|\n format.html { redirect_to admin_activity_award_cfgs_url, notice: 'Activity award cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n @periodicity.destroy\n respond_to do |format|\n format.html { redirect_to periodicities_url, notice: 'Periodicity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @study_period.destroy\n respond_to do |format|\n format.html { redirect_to study_year_study_periods_path(current_user.current_year) }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_frequency_period.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_frequency_periods_url, notice: 'Frequency period was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @theory_day.destroy\n respond_to do |format|\n format.html { redirect_to theory_days_url }\n format.json { head :no_content }\n end\n end", "def destroy\n child = @enrollment.child\n @enrollment.destroy\n respond_to do |format|\n format.html { redirect_to child, notice: tr(\"enrollment_destroyed\") }\n end\n end", "def destroy\n @complexity = Complexity.find(params[:id])\n @complexity.destroy\n\n respond_to do |format|\n format.html { redirect_to complexities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @child = Child.find(params[:id])\n @child.destroy\n\n respond_to do |format|\n format.html { redirect_to children_url }\n format.json { head :ok }\n end\n end", "def destroy\n @dailyStanding = DailyStanding.find(params[:id])\n @dailyStanding.destroy\n\n respond_to do |format|\n format.html { redirect_to dailyStanding_url }\n format.json { head :ok }\n end\n end", "def destroy\n @childmaster = Childmaster.find(params[:id])\n @childmaster.destroy\n\n respond_to do |format|\n format.html { redirect_to childmasters_url }\n format.json { head :no_content }\n end\n end", "def running_delete\n base_delete(params, \"Running\")\n end", "def delete_array_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/arrays/#{args[:arrayId]}\", args)\nend", "def destroy\n @historial_odt = HistorialOdt.find(params[:id])\n @historial_odt.destroy\n\n respond_to do |format|\n format.html { redirect_to historial_odts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_development.destroy\n respond_to do |format|\n format.html { redirect_to activity_developments_url, notice: 'Activity development was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to chronicles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ministry_child.destroy\n respond_to do |format|\n format.html { redirect_to ministry_children_url, notice: 'Ministry child was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget_line.destroy\n respond_to do |format|\n format.html { redirect_to budget_lines_url, notice: 'Budget line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @child_dupa2 = ChildDupa2.find(params[:id])\n @child_dupa2.destroy\n\n respond_to do |format|\n format.html { redirect_to(child_dupa2s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @period.destroy\n respond_to do |format|\n format.html { redirect_to periods_url, notice: 'Periode Telah Dihapus.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @development = Development.find(params[:id])\n @development.destroy\n\n respond_to do |format|\n format.html { redirect_to developments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @monitor_child_relationship = MonitorChildRelationship.find(params[:id])\n @monitor_child_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to monitor_child_relationships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # workaround\n @manifestation.identifiers.destroy_all\n @manifestation.creators.destroy_all\n @manifestation.contributors.destroy_all\n @manifestation.publishers.destroy_all\n @manifestation.bookmarks.destroy_all if defined?(EnjuBookmark)\n @manifestation.reload\n @manifestation.destroy\n\n respond_to do |format|\n format.html { redirect_to manifestations_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.manifestation')) }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_data_payment.destroy\n respond_to do |format|\n format.html { redirect_to daily_data_payments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient_condition = PatientCondition.find(params[:id])\n @patient_condition.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_conditions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @department_entry.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @dis_doseperiod.destroy\n respond_to do |format|\n format.html { redirect_to dis_doseperiods_url, notice: 'Dis doseperiod was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend", "def destroy\n @battery_weekly_test = BatteryWeeklyTest.find(params[:id])\n @battery_weekly_test.destroy\n\n respond_to do |format|\n format.html { redirect_to battery_battery_weekly_tests_url(@battery_weekly_test.battery) }\n format.json { head :no_content }\n end\n end", "def destroy\n @doctorsheduling = Doctorsheduling.find(params[:id])\n @doctorsheduling.destroy\n\n respond_to do |format|\n format.html { redirect_to(doctorshedulings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @version = Version.find(params[:id])\n @versionconfig = @version.version_configurations.destroy_all\n @version.destroy\n\n respond_to do |format|\n format.html { redirect_to [@application, @version] }\n format.json { head :no_content }\n end\n end", "def destroy\n @stage_duration = StageDuration.find(params[:id])\n @stage_duration.destroy\n\n respond_to do |format|\n format.html { redirect_to stage_durations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @therapy_budget.destroy\n respond_to do |format|\n format.html { redirect_to therapy_budgets_url, notice: 'Therapy budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @registration_period.destroy\n\n respond_to do |format|\n format.html { redirect_to registration_periods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_horoscope = DailyHoroscope.find(params[:id])\n @daily_horoscope.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_horoscopes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @allocation_date = AllocationDate.find(params[:id])\n @allocation_date.destroy\n\n respond_to do |format|\n format.html { redirect_to allocation_dates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @child.destroy\n respond_to do |format|\n format.html { redirect_to children_url, notice: 'Child was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @child.destroy\n respond_to do |format|\n format.html { redirect_to children_url, notice: 'Child was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dependence.destroy\n respond_to do |format|\n format.html { redirect_to dependences_url, notice: 'Dependence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n contest = @data_set.contest\n @data_set.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Data set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @child.destroy\n respond_to do |format|\n format.html { redirect_to children_url, notice: \"Child was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @child.destroy\n respond_to do |format|\n format.html { redirect_to children_url, notice: \"Child was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @backend_conf_activity.destroy\n respond_to do |format|\n format.html { redirect_to backend_conf_activities_url, notice: 'Conf activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @periodic.destroy\n respond_to do |format|\n format.html { redirect_to periodics_url, notice: 'Periodic was successfully destroyed.' }\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 @subcriterion = Subcriterion.find(params[:id])\n @subcriterion.destroy\n\n respond_to do |format|\n format.html { redirect_to subcriteria_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @period = Period.find(params[:id])\n @period.destroy\n\n respond_to do |format|\n format.html { redirect_to(periods_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @child_fatality.destroy\n respond_to do |format|\n format.html { redirect_to child_fatalities_url, notice: 'Child fatality was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @corporate_health_package_child = CorporateHealthPackageChild.find(params[:id])\n @corporate_health_package_child.destroy\n\n respond_to do |format|\n format.html { redirect_to(corporate_health_package_children_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @diseasesubset.destroy\n respond_to do |format|\n format.html { redirect_to diseasesubsets_url, notice: 'Diseasesubset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n puts @iot_datum.count\n if @iot_datum.count > 0\n @deleted_rec = IotDatum.new\n @deleted_rec.workbench_number = @iot_datum.workbench_number\n @deleted_rec.part_number = @iot_datum.part_number\n @deleted_rec.target = @iot_datum.target\n @deleted_rec.lot_size = @iot_datum.lot_size\n @deleted_rec.employee_name = @iot_datum.employee_name\n @deleted_rec.shift = @iot_datum.shift\n @deleted_rec.device_id = @iot_datum.device_id\n @deleted_rec.count = @iot_datum.count\n @deleted_rec.status = 'Deleted'\n @deleted_rec.save!\n @iot_datum.destroy\n else\n @iot_datum.destroy\n end\n respond_to do |format|\n format.html { redirect_to iot_data_url, notice: 'Planner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @key_donor_child.destroy\n respond_to do |format|\n format.html { redirect_to key_donor_children_url, notice: 'Key donor child was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_cron_request.destroy\n respond_to do |format|\n format.html { redirect_to admin_cron_requests_url, notice: I18n.t('admin.cron_requests.destroy.message.success') }\n format.json { head :no_content }\n end\n end", "def test_delete_with_child_locked\n setup_hr\n dicks_resume = 'httplock/hr/recruiting/resumes/dick'\n dicks_locktoken = lock(dicks_resume, :depth => 0).token\n\n response = @request.delete('httplock/hr/recruiting/resumes')\n assert_equal '207', response.status\n # TODO: check that response body contains a 423 for dicks_resume\n\n response = @request.get(dicks_resume)\n assert_equal '200', response.status\n\n response = @request.delete('httplock/hr/recruiting/resumes', :if => { dicks_resume => dicks_locktoken })\n assert_equal '204', response.status\n\n response = @request.get(dicks_resume)\n assert_equal '404', response.status\n\n # cleanup\n delete_coll('httplock')\n end", "def destroy\n @branch = Branch.find(params[:id])\n @parentTitle = Branch.find(params[:id]).uid\n Branch.where(parent: @parentTitle).delete_all\n @branch.destroy\n render :json => @branch.to_json\n end", "def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(@line.budget) }\n format.json { head :no_content }\n end\n end", "def destroy\n @parent_of.destroy\n respond_to do |format|\n format.html { redirect_to parent_ofs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @child.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Child was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_happiness.destroy\n respond_to do |format|\n format.html { redirect_to daily_happinesses_url, notice: 'Daily happiness was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @absent.destroy\n\n respond_to do |format|\n format.html { redirect_to absents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @period.destroy\n respond_to do |format|\n format.html { redirect_to @period.school, notice: 'Period was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reporting_period.destroy\n respond_to do |format|\n format.html { redirect_to reporting_periods_url, notice: \"Reporting period was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @toyota_epc_part_number_list_child = ToyotaEpc::PartNumberListChild.find(params[:id])\n @toyota_epc_part_number_list_child.destroy\n\n respond_to do |format|\n format.html { redirect_to toyota_epc_part_number_list_children_url }\n format.json { head :ok }\n end\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def destroy\n @pharmacy_payment_child = PharmacyPaymentChild.find(params[:id])\n @pharmacy_payment_child.destroy\n\n respond_to do |format|\n format.html { redirect_to(pharmacy_payment_children_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.67801195", "0.6630352", "0.65738904", "0.630415", "0.6274035", "0.6260299", "0.6245592", "0.62078804", "0.62060404", "0.62027586", "0.6199362", "0.6194493", "0.6173129", "0.616686", "0.61606044", "0.61487687", "0.61401623", "0.61256933", "0.6103577", "0.6099403", "0.6096628", "0.6081792", "0.6080497", "0.60741574", "0.60728854", "0.60710406", "0.60634893", "0.6047073", "0.6042659", "0.6034799", "0.60286564", "0.60237765", "0.6023457", "0.60167617", "0.60167176", "0.60138917", "0.60073334", "0.6001823", "0.59941447", "0.59936404", "0.59929526", "0.5992852", "0.5984699", "0.5984502", "0.5980803", "0.59789777", "0.5977203", "0.5977073", "0.59719276", "0.5970565", "0.5964835", "0.596268", "0.5961432", "0.5956382", "0.5955732", "0.5953969", "0.595156", "0.59409225", "0.59381545", "0.59350747", "0.59332484", "0.5932611", "0.59284216", "0.5927597", "0.59261924", "0.59234834", "0.5923003", "0.591924", "0.5916807", "0.5916807", "0.59158295", "0.5914934", "0.5914865", "0.5914865", "0.5914657", "0.5909818", "0.5902274", "0.5902274", "0.5902274", "0.5902274", "0.59009403", "0.58957523", "0.5888267", "0.5885307", "0.58843285", "0.58812994", "0.5878798", "0.58783597", "0.58758", "0.58742523", "0.58725363", "0.58716625", "0.5868058", "0.58676213", "0.58648556", "0.5863517", "0.586251", "0.58617705", "0.5860787", "0.58591914" ]
0.7515133
0
Use callbacks to share common setup or constraints between actions.
def set_child_development_period @child_development_period = ChildDevelopmentPeriod.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 child_development_period_params params.require(:child_development_period).permit(:date_contol, :weight, :size, :head_circunference, :child_id, :child_development_id, :medical_center_id, :doctor_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Update an existing LDAP identity source Update the configuration of an existing LDAP identity source. You may wish to verify the new configuration using the POST /aaa/ldapidentitysources?action=probe API before changing the configuration.
def create_or_update_ldap_identity_source(ldap_identity_source_id, ldap_identity_source, opts = {}) data, _status_code, _headers = create_or_update_ldap_identity_source_with_http_info(ldap_identity_source_id, ldap_identity_source, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_or_update_ldap_identity_source_with_http_info(ldap_identity_source_id, ldap_identity_source, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source\"\n end\n # verify the required parameter 'ldap_identity_source' is set\n if @api_client.config.client_side_validation && ldap_identity_source.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ldap_identity_source)\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#create_or_update_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_d_b_source(project_name, source_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:path]['SourceName'] = source_name\n\t\targs[:pattern] = '/projects/[ProjectName]/sources/[SourceName]'\n\t\targs[:query]['Action'] = 'UpdateDBSource'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :source\n\t\t\targs[:body]['Source'] = optional[:source]\n\t\tend\n\t\tself.run(args)\n\tend", "def update_sourced_attributes source_name=nil\n if source_name\n @sources[source_name].apply\n else\n @sources.values.each(&:apply)\n end\n end", "def update!(**args)\n @mysql_source_config = args[:mysql_source_config] if args.key?(:mysql_source_config)\n @oracle_source_config = args[:oracle_source_config] if args.key?(:oracle_source_config)\n @postgresql_source_config = args[:postgresql_source_config] if args.key?(:postgresql_source_config)\n @source_connection_profile = args[:source_connection_profile] if args.key?(:source_connection_profile)\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to edit_source_path, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to(@source, :notice => 'Source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to(@source, :notice => 'Source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @student_source = StudentSource.find(params[:id])\n\n respond_to do |format|\n if @student_source.update_attributes(params[:student_source])\n format.html { redirect_to @student_source, notice: 'Student source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @datasource = Datasource.find(params[:id])\n @datasource.update_attributes!(params[:datasource])\n\n flash[:notice] = \"Updated datasource properties\"\n redirect_to datasource_path(:id => @datasource)\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to @source, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @source = Source.find(params[:id])\n create_or_update\n end", "def update\n source = Source.find_by(id: params[:source_id])\n unless source_params[:name] == source.name\n render json: {error: 'You cannot change external api for a source, you must delete that source if you wish to remove it'}, status: :unprocessable_entity\n end\n if source && all_sources.include?(source)\n source.access_token = source_params[:access_token]\n source.account_id = source_params[:account_id]\n if source.save\n render json: { id: source.id, name: source.name, access_token: source.access_token, account_id: source.account_id }, status: :found\n else\n render json: source.errors, status: :unprocessable_entity\n end\n else\n render json: {error: \"could not find source with source id of #{params[:source_id]}\"}, status: :not_found\n end\n end", "def update\n @lookup_source = LookupSource.find(params[:id])\n\n respond_to do |format|\n if @lookup_source.update(params[:lookup_source], :without_protection => true)\n format.html { redirect_to(@lookup_source, :notice => 'Lookup source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lookup_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_record\n return false if @label.to_s.empty?\n\n atts = {}\n\n atts[\"status\"] = @status if @status\n atts[\"sync_period\"] = @sync_period if @sync_period\n atts[\"service_level\"] = @service_level if @service_level\n atts[\"password\"] = @password if @password\n atts[\"provider_token\"] = @provider_token if @provider_token\n atts[\"provider_token_secret\"] = @provider_token_secret if @provider_token_secret\n atts[\"provider_consumer_key\"] = @provider_consumer_key if @provider_consumer_key\n\n response = post(\"/2.0/accounts/#{@account_id}/sources/#{@label}\", atts)\n response['success']\n end", "def update!(**args)\n @data_source_ids = args[:data_source_ids] if args.key?(:data_source_ids)\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n end", "def update\n @proxy_source = ProxySource.find(params[:id])\n\n respond_to do |format|\n if @proxy_source.update_attributes(params[:proxy_source])\n format.html { redirect_to @proxy_source, notice: 'Proxy source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proxy_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n end", "def update(source)\n ifolder = get(source.name)\n raise \"No such ifolder: #{source.name}\" unless ifolder.exists?\n ifolder.update(source) \n end", "def update\n @annotation_source = AnnotationSource.find(params[:id])\n\n respond_to do |format|\n if @annotation_source.update_attributes(params[:annotation_source])\n format.html { redirect_to @annotation_source, notice: 'Annotation source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @annotation_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @source.update(source_params)\n format.html { redirect_to edit_source_path(@source), notice: 'Source was successfully updated.' }\n format.json { render :show, status: :ok, location: @source }\n else\n format.html { render :edit }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @source_trust = args[:source_trust] if args.key?(:source_trust)\n end", "def update\n @rep_source = RepSource.find(params[:id])\n\n respond_to do |format|\n if @rep_source.update_attributes(params[:rep_source])\n format.html { redirect_to(@rep_source, :notice => 'Rep source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rep_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @entity_sources = args[:entity_sources] if args.key?(:entity_sources)\n end", "def update\n respond_to do |format|\n if @data_source.update(data_source_params)\n format.html { redirect_to @data_source, notice: 'Data source was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_source }\n else\n format.html { render :edit }\n format.json { render json: @data_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event_source = EventSource.find(params[:id])\n\n respond_to do |format|\n if @event_source.update_attributes(params[:event_source])\n format.html { redirect_to @event_source, :notice => 'Event source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @payment_source = PaymentSource.find(params[:id])\n\n respond_to do |format|\n if @payment_source.update_attributes(params[:payment_source])\n format.html { redirect_to @payment_source, notice: 'Payment source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_source_contact(id, data)\n update(\"sourceContacts\", id, data).first\n end", "def update\n @enquiry_source = EnquirySource.find(params[:id])\n\n respond_to do |format|\n if @enquiry_source.update_attributes(params[:enquiry_source])\n format.html { redirect_to @enquiry_source, notice: 'Enquiry source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enquiry_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n sources = Fenix::Store::Converter::Flattener.sources params[:sources]\n respond_to do |format|\n if @host.set_sources sources\n format.html { redirect_to source, notice: 'SourceList was successfully updated.' }\n format.json { render :show, status: :ok, location: source }\n else\n format.html { render :edit }\n format.json { render json: source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n track_activity(@source, 'update', @source.previous_changes)\n format.html { redirect_to @source, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_to(new_source)\n update_deps_from(new_source)\n update_files_from(new_source)\n update_metadata_from(new_source)\n end", "def update\n authorize_user!\n params = clean_authors\n\n @source.update_image\n\n respond_to do |format|\n if @source.update(source_params)\n format.html { redirect_to source_path(@source), notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(source)\n copy(source, false)\n end", "def update!(**args)\n @source_object_identifier = args[:source_object_identifier] if args.key?(:source_object_identifier)\n end", "def update\n respond_to do |format|\n if @cla_source.update(cla_source_params)\n format.html { redirect_to @cla_source, notice: 'Cla source was successfully updated.' }\n format.json { render :show, status: :ok, location: @cla_source }\n else\n format.html { render :edit }\n format.json { render json: @cla_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n @source = args[:source] if args.key?(:source)\n end", "def update\n flash[:notice] = 'The source was successfully updated.' if source.update_attributes(params[:source])\n respond_with(source)\n end", "def update!(**args)\n @caller_id_source = args[:caller_id_source] if args.key?(:caller_id_source)\n end", "def probe_unconfigured_ldap_identity_source_probe_identity_source_with_http_info(ldap_identity_source, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source' is set\n if @api_client.config.client_side_validation && ldap_identity_source.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=probe_identity_source'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ldap_identity_source)\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceProbeResults')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_unconfigured_ldap_identity_source_probe_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @source_type_metadata = args[:source_type_metadata] if args.key?(:source_type_metadata)\n end", "def update!(**args)\n @source_type = args[:source_type] if args.key?(:source_type)\n end", "def update!(**args)\n @destinations = args[:destinations] if args.key?(:destinations)\n @sources = args[:sources] if args.key?(:sources)\n end", "def update!(**args)\n @filter_options = args[:filter_options] if args.key?(:filter_options)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @filter_options = args[:filter_options] if args.key?(:filter_options)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @source_type = args[:source_type] if args.key?(:source_type)\n @source_value = args[:source_value] if args.key?(:source_value)\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @source_field = args[:source_field] if args.key?(:source_field)\n end", "def update!(**args)\n @original_lookup_token = args[:original_lookup_token] if args.key?(:original_lookup_token)\n @previous_person_id = args[:previous_person_id] if args.key?(:previous_person_id)\n @source_ids = args[:source_ids] if args.key?(:source_ids)\n end", "def update!(**args)\n @crowding_config = args[:crowding_config] if args.key?(:crowding_config)\n @scoring_config = args[:scoring_config] if args.key?(:scoring_config)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @crowding_config = args[:crowding_config] if args.key?(:crowding_config)\n @scoring_config = args[:scoring_config] if args.key?(:scoring_config)\n @source = args[:source] if args.key?(:source)\n end", "def update\n @content_source = ContentSource.find(params[:id])\n\n respond_to do |format|\n if @content_source.update_attributes(params[:content_source])\n format.html { redirect_to(@content_source, :notice => 'Content source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @content_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end", "def update!(**args)\n @data_sources = args[:data_sources] if args.key?(:data_sources)\n @google_account = args[:google_account] if args.key?(:google_account)\n @third_party_account = args[:third_party_account] if args.key?(:third_party_account)\n end", "def update\n @rss_source = RssSource.find(params[:id])\n\n respond_to do |format|\n if @rss_source.update_attributes(params[:rss_source])\n format.html { redirect_to @rss_source, :notice => 'Rss source was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @rss_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @portal_source.update(portal_source_params)\n format.html { redirect_to @portal_source, notice: 'Portal source was successfully updated.' }\n format.json { render :show, status: :ok, location: @portal_source }\n else\n format.html { render :edit }\n format.json { render json: @portal_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n @source = args[:source] if args.key?(:source)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update\n @payment_source_type = PaymentSourceType.find(params[:id])\n\n respond_to do |format|\n if @payment_source_type.update_attributes(params[:payment_source_type])\n format.html { redirect_to @payment_source_type, notice: 'Payment source type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment_source_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subject_source = SubjectSource.find(params[:id])\n\n respond_to do |format|\n if @subject_source.update_attributes(params[:subject_source])\n format.html { redirect_to @subject_source, notice: 'Subject source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subject_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @allow_list_source_data = args[:allow_list_source_data] if args.key?(:allow_list_source_data)\n @confidence = args[:confidence] if args.key?(:confidence)\n @install = args[:install] if args.key?(:install)\n @is_categorical = args[:is_categorical] if args.key?(:is_categorical)\n @media_provider_source_data = args[:media_provider_source_data] if args.key?(:media_provider_source_data)\n @source = args[:source] if args.key?(:source)\n @teleport_source_data = args[:teleport_source_data] if args.key?(:teleport_source_data)\n end", "def update\n @recipesource = Recipesource.find(params[:id])\n\n respond_to do |format|\n if @recipesource.update_attributes(params[:recipesource])\n format.html { redirect_to @recipesource, notice: 'Recipesource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipesource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kernel_source.update(kernel_source_params)\n format.html { redirect_to @kernel_source, notice: \"Kernel source was successfully updated.\" }\n format.json { render :show, status: :ok, location: @kernel_source }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @kernel_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @config = args[:config] if args.key?(:config)\n @destination_store = args[:destination_store] if args.key?(:destination_store)\n @resource_filter = args[:resource_filter] if args.key?(:resource_filter)\n end", "def update\n @source_code = SourceCode.find(params[:id])\n\n respond_to do |format|\n if @source_code.update_attributes(params[:source_code])\n flash[:notice] = 'SourceCode was successfully updated.'\n format.html { redirect_to(@source_code) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source_code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @funding_source = FundingSource.find(params[:id])\n\n respond_to do |format|\n if @funding_source.update_attributes(params[:funding_source])\n flash[:notice] = 'FundingSource was successfully updated.'\n format.html { redirect_to([:admin, @funding_source]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @funding_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @creator_source = CreatorSource.find(params[:id])\n\n respond_to do |format|\n if @creator_source.update_attributes(params[:creator_source])\n format.html { redirect_to @creator_source, notice: 'Creator source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @creator_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @enabled_providers = args[:enabled_providers] if args.key?(:enabled_providers)\n @provider_configs = args[:provider_configs] if args.key?(:provider_configs)\n @state = args[:state] if args.key?(:state)\n end", "def update!(**args)\n @request_id = args[:request_id] if args.key?(:request_id)\n @source_address_group = args[:source_address_group] if args.key?(:source_address_group)\n end", "def update!(**args)\n @common_data_source = args[:common_data_source] if args.key?(:common_data_source)\n @host_app_data_source = args[:host_app_data_source] if args.key?(:host_app_data_source)\n end", "def update_source(source, instance)\n begin\n data = instance.fetch\n publish_data(source, data)\n ensure\n @after_update_callback.call\n end\n rescue Exception => ex\n puts \"Failed to update #{source}: #{ex.message}\"\n puts ex.backtrace\n @error_callback.call(ex)\n end", "def update\n @ldap_entry = LdapEntry.find(params[:id])\n\n respond_to do |format|\n if @ldap_entry.update_attributes(ldap_entry_params)\n format.html { redirect_to ldap_entries_path, notice: 'Ldap entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ldap_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @inventory_source_ids = args[:inventory_source_ids] if args.key?(:inventory_source_ids)\n end", "def update_sources\n return if @source_urls.nil?\n @source_urls.each do |source_url|\n source = config.sources_manager.source_with_name_or_url(source_url)\n dir = source.specs_dir\n UI.puts \"Updating a source at #{dir} for #{source}\"\n git!(%W(-C #{dir} pull))\n end\n end", "def update\n @source_code_type = SourceCodeType.find(params[:id])\n\n respond_to do |format|\n if @source_code_type.update_attributes(params[:source_code_type])\n flash[:notice] = 'SourceCodeType was successfully updated.'\n format.html { redirect_to(@source_code_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source_code_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @data_source_type.update(data_source_type_params)\n format.html { redirect_to @data_source_type, notice: 'Data source type was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_source_type }\n else\n format.html { render :edit }\n format.json { render json: @data_source_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @google_service_type = args[:google_service_type] if args.key?(:google_service_type)\n @source_ip = args[:source_ip] if args.key?(:source_ip)\n end", "def update!(**args)\n @product_source = args[:product_source] if args.key?(:product_source)\n end", "def update\n respond_to do |format|\n if @study_source.update(study_source_params)\n format.html { redirect_to @study_source, notice: 'Study source was successfully updated.' }\n format.json { render :show, status: :ok, location: @study_source }\n else\n format.html { render :edit }\n format.json { render json: @study_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @email_config = EmailConfig.find(params[:id])\n\n if @email_config.update_attributes(params[:email_config])\n save_success\n redirect_to adm_path\n else\n save_error\n render :action => \"edit\"\n end\n end", "def update!(**args)\n @inbound_saml_configs = args[:inbound_saml_configs] if args.key?(:inbound_saml_configs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @account_id = args[:account_id] if args.key?(:account_id)\n @custom_data_source_id = args[:custom_data_source_id] if args.key?(:custom_data_source_id)\n @errors = args[:errors] if args.key?(:errors)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @status = args[:status] if args.key?(:status)\n @upload_time = args[:upload_time] if args.key?(:upload_time)\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n @url = args[:url] if args.key?(:url)\n end", "def update\n respond_to do |format|\n if @dis_datasource.update(dis_datasource_params)\n format.html { redirect_to @dis_datasource, notice: 'Dis datasource was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_datasource }\n else\n format.html { render :edit }\n format.json { render json: @dis_datasource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @owner = args[:owner] if args.key?(:owner)\n @source = args[:source] if args.key?(:source)\n end", "def update\n @game_source = GameSource.find(params[:id])\n\n respond_to do |format|\n if @game_source.update_attributes(params[:game_source])\n format.html { redirect_to @game_source, notice: 'Game source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @error_message = args[:error_message] if args.key?(:error_message)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @error_message = args[:error_message] if args.key?(:error_message)\n @source = args[:source] if args.key?(:source)\n end", "def update\n respond_to do |format|\n if @founding_source.update(founding_source_params)\n format.html { redirect_to @founding_source, notice: 'Founding source was successfully updated.' }\n format.json { render :show, status: :ok, location: @founding_source }\n else\n format.html { render :edit }\n format.json { render json: @founding_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @config = args[:config] if args.key?(:config)\n @destination_store = args[:destination_store] if args.key?(:destination_store)\n @filter_config = args[:filter_config] if args.key?(:filter_config)\n end", "def probe_configured_ldap_identity_source_probe_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_configured_ldap_identity_source_probe ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_configured_ldap_identity_source_probe\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}?action=probe'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceProbeResults')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_configured_ldap_identity_source_probe\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @city_source.update(city_source_params)\n format.html { redirect_to @city_source, notice: 'City source was successfully updated.' }\n format.json { render :show, status: :ok, location: @city_source }\n else\n format.html { render :edit }\n format.json { render json: @city_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @external_identity = args[:external_identity] if args.key?(:external_identity)\n @resolution_status_code = args[:resolution_status_code] if args.key?(:resolution_status_code)\n end", "def update!(**args)\n @external_identity = args[:external_identity] if args.key?(:external_identity)\n @resolution_status_code = args[:resolution_status_code] if args.key?(:resolution_status_code)\n end", "def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end", "def update!(**args)\n @device_configs = args[:device_configs] if args.key?(:device_configs)\n end", "def update!(**args)\n @sgn_domain = args[:sgn_domain] if args.key?(:sgn_domain)\n @sgn_pk = args[:sgn_pk] if args.key?(:sgn_pk)\n end", "def update!(**args)\n @sgn_domain = args[:sgn_domain] if args.key?(:sgn_domain)\n @sgn_pk = args[:sgn_pk] if args.key?(:sgn_pk)\n end", "def search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}/search'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'filter_value'] = opts[:'filter_value'] if !opts[:'filter_value'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceSearchResultList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#search_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @ldap_auth_header = Irm::LdapAuthHeader.find(params[:id])\n\n respond_to do |format|\n if @ldap_auth_header.update_attributes(params[:irm_ldap_auth_header])\n format.html { redirect_to({:action => \"index\"}, :notice => t(:successfully_updated)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ldap_auth_header.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.62206554", "0.6021797", "0.5928674", "0.58621365", "0.58536536", "0.5799265", "0.5799265", "0.5796554", "0.57776475", "0.57416844", "0.5730712", "0.571053", "0.57081944", "0.5688139", "0.56732684", "0.5635068", "0.5635068", "0.56345046", "0.5632087", "0.5632087", "0.56264746", "0.56180197", "0.5604808", "0.55961525", "0.5562353", "0.5558088", "0.55575454", "0.55486375", "0.55328", "0.5517039", "0.54901046", "0.5488502", "0.5472042", "0.5471919", "0.54476416", "0.54243755", "0.54145885", "0.5406249", "0.53857434", "0.5360342", "0.53555393", "0.5353847", "0.53399915", "0.5332278", "0.5328537", "0.53231525", "0.53231525", "0.5319395", "0.5308997", "0.5256251", "0.52527404", "0.52527404", "0.5241506", "0.5235395", "0.5233275", "0.5232489", "0.52259386", "0.5218665", "0.5213317", "0.520412", "0.5204029", "0.5190662", "0.5185433", "0.5180458", "0.51655555", "0.5146587", "0.51326776", "0.5131898", "0.5120443", "0.51193863", "0.5106773", "0.51059604", "0.51038986", "0.509759", "0.50960284", "0.50772774", "0.50642556", "0.5062689", "0.50615746", "0.50465125", "0.5037984", "0.5033608", "0.5032437", "0.5027998", "0.5001609", "0.49846342", "0.49814638", "0.49814638", "0.497547", "0.4973821", "0.49638528", "0.49435744", "0.4942268", "0.4942268", "0.49267718", "0.49267718", "0.4916812", "0.4916812", "0.49121678", "0.49100316" ]
0.5492074
30
Update an existing LDAP identity source Update the configuration of an existing LDAP identity source. You may wish to verify the new configuration using the POST /aaa/ldapidentitysources?action&x3D;probe API before changing the configuration.
def create_or_update_ldap_identity_source_with_http_info(ldap_identity_source_id, ldap_identity_source, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source ...' end # verify the required parameter 'ldap_identity_source_id' is set if @api_client.config.client_side_validation && ldap_identity_source_id.nil? fail ArgumentError, "Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source" end # verify the required parameter 'ldap_identity_source' is set if @api_client.config.client_side_validation && ldap_identity_source.nil? fail ArgumentError, "Missing the required parameter 'ldap_identity_source' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source" end # resource path local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(ldap_identity_source) auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'LdapIdentitySource') if @api_client.config.debugging @api_client.config.logger.debug "API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#create_or_update_ldap_identity_source\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_d_b_source(project_name, source_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:path]['SourceName'] = source_name\n\t\targs[:pattern] = '/projects/[ProjectName]/sources/[SourceName]'\n\t\targs[:query]['Action'] = 'UpdateDBSource'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :source\n\t\t\targs[:body]['Source'] = optional[:source]\n\t\tend\n\t\tself.run(args)\n\tend", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to edit_source_path, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_sourced_attributes source_name=nil\n if source_name\n @sources[source_name].apply\n else\n @sources.values.each(&:apply)\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to(@source, :notice => 'Source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to(@source, :notice => 'Source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @mysql_source_config = args[:mysql_source_config] if args.key?(:mysql_source_config)\n @oracle_source_config = args[:oracle_source_config] if args.key?(:oracle_source_config)\n @postgresql_source_config = args[:postgresql_source_config] if args.key?(:postgresql_source_config)\n @source_connection_profile = args[:source_connection_profile] if args.key?(:source_connection_profile)\n end", "def update\n @student_source = StudentSource.find(params[:id])\n\n respond_to do |format|\n if @student_source.update_attributes(params[:student_source])\n format.html { redirect_to @student_source, notice: 'Student source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n format.html { redirect_to @source, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @datasource = Datasource.find(params[:id])\n @datasource.update_attributes!(params[:datasource])\n\n flash[:notice] = \"Updated datasource properties\"\n redirect_to datasource_path(:id => @datasource)\n end", "def update\n @lookup_source = LookupSource.find(params[:id])\n\n respond_to do |format|\n if @lookup_source.update(params[:lookup_source], :without_protection => true)\n format.html { redirect_to(@lookup_source, :notice => 'Lookup source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lookup_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n source = Source.find_by(id: params[:source_id])\n unless source_params[:name] == source.name\n render json: {error: 'You cannot change external api for a source, you must delete that source if you wish to remove it'}, status: :unprocessable_entity\n end\n if source && all_sources.include?(source)\n source.access_token = source_params[:access_token]\n source.account_id = source_params[:account_id]\n if source.save\n render json: { id: source.id, name: source.name, access_token: source.access_token, account_id: source.account_id }, status: :found\n else\n render json: source.errors, status: :unprocessable_entity\n end\n else\n render json: {error: \"could not find source with source id of #{params[:source_id]}\"}, status: :not_found\n end\n end", "def update\n @source = Source.find(params[:id])\n create_or_update\n end", "def update_record\n return false if @label.to_s.empty?\n\n atts = {}\n\n atts[\"status\"] = @status if @status\n atts[\"sync_period\"] = @sync_period if @sync_period\n atts[\"service_level\"] = @service_level if @service_level\n atts[\"password\"] = @password if @password\n atts[\"provider_token\"] = @provider_token if @provider_token\n atts[\"provider_token_secret\"] = @provider_token_secret if @provider_token_secret\n atts[\"provider_consumer_key\"] = @provider_consumer_key if @provider_consumer_key\n\n response = post(\"/2.0/accounts/#{@account_id}/sources/#{@label}\", atts)\n response['success']\n end", "def update!(**args)\n @data_source_ids = args[:data_source_ids] if args.key?(:data_source_ids)\n end", "def update\n @proxy_source = ProxySource.find(params[:id])\n\n respond_to do |format|\n if @proxy_source.update_attributes(params[:proxy_source])\n format.html { redirect_to @proxy_source, notice: 'Proxy source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proxy_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n end", "def update\n @annotation_source = AnnotationSource.find(params[:id])\n\n respond_to do |format|\n if @annotation_source.update_attributes(params[:annotation_source])\n format.html { redirect_to @annotation_source, notice: 'Annotation source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @annotation_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @source.update(source_params)\n format.html { redirect_to edit_source_path(@source), notice: 'Source was successfully updated.' }\n format.json { render :show, status: :ok, location: @source }\n else\n format.html { render :edit }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(source)\n ifolder = get(source.name)\n raise \"No such ifolder: #{source.name}\" unless ifolder.exists?\n ifolder.update(source) \n end", "def update\n @rep_source = RepSource.find(params[:id])\n\n respond_to do |format|\n if @rep_source.update_attributes(params[:rep_source])\n format.html { redirect_to(@rep_source, :notice => 'Rep source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rep_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @source_trust = args[:source_trust] if args.key?(:source_trust)\n end", "def update\n respond_to do |format|\n if @data_source.update(data_source_params)\n format.html { redirect_to @data_source, notice: 'Data source was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_source }\n else\n format.html { render :edit }\n format.json { render json: @data_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event_source = EventSource.find(params[:id])\n\n respond_to do |format|\n if @event_source.update_attributes(params[:event_source])\n format.html { redirect_to @event_source, :notice => 'Event source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_source_contact(id, data)\n update(\"sourceContacts\", id, data).first\n end", "def update!(**args)\n @entity_sources = args[:entity_sources] if args.key?(:entity_sources)\n end", "def update\n sources = Fenix::Store::Converter::Flattener.sources params[:sources]\n respond_to do |format|\n if @host.set_sources sources\n format.html { redirect_to source, notice: 'SourceList was successfully updated.' }\n format.json { render :show, status: :ok, location: source }\n else\n format.html { render :edit }\n format.json { render json: source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @payment_source = PaymentSource.find(params[:id])\n\n respond_to do |format|\n if @payment_source.update_attributes(params[:payment_source])\n format.html { redirect_to @payment_source, notice: 'Payment source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @enquiry_source = EnquirySource.find(params[:id])\n\n respond_to do |format|\n if @enquiry_source.update_attributes(params[:enquiry_source])\n format.html { redirect_to @enquiry_source, notice: 'Enquiry source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enquiry_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize_user!\n params = clean_authors\n\n @source.update_image\n\n respond_to do |format|\n if @source.update(source_params)\n format.html { redirect_to source_path(@source), notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @source = Source.find(params[:id])\n\n respond_to do |format|\n if @source.update_attributes(params[:source])\n track_activity(@source, 'update', @source.previous_changes)\n format.html { redirect_to @source, notice: 'Source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_or_update_ldap_identity_source(ldap_identity_source_id, ldap_identity_source, opts = {})\n data, _status_code, _headers = create_or_update_ldap_identity_source_with_http_info(ldap_identity_source_id, ldap_identity_source, opts)\n data\n end", "def update_to(new_source)\n update_deps_from(new_source)\n update_files_from(new_source)\n update_metadata_from(new_source)\n end", "def update(source)\n copy(source, false)\n end", "def update\n respond_to do |format|\n if @cla_source.update(cla_source_params)\n format.html { redirect_to @cla_source, notice: 'Cla source was successfully updated.' }\n format.json { render :show, status: :ok, location: @cla_source }\n else\n format.html { render :edit }\n format.json { render json: @cla_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n flash[:notice] = 'The source was successfully updated.' if source.update_attributes(params[:source])\n respond_with(source)\n end", "def update!(**args)\n @source_object_identifier = args[:source_object_identifier] if args.key?(:source_object_identifier)\n end", "def update!(**args)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @caller_id_source = args[:caller_id_source] if args.key?(:caller_id_source)\n end", "def update!(**args)\n @filter_options = args[:filter_options] if args.key?(:filter_options)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @filter_options = args[:filter_options] if args.key?(:filter_options)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @destinations = args[:destinations] if args.key?(:destinations)\n @sources = args[:sources] if args.key?(:sources)\n end", "def update!(**args)\n @source_type = args[:source_type] if args.key?(:source_type)\n @source_value = args[:source_value] if args.key?(:source_value)\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @source_field = args[:source_field] if args.key?(:source_field)\n end", "def update\n @rss_source = RssSource.find(params[:id])\n\n respond_to do |format|\n if @rss_source.update_attributes(params[:rss_source])\n format.html { redirect_to @rss_source, :notice => 'Rss source was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @rss_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @source_type = args[:source_type] if args.key?(:source_type)\n end", "def update!(**args)\n @source_type_metadata = args[:source_type_metadata] if args.key?(:source_type_metadata)\n end", "def update\n @content_source = ContentSource.find(params[:id])\n\n respond_to do |format|\n if @content_source.update_attributes(params[:content_source])\n format.html { redirect_to(@content_source, :notice => 'Content source was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @content_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def probe_unconfigured_ldap_identity_source_probe_identity_source_with_http_info(ldap_identity_source, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source' is set\n if @api_client.config.client_side_validation && ldap_identity_source.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=probe_identity_source'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ldap_identity_source)\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceProbeResults')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_unconfigured_ldap_identity_source_probe_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @original_lookup_token = args[:original_lookup_token] if args.key?(:original_lookup_token)\n @previous_person_id = args[:previous_person_id] if args.key?(:previous_person_id)\n @source_ids = args[:source_ids] if args.key?(:source_ids)\n end", "def update\n respond_to do |format|\n if @portal_source.update(portal_source_params)\n format.html { redirect_to @portal_source, notice: 'Portal source was successfully updated.' }\n format.json { render :show, status: :ok, location: @portal_source }\n else\n format.html { render :edit }\n format.json { render json: @portal_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @crowding_config = args[:crowding_config] if args.key?(:crowding_config)\n @scoring_config = args[:scoring_config] if args.key?(:scoring_config)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @crowding_config = args[:crowding_config] if args.key?(:crowding_config)\n @scoring_config = args[:scoring_config] if args.key?(:scoring_config)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @debug_options = args[:debug_options] if args.key?(:debug_options)\n @source = args[:source] if args.key?(:source)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update!(**args)\n @data_sources = args[:data_sources] if args.key?(:data_sources)\n @google_account = args[:google_account] if args.key?(:google_account)\n @third_party_account = args[:third_party_account] if args.key?(:third_party_account)\n end", "def update\n @subject_source = SubjectSource.find(params[:id])\n\n respond_to do |format|\n if @subject_source.update_attributes(params[:subject_source])\n format.html { redirect_to @subject_source, notice: 'Subject source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subject_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recipesource = Recipesource.find(params[:id])\n\n respond_to do |format|\n if @recipesource.update_attributes(params[:recipesource])\n format.html { redirect_to @recipesource, notice: 'Recipesource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipesource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @source_code = SourceCode.find(params[:id])\n\n respond_to do |format|\n if @source_code.update_attributes(params[:source_code])\n flash[:notice] = 'SourceCode was successfully updated.'\n format.html { redirect_to(@source_code) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source_code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @payment_source_type = PaymentSourceType.find(params[:id])\n\n respond_to do |format|\n if @payment_source_type.update_attributes(params[:payment_source_type])\n format.html { redirect_to @payment_source_type, notice: 'Payment source type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment_source_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end", "def update!(**args)\n @allow_list_source_data = args[:allow_list_source_data] if args.key?(:allow_list_source_data)\n @confidence = args[:confidence] if args.key?(:confidence)\n @install = args[:install] if args.key?(:install)\n @is_categorical = args[:is_categorical] if args.key?(:is_categorical)\n @media_provider_source_data = args[:media_provider_source_data] if args.key?(:media_provider_source_data)\n @source = args[:source] if args.key?(:source)\n @teleport_source_data = args[:teleport_source_data] if args.key?(:teleport_source_data)\n end", "def update\n @ldap_entry = LdapEntry.find(params[:id])\n\n respond_to do |format|\n if @ldap_entry.update_attributes(ldap_entry_params)\n format.html { redirect_to ldap_entries_path, notice: 'Ldap entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ldap_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kernel_source.update(kernel_source_params)\n format.html { redirect_to @kernel_source, notice: \"Kernel source was successfully updated.\" }\n format.json { render :show, status: :ok, location: @kernel_source }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @kernel_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @config = args[:config] if args.key?(:config)\n @destination_store = args[:destination_store] if args.key?(:destination_store)\n @resource_filter = args[:resource_filter] if args.key?(:resource_filter)\n end", "def update\n @funding_source = FundingSource.find(params[:id])\n\n respond_to do |format|\n if @funding_source.update_attributes(params[:funding_source])\n flash[:notice] = 'FundingSource was successfully updated.'\n format.html { redirect_to([:admin, @funding_source]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @funding_source.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @creator_source = CreatorSource.find(params[:id])\n\n respond_to do |format|\n if @creator_source.update_attributes(params[:creator_source])\n format.html { redirect_to @creator_source, notice: 'Creator source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @creator_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @source_code_type = SourceCodeType.find(params[:id])\n\n respond_to do |format|\n if @source_code_type.update_attributes(params[:source_code_type])\n flash[:notice] = 'SourceCodeType was successfully updated.'\n format.html { redirect_to(@source_code_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @source_code_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @request_id = args[:request_id] if args.key?(:request_id)\n @source_address_group = args[:source_address_group] if args.key?(:source_address_group)\n end", "def update!(**args)\n @enabled_providers = args[:enabled_providers] if args.key?(:enabled_providers)\n @provider_configs = args[:provider_configs] if args.key?(:provider_configs)\n @state = args[:state] if args.key?(:state)\n end", "def update_source(source, instance)\n begin\n data = instance.fetch\n publish_data(source, data)\n ensure\n @after_update_callback.call\n end\n rescue Exception => ex\n puts \"Failed to update #{source}: #{ex.message}\"\n puts ex.backtrace\n @error_callback.call(ex)\n end", "def update\n respond_to do |format|\n if @data_source_type.update(data_source_type_params)\n format.html { redirect_to @data_source_type, notice: 'Data source type was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_source_type }\n else\n format.html { render :edit }\n format.json { render json: @data_source_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @inventory_source_ids = args[:inventory_source_ids] if args.key?(:inventory_source_ids)\n end", "def update!(**args)\n @common_data_source = args[:common_data_source] if args.key?(:common_data_source)\n @host_app_data_source = args[:host_app_data_source] if args.key?(:host_app_data_source)\n end", "def update_sources\n return if @source_urls.nil?\n @source_urls.each do |source_url|\n source = config.sources_manager.source_with_name_or_url(source_url)\n dir = source.specs_dir\n UI.puts \"Updating a source at #{dir} for #{source}\"\n git!(%W(-C #{dir} pull))\n end\n end", "def update\n @email_config = EmailConfig.find(params[:id])\n\n if @email_config.update_attributes(params[:email_config])\n save_success\n redirect_to adm_path\n else\n save_error\n render :action => \"edit\"\n end\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n @url = args[:url] if args.key?(:url)\n end", "def update\n respond_to do |format|\n if @study_source.update(study_source_params)\n format.html { redirect_to @study_source, notice: 'Study source was successfully updated.' }\n format.json { render :show, status: :ok, location: @study_source }\n else\n format.html { render :edit }\n format.json { render json: @study_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @google_service_type = args[:google_service_type] if args.key?(:google_service_type)\n @source_ip = args[:source_ip] if args.key?(:source_ip)\n end", "def update!(**args)\n @account_id = args[:account_id] if args.key?(:account_id)\n @custom_data_source_id = args[:custom_data_source_id] if args.key?(:custom_data_source_id)\n @errors = args[:errors] if args.key?(:errors)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @status = args[:status] if args.key?(:status)\n @upload_time = args[:upload_time] if args.key?(:upload_time)\n end", "def update!(**args)\n @inbound_saml_configs = args[:inbound_saml_configs] if args.key?(:inbound_saml_configs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update\n respond_to do |format|\n if @dis_datasource.update(dis_datasource_params)\n format.html { redirect_to @dis_datasource, notice: 'Dis datasource was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_datasource }\n else\n format.html { render :edit }\n format.json { render json: @dis_datasource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @product_source = args[:product_source] if args.key?(:product_source)\n end", "def update!(**args)\n @owner = args[:owner] if args.key?(:owner)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @error_message = args[:error_message] if args.key?(:error_message)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @error_message = args[:error_message] if args.key?(:error_message)\n @source = args[:source] if args.key?(:source)\n end", "def update\n @game_source = GameSource.find(params[:id])\n\n respond_to do |format|\n if @game_source.update_attributes(params[:game_source])\n format.html { redirect_to @game_source, notice: 'Game source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @founding_source.update(founding_source_params)\n format.html { redirect_to @founding_source, notice: 'Founding source was successfully updated.' }\n format.json { render :show, status: :ok, location: @founding_source }\n else\n format.html { render :edit }\n format.json { render json: @founding_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ldap_auth_header = Irm::LdapAuthHeader.find(params[:id])\n\n respond_to do |format|\n if @ldap_auth_header.update_attributes(params[:irm_ldap_auth_header])\n format.html { redirect_to({:action => \"index\"}, :notice => t(:successfully_updated)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ldap_auth_header.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @config = args[:config] if args.key?(:config)\n @destination_store = args[:destination_store] if args.key?(:destination_store)\n @filter_config = args[:filter_config] if args.key?(:filter_config)\n end", "def update\n respond_to do |format|\n if @city_source.update(city_source_params)\n format.html { redirect_to @city_source, notice: 'City source was successfully updated.' }\n format.json { render :show, status: :ok, location: @city_source }\n else\n format.html { render :edit }\n format.json { render json: @city_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @external_identity = args[:external_identity] if args.key?(:external_identity)\n @resolution_status_code = args[:resolution_status_code] if args.key?(:resolution_status_code)\n end", "def update!(**args)\n @external_identity = args[:external_identity] if args.key?(:external_identity)\n @resolution_status_code = args[:resolution_status_code] if args.key?(:resolution_status_code)\n end", "def update\n @filter = Object::Filter.find(params[:id])\n @filter.source = @source\n\n respond_to do |format|\n if @filter.update_attributes(params[:filter])\n flash[:notice] = 'Filter was successfully updated.'\n format.html { redirect_to(@source) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @filter.errors, :status => :unprocessable_entity }\n end\n end\n end", "def search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}/search'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'filter_value'] = opts[:'filter_value'] if !opts[:'filter_value'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceSearchResultList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#search_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @data_source_restrictions = args[:data_source_restrictions] if args.key?(:data_source_restrictions)\n @query = args[:query] if args.key?(:query)\n @request_options = args[:request_options] if args.key?(:request_options)\n end", "def update!(**args)\n @data_source_restrictions = args[:data_source_restrictions] if args.key?(:data_source_restrictions)\n @query = args[:query] if args.key?(:query)\n @request_options = args[:request_options] if args.key?(:request_options)\n end", "def update!(**args)\n @sgn_domain = args[:sgn_domain] if args.key?(:sgn_domain)\n @sgn_pk = args[:sgn_pk] if args.key?(:sgn_pk)\n end", "def update!(**args)\n @sgn_domain = args[:sgn_domain] if args.key?(:sgn_domain)\n @sgn_pk = args[:sgn_pk] if args.key?(:sgn_pk)\n end" ]
[ "0.59991425", "0.5871316", "0.5868173", "0.58411664", "0.58411664", "0.58009285", "0.5790004", "0.5766625", "0.57663774", "0.5713809", "0.5705056", "0.56901103", "0.5675639", "0.5654438", "0.5643843", "0.56350017", "0.56350017", "0.5630999", "0.5630999", "0.5622461", "0.56220263", "0.56046253", "0.5592093", "0.5569498", "0.55658174", "0.55494255", "0.55449456", "0.55437666", "0.551887", "0.55108607", "0.5489818", "0.54843324", "0.5483667", "0.5481058", "0.5433679", "0.54269934", "0.5414627", "0.5396981", "0.5390274", "0.5359967", "0.5333927", "0.5331693", "0.5331693", "0.53281915", "0.5305517", "0.53039473", "0.53038883", "0.53026956", "0.52966166", "0.52924675", "0.5282491", "0.523956", "0.5231994", "0.5231849", "0.5231849", "0.52313304", "0.52281654", "0.5212802", "0.520208", "0.5196958", "0.51952773", "0.5186597", "0.5185578", "0.5171895", "0.5170014", "0.5162567", "0.5160993", "0.51436013", "0.5121206", "0.51102674", "0.5105103", "0.51012707", "0.50855166", "0.50845677", "0.50817496", "0.5075778", "0.5050144", "0.50475425", "0.5041419", "0.50412846", "0.5032445", "0.5031683", "0.50314593", "0.5028282", "0.5001997", "0.500074", "0.500074", "0.49962357", "0.4990768", "0.49725688", "0.49560183", "0.49518716", "0.4951483", "0.4951483", "0.49427158", "0.4930217", "0.49178344", "0.49178344", "0.49140444", "0.49140444" ]
0.6223852
0
Delete an LDAP identity source Delete an LDAP identity source. Users defined in that source will no longer be able to access NSX.
def delete_ldap_identity_source(ldap_identity_source_id, opts = {}) delete_ldap_identity_source_with_http_info(ldap_identity_source_id, opts) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.delete_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.delete_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#delete_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n return false if @label.to_s.empty?\n\n response = delete(\"/2.0/accounts/#{@account_id}/sources/#{@label}\")\n @label = '' if response['success']\n \n response['success']\n end", "def delete_d_b_source(project_name, source_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'DELETE'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:path]['SourceName'] = source_name\n\t\targs[:pattern] = '/projects/[ProjectName]/sources/[SourceName]'\n\t\targs[:query]['Action'] = 'DeleteDBSource'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend", "def delete\n result = Base.redis.hdel(:sources, name)\n if result == 1\n delete_all_inputs\n Log.info \"Deleting Source object from Redis: #{name}\"\n else\n raise UnknownSource, \"Cannot delete non-existent Source object in Redis: #{name}\"\n end\n result\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to user_path(current_user), notice: \"Register was deleted!\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @proxy_source = ProxySource.find(params[:id])\n @proxy_source.destroy\n\n respond_to do |format|\n format.html { redirect_to proxy_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ldap_auth_header = Irm::LdapAuthHeader.find(params[:id])\n @ldap_auth_header.destroy\n\n respond_to do |format|\n format.html { redirect_to(ldap_auth_headers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @datasource = Datasource.find(params[:id])\n @datasource.destroy\n\n flash[:notice] = \"Destroyed datasource\"\n redirect_to datasources_path\n end", "def deleteIdentity _args\n \"deleteIdentity _args;\" \n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n authorize_user!\n respond_to do |format|\n format.html { redirect_to sources_path(@source) }\n format.json { head :no_content }\n @source.destroy\n end\n end", "def delete_user(email_address)\n found_user = read_user(email_address)\n if found_user\n Net::LDAP.open(@ldap_conf) do |ldap|\n ldap.delete(:dn => get_DN(found_user[:cn]))\n end\n end\n end", "def destroy\n @rep_source = RepSource.find(params[:id])\n @rep_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(rep_sources_url) }\n format.xml { head :ok }\n end\n end", "def remove(payment_source)\n user.wallet_payment_sources.find_by!(payment_source: payment_source).destroy!\n end", "def destroy\n @lookup_source = LookupSource.find(params[:id])\n @lookup_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n AudioSource.delete( @bundle_source.audio_sources )\n \n corresponding_bundle = @bundle_source.bundle_id\n if( @bundle_source.bundle_id )\n corresponding_bundle = Bundle.find_by_id( @bundle_source.bundle_id )\n if( corresponding_bundle && corresponding_bundle.created_by_user_id == @user.id )\n logger.info(\"****** DESROY invoked ****** \")\n corresponding_bundle.destroy\n end\n end\n\n @bundle_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(bundle_sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction_source.destroy\n flash[:notice] = \"Transaction source was successfully deleted\"\n redirect_to transaction_sources_url\n end", "def destroy\n @identity.destroy\n\n head :no_content\n end", "def destroy\n @data_source.destroy\n respond_to do |format|\n format.html { redirect_to data_sources_url, notice: 'Data source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @data_source.destroy\n respond_to do |format|\n format.html { redirect_to data_sources_url, notice: 'Data source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_source = StudentSource.find(params[:id])\n @student_source.destroy\n\n respond_to do |format|\n format.html { redirect_to student_sources_url }\n format.json { head :no_content }\n end\n end", "def delete_store(uid)\n store = Store.find(uid)\n store.delete!\n end", "def destroy\n @content_source = ContentSource.find(params[:id])\n @content_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(content_sources_url) }\n format.xml { head :ok }\n end\n end", "def sources_id_delete(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_id_delete ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling sources_id_delete\" if id.nil?\n \n # resource path\n path = \"/sources/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:DELETE, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_id_delete. Result: #{result.inspect}\"\n end\n return result\n end", "def destroy\n @cla_source.destroy\n respond_to do |format|\n format.html { redirect_to cla_sources_url, notice: 'Cla source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subject_source = SubjectSource.find(params[:id])\n @subject_source.destroy\n\n respond_to do |format|\n format.html { redirect_to subject_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @identity = Identity.find(params[:id])\n @identity.destroy\n\n respond_to do |format|\n format.html { redirect_to(identities_url) }\n format.xml { head :ok }\n end\n end", "def delete(account_identity, samlidp_identity)\n @client.samlidp.delete(account_identity, samlidp_identity)\n end", "def delete_source_files source\n dir = Conf::directories\n base = File.join(dir.data)\n source.folders.each do |fold|\n url = File.join(dir.store,source.name.to_s,fold)\n delete_files_from url\n url = File.join(dir.backup,source.name.to_s,fold)\n delete_files_from url\n end\n Logger.<<(__FILE__,\"INFO\",\"Deleted files server & backup for #{source.name.to_s}\")\n end", "def destroy\n @source.destroy\n respond_to do |format|\n format.html { redirect_to sources_url, notice: 'Source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(dn)\n @conn.delete :dn => dn\n end", "def destroy\n @annotation_source = AnnotationSource.find(params[:id])\n @annotation_source.destroy\n\n respond_to do |format|\n format.html { redirect_to annotation_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment_source = PaymentSource.find(params[:id])\n @payment_source.destroy\n\n respond_to do |format|\n format.html { redirect_to payment_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kernel_source.destroy\n respond_to do |format|\n format.html { redirect_to kernel_sources_url, notice: \"Kernel source was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @funding_source = FundingSource.find(params[:id])\n @funding_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_funding_sources_url) }\n format.xml { head :ok }\n end\n end", "def delete\n @linked_user.delete(@uri)\n end", "def destroy\n flash[:notice] = 'The source was successfully removed.' if source.destroy\n respond_with(source)\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 delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def remove_source source\n # Check it exists\n fail ArgumentError, \"#{source} must be a string or symbol\" unless (source.responds_to?(:to_s))\n fail ArgumentError, \"#{source} has not been registered\" if @importers[source].nil?\n\n @importers.delete(source)\n @formatters.delete(source)\n end", "def destroy\n @portal_source.destroy\n respond_to do |format|\n format.html { redirect_to portal_sources_url, notice: 'Portal source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @source.destroy\n respond_to do |format|\n format.html { redirect_to sources_url, notice: \"Destroyed source #{@source.cached}\" }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { render action: :show, notice: 'failed to destroy the source, there is likely data associated with it' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"#{uri_prefix}/virtual_dns/#{id}\")\n end", "def destroy\n # TODO: refactor models so that externaluserdomain is in portal namespace?\n # @external_user_domain = Portal::ExternalUserDomain.find(params[:id])\n @external_user_domain = ExternalUserDomain.find(params[:id])\n @external_user_domain.destroy\n\n respond_to do |format|\n format.html { redirect_to(portal_external_user_domains_url) }\n format.xml { head :ok }\n end\n end", "def delete_all\n objs = target\n source.update_attribute(source_attribute, nil)\n objs.each(&:delete)\n end", "def delete(dn)\n log_dispatch(:delete, dn)\n adapter.delete(dn)\n end", "def unsubscribe(source)\n Log.debug(\"Unsubscribing from #{source}\")\n @connection.unsubscribe(source)\n @subscriptions.delete(source)\n end", "def delete_entry( c, dn ) # :yields: connection_info, distinguished_name\n \n self.bind( c.host, c.port, c.credentials, c.databag_name, c.use_tls ) unless @ldap\n @ldap.delete dn: dn\n raise \"Unable to remove record: #{@ldap.get_operation_result.message}\" unless @ldap.get_operation_result.message =~ /(Success|No Such Object)/\n end", "def remove_resource(source_record:)\n ::Pundit.authorize(user, source_record, 'destroy?')\n end", "def destroy\n @data_store = DataStore.find(params[:id])\n @data_store.destroy\n\n respond_to do |format|\n format.html { redirect_to data_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to report_sources_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @event_source = EventSource.find(params[:id])\n @event_source.destroy\n\n respond_to do |format|\n format.html { redirect_to event_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @enquiry_source = EnquirySource.find(params[:id])\n @enquiry_source.destroy\n\n respond_to do |format|\n format.html { redirect_to enquiry_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @identity.destroy\n respond_to do |format|\n format.html { redirect_to identities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dis_datasource.destroy\n respond_to do |format|\n format.html { redirect_to dis_datasources_url, notice: 'Dis datasource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_domain(domain)\n raise MogileFS::ReadOnlyError if readonly?\n ! @backend.delete_domain(:domain => domain).nil?\n end", "def delete(name)\n connect { |connection| connection.delete dn(name) }\n end", "def destroy\n @recipesource = Recipesource.find(params[:id])\n @recipesource.destroy\n\n respond_to do |format|\n format.html { redirect_to recipesources_url }\n format.json { head :no_content }\n end\n end", "def delete(account_identity, federatedsamlidp_identity)\n @client.federatedsamlidp.delete(account_identity, federatedsamlidp_identity)\n end", "def delete_session(env, sid, options)\n @cache.delete(cache_key(sid.private_id))\n @cache.delete(cache_key(sid.public_id))\n generate_sid\n end", "def destroy\n @rss_source = RssSource.find(params[:id])\n @rss_source.destroy\n\n respond_to do |format|\n format.html { redirect_to rss_sources_url }\n format.json { head :ok }\n end\n end", "def delete\n namespace.delete(dn)\n @attributes = (@original_attributes||{}).merge(@attributes)\n @original_attributes = nil\n self\n end", "def destroy\n @data_source_type.destroy\n respond_to do |format|\n format.html { redirect_to data_source_types_url, notice: 'Data source type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def unsubscribe(source)\n #TODO\n end", "def delete\n repository.purge_datastream(:pid => pid, :dsid => dsid) unless self.new?\n digital_object.datastreams.delete(dsid)\n reset_profile_attributes\n self\n end", "def destroy\n @identity = Identity.find(params[:id])\n @identity.destroy\n respond_to do |format|\n format.html { redirect_to identities_url, notice: \"Identity was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @creator_source = CreatorSource.find(params[:id])\n @creator_source.destroy\n\n respond_to do |format|\n format.html { redirect_to creator_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source_master.destroy\n respond_to do |format|\n format.html { redirect_to source_masters_url, notice: \"Source master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @metric_source.destroy\n respond_to do |format|\n format.html { redirect_to metric_sources_url, notice: 'Metric source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_user(id)\n elektron_identity.delete(\"users/#{id}\")\n end", "def remove_email_forward(source)\n validate_list([[\"Source\", source, :email] ])\n\n options = { \"Source\" => source }\n\n connection = Connection.new\n connection.post(\"Domain/EmailForward/Remove\", options)\n end", "def delete_ns(ns, obj)\n primary_sql_key = @schema.primary_sql_key_for_ns(ns)\n h = transform_one_ns(ns, obj)\n raise \"No #{primary_sql_key} found in transform of #{obj.inspect}\" if h[primary_sql_key].nil?\n table_for_ns(ns).where(primary_sql_key.to_sym => h[primary_sql_key]).delete\n end", "def remove_file\n\n @source_files_id = params[:source] + '_files'\n @source = TaliaCore::Source.find(N::URI.from_encoded(params[:source]))\n\n TaliaFile.find(params[:talia_file_uri]).destroy\n end", "def destroy\n @chef_att_source.destroy\n respond_to do |format|\n format.html { redirect_to chef_att_sources_url, notice: 'Chef att source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n final_parent.delete(source.statements)\n\n parent.statements.each do |statement|\n parent.delete_statement(statement) if\n statement.subject == source.rdf_subject || \n statement.object == source.rdf_subject\n end\n\n super { source.clear }\n end", "def remove_source(*source)\n unless source.blank?\n what.query[:sources] && what.query[:sources] >> source.flatten\n changed\n end\n end", "def delete(email)\n Iterable.request(conf, \"/users/#{email}\").delete\n end", "def destroy\n @funding_source.destroy\n flash[:success] = 'Funding source was successfully deleted.'\n redirect_to :back\n end", "def delete(context, name)\n res = context.transport.delete_request(context, \"security/users/#{name}\")\n\n context.err(name, res.body) unless res.success?\n end", "def delete_domain!(name)\n sdb_query({:Action => 'DeleteDomain', 'DomainName' => name})\n end", "def delete_collection\n FileUtils.rm_r @src_path\n FileUtils.rm_r @store_path if store_exist?\n end", "def delete_session(env, sid, options); end", "def delete_from_dor\n CocinaObjectStore.destroy(druid)\n AdministrativeTags.destroy_all(identifier: druid)\n ObjectVersion.where(druid:).destroy_all\n Event.where(druid:).destroy_all\n end", "def destroy\n @domain = DOMAIN.first_or_get(params[:id])\n @domain.destroy if @domain\n\n respond_to do |format|\n flash[:notice] = 'Domain was successfully deleted.'\n format.html { redirect_to(domains_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n test_domain = session[:test_domain]\n reset_session\n clear_user\n session[:test_domain] = test_domain\n redirect_to root_path\n end", "def destroy\n @source_code = SourceCode.find(params[:id])\n @source_code.destroy\n\n respond_to do |format|\n format.html { redirect_to(source_codes_url) }\n format.xml { head :ok }\n end\n end", "def users_id_user_connections_id_connection_sources_id_source_delete(id_user, id_connection, id_source, opts = {})\n data, _status_code, _headers = users_id_user_connections_id_connection_sources_id_source_delete_with_http_info(id_user, id_connection, id_source, opts)\n data\n end", "def group_delete(attribs, dir_info)\n attribs = group_record_name_alternatives(attribs)\n\n check_critical_attribute( attribs, :record_name )\n\n command = {action: 'delete', scope: 'Groups', attribute: nil, value: nil}\n user_attrs = attribs.merge(command)\n\n dscl( user_attrs, dir_info )\n end", "def destroy\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.remove_users_from_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Removed member #{params[:id]}\"\n end", "def destroy\n @email_domain = Email::Domain.find(params[:id])\n @email_domain.destroy\n\n respond_to do |format|\n format.html { redirect_to(email_domains_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n dbf.destroy\n rescue MissingSource\n ensure\n freeze\n end", "def destroy\n @city_source.destroy\n respond_to do |format|\n format.html { redirect_to city_sources_url, notice: 'City source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @identity.destroy\n respond_to do |format|\n format.html { redirect_to identities_url, notice: 'Identity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.6723568", "0.6233082", "0.61297023", "0.59645885", "0.5926988", "0.5892196", "0.5750985", "0.57506543", "0.5746354", "0.57235134", "0.5718202", "0.5718202", "0.5718202", "0.5718202", "0.57054794", "0.57052445", "0.5684634", "0.5679185", "0.5638329", "0.5606411", "0.5597102", "0.5596498", "0.5596498", "0.5586582", "0.5549436", "0.5540635", "0.5540635", "0.55374616", "0.5535576", "0.55304796", "0.5528034", "0.55210906", "0.54931486", "0.5492462", "0.547884", "0.54723376", "0.5465912", "0.54597014", "0.5424391", "0.5401819", "0.53951395", "0.539399", "0.5391043", "0.53777295", "0.5367732", "0.53578764", "0.5346594", "0.53329533", "0.5330657", "0.532579", "0.53106326", "0.53064287", "0.53053004", "0.5303989", "0.5296039", "0.52858514", "0.5280221", "0.5279173", "0.5273825", "0.5270407", "0.5254457", "0.5254286", "0.5242413", "0.5235327", "0.5222009", "0.5206788", "0.5203426", "0.5166526", "0.51633894", "0.51559925", "0.51552355", "0.5150814", "0.51491725", "0.51485044", "0.51474094", "0.5145157", "0.51435894", "0.5137891", "0.5135156", "0.51285964", "0.51085997", "0.51030034", "0.5099792", "0.5098653", "0.50950915", "0.5086466", "0.5085754", "0.50769824", "0.5058453", "0.50579613", "0.5054871", "0.5054012", "0.5051794", "0.5051743", "0.50499815", "0.50493145", "0.5039378", "0.5038919", "0.502971", "0.50296026" ]
0.70585525
0
Delete an LDAP identity source Delete an LDAP identity source. Users defined in that source will no longer be able to access NSX.
def delete_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.delete_ldap_identity_source ...' end # verify the required parameter 'ldap_identity_source_id' is set if @api_client.config.client_side_validation && ldap_identity_source_id.nil? fail ArgumentError, "Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.delete_ldap_identity_source" end # resource path local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#delete_ldap_identity_source\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_ldap_identity_source(ldap_identity_source_id, opts = {})\n delete_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n nil\n end", "def destroy\n return false if @label.to_s.empty?\n\n response = delete(\"/2.0/accounts/#{@account_id}/sources/#{@label}\")\n @label = '' if response['success']\n \n response['success']\n end", "def delete_d_b_source(project_name, source_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'DELETE'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:path]['SourceName'] = source_name\n\t\targs[:pattern] = '/projects/[ProjectName]/sources/[SourceName]'\n\t\targs[:query]['Action'] = 'DeleteDBSource'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend", "def delete\n result = Base.redis.hdel(:sources, name)\n if result == 1\n delete_all_inputs\n Log.info \"Deleting Source object from Redis: #{name}\"\n else\n raise UnknownSource, \"Cannot delete non-existent Source object in Redis: #{name}\"\n end\n result\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to user_path(current_user), notice: \"Register was deleted!\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @proxy_source = ProxySource.find(params[:id])\n @proxy_source.destroy\n\n respond_to do |format|\n format.html { redirect_to proxy_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datasource = Datasource.find(params[:id])\n @datasource.destroy\n\n flash[:notice] = \"Destroyed datasource\"\n redirect_to datasources_path\n end", "def destroy\n @ldap_auth_header = Irm::LdapAuthHeader.find(params[:id])\n @ldap_auth_header.destroy\n\n respond_to do |format|\n format.html { redirect_to(ldap_auth_headers_url) }\n format.xml { head :ok }\n end\n end", "def deleteIdentity _args\n \"deleteIdentity _args;\" \n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to(sources_url) }\n format.xml { head :ok }\n end\n end", "def delete_user(email_address)\n found_user = read_user(email_address)\n if found_user\n Net::LDAP.open(@ldap_conf) do |ldap|\n ldap.delete(:dn => get_DN(found_user[:cn]))\n end\n end\n end", "def destroy\n authorize_user!\n respond_to do |format|\n format.html { redirect_to sources_path(@source) }\n format.json { head :no_content }\n @source.destroy\n end\n end", "def destroy\n @rep_source = RepSource.find(params[:id])\n @rep_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(rep_sources_url) }\n format.xml { head :ok }\n end\n end", "def remove(payment_source)\n user.wallet_payment_sources.find_by!(payment_source: payment_source).destroy!\n end", "def destroy\n @lookup_source = LookupSource.find(params[:id])\n @lookup_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n AudioSource.delete( @bundle_source.audio_sources )\n \n corresponding_bundle = @bundle_source.bundle_id\n if( @bundle_source.bundle_id )\n corresponding_bundle = Bundle.find_by_id( @bundle_source.bundle_id )\n if( corresponding_bundle && corresponding_bundle.created_by_user_id == @user.id )\n logger.info(\"****** DESROY invoked ****** \")\n corresponding_bundle.destroy\n end\n end\n\n @bundle_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(bundle_sources_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction_source.destroy\n flash[:notice] = \"Transaction source was successfully deleted\"\n redirect_to transaction_sources_url\n end", "def destroy\n @identity.destroy\n\n head :no_content\n end", "def destroy\n @data_source.destroy\n respond_to do |format|\n format.html { redirect_to data_sources_url, notice: 'Data source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @data_source.destroy\n respond_to do |format|\n format.html { redirect_to data_sources_url, notice: 'Data source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_source = StudentSource.find(params[:id])\n @student_source.destroy\n\n respond_to do |format|\n format.html { redirect_to student_sources_url }\n format.json { head :no_content }\n end\n end", "def delete_store(uid)\n store = Store.find(uid)\n store.delete!\n end", "def destroy\n @content_source = ContentSource.find(params[:id])\n @content_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(content_sources_url) }\n format.xml { head :ok }\n end\n end", "def sources_id_delete(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: SourceApi#sources_id_delete ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling sources_id_delete\" if id.nil?\n \n # resource path\n path = \"/sources/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:DELETE, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: SourceApi#sources_id_delete. Result: #{result.inspect}\"\n end\n return result\n end", "def destroy\n @cla_source.destroy\n respond_to do |format|\n format.html { redirect_to cla_sources_url, notice: 'Cla source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @identity = Identity.find(params[:id])\n @identity.destroy\n\n respond_to do |format|\n format.html { redirect_to(identities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @subject_source = SubjectSource.find(params[:id])\n @subject_source.destroy\n\n respond_to do |format|\n format.html { redirect_to subject_sources_url }\n format.json { head :no_content }\n end\n end", "def delete(account_identity, samlidp_identity)\n @client.samlidp.delete(account_identity, samlidp_identity)\n end", "def delete_source_files source\n dir = Conf::directories\n base = File.join(dir.data)\n source.folders.each do |fold|\n url = File.join(dir.store,source.name.to_s,fold)\n delete_files_from url\n url = File.join(dir.backup,source.name.to_s,fold)\n delete_files_from url\n end\n Logger.<<(__FILE__,\"INFO\",\"Deleted files server & backup for #{source.name.to_s}\")\n end", "def destroy\n @source.destroy\n respond_to do |format|\n format.html { redirect_to sources_url, notice: 'Source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(dn)\n @conn.delete :dn => dn\n end", "def destroy\n @annotation_source = AnnotationSource.find(params[:id])\n @annotation_source.destroy\n\n respond_to do |format|\n format.html { redirect_to annotation_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment_source = PaymentSource.find(params[:id])\n @payment_source.destroy\n\n respond_to do |format|\n format.html { redirect_to payment_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kernel_source.destroy\n respond_to do |format|\n format.html { redirect_to kernel_sources_url, notice: \"Kernel source was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @funding_source = FundingSource.find(params[:id])\n @funding_source.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_funding_sources_url) }\n format.xml { head :ok }\n end\n end", "def delete\n @linked_user.delete(@uri)\n end", "def destroy\n flash[:notice] = 'The source was successfully removed.' if source.destroy\n respond_with(source)\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 delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def remove_source source\n # Check it exists\n fail ArgumentError, \"#{source} must be a string or symbol\" unless (source.responds_to?(:to_s))\n fail ArgumentError, \"#{source} has not been registered\" if @importers[source].nil?\n\n @importers.delete(source)\n @formatters.delete(source)\n end", "def destroy\n @portal_source.destroy\n respond_to do |format|\n format.html { redirect_to portal_sources_url, notice: 'Portal source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @source.destroy\n respond_to do |format|\n format.html { redirect_to sources_url, notice: \"Destroyed source #{@source.cached}\" }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { render action: :show, notice: 'failed to destroy the source, there is likely data associated with it' }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"#{uri_prefix}/virtual_dns/#{id}\")\n end", "def destroy\n # TODO: refactor models so that externaluserdomain is in portal namespace?\n # @external_user_domain = Portal::ExternalUserDomain.find(params[:id])\n @external_user_domain = ExternalUserDomain.find(params[:id])\n @external_user_domain.destroy\n\n respond_to do |format|\n format.html { redirect_to(portal_external_user_domains_url) }\n format.xml { head :ok }\n end\n end", "def delete_all\n objs = target\n source.update_attribute(source_attribute, nil)\n objs.each(&:delete)\n end", "def unsubscribe(source)\n Log.debug(\"Unsubscribing from #{source}\")\n @connection.unsubscribe(source)\n @subscriptions.delete(source)\n end", "def delete(dn)\n log_dispatch(:delete, dn)\n adapter.delete(dn)\n end", "def delete_entry( c, dn ) # :yields: connection_info, distinguished_name\n \n self.bind( c.host, c.port, c.credentials, c.databag_name, c.use_tls ) unless @ldap\n @ldap.delete dn: dn\n raise \"Unable to remove record: #{@ldap.get_operation_result.message}\" unless @ldap.get_operation_result.message =~ /(Success|No Such Object)/\n end", "def remove_resource(source_record:)\n ::Pundit.authorize(user, source_record, 'destroy?')\n end", "def destroy\n @data_store = DataStore.find(params[:id])\n @data_store.destroy\n\n respond_to do |format|\n format.html { redirect_to data_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to report_sources_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @event_source = EventSource.find(params[:id])\n @event_source.destroy\n\n respond_to do |format|\n format.html { redirect_to event_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @enquiry_source = EnquirySource.find(params[:id])\n @enquiry_source.destroy\n\n respond_to do |format|\n format.html { redirect_to enquiry_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @identity.destroy\n respond_to do |format|\n format.html { redirect_to identities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dis_datasource.destroy\n respond_to do |format|\n format.html { redirect_to dis_datasources_url, notice: 'Dis datasource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_domain(domain)\n raise MogileFS::ReadOnlyError if readonly?\n ! @backend.delete_domain(:domain => domain).nil?\n end", "def delete(name)\n connect { |connection| connection.delete dn(name) }\n end", "def destroy\n @recipesource = Recipesource.find(params[:id])\n @recipesource.destroy\n\n respond_to do |format|\n format.html { redirect_to recipesources_url }\n format.json { head :no_content }\n end\n end", "def delete(account_identity, federatedsamlidp_identity)\n @client.federatedsamlidp.delete(account_identity, federatedsamlidp_identity)\n end", "def delete_session(env, sid, options)\n @cache.delete(cache_key(sid.private_id))\n @cache.delete(cache_key(sid.public_id))\n generate_sid\n end", "def destroy\n @rss_source = RssSource.find(params[:id])\n @rss_source.destroy\n\n respond_to do |format|\n format.html { redirect_to rss_sources_url }\n format.json { head :ok }\n end\n end", "def delete\n namespace.delete(dn)\n @attributes = (@original_attributes||{}).merge(@attributes)\n @original_attributes = nil\n self\n end", "def unsubscribe(source)\n #TODO\n end", "def destroy\n @data_source_type.destroy\n respond_to do |format|\n format.html { redirect_to data_source_types_url, notice: 'Data source type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n repository.purge_datastream(:pid => pid, :dsid => dsid) unless self.new?\n digital_object.datastreams.delete(dsid)\n reset_profile_attributes\n self\n end", "def destroy\n @identity = Identity.find(params[:id])\n @identity.destroy\n respond_to do |format|\n format.html { redirect_to identities_url, notice: \"Identity was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @creator_source = CreatorSource.find(params[:id])\n @creator_source.destroy\n\n respond_to do |format|\n format.html { redirect_to creator_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @source_master.destroy\n respond_to do |format|\n format.html { redirect_to source_masters_url, notice: \"Source master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @metric_source.destroy\n respond_to do |format|\n format.html { redirect_to metric_sources_url, notice: 'Metric source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_user(id)\n elektron_identity.delete(\"users/#{id}\")\n end", "def remove_email_forward(source)\n validate_list([[\"Source\", source, :email] ])\n\n options = { \"Source\" => source }\n\n connection = Connection.new\n connection.post(\"Domain/EmailForward/Remove\", options)\n end", "def delete_ns(ns, obj)\n primary_sql_key = @schema.primary_sql_key_for_ns(ns)\n h = transform_one_ns(ns, obj)\n raise \"No #{primary_sql_key} found in transform of #{obj.inspect}\" if h[primary_sql_key].nil?\n table_for_ns(ns).where(primary_sql_key.to_sym => h[primary_sql_key]).delete\n end", "def remove_file\n\n @source_files_id = params[:source] + '_files'\n @source = TaliaCore::Source.find(N::URI.from_encoded(params[:source]))\n\n TaliaFile.find(params[:talia_file_uri]).destroy\n end", "def destroy\n @chef_att_source.destroy\n respond_to do |format|\n format.html { redirect_to chef_att_sources_url, notice: 'Chef att source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n final_parent.delete(source.statements)\n\n parent.statements.each do |statement|\n parent.delete_statement(statement) if\n statement.subject == source.rdf_subject || \n statement.object == source.rdf_subject\n end\n\n super { source.clear }\n end", "def remove_source(*source)\n unless source.blank?\n what.query[:sources] && what.query[:sources] >> source.flatten\n changed\n end\n end", "def delete(email)\n Iterable.request(conf, \"/users/#{email}\").delete\n end", "def destroy\n @funding_source.destroy\n flash[:success] = 'Funding source was successfully deleted.'\n redirect_to :back\n end", "def delete(context, name)\n res = context.transport.delete_request(context, \"security/users/#{name}\")\n\n context.err(name, res.body) unless res.success?\n end", "def delete_domain!(name)\n sdb_query({:Action => 'DeleteDomain', 'DomainName' => name})\n end", "def delete_collection\n FileUtils.rm_r @src_path\n FileUtils.rm_r @store_path if store_exist?\n end", "def delete_from_dor\n CocinaObjectStore.destroy(druid)\n AdministrativeTags.destroy_all(identifier: druid)\n ObjectVersion.where(druid:).destroy_all\n Event.where(druid:).destroy_all\n end", "def delete_session(env, sid, options); end", "def destroy\n test_domain = session[:test_domain]\n reset_session\n clear_user\n session[:test_domain] = test_domain\n redirect_to root_path\n end", "def destroy\n @domain = DOMAIN.first_or_get(params[:id])\n @domain.destroy if @domain\n\n respond_to do |format|\n flash[:notice] = 'Domain was successfully deleted.'\n format.html { redirect_to(domains_url) }\n format.xml { head :ok }\n end\n end", "def users_id_user_connections_id_connection_sources_id_source_delete(id_user, id_connection, id_source, opts = {})\n data, _status_code, _headers = users_id_user_connections_id_connection_sources_id_source_delete_with_http_info(id_user, id_connection, id_source, opts)\n data\n end", "def destroy\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.remove_users_from_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Removed member #{params[:id]}\"\n end", "def destroy\n @source_code = SourceCode.find(params[:id])\n @source_code.destroy\n\n respond_to do |format|\n format.html { redirect_to(source_codes_url) }\n format.xml { head :ok }\n end\n end", "def group_delete(attribs, dir_info)\n attribs = group_record_name_alternatives(attribs)\n\n check_critical_attribute( attribs, :record_name )\n\n command = {action: 'delete', scope: 'Groups', attribute: nil, value: nil}\n user_attrs = attribs.merge(command)\n\n dscl( user_attrs, dir_info )\n end", "def destroy\n dbf.destroy\n rescue MissingSource\n ensure\n freeze\n end", "def destroy\n @email_domain = Email::Domain.find(params[:id])\n @email_domain.destroy\n\n respond_to do |format|\n format.html { redirect_to(email_domains_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @city_source.destroy\n respond_to do |format|\n format.html { redirect_to city_sources_url, notice: 'City source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @identity.destroy\n respond_to do |format|\n format.html { redirect_to identities_url, notice: 'Identity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.70582306", "0.6231639", "0.61289907", "0.596344", "0.5927216", "0.5892083", "0.575091", "0.5750589", "0.5746151", "0.5722867", "0.57174736", "0.57174736", "0.57174736", "0.57174736", "0.5705863", "0.57056266", "0.56840503", "0.5678719", "0.5637872", "0.56053716", "0.5596383", "0.55957747", "0.55957747", "0.55863726", "0.5549144", "0.55402255", "0.55402255", "0.5536757", "0.5535319", "0.55296046", "0.55266875", "0.55198985", "0.5492377", "0.54920506", "0.5477203", "0.5472334", "0.54651767", "0.54589146", "0.5423063", "0.54007095", "0.5394909", "0.53937614", "0.5391272", "0.5376775", "0.53670746", "0.53577393", "0.53462976", "0.5332362", "0.5329948", "0.5325174", "0.5310331", "0.53058314", "0.5304504", "0.53042626", "0.5294727", "0.52865565", "0.5279791", "0.527875", "0.52731484", "0.5269433", "0.52543783", "0.5253455", "0.52417773", "0.5235118", "0.5221901", "0.5205734", "0.52025664", "0.51656336", "0.51616293", "0.51559746", "0.515507", "0.5151678", "0.51489955", "0.51483005", "0.51465267", "0.51449", "0.5144871", "0.513738", "0.51337045", "0.5127986", "0.51083213", "0.5101917", "0.5099375", "0.50981563", "0.50952256", "0.50874597", "0.5084313", "0.50758827", "0.50581366", "0.5057853", "0.5053851", "0.5053602", "0.50519603", "0.50501406", "0.5050074", "0.5049297", "0.5038369", "0.503782", "0.5029408", "0.5029396" ]
0.672373
1
Fetch the server certificate of an LDAP server Attempt to connect to an LDAP server and retrieve the server certificate it presents.
def fetch_identity_source_ldap_server_certificate_fetch_certificate(identity_source_ldap_server_endpoint, opts = {}) data, _status_code, _headers = fetch_identity_source_ldap_server_certificate_fetch_certificate_with_http_info(identity_source_ldap_server_endpoint, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ldap_server\n get_attribute_from_auth_source('host')\n end", "def server_cert_from_spec(spec)\n if spec[:server_certificate]\n spec[:server_certificate]\n elsif spec[:ssl_certificate_id]\n spec[:ssl_certificate_id]\n else\n nil\n end\n end", "def ldap_connect\n ldap = Net::LDAP.new(host: host, port: Net::LDAP::DefaultPort)\n ldap\n end", "def get_server_certificate(name)\n request({\n 'Action' => 'GetServerCertificate',\n 'ServerCertificateName' => name,\n :parser => Fog::Parsers::AWS::IAM::UploadServerCertificate.new\n })\n end", "def connection\n return @connection if @connection\n load_ldap_library\n @connection = if ldap_library == 'net/ldap'\n Net::LDAP.new(:host=>server, :port=>(port), :encryption=>(:simple_tls if use_ssl))\n else\n (use_ssl ? LDAP::SSLConn : LDAP::Conn).new(server, port)\n end\n end", "def connect\n @logger.debug(\"Connecting to LDAP server: #{Time.now}\" )\n\n connected = false\n error = nil\n LDAP_SERVERS.each do |ldap_server| \n begin\n @ldap.host = ldap_server\n @ldap.port = 636\n @ldap.encryption :simple_tls\n @ldap.auth BIND_DN, BIND_PASS\n connected = @ldap.bind\n @logger.debug(\"bind result: #{@ldap.get_operation_result}\")\n break if connected\n raise \"Failed to connect to LDAP server #{ldap_server}. Error: #{@ldap.get_operation_result.message} (#{@ldap.get_operation_result.code})\"\n rescue => e\n connected = false\n error = \"Failed to connect to LDAP server #{ldap_server}. Error: #{e.message}\\n#{e.backtrace}\"\n end\n @logger.warn(error)\n end\n\n # raise exception if not connected\n raise ConnectError, error unless connected\n\n @logger.debug(\"connected to #{@ldap.host}.\")\n end", "def get_cert_details()\n $log.debug(\"Returning certificate details\")\n self.use_ssl = true\n disable_validations\n begin\n self.start do |x|\n return ResultContainer.new(true, x.peer_cert)\n end\n rescue => ex\n return ResultContainer.new(false, ex)\n end\n end", "def get_certificate(kerberos)\n mech = Mechanize.new do |m|\n m.user_agent_alias = 'Linux Firefox'\n # NOTE: ca.mit.edu uses a Geotrust certificate, not the self-signed one\n end\n login_page = mech.get 'https://ca.mit.edu/ca/'\n login_form = login_page.form_with :action => /login/\n login_form.field_with(:name => /login/).value = kerberos[:user]\n login_form.field_with(:name => /pass/).value = kerberos[:pass]\n login_form.field_with(:name => /mitid/).value = kerberos[:mit_id]\n keygen_page = login_form.submit login_form.buttons.first\n\n keygen_form = keygen_page.form_with(:action => /ca/)\n if /login/ =~ keygen_form.action\n raise ArgumentError, 'Invalid Kerberos credentials'\n end\n keygen_form.field_with(:name => /life/).value = kerberos[:ttl] || 1\n key_pair = keygen_form.keygens.first.key\n response_page = keygen_form.submit keygen_form.buttons.first\n \n cert_frame = response_page.frame_with(:name => /download/)\n cert_bytes = mech.get_file cert_frame.uri\n cert = OpenSSL::X509::Certificate.new cert_bytes\n {:key => key_pair, :cert => cert}\n end", "def fetch_identity_source_ldap_server_certificate_fetch_certificate_with_http_info(identity_source_ldap_server_endpoint, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.fetch_identity_source_ldap_server_certificate_fetch_certificate ...'\n end\n # verify the required parameter 'identity_source_ldap_server_endpoint' is set\n if @api_client.config.client_side_validation && identity_source_ldap_server_endpoint.nil?\n fail ArgumentError, \"Missing the required parameter 'identity_source_ldap_server_endpoint' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.fetch_identity_source_ldap_server_certificate_fetch_certificate\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=fetch_certificate'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(identity_source_ldap_server_endpoint)\n auth_names = ['BasicAuth']\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 => 'PeerCertificateChain')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#fetch_identity_source_ldap_server_certificate_fetch_certificate\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def ssl_generate_certificate\n Rex::Socket::SslTcpServer.ssl_generate_certificate\n end", "def certificate\n _get_certificate\n end", "def ssl_cert\n datastore['SSLCert']\n end", "def certificate_get\n return @cert unless @cert.nil?\n cert_path = File.join(resource[:cert_dir], resource[:cert_name])\n @cert = if Pathname.new(cert_path).exist?\n file = File.read(cert_path)\n OpenSSL::X509::Certificate.new(file)\n else\n false\n end\n end", "def server_certificate_metadata\n data.server_certificate_metadata\n end", "def connect_to_ldap\r\n begin\r\n @ldap = Net::LDAP.new(:host => @ldap_host,\r\n :port => @ldap_port,\r\n :auth => { :method => :simple,\r\n :username => @ldap_username,\r\n :password => @ldap_password } )\r\n @logger.info \"Connecting to LDAP: '#{@ldap_host}' on port #{@ldap_port}\"\r\n @logger.info \"Binding to LDAP as: #{@ldap_username}\"\r\n \r\n success = @ldap.bind()\r\n if (success)\r\n @logger.info \"LDAP authorization succeeded\"\r\n return true\r\n else\r\n @logger.error \"LDAP authorization failed: #{@ldap.get_operation_result.message}\"\r\n return false\r\n end\r\n rescue Net::LDAP::LdapError => error\r\n @logger.error(\"Error connecting to LDAP: #{error}\")\r\n return false\r\n end\r\n end", "def ensure_ca_certificates\n final_state = run_machine(NeedCACerts.new, NeedKey)\n final_state.ssl_context\n end", "def connect\n\t\tconn = nil\n\n\t\tcase @connect_type\n\t\twhen :tls\n\t\t\tself.log.debug \"Connecting using TLS to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::SSLConn.new( @host, @port, true )\n\t\twhen :ssl\n\t\t\tself.log.debug \"Connecting using SSL to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::SSLConn.new( @host, @port )\n\t\telse\n\t\t\tself.log.debug \"Connecting using an unencrypted connection to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::Conn.new( @host, @port )\n\t\tend\n\n\t\tconn.set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, 3 )\n\t\tconn.set_option( LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_OFF )\n\n\t\treturn conn\n\tend", "def get_dn_from_certificate(type)\n cert_str = request.env[\"#{options.client_cert_header}\"]\n if cert_str\n client_cert = cert_str.to_cert\n log :debug, \"Client certificate:\\r\\n#{client_cert}\"\n raw_dn ||= parse_dn_from_certificate(client_cert, type)\n log :debug, \"raw_dn (#{type}) from cert: #{raw_dn}\"\n end\n\n raw_dn\n end", "def ca_cert_string\n @ca_cert_string ||= begin\n vcap_services[vcap_services.keys.first].first['credentials']['cacrt']\n end\n end", "def connect!\n com::unboundid::ldap::sdk::LDAPConnection.new(\n self.host, self.port, self.bind_dn, self.password) \n end", "def connect\n @conn ||= Net::LDAP.new\n @conn.host = @host\n @conn.port = @port\n @conn.auth \"#{@login_dn},#{@base_dn}\", @password\n\n if @conn.bind\n return true\n else\n return false\n end\n end", "def certificate_path\n\t\t\tFile.join(@root, \"#{@hostname}.crt\")\n\t\tend", "def cert\n @cert\n end", "def connection\n unless @connection\n raise Puppet::Error, \"Could not set up LDAP Connection: Missing ruby/ldap libraries\" unless Puppet.features.ldap?\n begin\n conn = Puppet::Util::Ldap::Connection.instance\n conn.start\n @connection = conn.connection\n rescue => detail\n puts detail.backtrace if Puppet[:trace]\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end\n end\n\n @connection\n end", "def describe_server_certificate(server_certificate_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeServerCertificate'\n\t\targs[:query]['ServerCertificateId'] = server_certificate_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def fetch_ssl_certificates\n run_command(\"ssl fetch\")\n rescue Runner::Exceptions::KnifeCommandFailed => e\n raise Runner::Exceptions::CertFetchFailed.new(e.message)\n end", "def list_server_certificates(options = {})\n request({\n 'Action' => 'ListServerCertificates',\n :parser => Fog::Parsers::AWS::IAM::ListServerCertificates.new\n }.merge!(options))\n end", "def ssl_certificate\n @ssl_certificate ||= OpenSSL::X509::Certificate.new <<-CERT\n-----BEGIN CERTIFICATE-----\nMIIBQjCB7aADAgECAgEAMA0GCSqGSIb3DQEBBQUAMCoxDzANBgNVBAMMBm5vYm9k\neTEXMBUGCgmSJomT8ixkARkWB2V4YW1wbGUwIBcNMTExMTAzMjEwODU5WhgPOTk5\nOTEyMzExMjU5NTlaMCoxDzANBgNVBAMMBm5vYm9keTEXMBUGCgmSJomT8ixkARkW\nB2V4YW1wbGUwWjANBgkqhkiG9w0BAQEFAANJADBGAkEA8pmEfmP0Ibir91x6pbts\n4JmmsVZd3xvD5p347EFvBCbhBW1nv1GsbCBEFlSiT1q2qvxGb5IlbrfdhdgyqdTX\nUQIBATANBgkqhkiG9w0BAQUFAANBAAAB////////////////////////////////\n//8AMCEwCQYFKw4DAhoFAAQUePiv+QrJxyjtEJNnH5pB9OTWIqA=\n-----END CERTIFICATE-----\n CERT\n end", "def client\n Net::LDAP.new({\n host: Settings.ldap.host,\n port: Settings.ldap.port,\n encryption: { method: :simple_tls },\n auth: {\n method: :simple,\n username: Settings.ldap.application_bind,\n password: Settings.ldap.application_password\n }\n })\n end", "def start\n case ssl\n when :tls\n @connection = LDAP::SSLConn.new(host, port, true)\n when true\n @connection = LDAP::SSLConn.new(host, port)\n else\n @connection = LDAP::Conn.new(host, port)\n end\n @connection.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n @connection.set_option(LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_ON)\n @connection.simple_bind(user, password)\n rescue => detail\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end", "def ssl\n if @options[\"ssl-gen-self-signed-certs\"]\n puts \"Generating private key and certificate\"\n args = [\n \"-C\", HOSTNAME,\n \"-n\", HOSTNAME,\n \"-o\", @options[\"ssl-organization\"],\n \"-u\", @options[\"ssl-organization-unit\"],\n \"-e\", @options[\"ssl-email\"],\n \"-c\", @options[\"ssl-country\"],\n \"-l\", @options[\"ssl-city\"],\n \"-s\", @options[\"ssl-state\"]\n ]\n Runner.exec(\"gensslcert\", args)\n end\n\n handle_own_certs @options[\"ssl-certs-dir\"].chomp \\\n unless @options[\"ssl-certs-dir\"].chomp.empty?\n\n key_file = \"/etc/apache2/ssl.key/#{HOSTNAME}-ca.key\"\n crt_file = \"/etc/apache2/ssl.crt/#{HOSTNAME}-ca.crt\"\n portus_key = \"/srv/Portus/config/server.key\"\n\n missing_file(key_file) unless File.exist?(key_file)\n missing_file(crt_file) unless File.exist?(crt_file)\n\n # Move key to portus dir, set permissions and create symlink\n # bsc#1022811\n FileUtils.cp(\n key_file,\n portus_key\n )\n FileUtils.chown(\"wwwrun\", \"www\", portus_key)\n FileUtils.chmod(0o440, portus_key)\n FileUtils.rm(key_file)\n FileUtils.ln_s(\n portus_key,\n key_file\n )\n\n FileUtils.cp(\n crt_file,\n \"/srv/www/htdocs\"\n )\n FileUtils.chmod(0o755, \"/srv/www/htdocs/#{HOSTNAME}-ca.crt\")\n FileUtils.cp(\n crt_file,\n \"/etc/pki/trust/anchors\"\n )\n Runner.exec(\"update-ca-certificates\")\n end", "def cert\n digidoc_cert if @cert.nil?\n @cert\n end", "def certificate\n return @cert unless @cert.nil?\n\n # Verify that the given directory exists\n unless File.directory?(resource[:cert_dir])\n raise ArgumentError, \"Directory not found for: #{resource[:cert_dir]}\"\n end\n\n cert_path = File.join(resource[:cert_dir], resource[:cert_name])\n @cert = if Pathname.new(cert_path).exist?\n file = File.read(cert_path)\n OpenSSL::X509::Certificate.new(file)\n else\n false\n end\n end", "def get(certificate_thumbprint)\n cert_get(certificate_thumbprint)\n end", "def describe_server_certificates(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeServerCertificates'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :server_certificate_id\n\t\t\targs[:query]['ServerCertificateId'] = optional[:server_certificate_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def cert_path; end", "def cert_path; end", "def ldap_authenticate\n # logger.debug(\"ldap_authenticate\")\n # ldap_time = Benchmark.realtime { ActiveLdap::Base.setup_connection }\n # logger.debug(\"LDAP: took #{ldap_time} to establish the connection\")\n authenticate_or_request_with_http_basic \"Bluepages Authentication\" do |user_name, password|\n logger.info(\"attempt to ldap authenticate: user_name #{user_name}\")\n next nil unless LdapUser.authenticate_from_email(user_name, password)\n logger.info(\"successful ldap_authenticate as #{user_name}\")\n common_authenticate(user_name)\n return true\n end\n return false\n end", "def ldap_ssl?\r\n ldap_ssl.to_s.to_i != 0\r\n end", "def ssl_cert\n self.config.ssl_cert\n end", "def cert; end", "def cert; end", "def cert; end", "def ssl_verify_peer(cert_string)\n #puts cert_string\n #puts\n cert = OpenSSL::X509::Certificate.new(cert_string)\n #p cert\n # Some servers send the same certificate multiple times. I'm not even joking... (gmail.com)\n return true if cert == @last_seen_cert\n @last_seen_cert = cert\n\n if ca_store.verify(@last_seen_cert)\n # A server may send the root certifiacte, which we already have and thus\n # should not be added to the store again.\n ca_store.add_cert(@last_seen_cert) unless @last_seen_cert.root?\n true\n else\n fail \"unable to verify the server certificate of `#{@hostname}'\"\n false\n end\n end", "def test_ssl_with_cert\n client = MongoClient.new('server', 27017, :connect => false,\n :ssl => true,\n :ssl_cert => CLIENT_CERT,\n :ssl_key => CLIENT_CERT)\n assert client.connect\n end", "def ldap_connect(domain,binddn=BINDUSER,bindpw=BINDPASS)\n binddn = binddn + \"@\" + domain\n ldap = Net::LDAP.new(:host => domain,\n :port => 389,\n :auth => {\n :method => :simple,\n :username => binddn,\n :password => bindpw,\n })\n return ldap\n end", "def get_cert_path\n if !has_cert?\n return nil\n end\n\n return @cert_file_path\n end", "def cert\n @cert ||= (OpenSSL::X509::Certificate.new File.read(cert_file) if cert_file)\n end", "def cert_store; end", "def cert_store; end", "def server_certificate_eql?(cert1, cert2)\n server_cert_to_string(cert1) == server_cert_to_string(cert2)\n end", "def ssl_config # :nodoc:\n {\n SSLCertificate: @certificate,\n SSLPrivateKey: @key,\n SSLCaCertificateStore: certificate_store,\n SSLVerifyMode:\n OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT,\n }\n end", "def get!(certificate_thumbprint)\n cert_pem = cert_get(certificate_thumbprint)\n\n raise ArgumentError, \"Unable to retrieve the certificate\" if cert_pem.empty? || cert_pem == \"Certificate Not Found\"\n\n cert_pem\n end", "def bind_connection(credentials)\n Net::LDAP.new(credentials)\n rescue\n raise(ConnectionError, 'Failure connecting to LDAP host')\n end", "def certificate\n return @certificate\n end", "def get_cert\n cert_str = \"\"\n \n File.open(@cert_file_path, \"r\") do |f|\n cert_str = f.read\n end\n\n return cert_str\n end", "def ca_certificate_identifier\n @dbi.ca_certificate_identifier\n end", "def ca_certificate_identifier\n @dbi.ca_certificate_identifier\n end", "def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :pwdays => 0,\n :notify => false,\n }\n\n if entry.respond_to? :mail\n acct[:mail] = entry.mail.first.to_s\n else\n acct[:mail] = \"im-bigdata-pgh-sysadmins@wwpdl.vnet.ibm.com\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n next # These passwords have already expired.\n end\n\n # Send a notice 14, 7, 3, 2 and 1 days before expiration\n if [14, 7, 3, 2, 1].include? numDays\n acct[:notify] = true\n acct[:pwDays] = numDays\n end\n\n $accounts.push acct\n end\nend", "def certification\n return @certification\n end", "def bind\n conn = Net::LDAP.new :host => @config[:server],\n :port => @config[:port],\n :base => @config[:base]\n if @config[:encryption]\n conn.encryption @config[:encryption]\n end\n \n raise \"Anonymous Bind is disabled\" if @config[:password] == \"\" && !(@config[:anonymous_bind])\n \n conn.auth \"#{@config[:username]}@#{@config[:domain]}\", @config[:password]\n \n begin\n Timeout::timeout(10){\n if conn.bind\n return conn\n else\n raise 'Query User Rejected'\n end\n }\n rescue Timeout::Error\n raise 'Unable to connect to LDAP Server'\n rescue Errno::ECONNRESET\n if @config[:allow_fallback]\n @config[:port] = @config[:allow_fallback]\n @config[:encryption] = false\n return Adauth::Connection.new(@config).bind\n end\n end\n end", "def ssl_certs\n requires :identity\n\n service.ssl_certs.all(identity)\n end", "def ldap_secure\n @attributes[:ldap_secure]\n end", "def cert\n @agent.certificate\n end", "def x509_certificate_string\n t=self.metadata_nokogiri.clone\n t.remove_namespaces!\n the_xpath = \"//KeyDescriptor/KeyInfo/X509Data/X509Certificate\"\n node = t.xpath(the_xpath)\n if node.blank?\n raise \"Could not extract X509Certificate from #{site.name}\"\n else\n node.inner_text\n end\n end", "def post_connection_check(peer_cert, hostname) # :nodoc:\n check_common_name = true\n cert = peer_cert\n cert.extensions.each{|ext|\n next if ext.oid != \"subjectAltName\"\n ext.value.split(/,\\s+/).each{|general_name|\n if /\\ADNS:(.*)/ =~ general_name\n check_common_name = false\n reg = Regexp.escape($1).gsub(/\\\\\\*/, \"[^.]+\")\n return true if /\\A#{reg}\\z/i =~ hostname\n elsif /\\AIP Address:(.*)/ =~ general_name\n check_common_name = false\n return true if $1 == hostname\n end\n }\n }\n if check_common_name\n cert.subject.to_a.each{|oid, value|\n if oid == \"CN\"\n reg = Regexp.escape(value).gsub(/\\\\\\*/, \"[^.]+\")\n return true if /\\A#{reg}\\z/i =~ hostname\n end\n }\n end\n raise SSL::SSLError, \"hostname was not match with the server certificate\"\n end", "def to_x509()\n @cert\n end", "def test_connection\n ldap_con = initialize_ldap_con(self.account, self.account_password)\n ldap_con.open { }\n rescue Net::LDAP::LdapError => text\n raise \"LdapError: %s\" % text\n end", "def ssl_cert\n OpenSSL::X509::Certificate.new(File.read(self.class.ssl_cert_path))\n rescue => e\n # :nocov:\n unless allow_missing_certs?\n Rails.logger.warn \"Could not load #{service_name} SSL cert: #{e.message}\"\n raise e if Rails.env.production?\n end\n nil\n # :nocov:\n end", "def ldap_options_for(ldap_login, ldap_password)\n host = ENV['DISTRICT_LDAP_HOST']\n port = ENV['DISTRICT_LDAP_PORT'].to_i\n encryption_tls_options = JSON.parse(ENV['DISTRICT_LDAP_ENCRYPTION_TLS_OPTIONS_JSON'] || '{}').deep_symbolize_keys\n\n {\n host: host,\n port: port,\n connect_timeout: ENV.fetch('DISTRICT_LDAP_TIMEOUT_IN_SECONDS', '30').to_i,\n auth: {\n :method => :simple,\n :username => ldap_login,\n :password => ldap_password,\n },\n encryption: {\n method: :simple_tls,\n tls_options: encryption_tls_options\n }\n }\n end", "def post_connection_check(peer_cert, hostname)\n check_common_name = true\n cert = peer_cert\n cert.extensions.each{|ext|\n next if ext.oid != \"subjectAltName\"\n ext.value.split(/,\\s+/).each{|general_name|\n if /\\ADNS:(.*)/ =~ general_name\n check_common_name = false\n reg = Regexp.escape($1).gsub(/\\\\\\*/, \"[^.]+\")\n return true if /\\A#{reg}\\z/i =~ hostname\n elsif /\\AIP Address:(.*)/ =~ general_name\n check_common_name = false\n return true if $1 == hostname\n end\n }\n }\n if check_common_name\n cert.subject.to_a.each{|oid, value|\n if oid == \"CN\"\n reg = Regexp.escape(value).gsub(/\\\\\\*/, \"[^.]+\")\n return true if /\\A#{reg}\\z/i =~ hostname\n end\n }\n end\n raise OpenSSL::SSL::SSLError, \"hostname not match\"\n end", "def certificate_value(h)\n v = credential_authentication_inverso_issuer(h)\n h[:k] == \"seal\" && valid_keys.include?(\"certificate\") ? \"#{v} #{join_seal(h[:ver])}\" : v\n end", "def certificate; end", "def certificate; end", "def certificate\n cert_value = @ar.at_css(\n 'xmlns|X509Certificate',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#'\n ).content.gsub(/\\s+/, \"\")\n\n cert = process_cert_value(cert_value)\n\n begin\n OpenSSL::X509::Certificate.new(cert)\n rescue => e\n fail OpenSSL::X509::CertificateError,\n \"The certificate embedded in the application response could not be \" \\\n \"processed. It's most likely corrupted. \" \\\n \"OpenSSL had this to say: #{e}.\"\n end\n end", "def update_server_certificate(server_certificate_name, options={})\n request_hash = { 'ServerCertificateName' => server_certificate_name}\n request_hash['NewServerCertificateName'] = options[:new_server_certificate_name] unless options[:new_server_certificate_name].right_blank?\n request_hash['NewPath'] = options[:new_path] unless options[:new_path].right_blank?\n link = generate_request(\"UpdateServerCertificate\", request_hash)\n request_info(link, RightHttp2xxParser.new(:logger => @logger))\n end", "def server_cert_verification_enabled?\n @enable_server_cert_verification\n end", "def ca_cert\n \n end", "def test_ssl_with_invalid_cert\n assert_raise ConnectionFailure do\n MongoClient.new('server', 27017, :ssl => true,\n :ssl_key => CLIENT_CERT,\n :ssl_cert => CLIENT_CERT,\n :ssl_verify => true,\n :ssl_ca_cert => CA_CERT)\n end\n end", "def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n skip_accounts = ['CORP$']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n if skip_accounts.include? entry.sAMAccountName.first.to_s\n next\n end\n\n begin\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :mail => entry.mail.first.to_s,\n :pwdays => 0,\n :notify => false,\n }\n rescue\n puts \"Caught exception: #{entry.inspect}\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n acct[:pwdays] = numDays\n $accounts.push acct\n end\n\n end\nend", "def certificate_subject\n attributes[:certificate_subject]\n end", "def cert_path=(_arg0); end", "def test_connection\n\t\tldap_con = initialize_ldap_con(self.account, self.encrypted_password)\n\t\tldap_con.open do |ldap|\n\t\tend\n\trescue Net::LDAP::LdapError => text\n\t\traise \"LdapError: \" + text\n\tend", "def x509\n @x509 ||= OpenSSL::X509::Certificate.new(as_pem)\n end", "def net_ldap\n @net_ldap ||= new_net_ldap\n end", "def certificate(record)\n record.public_send(options[:certificate])\n end", "def bind_default_ldap_server(size_limit, domain=nil)\n vprint_status(\"Initializing LDAP connection.\")\n\n # If domain is still null the API may be able to handle it...\n init_result = wldap32.ldap_sslinitA(domain, 389, 0)\n session_handle = init_result['return']\n if session_handle == 0\n raise \"Unable to initialize ldap server: #{init_result[\"ErrorMessage\"]}\"\n end\n\n vprint_status(\"LDAP Handle: #{session_handle}\")\n\n vprint_status(\"Setting Sizelimit Option\")\n wldap32.ldap_set_option(session_handle, LDAP_OPT_SIZELIMIT, size_limit)\n\n vprint_status(\"Binding to LDAP server\")\n bind_result = wldap32.ldap_bind_sA(session_handle, nil, nil, LDAP_AUTH_NEGOTIATE)\n\n bind = bind_result['return']\n unless bind == 0\n wldap32.ldap_unbind(session_handle)\n raise \"Unable to bind to ldap server: #{ERROR_CODE_TO_CONSTANT[bind]}\"\n end\n\n if (block_given?)\n begin\n yield session_handle\n ensure\n vprint_status(\"Unbinding from LDAP service\")\n wldap32.ldap_unbind(session_handle)\n end\n else\n return session_handle\n end\n\n return session_handle\n end", "def collect_cert_info\n # Redirect keytool check error to /dev/null\n os_has_keytool = system('keytool 2>/dev/null')\n raise 'keytool dependency not satisfied. Make sure that JAVA keytool utility is installed' unless os_has_keytool\n cert_info = {}\n certificate_raw = `keytool -printcert -rfc -jarfile #{@apk_path.shellescape}`\n certificate_content_regexp = /(-----BEGIN CERTIFICATE-----.*-----END CERTIFICATE-----)/m\n matched_data = certificate_content_regexp.match(certificate_raw)\n if matched_data\n certificate_content = matched_data.captures[0]\n cert_info = {\n issuer_raw: nil,\n cn: nil,\n ou: nil,\n o: nil,\n st: nil,\n l: nil,\n c: nil,\n creation_date: nil,\n expiration_date: nil\n }\n cert_extract_dates(certificate_content, cert_info)\n cert_extract_issuer(certificate_content, cert_info)\n else\n puts 'Failed to find CERT.RSA file in APK'\n end\n cert_info\n end", "def setup_ldap_server\n server = FakeLDAP::Server.new(port: 1389)\n server.run_tcpserver\n\n @domain = 'dc=example,dc=com'\n @toplevel_user_dn = \"cn=toplevel_user,cn=TOPLEVEL,#{@domain}\"\n @toplevel_user_password = 'toplevel_password'\n\n @regular_user_cn = 'regular_user'\n @regular_user_dn = \"cn=#{@regular_user_cn},ou=USERS,#{@domain}\"\n @regular_user_password = 'regular_password'\n @regular_user_email = \"#{@regular_user_cn}@example.com\"\n\n server.add_user(@toplevel_user_dn, @toplevel_user_password)\n server.add_user(@regular_user_dn, @regular_user_password,\n @regular_user_email)\n server\n end", "def getSslTcpConnection(host, port)\n store = OpenSSL::X509::Store.new\n store.add_file(OpenSSL::X509::DEFAULT_CERT_FILE)\n sslContext = OpenSSL::SSL::SSLContext.new\n sslContext.cert_store = store\n sslContext.ssl_version = :SSLv23\n sslSocket = OpenSSL::SSL::SSLSocket.new(TCPSocket.new(host, port), sslContext)\n sslSocket.hostname = host #for Server Name Indication (SNI)\n sslSocket.sync_close = true #instead of calling close on tcp socket\n sslSocket.connect\n sslSocket\nend", "def test_ssl_certs_dir\n certfile = \"#{RbConfig::TOPDIR}/#{\"bin/etc/\" if RUBY_VERSION >= \"3.2\"}ssl/certs/#{pki.ca_cert.subject.hash.to_s(16)}.0\"\n File.write(certfile, pki.ca_cert.to_pem)\n\n server = TCPServer.new \"localhost\", 0\n server_th = Thread.new do\n run_ssl_server(server, pki)\n end\n\n # Connect per system CA list (with addition of our certificate)\n sclient = connect_ssl_client(\"localhost\", server.local_address.ip_port)\n assert_ssl_connection_is_usable(server_th.value, sclient)\n\n File.unlink(certfile)\n end", "def certificate\n Base64.strict_encode64(parsed_certificate.to_der)\n end", "def server_signing_profile(node)\n {\n \"digest\" => manager.provider.ca.server_certificates.digest,\n \"extensions\" => {\n \"keyUsage\" => {\n \"usage\" => [\"digitalSignature\", \"keyAgreement\"]\n },\n \"extendedKeyUsage\" => {\n \"usage\" => [\"serverAuth\"]\n },\n \"subjectAltName\" => {\n \"ips\" => [node.ip_address],\n \"dns_names\" => dns_names_for_node(node)\n }\n }\n }\n end", "def setup_ssl\n @connection.use_ssl = @config[:use_ssl]\n\n if @config[:ssl_verify_peer]\n @connection.verify_mdoe = OpenSSL::SSL::VERIFY_PEER\n @connection.ca_file = @config[:ssl_ca_file]\n else\n @connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n end", "def get_tls_certificate_0(certificate_id, opts = {})\n data, _status_code, _headers = get_tls_certificate_0_with_http_info(certificate_id, opts)\n data\n end", "def cert_pem; end", "def get_network_sm_certs(options = {})\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'network_id' => options['network_id'],\r\n 'device_id' => options['device_id']\r\n )\r\n # Prepare query url.\r\n _path_url = '/networks/{networkId}/sm/{deviceId}/certs'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'networkId' => options['network_id'],\r\n 'deviceId' => options['device_id']\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end", "def ssl_verify; @opts[:ssl_verify]; end", "def authenticate_dn(dn, password)\n\t\tif dn.present? && password.present?\n\t\t\tinitialize_ldap_con(dn, password).bind\n\t\tend\n\tend", "def setup_connection(connection)\n if ssl_certificates_are_present?\n connection.cert_store = @ssl_host.ssl_store\n connection.ca_file = @ssl_configuration.ca_auth_file\n connection.cert = @ssl_host.certificate.content\n connection.key = @ssl_host.key.content\n connection.verify_mode = OpenSSL::SSL::VERIFY_PEER\n connection.verify_callback = self\n else\n connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n end" ]
[ "0.62266874", "0.6185673", "0.6164346", "0.6135415", "0.61141545", "0.60927397", "0.60395366", "0.59357697", "0.5927438", "0.5907095", "0.59048176", "0.5898186", "0.5868905", "0.57577205", "0.5673497", "0.565986", "0.56488395", "0.5608903", "0.55968666", "0.5588238", "0.55717224", "0.5566177", "0.55588603", "0.5544923", "0.55422705", "0.55368555", "0.5522041", "0.5479882", "0.5423568", "0.54163796", "0.538589", "0.53645307", "0.5355701", "0.5326541", "0.5299274", "0.5295776", "0.5295776", "0.529441", "0.5292162", "0.5289308", "0.52710634", "0.52710634", "0.52710634", "0.5246822", "0.52450615", "0.5240989", "0.5219939", "0.5211578", "0.5210434", "0.5210434", "0.52023566", "0.5202083", "0.5190433", "0.51806027", "0.5175606", "0.5173881", "0.5168261", "0.5168261", "0.51558006", "0.51543945", "0.5151032", "0.51396453", "0.5127894", "0.5111121", "0.509906", "0.5090384", "0.5080007", "0.5062896", "0.5052866", "0.5043186", "0.50382936", "0.50372994", "0.503327", "0.503327", "0.50316054", "0.5028306", "0.50247145", "0.5013601", "0.50128394", "0.5011912", "0.50017244", "0.49944904", "0.49920353", "0.49874756", "0.49709415", "0.49697524", "0.4965297", "0.4960889", "0.49556598", "0.49420318", "0.49413145", "0.4941131", "0.49304488", "0.49260172", "0.49247968", "0.49214342", "0.49203166", "0.49191585", "0.49080005", "0.49073732" ]
0.5811374
13
Fetch the server certificate of an LDAP server Attempt to connect to an LDAP server and retrieve the server certificate it presents.
def fetch_identity_source_ldap_server_certificate_fetch_certificate_with_http_info(identity_source_ldap_server_endpoint, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.fetch_identity_source_ldap_server_certificate_fetch_certificate ...' end # verify the required parameter 'identity_source_ldap_server_endpoint' is set if @api_client.config.client_side_validation && identity_source_ldap_server_endpoint.nil? fail ArgumentError, "Missing the required parameter 'identity_source_ldap_server_endpoint' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.fetch_identity_source_ldap_server_certificate_fetch_certificate" end # resource path local_var_path = '/aaa/ldap-identity-sources?action=fetch_certificate' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(identity_source_ldap_server_endpoint) auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'PeerCertificateChain') if @api_client.config.debugging @api_client.config.logger.debug "API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#fetch_identity_source_ldap_server_certificate_fetch_certificate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ldap_server\n get_attribute_from_auth_source('host')\n end", "def server_cert_from_spec(spec)\n if spec[:server_certificate]\n spec[:server_certificate]\n elsif spec[:ssl_certificate_id]\n spec[:ssl_certificate_id]\n else\n nil\n end\n end", "def ldap_connect\n ldap = Net::LDAP.new(host: host, port: Net::LDAP::DefaultPort)\n ldap\n end", "def get_server_certificate(name)\n request({\n 'Action' => 'GetServerCertificate',\n 'ServerCertificateName' => name,\n :parser => Fog::Parsers::AWS::IAM::UploadServerCertificate.new\n })\n end", "def connection\n return @connection if @connection\n load_ldap_library\n @connection = if ldap_library == 'net/ldap'\n Net::LDAP.new(:host=>server, :port=>(port), :encryption=>(:simple_tls if use_ssl))\n else\n (use_ssl ? LDAP::SSLConn : LDAP::Conn).new(server, port)\n end\n end", "def connect\n @logger.debug(\"Connecting to LDAP server: #{Time.now}\" )\n\n connected = false\n error = nil\n LDAP_SERVERS.each do |ldap_server| \n begin\n @ldap.host = ldap_server\n @ldap.port = 636\n @ldap.encryption :simple_tls\n @ldap.auth BIND_DN, BIND_PASS\n connected = @ldap.bind\n @logger.debug(\"bind result: #{@ldap.get_operation_result}\")\n break if connected\n raise \"Failed to connect to LDAP server #{ldap_server}. Error: #{@ldap.get_operation_result.message} (#{@ldap.get_operation_result.code})\"\n rescue => e\n connected = false\n error = \"Failed to connect to LDAP server #{ldap_server}. Error: #{e.message}\\n#{e.backtrace}\"\n end\n @logger.warn(error)\n end\n\n # raise exception if not connected\n raise ConnectError, error unless connected\n\n @logger.debug(\"connected to #{@ldap.host}.\")\n end", "def get_cert_details()\n $log.debug(\"Returning certificate details\")\n self.use_ssl = true\n disable_validations\n begin\n self.start do |x|\n return ResultContainer.new(true, x.peer_cert)\n end\n rescue => ex\n return ResultContainer.new(false, ex)\n end\n end", "def get_certificate(kerberos)\n mech = Mechanize.new do |m|\n m.user_agent_alias = 'Linux Firefox'\n # NOTE: ca.mit.edu uses a Geotrust certificate, not the self-signed one\n end\n login_page = mech.get 'https://ca.mit.edu/ca/'\n login_form = login_page.form_with :action => /login/\n login_form.field_with(:name => /login/).value = kerberos[:user]\n login_form.field_with(:name => /pass/).value = kerberos[:pass]\n login_form.field_with(:name => /mitid/).value = kerberos[:mit_id]\n keygen_page = login_form.submit login_form.buttons.first\n\n keygen_form = keygen_page.form_with(:action => /ca/)\n if /login/ =~ keygen_form.action\n raise ArgumentError, 'Invalid Kerberos credentials'\n end\n keygen_form.field_with(:name => /life/).value = kerberos[:ttl] || 1\n key_pair = keygen_form.keygens.first.key\n response_page = keygen_form.submit keygen_form.buttons.first\n \n cert_frame = response_page.frame_with(:name => /download/)\n cert_bytes = mech.get_file cert_frame.uri\n cert = OpenSSL::X509::Certificate.new cert_bytes\n {:key => key_pair, :cert => cert}\n end", "def ssl_generate_certificate\n Rex::Socket::SslTcpServer.ssl_generate_certificate\n end", "def certificate\n _get_certificate\n end", "def ssl_cert\n datastore['SSLCert']\n end", "def certificate_get\n return @cert unless @cert.nil?\n cert_path = File.join(resource[:cert_dir], resource[:cert_name])\n @cert = if Pathname.new(cert_path).exist?\n file = File.read(cert_path)\n OpenSSL::X509::Certificate.new(file)\n else\n false\n end\n end", "def fetch_identity_source_ldap_server_certificate_fetch_certificate(identity_source_ldap_server_endpoint, opts = {})\n data, _status_code, _headers = fetch_identity_source_ldap_server_certificate_fetch_certificate_with_http_info(identity_source_ldap_server_endpoint, opts)\n data\n end", "def server_certificate_metadata\n data.server_certificate_metadata\n end", "def connect_to_ldap\r\n begin\r\n @ldap = Net::LDAP.new(:host => @ldap_host,\r\n :port => @ldap_port,\r\n :auth => { :method => :simple,\r\n :username => @ldap_username,\r\n :password => @ldap_password } )\r\n @logger.info \"Connecting to LDAP: '#{@ldap_host}' on port #{@ldap_port}\"\r\n @logger.info \"Binding to LDAP as: #{@ldap_username}\"\r\n \r\n success = @ldap.bind()\r\n if (success)\r\n @logger.info \"LDAP authorization succeeded\"\r\n return true\r\n else\r\n @logger.error \"LDAP authorization failed: #{@ldap.get_operation_result.message}\"\r\n return false\r\n end\r\n rescue Net::LDAP::LdapError => error\r\n @logger.error(\"Error connecting to LDAP: #{error}\")\r\n return false\r\n end\r\n end", "def ensure_ca_certificates\n final_state = run_machine(NeedCACerts.new, NeedKey)\n final_state.ssl_context\n end", "def connect\n\t\tconn = nil\n\n\t\tcase @connect_type\n\t\twhen :tls\n\t\t\tself.log.debug \"Connecting using TLS to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::SSLConn.new( @host, @port, true )\n\t\twhen :ssl\n\t\t\tself.log.debug \"Connecting using SSL to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::SSLConn.new( @host, @port )\n\t\telse\n\t\t\tself.log.debug \"Connecting using an unencrypted connection to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::Conn.new( @host, @port )\n\t\tend\n\n\t\tconn.set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, 3 )\n\t\tconn.set_option( LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_OFF )\n\n\t\treturn conn\n\tend", "def get_dn_from_certificate(type)\n cert_str = request.env[\"#{options.client_cert_header}\"]\n if cert_str\n client_cert = cert_str.to_cert\n log :debug, \"Client certificate:\\r\\n#{client_cert}\"\n raw_dn ||= parse_dn_from_certificate(client_cert, type)\n log :debug, \"raw_dn (#{type}) from cert: #{raw_dn}\"\n end\n\n raw_dn\n end", "def ca_cert_string\n @ca_cert_string ||= begin\n vcap_services[vcap_services.keys.first].first['credentials']['cacrt']\n end\n end", "def connect!\n com::unboundid::ldap::sdk::LDAPConnection.new(\n self.host, self.port, self.bind_dn, self.password) \n end", "def connect\n @conn ||= Net::LDAP.new\n @conn.host = @host\n @conn.port = @port\n @conn.auth \"#{@login_dn},#{@base_dn}\", @password\n\n if @conn.bind\n return true\n else\n return false\n end\n end", "def certificate_path\n\t\t\tFile.join(@root, \"#{@hostname}.crt\")\n\t\tend", "def cert\n @cert\n end", "def connection\n unless @connection\n raise Puppet::Error, \"Could not set up LDAP Connection: Missing ruby/ldap libraries\" unless Puppet.features.ldap?\n begin\n conn = Puppet::Util::Ldap::Connection.instance\n conn.start\n @connection = conn.connection\n rescue => detail\n puts detail.backtrace if Puppet[:trace]\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end\n end\n\n @connection\n end", "def describe_server_certificate(server_certificate_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeServerCertificate'\n\t\targs[:query]['ServerCertificateId'] = server_certificate_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def fetch_ssl_certificates\n run_command(\"ssl fetch\")\n rescue Runner::Exceptions::KnifeCommandFailed => e\n raise Runner::Exceptions::CertFetchFailed.new(e.message)\n end", "def list_server_certificates(options = {})\n request({\n 'Action' => 'ListServerCertificates',\n :parser => Fog::Parsers::AWS::IAM::ListServerCertificates.new\n }.merge!(options))\n end", "def ssl_certificate\n @ssl_certificate ||= OpenSSL::X509::Certificate.new <<-CERT\n-----BEGIN CERTIFICATE-----\nMIIBQjCB7aADAgECAgEAMA0GCSqGSIb3DQEBBQUAMCoxDzANBgNVBAMMBm5vYm9k\neTEXMBUGCgmSJomT8ixkARkWB2V4YW1wbGUwIBcNMTExMTAzMjEwODU5WhgPOTk5\nOTEyMzExMjU5NTlaMCoxDzANBgNVBAMMBm5vYm9keTEXMBUGCgmSJomT8ixkARkW\nB2V4YW1wbGUwWjANBgkqhkiG9w0BAQEFAANJADBGAkEA8pmEfmP0Ibir91x6pbts\n4JmmsVZd3xvD5p347EFvBCbhBW1nv1GsbCBEFlSiT1q2qvxGb5IlbrfdhdgyqdTX\nUQIBATANBgkqhkiG9w0BAQUFAANBAAAB////////////////////////////////\n//8AMCEwCQYFKw4DAhoFAAQUePiv+QrJxyjtEJNnH5pB9OTWIqA=\n-----END CERTIFICATE-----\n CERT\n end", "def client\n Net::LDAP.new({\n host: Settings.ldap.host,\n port: Settings.ldap.port,\n encryption: { method: :simple_tls },\n auth: {\n method: :simple,\n username: Settings.ldap.application_bind,\n password: Settings.ldap.application_password\n }\n })\n end", "def start\n case ssl\n when :tls\n @connection = LDAP::SSLConn.new(host, port, true)\n when true\n @connection = LDAP::SSLConn.new(host, port)\n else\n @connection = LDAP::Conn.new(host, port)\n end\n @connection.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n @connection.set_option(LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_ON)\n @connection.simple_bind(user, password)\n rescue => detail\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end", "def ssl\n if @options[\"ssl-gen-self-signed-certs\"]\n puts \"Generating private key and certificate\"\n args = [\n \"-C\", HOSTNAME,\n \"-n\", HOSTNAME,\n \"-o\", @options[\"ssl-organization\"],\n \"-u\", @options[\"ssl-organization-unit\"],\n \"-e\", @options[\"ssl-email\"],\n \"-c\", @options[\"ssl-country\"],\n \"-l\", @options[\"ssl-city\"],\n \"-s\", @options[\"ssl-state\"]\n ]\n Runner.exec(\"gensslcert\", args)\n end\n\n handle_own_certs @options[\"ssl-certs-dir\"].chomp \\\n unless @options[\"ssl-certs-dir\"].chomp.empty?\n\n key_file = \"/etc/apache2/ssl.key/#{HOSTNAME}-ca.key\"\n crt_file = \"/etc/apache2/ssl.crt/#{HOSTNAME}-ca.crt\"\n portus_key = \"/srv/Portus/config/server.key\"\n\n missing_file(key_file) unless File.exist?(key_file)\n missing_file(crt_file) unless File.exist?(crt_file)\n\n # Move key to portus dir, set permissions and create symlink\n # bsc#1022811\n FileUtils.cp(\n key_file,\n portus_key\n )\n FileUtils.chown(\"wwwrun\", \"www\", portus_key)\n FileUtils.chmod(0o440, portus_key)\n FileUtils.rm(key_file)\n FileUtils.ln_s(\n portus_key,\n key_file\n )\n\n FileUtils.cp(\n crt_file,\n \"/srv/www/htdocs\"\n )\n FileUtils.chmod(0o755, \"/srv/www/htdocs/#{HOSTNAME}-ca.crt\")\n FileUtils.cp(\n crt_file,\n \"/etc/pki/trust/anchors\"\n )\n Runner.exec(\"update-ca-certificates\")\n end", "def cert\n digidoc_cert if @cert.nil?\n @cert\n end", "def certificate\n return @cert unless @cert.nil?\n\n # Verify that the given directory exists\n unless File.directory?(resource[:cert_dir])\n raise ArgumentError, \"Directory not found for: #{resource[:cert_dir]}\"\n end\n\n cert_path = File.join(resource[:cert_dir], resource[:cert_name])\n @cert = if Pathname.new(cert_path).exist?\n file = File.read(cert_path)\n OpenSSL::X509::Certificate.new(file)\n else\n false\n end\n end", "def get(certificate_thumbprint)\n cert_get(certificate_thumbprint)\n end", "def describe_server_certificates(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeServerCertificates'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :server_certificate_id\n\t\t\targs[:query]['ServerCertificateId'] = optional[:server_certificate_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def cert_path; end", "def cert_path; end", "def ldap_authenticate\n # logger.debug(\"ldap_authenticate\")\n # ldap_time = Benchmark.realtime { ActiveLdap::Base.setup_connection }\n # logger.debug(\"LDAP: took #{ldap_time} to establish the connection\")\n authenticate_or_request_with_http_basic \"Bluepages Authentication\" do |user_name, password|\n logger.info(\"attempt to ldap authenticate: user_name #{user_name}\")\n next nil unless LdapUser.authenticate_from_email(user_name, password)\n logger.info(\"successful ldap_authenticate as #{user_name}\")\n common_authenticate(user_name)\n return true\n end\n return false\n end", "def ldap_ssl?\r\n ldap_ssl.to_s.to_i != 0\r\n end", "def ssl_cert\n self.config.ssl_cert\n end", "def cert; end", "def cert; end", "def cert; end", "def ssl_verify_peer(cert_string)\n #puts cert_string\n #puts\n cert = OpenSSL::X509::Certificate.new(cert_string)\n #p cert\n # Some servers send the same certificate multiple times. I'm not even joking... (gmail.com)\n return true if cert == @last_seen_cert\n @last_seen_cert = cert\n\n if ca_store.verify(@last_seen_cert)\n # A server may send the root certifiacte, which we already have and thus\n # should not be added to the store again.\n ca_store.add_cert(@last_seen_cert) unless @last_seen_cert.root?\n true\n else\n fail \"unable to verify the server certificate of `#{@hostname}'\"\n false\n end\n end", "def test_ssl_with_cert\n client = MongoClient.new('server', 27017, :connect => false,\n :ssl => true,\n :ssl_cert => CLIENT_CERT,\n :ssl_key => CLIENT_CERT)\n assert client.connect\n end", "def ldap_connect(domain,binddn=BINDUSER,bindpw=BINDPASS)\n binddn = binddn + \"@\" + domain\n ldap = Net::LDAP.new(:host => domain,\n :port => 389,\n :auth => {\n :method => :simple,\n :username => binddn,\n :password => bindpw,\n })\n return ldap\n end", "def get_cert_path\n if !has_cert?\n return nil\n end\n\n return @cert_file_path\n end", "def cert\n @cert ||= (OpenSSL::X509::Certificate.new File.read(cert_file) if cert_file)\n end", "def cert_store; end", "def cert_store; end", "def server_certificate_eql?(cert1, cert2)\n server_cert_to_string(cert1) == server_cert_to_string(cert2)\n end", "def ssl_config # :nodoc:\n {\n SSLCertificate: @certificate,\n SSLPrivateKey: @key,\n SSLCaCertificateStore: certificate_store,\n SSLVerifyMode:\n OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT,\n }\n end", "def get!(certificate_thumbprint)\n cert_pem = cert_get(certificate_thumbprint)\n\n raise ArgumentError, \"Unable to retrieve the certificate\" if cert_pem.empty? || cert_pem == \"Certificate Not Found\"\n\n cert_pem\n end", "def bind_connection(credentials)\n Net::LDAP.new(credentials)\n rescue\n raise(ConnectionError, 'Failure connecting to LDAP host')\n end", "def certificate\n return @certificate\n end", "def get_cert\n cert_str = \"\"\n \n File.open(@cert_file_path, \"r\") do |f|\n cert_str = f.read\n end\n\n return cert_str\n end", "def ca_certificate_identifier\n @dbi.ca_certificate_identifier\n end", "def ca_certificate_identifier\n @dbi.ca_certificate_identifier\n end", "def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :pwdays => 0,\n :notify => false,\n }\n\n if entry.respond_to? :mail\n acct[:mail] = entry.mail.first.to_s\n else\n acct[:mail] = \"im-bigdata-pgh-sysadmins@wwpdl.vnet.ibm.com\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n next # These passwords have already expired.\n end\n\n # Send a notice 14, 7, 3, 2 and 1 days before expiration\n if [14, 7, 3, 2, 1].include? numDays\n acct[:notify] = true\n acct[:pwDays] = numDays\n end\n\n $accounts.push acct\n end\nend", "def certification\n return @certification\n end", "def bind\n conn = Net::LDAP.new :host => @config[:server],\n :port => @config[:port],\n :base => @config[:base]\n if @config[:encryption]\n conn.encryption @config[:encryption]\n end\n \n raise \"Anonymous Bind is disabled\" if @config[:password] == \"\" && !(@config[:anonymous_bind])\n \n conn.auth \"#{@config[:username]}@#{@config[:domain]}\", @config[:password]\n \n begin\n Timeout::timeout(10){\n if conn.bind\n return conn\n else\n raise 'Query User Rejected'\n end\n }\n rescue Timeout::Error\n raise 'Unable to connect to LDAP Server'\n rescue Errno::ECONNRESET\n if @config[:allow_fallback]\n @config[:port] = @config[:allow_fallback]\n @config[:encryption] = false\n return Adauth::Connection.new(@config).bind\n end\n end\n end", "def ssl_certs\n requires :identity\n\n service.ssl_certs.all(identity)\n end", "def ldap_secure\n @attributes[:ldap_secure]\n end", "def cert\n @agent.certificate\n end", "def x509_certificate_string\n t=self.metadata_nokogiri.clone\n t.remove_namespaces!\n the_xpath = \"//KeyDescriptor/KeyInfo/X509Data/X509Certificate\"\n node = t.xpath(the_xpath)\n if node.blank?\n raise \"Could not extract X509Certificate from #{site.name}\"\n else\n node.inner_text\n end\n end", "def post_connection_check(peer_cert, hostname) # :nodoc:\n check_common_name = true\n cert = peer_cert\n cert.extensions.each{|ext|\n next if ext.oid != \"subjectAltName\"\n ext.value.split(/,\\s+/).each{|general_name|\n if /\\ADNS:(.*)/ =~ general_name\n check_common_name = false\n reg = Regexp.escape($1).gsub(/\\\\\\*/, \"[^.]+\")\n return true if /\\A#{reg}\\z/i =~ hostname\n elsif /\\AIP Address:(.*)/ =~ general_name\n check_common_name = false\n return true if $1 == hostname\n end\n }\n }\n if check_common_name\n cert.subject.to_a.each{|oid, value|\n if oid == \"CN\"\n reg = Regexp.escape(value).gsub(/\\\\\\*/, \"[^.]+\")\n return true if /\\A#{reg}\\z/i =~ hostname\n end\n }\n end\n raise SSL::SSLError, \"hostname was not match with the server certificate\"\n end", "def to_x509()\n @cert\n end", "def test_connection\n ldap_con = initialize_ldap_con(self.account, self.account_password)\n ldap_con.open { }\n rescue Net::LDAP::LdapError => text\n raise \"LdapError: %s\" % text\n end", "def ssl_cert\n OpenSSL::X509::Certificate.new(File.read(self.class.ssl_cert_path))\n rescue => e\n # :nocov:\n unless allow_missing_certs?\n Rails.logger.warn \"Could not load #{service_name} SSL cert: #{e.message}\"\n raise e if Rails.env.production?\n end\n nil\n # :nocov:\n end", "def ldap_options_for(ldap_login, ldap_password)\n host = ENV['DISTRICT_LDAP_HOST']\n port = ENV['DISTRICT_LDAP_PORT'].to_i\n encryption_tls_options = JSON.parse(ENV['DISTRICT_LDAP_ENCRYPTION_TLS_OPTIONS_JSON'] || '{}').deep_symbolize_keys\n\n {\n host: host,\n port: port,\n connect_timeout: ENV.fetch('DISTRICT_LDAP_TIMEOUT_IN_SECONDS', '30').to_i,\n auth: {\n :method => :simple,\n :username => ldap_login,\n :password => ldap_password,\n },\n encryption: {\n method: :simple_tls,\n tls_options: encryption_tls_options\n }\n }\n end", "def post_connection_check(peer_cert, hostname)\n check_common_name = true\n cert = peer_cert\n cert.extensions.each{|ext|\n next if ext.oid != \"subjectAltName\"\n ext.value.split(/,\\s+/).each{|general_name|\n if /\\ADNS:(.*)/ =~ general_name\n check_common_name = false\n reg = Regexp.escape($1).gsub(/\\\\\\*/, \"[^.]+\")\n return true if /\\A#{reg}\\z/i =~ hostname\n elsif /\\AIP Address:(.*)/ =~ general_name\n check_common_name = false\n return true if $1 == hostname\n end\n }\n }\n if check_common_name\n cert.subject.to_a.each{|oid, value|\n if oid == \"CN\"\n reg = Regexp.escape(value).gsub(/\\\\\\*/, \"[^.]+\")\n return true if /\\A#{reg}\\z/i =~ hostname\n end\n }\n end\n raise OpenSSL::SSL::SSLError, \"hostname not match\"\n end", "def certificate_value(h)\n v = credential_authentication_inverso_issuer(h)\n h[:k] == \"seal\" && valid_keys.include?(\"certificate\") ? \"#{v} #{join_seal(h[:ver])}\" : v\n end", "def certificate; end", "def certificate; end", "def certificate\n cert_value = @ar.at_css(\n 'xmlns|X509Certificate',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#'\n ).content.gsub(/\\s+/, \"\")\n\n cert = process_cert_value(cert_value)\n\n begin\n OpenSSL::X509::Certificate.new(cert)\n rescue => e\n fail OpenSSL::X509::CertificateError,\n \"The certificate embedded in the application response could not be \" \\\n \"processed. It's most likely corrupted. \" \\\n \"OpenSSL had this to say: #{e}.\"\n end\n end", "def update_server_certificate(server_certificate_name, options={})\n request_hash = { 'ServerCertificateName' => server_certificate_name}\n request_hash['NewServerCertificateName'] = options[:new_server_certificate_name] unless options[:new_server_certificate_name].right_blank?\n request_hash['NewPath'] = options[:new_path] unless options[:new_path].right_blank?\n link = generate_request(\"UpdateServerCertificate\", request_hash)\n request_info(link, RightHttp2xxParser.new(:logger => @logger))\n end", "def server_cert_verification_enabled?\n @enable_server_cert_verification\n end", "def ca_cert\n \n end", "def test_ssl_with_invalid_cert\n assert_raise ConnectionFailure do\n MongoClient.new('server', 27017, :ssl => true,\n :ssl_key => CLIENT_CERT,\n :ssl_cert => CLIENT_CERT,\n :ssl_verify => true,\n :ssl_ca_cert => CA_CERT)\n end\n end", "def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n skip_accounts = ['CORP$']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n if skip_accounts.include? entry.sAMAccountName.first.to_s\n next\n end\n\n begin\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :mail => entry.mail.first.to_s,\n :pwdays => 0,\n :notify => false,\n }\n rescue\n puts \"Caught exception: #{entry.inspect}\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n acct[:pwdays] = numDays\n $accounts.push acct\n end\n\n end\nend", "def certificate_subject\n attributes[:certificate_subject]\n end", "def cert_path=(_arg0); end", "def test_connection\n\t\tldap_con = initialize_ldap_con(self.account, self.encrypted_password)\n\t\tldap_con.open do |ldap|\n\t\tend\n\trescue Net::LDAP::LdapError => text\n\t\traise \"LdapError: \" + text\n\tend", "def x509\n @x509 ||= OpenSSL::X509::Certificate.new(as_pem)\n end", "def net_ldap\n @net_ldap ||= new_net_ldap\n end", "def certificate(record)\n record.public_send(options[:certificate])\n end", "def bind_default_ldap_server(size_limit, domain=nil)\n vprint_status(\"Initializing LDAP connection.\")\n\n # If domain is still null the API may be able to handle it...\n init_result = wldap32.ldap_sslinitA(domain, 389, 0)\n session_handle = init_result['return']\n if session_handle == 0\n raise \"Unable to initialize ldap server: #{init_result[\"ErrorMessage\"]}\"\n end\n\n vprint_status(\"LDAP Handle: #{session_handle}\")\n\n vprint_status(\"Setting Sizelimit Option\")\n wldap32.ldap_set_option(session_handle, LDAP_OPT_SIZELIMIT, size_limit)\n\n vprint_status(\"Binding to LDAP server\")\n bind_result = wldap32.ldap_bind_sA(session_handle, nil, nil, LDAP_AUTH_NEGOTIATE)\n\n bind = bind_result['return']\n unless bind == 0\n wldap32.ldap_unbind(session_handle)\n raise \"Unable to bind to ldap server: #{ERROR_CODE_TO_CONSTANT[bind]}\"\n end\n\n if (block_given?)\n begin\n yield session_handle\n ensure\n vprint_status(\"Unbinding from LDAP service\")\n wldap32.ldap_unbind(session_handle)\n end\n else\n return session_handle\n end\n\n return session_handle\n end", "def collect_cert_info\n # Redirect keytool check error to /dev/null\n os_has_keytool = system('keytool 2>/dev/null')\n raise 'keytool dependency not satisfied. Make sure that JAVA keytool utility is installed' unless os_has_keytool\n cert_info = {}\n certificate_raw = `keytool -printcert -rfc -jarfile #{@apk_path.shellescape}`\n certificate_content_regexp = /(-----BEGIN CERTIFICATE-----.*-----END CERTIFICATE-----)/m\n matched_data = certificate_content_regexp.match(certificate_raw)\n if matched_data\n certificate_content = matched_data.captures[0]\n cert_info = {\n issuer_raw: nil,\n cn: nil,\n ou: nil,\n o: nil,\n st: nil,\n l: nil,\n c: nil,\n creation_date: nil,\n expiration_date: nil\n }\n cert_extract_dates(certificate_content, cert_info)\n cert_extract_issuer(certificate_content, cert_info)\n else\n puts 'Failed to find CERT.RSA file in APK'\n end\n cert_info\n end", "def setup_ldap_server\n server = FakeLDAP::Server.new(port: 1389)\n server.run_tcpserver\n\n @domain = 'dc=example,dc=com'\n @toplevel_user_dn = \"cn=toplevel_user,cn=TOPLEVEL,#{@domain}\"\n @toplevel_user_password = 'toplevel_password'\n\n @regular_user_cn = 'regular_user'\n @regular_user_dn = \"cn=#{@regular_user_cn},ou=USERS,#{@domain}\"\n @regular_user_password = 'regular_password'\n @regular_user_email = \"#{@regular_user_cn}@example.com\"\n\n server.add_user(@toplevel_user_dn, @toplevel_user_password)\n server.add_user(@regular_user_dn, @regular_user_password,\n @regular_user_email)\n server\n end", "def getSslTcpConnection(host, port)\n store = OpenSSL::X509::Store.new\n store.add_file(OpenSSL::X509::DEFAULT_CERT_FILE)\n sslContext = OpenSSL::SSL::SSLContext.new\n sslContext.cert_store = store\n sslContext.ssl_version = :SSLv23\n sslSocket = OpenSSL::SSL::SSLSocket.new(TCPSocket.new(host, port), sslContext)\n sslSocket.hostname = host #for Server Name Indication (SNI)\n sslSocket.sync_close = true #instead of calling close on tcp socket\n sslSocket.connect\n sslSocket\nend", "def test_ssl_certs_dir\n certfile = \"#{RbConfig::TOPDIR}/#{\"bin/etc/\" if RUBY_VERSION >= \"3.2\"}ssl/certs/#{pki.ca_cert.subject.hash.to_s(16)}.0\"\n File.write(certfile, pki.ca_cert.to_pem)\n\n server = TCPServer.new \"localhost\", 0\n server_th = Thread.new do\n run_ssl_server(server, pki)\n end\n\n # Connect per system CA list (with addition of our certificate)\n sclient = connect_ssl_client(\"localhost\", server.local_address.ip_port)\n assert_ssl_connection_is_usable(server_th.value, sclient)\n\n File.unlink(certfile)\n end", "def certificate\n Base64.strict_encode64(parsed_certificate.to_der)\n end", "def server_signing_profile(node)\n {\n \"digest\" => manager.provider.ca.server_certificates.digest,\n \"extensions\" => {\n \"keyUsage\" => {\n \"usage\" => [\"digitalSignature\", \"keyAgreement\"]\n },\n \"extendedKeyUsage\" => {\n \"usage\" => [\"serverAuth\"]\n },\n \"subjectAltName\" => {\n \"ips\" => [node.ip_address],\n \"dns_names\" => dns_names_for_node(node)\n }\n }\n }\n end", "def setup_ssl\n @connection.use_ssl = @config[:use_ssl]\n\n if @config[:ssl_verify_peer]\n @connection.verify_mdoe = OpenSSL::SSL::VERIFY_PEER\n @connection.ca_file = @config[:ssl_ca_file]\n else\n @connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n end", "def get_tls_certificate_0(certificate_id, opts = {})\n data, _status_code, _headers = get_tls_certificate_0_with_http_info(certificate_id, opts)\n data\n end", "def cert_pem; end", "def get_network_sm_certs(options = {})\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'network_id' => options['network_id'],\r\n 'device_id' => options['device_id']\r\n )\r\n # Prepare query url.\r\n _path_url = '/networks/{networkId}/sm/{deviceId}/certs'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'networkId' => options['network_id'],\r\n 'deviceId' => options['device_id']\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end", "def ssl_verify; @opts[:ssl_verify]; end", "def authenticate_dn(dn, password)\n\t\tif dn.present? && password.present?\n\t\t\tinitialize_ldap_con(dn, password).bind\n\t\tend\n\tend", "def setup_connection(connection)\n if ssl_certificates_are_present?\n connection.cert_store = @ssl_host.ssl_store\n connection.ca_file = @ssl_configuration.ca_auth_file\n connection.cert = @ssl_host.certificate.content\n connection.key = @ssl_host.key.content\n connection.verify_mode = OpenSSL::SSL::VERIFY_PEER\n connection.verify_callback = self\n else\n connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n end" ]
[ "0.62266874", "0.6185673", "0.6164346", "0.6135415", "0.61141545", "0.60927397", "0.60395366", "0.59357697", "0.5907095", "0.59048176", "0.5898186", "0.5868905", "0.5811374", "0.57577205", "0.5673497", "0.565986", "0.56488395", "0.5608903", "0.55968666", "0.5588238", "0.55717224", "0.5566177", "0.55588603", "0.5544923", "0.55422705", "0.55368555", "0.5522041", "0.5479882", "0.5423568", "0.54163796", "0.538589", "0.53645307", "0.5355701", "0.5326541", "0.5299274", "0.5295776", "0.5295776", "0.529441", "0.5292162", "0.5289308", "0.52710634", "0.52710634", "0.52710634", "0.5246822", "0.52450615", "0.5240989", "0.5219939", "0.5211578", "0.5210434", "0.5210434", "0.52023566", "0.5202083", "0.5190433", "0.51806027", "0.5175606", "0.5173881", "0.5168261", "0.5168261", "0.51558006", "0.51543945", "0.5151032", "0.51396453", "0.5127894", "0.5111121", "0.509906", "0.5090384", "0.5080007", "0.5062896", "0.5052866", "0.5043186", "0.50382936", "0.50372994", "0.503327", "0.503327", "0.50316054", "0.5028306", "0.50247145", "0.5013601", "0.50128394", "0.5011912", "0.50017244", "0.49944904", "0.49920353", "0.49874756", "0.49709415", "0.49697524", "0.4965297", "0.4960889", "0.49556598", "0.49420318", "0.49413145", "0.4941131", "0.49304488", "0.49260172", "0.49247968", "0.49214342", "0.49203166", "0.49191585", "0.49080005", "0.49073732" ]
0.5927438
8
List LDAP identity sources Return a list of all configured LDAP identity sources.
def list_ldap_identity_sources(opts = {}) data, _status_code, _headers = list_ldap_identity_sources_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_ldap_identity_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/aaa/ldap-identity-sources'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#list_ldap_identity_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_authentication_sources(opts = {})\n data, _status_code, _headers = get_authentication_sources_with_http_info(opts)\n data\n end", "def list(sources=DEFAULT_SOURCES, options)\n options = DEFAULT_OPTIONS.merge!(options)\n sources.collect do |source|\n source.list(options)\n end.flatten.uniq\n end", "def sources(source: nil)\n params = {\n source: source\n }.compact\n\n _get(\"/account/sources\", params) { |json| json }\n end", "def account_sources(source)\n get('account/sources', {'source' => source})\n end", "def domains\n @domains ||= ldap.search_domains.map { |base| ldap.domain(base) }\n end", "def domains\n @domains ||= ldap.search_domains.map { |base| ldap.domain(base) }\n end", "def sources\n @sources.names\n end", "def get_sources(opts = {})\n data, _status_code, _headers = get_sources_with_http_info(opts)\n data\n end", "def search_sources(opts = {})\n data, _status_code, _headers = search_sources_with_http_info(opts)\n data\n end", "def data_sources\n src.collect{|v| v['source']}\n end", "def sources\n @settings.sources.to_a.inject({}) do |result, (source_id, source)|\n result[source_id] = source[:adapter].configuration\n result\n end\n end", "def get_sources\n response = execute_get(\"/reference/source\")\n Source.from_array(decode(response))\n end", "def sources\n @sources ||= AVAILABLE_SOURCES.each_with_object({}) do |source_class, list|\n source = source_class.new\n list[source.id.to_s] = {\n 'name' => source.name,\n 'website' => source.website,\n 'notes' => source.notes,\n 'class' => source.class\n }\n end\n end", "def sources\n IITSourceCollection.new(@ole.Sources)\n end", "def get_all_sources_info\n source_info = {}\n METADATA_FIELDS.keys.each { |ns|\n source_info[ns] = get_metadata_source_info(ns)\n }\n source_info\n end", "def sources\n @_configuration.fetch('sources') { DEFAULT_SOURCES }\n end", "def all_sources\n result = Set.new\n sources.each do |ev|\n result << ev\n result.merge(ev.all_sources)\n end\n result\n end", "def search_ldap_identity_source(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def available_data_sources\n data_sources = []\n if self.current_contexts.size == 1\n the_context = self.current_contexts.first\n if the_context != ContextEnum.either\n the_data_source = self.inherited_data_source\n if the_data_source == DataSourceNone # top level data source\n data_sources = ContextDataSourceMap[the_context]\n else\n data_sources = DataSourceChainMap[the_data_source]\n end\n end\n end\n data_sources\n end", "def get_sources(workdir)\n @sources.each do |source|\n cur_source = Vanagon::Component::Source.source(source.url, { :ref => source.ref, :sum => source.sum }, workdir)\n cur_source.fetch\n cur_source.verify\n end\n end", "def sources\n @sources ||= []\n end", "def data_sources\n []\n end", "def get_authentication_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_authentication_sources ...'\n end\n # resource path\n local_var_path = '/api/3/authentication_sources'\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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = 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 => 'ResourcesAuthenticationSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_authentication_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @cla_sources = ClaSource.all\n end", "def sources(sources = nil)\n @sources.assign(sources) if sources\n @sources\n end", "def add_sources(marshaller)\n source_dir = (source_type == SOURCE_TYPE_INTERNAL) \\\n ? SystemProperties::getCenterInternalDirectory \\\n : SystemProperties::getCenterExternalDirectory\n\n ha_configured = CommonSql.ha_configured?\n\n ConfigurationSource.get_all_sources_by_type(source_type).each do |source|\n source_xml = marshaller.factory.createConfigurationSourceType\n central_server_address = nil\n if ha_configured\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS,\n :ha_node_name => source.ha_node_name).first.value\n else\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS).first.value\n end\n source_xml.downloadURL =\n \"http://\" + central_server_address + \"/\" + source_dir\n source.configuration_signing_keys.find_each do |key|\n source_xml.getVerificationCert.add(key.cert.to_java_bytes)\n end\n marshaller.root.source.add(source_xml)\n end\n end", "def add_datasources\n options = {\n active_source: active_source,\n query: params['q'] || params['s.q'] || nil\n }\n\n has_facets = source_has_facets?(active_source)\n # Show all datasources when there's no current query, or\n # when we're in a datasource that doesn't have facets.\n options[:all_sources] = !active_query? || !has_facets\n\n result = []\n result |= datasources_active_list(options).map do |src|\n single_datasource_list_item(src, options)\n end\n\n # If there are hidden data-sources, gather them up wrapped w/ expand/contract links\n unless (hidden_datasources = datasources_hidden_list(options)).empty?\n result << content_tag(:li, link_to('More...', '#'), id: 'datasource_expand')\n\n sub_results = hidden_datasources.map do |src|\n single_datasource_list_item(src, options)\n end\n\n sub_results << content_tag(:li, link_to('Fewer...', '#'), id: 'datasource_contract')\n result << content_tag(:ul, sub_results.join('').html_safe, id: 'expanded_datasources', class: 'list-unstyled')\n end\n\n landing_class = options[:all_sources] ? 'landing datasource_list' : 'datasource_list'\n landing_class += ' no_facets' unless has_facets\n landing_class += ' hidden-xs'\n clio_sidebar_items.unshift(\n content_tag(:ul, result.join('').html_safe, id: 'datasources', class: landing_class)\n )\n end", "def search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}/search'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'filter_value'] = opts[:'filter_value'] if !opts[:'filter_value'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceSearchResultList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#search_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def identity_providers\n return @identity_providers\n end", "def identity_providers\n return @identity_providers\n end", "def sources(opts)\n if opts.edit\n path = File.expand_path(Config.instance.options['sources']['path'])\n Config.instance.open_file(path)\n else\n sources = Sources.instance\n sources.parse(@sources)\n sources_list_dl(sources, opts)\n end\n end", "def sources\n sort!\n @sources\n end", "def list_sources\n sources = Profile.get_guardian_headlines\n # prints out numbered articles\n sources.each do |key, value|\n puts ColorizedString[\"#{key}.\"].red + \" #{value[0]}\"\n end\n # asks for input\n input = choose_source(sources)\n choice = sources[input][0]\n print ColorizedString[\"You have chosen:\"].red\n puts ColorizedString[\" #{choice}\"].underline\n sources[input][1]\n end", "def add_datasources(active_source = @active_source)\n options = {\n active_source: active_source,\n query: params['q'] || params['s.q'] || ''\n }\n\n has_facets = FOCUS_CONFIG[active_source].has_facets?\n\n # Show all datasources when there's no current query, or\n # when we're in a datasource that doesn't have facets.\n options[:all_sources] = !active_query? || !has_facets\n\n result = []\n result |= datasources_active_list(options).map do |src|\n single_datasource_list_item(src, options)\n end\n\n # If there are hidden data-sources, gather them up wrapped w/ expand/contract links\n unless (hidden_datasources = datasources_hidden_list(options)).empty?\n result << content_tag(:li, link_to('More...', '#'), id: 'datasource_expand')\n\n sub_results = hidden_datasources.map do |src|\n single_datasource_list_item(src, options)\n end\n\n sub_results << content_tag(:li, link_to('Fewer...', '#'), id: 'datasource_contract')\n result << content_tag(:ul, sub_results.join('').html_safe, id: 'expanded_datasources', class: 'list-unstyled')\n end\n\n landing_class = options[:all_sources] ? 'landing datasource_list' : 'datasource_list'\n landing_class += ' no_facets' unless has_facets\n landing_class += ' hidden-xs'\n clio_sidebar_items.unshift(\n content_tag(:ul, result.join('').html_safe, id: 'datasources', class: landing_class)\n )\n end", "def sources\n @iTunes.sources.each do |source|\n @sources << source\n end\n end", "def get_sources\n @page.all(input_elements[:sources_list])\n end", "def sources #:nodoc:\n @sources.map{ |source| source.call }.flatten\n end", "def sources\n\t\tKassociation.where( :source_id => self.id )\n\tend", "def source_list(source)\n if source.nil? || source.empty?\n raise Error, 'No source specified for query'\n end\n auto_alias_count = @opts[:num_dataset_sources] || 0\n m = source.map do |s|\n case s\n when Dataset\n auto_alias_count += 1\n s.to_table_reference(\"t#{auto_alias_count}\")\n else\n table_ref(s)\n end\n end\n m.join(COMMA_SEPARATOR)\n end", "def domains\n collect { |a| a.domain }\n end", "def index\n @data_sources = DataSource.all\n end", "def datasources(query = {})\n Request.new(self, '/cdn/datasources', query).get\n end", "def providers_id_connector_sources_get(id_connector, opts = {})\n data, _status_code, _headers = providers_id_connector_sources_get_with_http_info(id_connector, opts)\n data\n end", "def sources_list_dl(sources, opts)\n mods = opts.categories ? sources.parse_mods(opts.categories) : nil\n sources.apply_mods(mods) if mods\n\n if opts.download\n Storage.instance.download_sources\n else\n IO.instance.sources_print(sources.sources)\n end\n end", "def urls\n @gapi.source_uris\n end", "def sources\n []\n end", "def get_all_ach_funding_sources(opts = {})\n data, _status_code, _headers = get_all_ach_funding_sources_with_http_info(opts)\n data\n end", "def sources\n s = Set.new\n experiments.each { |experiment| s.merge(experiment.sources) }\n s.to_a\n end", "def list_identities(opts = {})\n data, _status_code, _headers = list_identities_with_http_info(opts)\n data\n end", "def list_identities(opts = {})\n data, _status_code, _headers = list_identities_with_http_info(opts)\n data\n end", "def identity_providers=(value)\n @identity_providers = value\n end", "def identity_providers=(value)\n @identity_providers = value\n end", "def index\n @portal_sources = PortalSource.all\n end", "def domains_list\n call('domains.list')[:domains]\n end", "def sources\n source_paths\n end", "def sources\n filter.sources\n end", "def all_sources\n @normal_sources + @extensions + @replacements\n end", "def datasources_hidden_list(options = {})\n if options[:all_sources]\n []\n else\n datasource_list(:minor).reject { |source| source == options[:active_source] }\n end\n end", "def datasources_hidden_list(options = {})\n if options[:all_sources]\n []\n else\n datasource_list(:minor).reject { |source| source == options[:active_source] }\n end\n end", "def list_ccadmins\n domain = domains(name: Rails.configuration.cloud_admin_domain).first\n return [] unless domain\n list_scope_admins(domain_id: domain.id)\n end", "def get_authentication_source_users(id, opts = {})\n data, _status_code, _headers = get_authentication_source_users_with_http_info(id, opts)\n data\n end", "def sources_data\n sources_url = Api.gnews_path('sources')\n call_gnews_url(sources_url).parse\n end", "def domains\n connection.list_domains[:domains]\n end", "def sources\n [root_source] + reference_sources\n end", "def sources\n @sources ||= SourcePool.new\n end", "def sources\n @sources ||= ApiFactory.new 'Repos::Sources'\n end", "def get_source_ids(source_names)\n if source_names && current_user.try(:is_admin_or_staff?)\n source_ids = Source.where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif source_names\n source_ids = Source.where(\"private = ?\", false).where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif current_user.try(:is_admin_or_staff?)\n source_ids = Source.order(\"name\").pluck(:id)\n else\n source_ids = Source.where(\"private = ?\", false).order(\"name\").pluck(:id)\n end\n end", "def get_source_ids(source_names)\n if source_names && current_user.try(:is_admin_or_staff?)\n source_ids = Source.where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif source_names\n source_ids = Source.where(\"private = ?\", false).where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif current_user.try(:is_admin_or_staff?)\n source_ids = Source.order(\"name\").pluck(:id)\n else\n source_ids = Source.where(\"private = ?\", false).order(\"name\").pluck(:id)\n end\n end", "def default_sources\n self.class.default_sources.map{ |src| File.join(root, src) }\n end", "def v1_measurement_sources_get(opts = {})\n data, _status_code, _headers = v1_measurement_sources_get_with_http_info(opts)\n return data\n end", "def domains\n request('domain-list_domains').inject([]) { |domains, domain|\n domains << Domain.new(domain)\n }\n end", "def slapd_listen_urls\n urls = []\n\n (use_ldap, use_ldaps) = use_ldap_or_ldaps?(node['ca_openldap']['tls']['enable'].to_sym)\n ldap_port = node['ca_openldap']['default_ports']['ldap']\n ldaps_port = node['ca_openldap']['default_ports']['ldaps']\n\n urls << \"ldapi:///\" if node['ca_openldap']['enable_ldapi']\n\n if use_ldap == 'yes'\n node['ca_openldap']['slapd_listen_addresses'].each do |listen_adress|\n urls << \"ldap://#{ listen_adress }:#{ ldap_port }\"\n end\n end\n\n if use_ldaps == 'yes'\n node['ca_openldap']['slapd_listen_addresses'].each do |listen_adress|\n urls << \"ldaps://#{ listen_adress }:#{ ldaps_port }\"\n end\n end\n\n urls.join \" \"\n end", "def get_sources(workdir) # rubocop:disable Metrics/AbcSize\n sources.each do |source|\n src = Vanagon::Component::Source.source(\n source.url, workdir: workdir, ref: source.ref, sum: source.sum\n )\n src.fetch\n src.verify\n if source.erb\n erb_file(src.file, File.join(File.dirname(src.file), File.basename(src.file, \".erb\")), true)\n end\n # set src.file to only be populated with the basename instead of entire file path\n src.file = File.basename(src.url)\n extract_with << src.extract(platform.tar) if src.respond_to? :extract\n end\n end", "def lists\n @lists ||= ActsAsIcontact::Subscription.lists(:contactId => id)\n end", "def index_task_sources(task_id, opts = {})\n data, _status_code, _headers = index_task_sources_with_http_info(task_id, opts)\n data\n end", "def identifier_uris\n return @identifier_uris\n end", "def discount_ids\n discount_sources.map { |att| send(att) }\n end", "def index\n @data_source_types = DataSourceType.all\n end", "def show\n @ldap_auth_header = Irm::LdapAuthHeader.list_all.find(params[:id])\n puts @ldap_auth_header.ldap_source.name\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ldap_auth_header }\n end\n end", "def index\n @sources = Source.all\n end", "def read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#read_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def datasources\n [@slice_names_ds_proxy]\n end", "def organizations\n self.organization_ids.map do |uid|\n MnoEnterprise::Organization.find_by(uid: uid)\n end\n end", "def domains\n doc = request(\"domain-list_domains\")\n api_error?(doc)\n (doc/:data).inject([]) { |domains, domain| domains << Domain.new_from_xml(domain); domains }\n end", "def list_domains(opts = {})\n data, _status_code, _headers = list_domains_with_http_info(opts)\n data\n end", "def read_ldap_identity_source(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def list\n cert_list(certstore_handler)\n end", "def list\n cf_get(path: \"#{uri_prefix}/virtual_dns\")\n end", "def set_sources\n @yaml[:sources].each do |name, path|\n @sources << Yuyi::Source.new(name, path)\n end\n end", "def makeSourcesList(accounts)\n sources = []\n\n accounts.each do |account|\n if account[:service] == 'twitter'\n sources << buildSourceHash(account, 'Home Timeline', 'statuses/home_timeline')\n sources << buildSourceHash(account, 'Own Tweets', 'statuses/user_timeline')\n sources << buildSourceHash(account, 'Mentions', 'statuses/mentions_timeline')\n sources << buildSourceHash(account, 'Direct Messages', 'direct_messages')\n sources << buildSourceHash(account, 'Sent Messages', 'direct_messages/sent')\n # Now we have to auth with Twitter to get the lists\n twitterClient = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV['TWITTER_CONSUMER_KEY']\n config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']\n config.access_token = account[:servicetokens]['oauth_token']\n config.access_token_secret = account[:servicetokens]['oauth_token_secret']\n end\n begin\n lists = twitterClient.lists()\n lists.each do |list|\n sources << buildSourceHash(account, \"#{list[:name].gsub(/[\\-_]/,' ').titlecase} list\", \"lists/#{list[:slug]}/statuses\")\n end\n rescue\n end\n \n elsif account[:service] == 'facebook'\n sources << buildSourceHash(account, 'Home Feed', 'me/home')\n sources << buildSourceHash(account, 'Wall', 'me/feed')\n sources << buildSourceHash(account, 'Events', 'me/events')\n sources << buildSourceHash(account, 'Notifications', 'me/notifications')\n end\n end\n\n return sources\nend", "def included_sources=(value)\n @included_sources = value\n end", "def index\n @chef_att_sources = ChefAttSource.all\n end", "def list(options = {})\n @client.get('domains', options).to_h['items']\n end", "def managed_list(inst_id)\n uri = URI.parse(@url + \"/#{inst_id}/servers\") unless @server_name\n uri = URI.parse(@url + \"/#{inst_id}/servers/\" + @server_name) if @server_name\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field 'X-ID-TENANT-NAME', id_domain\n http.request(request)\n end", "def sources(object, coord = nil)\n if coord\n AssociationMap.get_associated_data(object, SOURCE, coord: coord)\n else\n AssociationMap.get_associated_data(object, SOURCE)\n end\n end", "def datasource_entries(query = {})\n Request.new(self, '/cdn/datasource_entries', query).get\n end", "def datasource_entries(query = {})\n Request.new(self, '/cdn/datasource_entries', query).get\n end", "def ldap_server\n get_attribute_from_auth_source('host')\n end", "def get_source_ids(source_names)\n if source_names and current_user.try(:admin_or_staff?)\n source_ids = Source.where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif source_names\n source_ids = Source.where(\"private = ?\", false).where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id) #.where(\"private = 0 AND lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif current_user.try(:admin_or_staff?)\n source_ids = Source.order(\"name\").pluck(:id)\n else\n source_ids = Source.where(\"private = ?\", false).order(\"name\").pluck(:id) #where(\"private = 0\").order(\"name\").pluck(:id)\n end\n end" ]
[ "0.63612556", "0.622355", "0.593756", "0.58011377", "0.5699125", "0.5532021", "0.5532021", "0.55220413", "0.5519219", "0.54380757", "0.54123676", "0.53952926", "0.5388987", "0.5300855", "0.52596927", "0.52528185", "0.522744", "0.52056587", "0.5184532", "0.5147061", "0.5123818", "0.5123441", "0.51221204", "0.51064736", "0.51044726", "0.50686914", "0.5064915", "0.5063893", "0.50530875", "0.5051819", "0.5051819", "0.5045538", "0.50257957", "0.49840122", "0.49830875", "0.49825186", "0.49704844", "0.49653274", "0.4959884", "0.49535114", "0.49530405", "0.49523908", "0.49515492", "0.49471128", "0.4944656", "0.49356136", "0.4934082", "0.4932144", "0.4927666", "0.49159515", "0.49159515", "0.4910515", "0.4910515", "0.48954716", "0.48948622", "0.4886189", "0.4865578", "0.48375118", "0.48267886", "0.48267886", "0.4826539", "0.48230457", "0.4810306", "0.47843668", "0.47690415", "0.47678062", "0.47672412", "0.47425318", "0.47425318", "0.4710216", "0.46853366", "0.46823418", "0.46766007", "0.46512827", "0.46511787", "0.46320546", "0.46308672", "0.46198928", "0.46161667", "0.46108258", "0.46040407", "0.45857197", "0.45830092", "0.45802918", "0.45589235", "0.45501938", "0.45456496", "0.4542432", "0.45321178", "0.45292282", "0.4518072", "0.45160738", "0.451118", "0.4507759", "0.44816166", "0.4480327", "0.44667992", "0.44667992", "0.44667232", "0.44650283" ]
0.84067184
0
List LDAP identity sources Return a list of all configured LDAP identity sources.
def list_ldap_identity_sources_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources ...' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources, must be greater than or equal to 0.' end # resource path local_var_path = '/aaa/ldap-identity-sources' # query parameters query_params = {} query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil? query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'LdapIdentitySourceListResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#list_ldap_identity_sources\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_ldap_identity_sources(opts = {})\n data, _status_code, _headers = list_ldap_identity_sources_with_http_info(opts)\n data\n end", "def get_authentication_sources(opts = {})\n data, _status_code, _headers = get_authentication_sources_with_http_info(opts)\n data\n end", "def list(sources=DEFAULT_SOURCES, options)\n options = DEFAULT_OPTIONS.merge!(options)\n sources.collect do |source|\n source.list(options)\n end.flatten.uniq\n end", "def sources(source: nil)\n params = {\n source: source\n }.compact\n\n _get(\"/account/sources\", params) { |json| json }\n end", "def account_sources(source)\n get('account/sources', {'source' => source})\n end", "def domains\n @domains ||= ldap.search_domains.map { |base| ldap.domain(base) }\n end", "def domains\n @domains ||= ldap.search_domains.map { |base| ldap.domain(base) }\n end", "def sources\n @sources.names\n end", "def get_sources(opts = {})\n data, _status_code, _headers = get_sources_with_http_info(opts)\n data\n end", "def search_sources(opts = {})\n data, _status_code, _headers = search_sources_with_http_info(opts)\n data\n end", "def data_sources\n src.collect{|v| v['source']}\n end", "def sources\n @settings.sources.to_a.inject({}) do |result, (source_id, source)|\n result[source_id] = source[:adapter].configuration\n result\n end\n end", "def get_sources\n response = execute_get(\"/reference/source\")\n Source.from_array(decode(response))\n end", "def sources\n @sources ||= AVAILABLE_SOURCES.each_with_object({}) do |source_class, list|\n source = source_class.new\n list[source.id.to_s] = {\n 'name' => source.name,\n 'website' => source.website,\n 'notes' => source.notes,\n 'class' => source.class\n }\n end\n end", "def sources\n IITSourceCollection.new(@ole.Sources)\n end", "def get_all_sources_info\n source_info = {}\n METADATA_FIELDS.keys.each { |ns|\n source_info[ns] = get_metadata_source_info(ns)\n }\n source_info\n end", "def sources\n @_configuration.fetch('sources') { DEFAULT_SOURCES }\n end", "def all_sources\n result = Set.new\n sources.each do |ev|\n result << ev\n result.merge(ev.all_sources)\n end\n result\n end", "def search_ldap_identity_source(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def available_data_sources\n data_sources = []\n if self.current_contexts.size == 1\n the_context = self.current_contexts.first\n if the_context != ContextEnum.either\n the_data_source = self.inherited_data_source\n if the_data_source == DataSourceNone # top level data source\n data_sources = ContextDataSourceMap[the_context]\n else\n data_sources = DataSourceChainMap[the_data_source]\n end\n end\n end\n data_sources\n end", "def get_sources(workdir)\n @sources.each do |source|\n cur_source = Vanagon::Component::Source.source(source.url, { :ref => source.ref, :sum => source.sum }, workdir)\n cur_source.fetch\n cur_source.verify\n end\n end", "def sources\n @sources ||= []\n end", "def data_sources\n []\n end", "def get_authentication_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_authentication_sources ...'\n end\n # resource path\n local_var_path = '/api/3/authentication_sources'\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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = 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 => 'ResourcesAuthenticationSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_authentication_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @cla_sources = ClaSource.all\n end", "def sources(sources = nil)\n @sources.assign(sources) if sources\n @sources\n end", "def add_sources(marshaller)\n source_dir = (source_type == SOURCE_TYPE_INTERNAL) \\\n ? SystemProperties::getCenterInternalDirectory \\\n : SystemProperties::getCenterExternalDirectory\n\n ha_configured = CommonSql.ha_configured?\n\n ConfigurationSource.get_all_sources_by_type(source_type).each do |source|\n source_xml = marshaller.factory.createConfigurationSourceType\n central_server_address = nil\n if ha_configured\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS,\n :ha_node_name => source.ha_node_name).first.value\n else\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS).first.value\n end\n source_xml.downloadURL =\n \"http://\" + central_server_address + \"/\" + source_dir\n source.configuration_signing_keys.find_each do |key|\n source_xml.getVerificationCert.add(key.cert.to_java_bytes)\n end\n marshaller.root.source.add(source_xml)\n end\n end", "def add_datasources\n options = {\n active_source: active_source,\n query: params['q'] || params['s.q'] || nil\n }\n\n has_facets = source_has_facets?(active_source)\n # Show all datasources when there's no current query, or\n # when we're in a datasource that doesn't have facets.\n options[:all_sources] = !active_query? || !has_facets\n\n result = []\n result |= datasources_active_list(options).map do |src|\n single_datasource_list_item(src, options)\n end\n\n # If there are hidden data-sources, gather them up wrapped w/ expand/contract links\n unless (hidden_datasources = datasources_hidden_list(options)).empty?\n result << content_tag(:li, link_to('More...', '#'), id: 'datasource_expand')\n\n sub_results = hidden_datasources.map do |src|\n single_datasource_list_item(src, options)\n end\n\n sub_results << content_tag(:li, link_to('Fewer...', '#'), id: 'datasource_contract')\n result << content_tag(:ul, sub_results.join('').html_safe, id: 'expanded_datasources', class: 'list-unstyled')\n end\n\n landing_class = options[:all_sources] ? 'landing datasource_list' : 'datasource_list'\n landing_class += ' no_facets' unless has_facets\n landing_class += ' hidden-xs'\n clio_sidebar_items.unshift(\n content_tag(:ul, result.join('').html_safe, id: 'datasources', class: landing_class)\n )\n end", "def search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}/search'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'filter_value'] = opts[:'filter_value'] if !opts[:'filter_value'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceSearchResultList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#search_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def identity_providers\n return @identity_providers\n end", "def identity_providers\n return @identity_providers\n end", "def sources(opts)\n if opts.edit\n path = File.expand_path(Config.instance.options['sources']['path'])\n Config.instance.open_file(path)\n else\n sources = Sources.instance\n sources.parse(@sources)\n sources_list_dl(sources, opts)\n end\n end", "def sources\n sort!\n @sources\n end", "def list_sources\n sources = Profile.get_guardian_headlines\n # prints out numbered articles\n sources.each do |key, value|\n puts ColorizedString[\"#{key}.\"].red + \" #{value[0]}\"\n end\n # asks for input\n input = choose_source(sources)\n choice = sources[input][0]\n print ColorizedString[\"You have chosen:\"].red\n puts ColorizedString[\" #{choice}\"].underline\n sources[input][1]\n end", "def add_datasources(active_source = @active_source)\n options = {\n active_source: active_source,\n query: params['q'] || params['s.q'] || ''\n }\n\n has_facets = FOCUS_CONFIG[active_source].has_facets?\n\n # Show all datasources when there's no current query, or\n # when we're in a datasource that doesn't have facets.\n options[:all_sources] = !active_query? || !has_facets\n\n result = []\n result |= datasources_active_list(options).map do |src|\n single_datasource_list_item(src, options)\n end\n\n # If there are hidden data-sources, gather them up wrapped w/ expand/contract links\n unless (hidden_datasources = datasources_hidden_list(options)).empty?\n result << content_tag(:li, link_to('More...', '#'), id: 'datasource_expand')\n\n sub_results = hidden_datasources.map do |src|\n single_datasource_list_item(src, options)\n end\n\n sub_results << content_tag(:li, link_to('Fewer...', '#'), id: 'datasource_contract')\n result << content_tag(:ul, sub_results.join('').html_safe, id: 'expanded_datasources', class: 'list-unstyled')\n end\n\n landing_class = options[:all_sources] ? 'landing datasource_list' : 'datasource_list'\n landing_class += ' no_facets' unless has_facets\n landing_class += ' hidden-xs'\n clio_sidebar_items.unshift(\n content_tag(:ul, result.join('').html_safe, id: 'datasources', class: landing_class)\n )\n end", "def sources\n @iTunes.sources.each do |source|\n @sources << source\n end\n end", "def get_sources\n @page.all(input_elements[:sources_list])\n end", "def sources #:nodoc:\n @sources.map{ |source| source.call }.flatten\n end", "def sources\n\t\tKassociation.where( :source_id => self.id )\n\tend", "def source_list(source)\n if source.nil? || source.empty?\n raise Error, 'No source specified for query'\n end\n auto_alias_count = @opts[:num_dataset_sources] || 0\n m = source.map do |s|\n case s\n when Dataset\n auto_alias_count += 1\n s.to_table_reference(\"t#{auto_alias_count}\")\n else\n table_ref(s)\n end\n end\n m.join(COMMA_SEPARATOR)\n end", "def domains\n collect { |a| a.domain }\n end", "def index\n @data_sources = DataSource.all\n end", "def datasources(query = {})\n Request.new(self, '/cdn/datasources', query).get\n end", "def providers_id_connector_sources_get(id_connector, opts = {})\n data, _status_code, _headers = providers_id_connector_sources_get_with_http_info(id_connector, opts)\n data\n end", "def sources_list_dl(sources, opts)\n mods = opts.categories ? sources.parse_mods(opts.categories) : nil\n sources.apply_mods(mods) if mods\n\n if opts.download\n Storage.instance.download_sources\n else\n IO.instance.sources_print(sources.sources)\n end\n end", "def urls\n @gapi.source_uris\n end", "def sources\n []\n end", "def get_all_ach_funding_sources(opts = {})\n data, _status_code, _headers = get_all_ach_funding_sources_with_http_info(opts)\n data\n end", "def sources\n s = Set.new\n experiments.each { |experiment| s.merge(experiment.sources) }\n s.to_a\n end", "def list_identities(opts = {})\n data, _status_code, _headers = list_identities_with_http_info(opts)\n data\n end", "def list_identities(opts = {})\n data, _status_code, _headers = list_identities_with_http_info(opts)\n data\n end", "def identity_providers=(value)\n @identity_providers = value\n end", "def identity_providers=(value)\n @identity_providers = value\n end", "def index\n @portal_sources = PortalSource.all\n end", "def domains_list\n call('domains.list')[:domains]\n end", "def sources\n source_paths\n end", "def sources\n filter.sources\n end", "def all_sources\n @normal_sources + @extensions + @replacements\n end", "def datasources_hidden_list(options = {})\n if options[:all_sources]\n []\n else\n datasource_list(:minor).reject { |source| source == options[:active_source] }\n end\n end", "def datasources_hidden_list(options = {})\n if options[:all_sources]\n []\n else\n datasource_list(:minor).reject { |source| source == options[:active_source] }\n end\n end", "def list_ccadmins\n domain = domains(name: Rails.configuration.cloud_admin_domain).first\n return [] unless domain\n list_scope_admins(domain_id: domain.id)\n end", "def get_authentication_source_users(id, opts = {})\n data, _status_code, _headers = get_authentication_source_users_with_http_info(id, opts)\n data\n end", "def sources_data\n sources_url = Api.gnews_path('sources')\n call_gnews_url(sources_url).parse\n end", "def domains\n connection.list_domains[:domains]\n end", "def sources\n [root_source] + reference_sources\n end", "def sources\n @sources ||= SourcePool.new\n end", "def sources\n @sources ||= ApiFactory.new 'Repos::Sources'\n end", "def get_source_ids(source_names)\n if source_names && current_user.try(:is_admin_or_staff?)\n source_ids = Source.where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif source_names\n source_ids = Source.where(\"private = ?\", false).where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif current_user.try(:is_admin_or_staff?)\n source_ids = Source.order(\"name\").pluck(:id)\n else\n source_ids = Source.where(\"private = ?\", false).order(\"name\").pluck(:id)\n end\n end", "def get_source_ids(source_names)\n if source_names && current_user.try(:is_admin_or_staff?)\n source_ids = Source.where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif source_names\n source_ids = Source.where(\"private = ?\", false).where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif current_user.try(:is_admin_or_staff?)\n source_ids = Source.order(\"name\").pluck(:id)\n else\n source_ids = Source.where(\"private = ?\", false).order(\"name\").pluck(:id)\n end\n end", "def default_sources\n self.class.default_sources.map{ |src| File.join(root, src) }\n end", "def v1_measurement_sources_get(opts = {})\n data, _status_code, _headers = v1_measurement_sources_get_with_http_info(opts)\n return data\n end", "def domains\n request('domain-list_domains').inject([]) { |domains, domain|\n domains << Domain.new(domain)\n }\n end", "def slapd_listen_urls\n urls = []\n\n (use_ldap, use_ldaps) = use_ldap_or_ldaps?(node['ca_openldap']['tls']['enable'].to_sym)\n ldap_port = node['ca_openldap']['default_ports']['ldap']\n ldaps_port = node['ca_openldap']['default_ports']['ldaps']\n\n urls << \"ldapi:///\" if node['ca_openldap']['enable_ldapi']\n\n if use_ldap == 'yes'\n node['ca_openldap']['slapd_listen_addresses'].each do |listen_adress|\n urls << \"ldap://#{ listen_adress }:#{ ldap_port }\"\n end\n end\n\n if use_ldaps == 'yes'\n node['ca_openldap']['slapd_listen_addresses'].each do |listen_adress|\n urls << \"ldaps://#{ listen_adress }:#{ ldaps_port }\"\n end\n end\n\n urls.join \" \"\n end", "def get_sources(workdir) # rubocop:disable Metrics/AbcSize\n sources.each do |source|\n src = Vanagon::Component::Source.source(\n source.url, workdir: workdir, ref: source.ref, sum: source.sum\n )\n src.fetch\n src.verify\n if source.erb\n erb_file(src.file, File.join(File.dirname(src.file), File.basename(src.file, \".erb\")), true)\n end\n # set src.file to only be populated with the basename instead of entire file path\n src.file = File.basename(src.url)\n extract_with << src.extract(platform.tar) if src.respond_to? :extract\n end\n end", "def lists\n @lists ||= ActsAsIcontact::Subscription.lists(:contactId => id)\n end", "def index_task_sources(task_id, opts = {})\n data, _status_code, _headers = index_task_sources_with_http_info(task_id, opts)\n data\n end", "def identifier_uris\n return @identifier_uris\n end", "def discount_ids\n discount_sources.map { |att| send(att) }\n end", "def index\n @data_source_types = DataSourceType.all\n end", "def show\n @ldap_auth_header = Irm::LdapAuthHeader.list_all.find(params[:id])\n puts @ldap_auth_header.ldap_source.name\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ldap_auth_header }\n end\n end", "def index\n @sources = Source.all\n end", "def read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#read_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def datasources\n [@slice_names_ds_proxy]\n end", "def organizations\n self.organization_ids.map do |uid|\n MnoEnterprise::Organization.find_by(uid: uid)\n end\n end", "def domains\n doc = request(\"domain-list_domains\")\n api_error?(doc)\n (doc/:data).inject([]) { |domains, domain| domains << Domain.new_from_xml(domain); domains }\n end", "def list_domains(opts = {})\n data, _status_code, _headers = list_domains_with_http_info(opts)\n data\n end", "def read_ldap_identity_source(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def list\n cert_list(certstore_handler)\n end", "def list\n cf_get(path: \"#{uri_prefix}/virtual_dns\")\n end", "def set_sources\n @yaml[:sources].each do |name, path|\n @sources << Yuyi::Source.new(name, path)\n end\n end", "def makeSourcesList(accounts)\n sources = []\n\n accounts.each do |account|\n if account[:service] == 'twitter'\n sources << buildSourceHash(account, 'Home Timeline', 'statuses/home_timeline')\n sources << buildSourceHash(account, 'Own Tweets', 'statuses/user_timeline')\n sources << buildSourceHash(account, 'Mentions', 'statuses/mentions_timeline')\n sources << buildSourceHash(account, 'Direct Messages', 'direct_messages')\n sources << buildSourceHash(account, 'Sent Messages', 'direct_messages/sent')\n # Now we have to auth with Twitter to get the lists\n twitterClient = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV['TWITTER_CONSUMER_KEY']\n config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']\n config.access_token = account[:servicetokens]['oauth_token']\n config.access_token_secret = account[:servicetokens]['oauth_token_secret']\n end\n begin\n lists = twitterClient.lists()\n lists.each do |list|\n sources << buildSourceHash(account, \"#{list[:name].gsub(/[\\-_]/,' ').titlecase} list\", \"lists/#{list[:slug]}/statuses\")\n end\n rescue\n end\n \n elsif account[:service] == 'facebook'\n sources << buildSourceHash(account, 'Home Feed', 'me/home')\n sources << buildSourceHash(account, 'Wall', 'me/feed')\n sources << buildSourceHash(account, 'Events', 'me/events')\n sources << buildSourceHash(account, 'Notifications', 'me/notifications')\n end\n end\n\n return sources\nend", "def included_sources=(value)\n @included_sources = value\n end", "def index\n @chef_att_sources = ChefAttSource.all\n end", "def list(options = {})\n @client.get('domains', options).to_h['items']\n end", "def managed_list(inst_id)\n uri = URI.parse(@url + \"/#{inst_id}/servers\") unless @server_name\n uri = URI.parse(@url + \"/#{inst_id}/servers/\" + @server_name) if @server_name\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field 'X-ID-TENANT-NAME', id_domain\n http.request(request)\n end", "def sources(object, coord = nil)\n if coord\n AssociationMap.get_associated_data(object, SOURCE, coord: coord)\n else\n AssociationMap.get_associated_data(object, SOURCE)\n end\n end", "def datasource_entries(query = {})\n Request.new(self, '/cdn/datasource_entries', query).get\n end", "def datasource_entries(query = {})\n Request.new(self, '/cdn/datasource_entries', query).get\n end", "def ldap_server\n get_attribute_from_auth_source('host')\n end", "def get_source_ids(source_names)\n if source_names and current_user.try(:admin_or_staff?)\n source_ids = Source.where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif source_names\n source_ids = Source.where(\"private = ?\", false).where(\"lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id) #.where(\"private = 0 AND lower(name) in (?)\", source_names.split(\",\")).order(\"name\").pluck(:id)\n elsif current_user.try(:admin_or_staff?)\n source_ids = Source.order(\"name\").pluck(:id)\n else\n source_ids = Source.where(\"private = ?\", false).order(\"name\").pluck(:id) #where(\"private = 0\").order(\"name\").pluck(:id)\n end\n end" ]
[ "0.84067184", "0.622355", "0.593756", "0.58011377", "0.5699125", "0.5532021", "0.5532021", "0.55220413", "0.5519219", "0.54380757", "0.54123676", "0.53952926", "0.5388987", "0.5300855", "0.52596927", "0.52528185", "0.522744", "0.52056587", "0.5184532", "0.5147061", "0.5123818", "0.5123441", "0.51221204", "0.51064736", "0.51044726", "0.50686914", "0.5064915", "0.5063893", "0.50530875", "0.5051819", "0.5051819", "0.5045538", "0.50257957", "0.49840122", "0.49830875", "0.49825186", "0.49704844", "0.49653274", "0.4959884", "0.49535114", "0.49530405", "0.49523908", "0.49515492", "0.49471128", "0.4944656", "0.49356136", "0.4934082", "0.4932144", "0.4927666", "0.49159515", "0.49159515", "0.4910515", "0.4910515", "0.48954716", "0.48948622", "0.4886189", "0.4865578", "0.48375118", "0.48267886", "0.48267886", "0.4826539", "0.48230457", "0.4810306", "0.47843668", "0.47690415", "0.47678062", "0.47672412", "0.47425318", "0.47425318", "0.4710216", "0.46853366", "0.46823418", "0.46766007", "0.46512827", "0.46511787", "0.46320546", "0.46308672", "0.46198928", "0.46161667", "0.46108258", "0.46040407", "0.45857197", "0.45830092", "0.45802918", "0.45589235", "0.45501938", "0.45456496", "0.4542432", "0.45321178", "0.45292282", "0.4518072", "0.45160738", "0.451118", "0.4507759", "0.44816166", "0.4480327", "0.44667992", "0.44667992", "0.44667232", "0.44650283" ]
0.63612556
1
Test the configuration of an existing LDAP identity source Attempt to connect to an existing LDAP identity source and report any errors encountered.
def probe_configured_ldap_identity_source_probe(ldap_identity_source_id, opts = {}) data, _status_code, _headers = probe_configured_ldap_identity_source_probe_with_http_info(ldap_identity_source_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_connection\n ldap_con = initialize_ldap_con(self.account, self.account_password)\n ldap_con.open { }\n rescue Net::LDAP::LdapError => text\n raise \"LdapError: %s\" % text\n end", "def test_connection\n\t\tldap_con = initialize_ldap_con(self.account, self.encrypted_password)\n\t\tldap_con.open do |ldap|\n\t\tend\n\trescue Net::LDAP::LdapError => text\n\t\traise \"LdapError: \" + text\n\tend", "def activedirectory_connect\n ActiveDirectory::Base.enable_cache if ::Devise.ad_caching\n ActiveDirectory::Base.setup(::Devise.ad_settings)\n raise DeviseActiveDirectoryAuthenticatable::ActiveDirectoryException, \"Invalid Username or Password\" unless ActiveDirectory::Base.connected?\n end", "def connect_to_ldap\r\n begin\r\n @ldap = Net::LDAP.new(:host => @ldap_host,\r\n :port => @ldap_port,\r\n :auth => { :method => :simple,\r\n :username => @ldap_username,\r\n :password => @ldap_password } )\r\n @logger.info \"Connecting to LDAP: '#{@ldap_host}' on port #{@ldap_port}\"\r\n @logger.info \"Binding to LDAP as: #{@ldap_username}\"\r\n \r\n success = @ldap.bind()\r\n if (success)\r\n @logger.info \"LDAP authorization succeeded\"\r\n return true\r\n else\r\n @logger.error \"LDAP authorization failed: #{@ldap.get_operation_result.message}\"\r\n return false\r\n end\r\n rescue Net::LDAP::LdapError => error\r\n @logger.error(\"Error connecting to LDAP: #{error}\")\r\n return false\r\n end\r\n end", "def probe_unconfigured_ldap_identity_source_probe_identity_source_with_http_info(ldap_identity_source, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source' is set\n if @api_client.config.client_side_validation && ldap_identity_source.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=probe_identity_source'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ldap_identity_source)\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceProbeResults')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_unconfigured_ldap_identity_source_probe_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connect\n @logger.debug(\"Connecting to LDAP server: #{Time.now}\" )\n\n connected = false\n error = nil\n LDAP_SERVERS.each do |ldap_server| \n begin\n @ldap.host = ldap_server\n @ldap.port = 636\n @ldap.encryption :simple_tls\n @ldap.auth BIND_DN, BIND_PASS\n connected = @ldap.bind\n @logger.debug(\"bind result: #{@ldap.get_operation_result}\")\n break if connected\n raise \"Failed to connect to LDAP server #{ldap_server}. Error: #{@ldap.get_operation_result.message} (#{@ldap.get_operation_result.code})\"\n rescue => e\n connected = false\n error = \"Failed to connect to LDAP server #{ldap_server}. Error: #{e.message}\\n#{e.backtrace}\"\n end\n @logger.warn(error)\n end\n\n # raise exception if not connected\n raise ConnectError, error unless connected\n\n @logger.debug(\"connected to #{@ldap.host}.\")\n end", "def read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#read_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def probe_configured_ldap_identity_source_probe_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_configured_ldap_identity_source_probe ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_configured_ldap_identity_source_probe\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}?action=probe'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceProbeResults')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_configured_ldap_identity_source_probe\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connect!\n com::unboundid::ldap::sdk::LDAPConnection.new(\n self.host, self.port, self.bind_dn, self.password) \n end", "def ldap_verify_and_update\n return unless self.is_ldap?\n\n scanner = LdapQuery::Scanner.search self.login, :only=>:ldap\n\n if scanner.errors.size > 0\n errors.add(:login, 'Login is invalid or cannot be found in OHSU\\'s servers')\n return\n end\n\n # Update our information from ldap\n self.assign_attributes scanner.as_user_attributes\n\n end", "def login_from_other_sources\n result = nil\n # Takes the first entry that doesn't return false\n sorcery_config.login_sources.find do |source|\n result = send(source)\n end\n return result if result\n\n nil\n end", "def start\n case ssl\n when :tls\n @connection = LDAP::SSLConn.new(host, port, true)\n when true\n @connection = LDAP::SSLConn.new(host, port)\n else\n @connection = LDAP::Conn.new(host, port)\n end\n @connection.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n @connection.set_option(LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_ON)\n @connection.simple_bind(user, password)\n rescue => detail\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end", "def search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}/search'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'filter_value'] = opts[:'filter_value'] if !opts[:'filter_value'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceSearchResultList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#search_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connection\n unless @connection\n raise Puppet::Error, \"Could not set up LDAP Connection: Missing ruby/ldap libraries\" unless Puppet.features.ldap?\n begin\n conn = Puppet::Util::Ldap::Connection.instance\n conn.start\n @connection = conn.connection\n rescue => detail\n puts detail.backtrace if Puppet[:trace]\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end\n end\n\n @connection\n end", "def bind_connection(credentials)\n Net::LDAP.new(credentials)\n rescue\n raise(ConnectionError, 'Failure connecting to LDAP host')\n end", "def ldap_connect\n ldap = Net::LDAP.new(host: host, port: Net::LDAP::DefaultPort)\n ldap\n end", "def config_ldap_start\n\n\t\t`chkconfig --level 3 ldap on`\n\t\t`service ldap start`\n\n\t\tldap_status = `service ldap status`\n\n\t\tif ldap_status.include? \"running\"\n\t\t\tputs \"LDAP Server was started correctly\"\n\t\telsif ldap_status.include? \"stopped\"\n\t\t\tputs \"LDAP server is not started or is not working correctly\"\n\t\telse\n\t\t\tputs \"Error processing LDAP status\"\n\t\tend\n\tend", "def populateLDAP\n return unless Rails.env.production?\n #quit if no email or netid to work with\n self.email ||= ''\n return if !self.email.include?('@yale.edu') && !self.netid\n\n begin\n ldap = Net::LDAP.new( :host =>\"directory.yale.edu\" , :port =>\"389\" )\n\n #set e filter, use netid, then email\n if !self.netid.blank? #netid\n f = Net::LDAP::Filter.eq('uid', self.netid)\n else\n f = Net::LDAP::Filter.eq('mail', self.email)\n end\n\n b = 'ou=People,o=yale.edu'\n p = ldap.search(:base => b, :filter => f, :return_result => true).first\n\n rescue Exception => e\n guessFromEmail\n end\n\n return unless p\n\n self.netid = ( p['uid'] ? p['uid'][0] : '' )\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n self.fname ||= ( p['givenname'] ? p['givenname'][0] : '' )\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n\n # Don't save the model, because they are going to be shown a form to edit info\n # self.save!\n end", "def initialize_ldap_con(username, password, hosts)\n result = nil\n\n hosts.each do |host|\n ldap = Net::LDAP.new({\n :host => host,\n :port => 389,\n :auth => {\n :method => :simple,\n :username => username,\n :password => password\n }\n })\n\n # If the bind succeeded, return the active connection. Else try the next host\n result = ldap if ldap.get_operation_result.code == 0\n end\n\n return result\n end", "def create_or_update_ldap_identity_source_with_http_info(ldap_identity_source_id, ldap_identity_source, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source\"\n end\n # verify the required parameter 'ldap_identity_source' is set\n if @api_client.config.client_side_validation && ldap_identity_source.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ldap_identity_source)\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#create_or_update_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connect\n raise ArgumentError, \"You must pass a block to #connect\" unless block_given?\n\n unless @connection\n if Puppet[:ldaptls]\n ssl = :tls\n elsif Puppet[:ldapssl]\n ssl = true\n else\n ssl = false\n end\n options = {:ssl => ssl}\n if user = Puppet[:ldapuser] and user != \"\"\n options[:user] = user\n end\n if password = Puppet[:ldappassword] and password != \"\"\n options[:password] = password\n end\n @connection = Puppet::Util::Ldap::Connection.new(Puppet[:ldapserver], Puppet[:ldapport], options)\n end\n @connection.start\n begin\n yield @connection.connection\n ensure\n @connection.close\n end\n nil\n end", "def populateLDAP\n \n #quit if no email or netid to work with\n return if !self.netid\n \n ldap = Net::LDAP.new(host: 'directory.yale.edu', port: 389)\n b = 'ou=People,o=yale.edu'\n f = Net::LDAP::Filter.eq('uid', self.netid)\n a = %w(givenname sn mail knownAs class college)\n\n p = ldap.search(base: b, filter: f, attributes: a).first\n \n\n\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n if self.fname.blank?\n self.fname = ( p['givenname'] ? p['givenname'][0] : '' )\n end\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n self.save!\n end", "def ldap_authenticate\n # logger.debug(\"ldap_authenticate\")\n # ldap_time = Benchmark.realtime { ActiveLdap::Base.setup_connection }\n # logger.debug(\"LDAP: took #{ldap_time} to establish the connection\")\n authenticate_or_request_with_http_basic \"Bluepages Authentication\" do |user_name, password|\n logger.info(\"attempt to ldap authenticate: user_name #{user_name}\")\n next nil unless LdapUser.authenticate_from_email(user_name, password)\n logger.info(\"successful ldap_authenticate as #{user_name}\")\n common_authenticate(user_name)\n return true\n end\n return false\n end", "def probe_identity_source_ldap_server_probe_ldap_server_with_http_info(identity_source_ldap_server, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_identity_source_ldap_server_probe_ldap_server ...'\n end\n # verify the required parameter 'identity_source_ldap_server' is set\n if @api_client.config.client_side_validation && identity_source_ldap_server.nil?\n fail ArgumentError, \"Missing the required parameter 'identity_source_ldap_server' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_identity_source_ldap_server_probe_ldap_server\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=probe_ldap_server'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(identity_source_ldap_server)\n auth_names = ['BasicAuth']\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 => 'IdentitySourceLdapServerProbeResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_identity_source_ldap_server_probe_ldap_server\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def attempt_connection\n # All that we care about is that we are able to connect successfully via\n # https, so here we're simpling hitting a somewhat arbitrary low-impact URL\n # on the scalemgmt server.\n http = Net::HTTP.new(scalemgmt_server, scalemgmt_port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(test_path, test_headers)\n request.basic_auth(api_user, api_password)\n\n response = http.request(request)\n unless response.is_a?(Net::HTTPSuccess)\n Puppet.notice \"Unable to connect to scalemgmt server (https://#{scalemgmt_server}:#{scalemgmt_port}): [#{response.code}] #{response.msg}\"\n return false\n end\n true\n rescue Exception => e # rubocop:disable Lint/RescueException\n Puppet.notice \"Unable to connect to scalemgmt server (https://#{scalemgmt_server}:#{scalemgmt_port}): #{e.message}\"\n false\n end", "def authenticate_dn(dn, password)\n\t\tif dn.present? && password.present?\n\t\t\tinitialize_ldap_con(dn, password).bind\n\t\tend\n\tend", "def try_update_ldap\n auths = self.authentications.where(provider: 'shibboleth')\n return false if auths.length > 0\n\n auths = self.authentications.where(provider: 'ldap')\n if auths.length > 0\n uid = auths.first.uid\n else\n uid = self.login_id\n end\n begin\n Ldap_User::LDAP.replace_attribute(uid, 'mail', [self.email])\n rescue LdapMixin::LdapException => ex\n return false\n end\n return true\n end", "def connect\n @conn ||= Net::LDAP.new\n @conn.host = @host\n @conn.port = @port\n @conn.auth \"#{@login_dn},#{@base_dn}\", @password\n\n if @conn.bind\n return true\n else\n return false\n end\n end", "def load_ldap_library\n return if @ldap_library_loaded\n if @ldap_library\n if @ldap_library == 'net/ldap'\n require 'net/ldap'\n else\n require 'ldap'\n require 'ldap/control'\n end\n else\n begin\n require 'ldap'\n require 'ldap/control'\n @ldap_library = 'ldap'\n rescue LoadError\n require 'net/ldap'\n @ldap_library = 'net/ldap'\n end\n end\n @ldap_library_loaded = true\n end", "def valid_user?\n #create a new LDAP object using the ruby-net-ldap library\n @ldap = Net::LDAP.new(:base => \"dc=#{@domain},dc=#{@tld}\",\n :host => @adshost,\n :auth => {:username => \"#{@username}@#{@domain}.#{@tld}\",\n :password => @password,\n :method => :simple})\n #return a boolean indicating whether authentication was successful or not\n return @ldap.bind\n end", "def probe_unconfigured_ldap_identity_source_probe_identity_source(ldap_identity_source, opts = {})\n data, _status_code, _headers = probe_unconfigured_ldap_identity_source_probe_identity_source_with_http_info(ldap_identity_source, opts)\n data\n end", "def setup_ldap_server\n server = FakeLDAP::Server.new(port: 1389)\n server.run_tcpserver\n\n @domain = 'dc=example,dc=com'\n @toplevel_user_dn = \"cn=toplevel_user,cn=TOPLEVEL,#{@domain}\"\n @toplevel_user_password = 'toplevel_password'\n\n @regular_user_cn = 'regular_user'\n @regular_user_dn = \"cn=#{@regular_user_cn},ou=USERS,#{@domain}\"\n @regular_user_password = 'regular_password'\n @regular_user_email = \"#{@regular_user_cn}@example.com\"\n\n server.add_user(@toplevel_user_dn, @toplevel_user_password)\n server.add_user(@regular_user_dn, @regular_user_password,\n @regular_user_email)\n server\n end", "def authenticate!\n fill_user_params!\n\n cfg = ::Portus::LDAP::Configuration.new(params)\n if cfg.enabled?\n connection = initialized_adapter\n entry, admin = bind_as(connection, cfg)\n portus_login!(connection, cfg, admin) if entry\n elsif cfg.soft?\n # rubocop:disable Style/SignalException\n fail cfg.reason_message\n # rubocop:enable Style/SignalException\n else\n fail! cfg.reason_message\n end\n rescue ::Portus::LDAP::Error, Net::LDAP::Error => e\n logged_failure!(e.message)\n end", "def validate_datasource!\n return if datasource[:access] == 'proxy' && datasource[:type] == 'prometheus'\n\n raise_error 'Only Prometheus datasources with proxy access in Grafana are supported.'\n end", "def net_ldap\n @net_ldap ||= new_net_ldap\n end", "def add_sources(marshaller)\n source_dir = (source_type == SOURCE_TYPE_INTERNAL) \\\n ? SystemProperties::getCenterInternalDirectory \\\n : SystemProperties::getCenterExternalDirectory\n\n ha_configured = CommonSql.ha_configured?\n\n ConfigurationSource.get_all_sources_by_type(source_type).each do |source|\n source_xml = marshaller.factory.createConfigurationSourceType\n central_server_address = nil\n if ha_configured\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS,\n :ha_node_name => source.ha_node_name).first.value\n else\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS).first.value\n end\n source_xml.downloadURL =\n \"http://\" + central_server_address + \"/\" + source_dir\n source.configuration_signing_keys.find_each do |key|\n source_xml.getVerificationCert.add(key.cert.to_java_bytes)\n end\n marshaller.root.source.add(source_xml)\n end\n end", "def create_default_authentication_ldap_configuration(opts)\n opts = check_params(opts,[:search_base_dn,:servers])\n super(opts)\n end", "def associate_auth(source)\n return if user_authentications.where(:provider => source['provider'], :uid => source['uid'].to_s).count > 0\n self.user_authentications.create!(:provider => source['provider'], :uid => source['uid'], :nickname => source[\"user_info\"]['nickname'])\n end", "def test_local_core_connection\n \n # Change username, password, host and port in order to test the connection with a different Ensembl db server\n assert_nothing_raised do \n Ensembl::Core::DBConnection.connect('Homo sapiens',56,:username => \"anonymous\",:host => \"ensembldb.ensembl.org\", :port => 5306)\n end\n end", "def ldap_user_not_at_cartodb\n render action: 'new' and return unless verify_warden_failure\n\n username = warden.env['warden.options'][:cartodb_username]\n organization_id = warden.env['warden.options'][:organization_id]\n email = warden.env['warden.options'][:ldap_email].presence\n\n create_user(\n username: username,\n organization_id: organization_id,\n email: email,\n created_via: Carto::UserCreation::CREATED_VIA_LDAP\n )\n end", "def initialize(ldap_config)\n @ldap = Net::LDAP.new host: ldap_config['host'], port: ldap_config['port']\n @attributes_to_import = %w(uid sn givenname mail title objectclass)\n @tree_base = ldap_config['treebase']\n\n # Used to log information\n @people_saved = 0\n @picture_uploaded = 0\n end", "def initialize(conf:)\n @ldap = Net::LDAP.new host: LDAP_SERVER, # your LDAP host name or IP goes here,\n # port: '389', # unencrypted LDAP host port,\n port: '636', # TLS port\n encryption: :simple_tls,\n base: 'DC=UoA,DC=auckland,DC=ac,DC=nz', # the base of your AD tree goes here,\n auth: {\n method: :simple,\n username: conf.ldap_user, # a user w/sufficient privileges to read from AD goes here,\n password: conf.ldap_auth_token # the user's password goes here\n }\n end", "def test_nonexistent_source\n assert_error \"FATAL: database \\\"db1\\\" does not exist\\n\", \"--from db1 --to pgsync_test2\"\n end", "def test_nonexistent_source\n assert_error \"FATAL: database \\\"db1\\\" does not exist\\n\", \"--from db1 --to pgsync_test2\"\n end", "def ldap_ssl_option\n super\n end", "def stub_api_source_calls(source)\n stub_api_source_get(source, show(source))\n return unless source_available?(source)\n\n endpoint = endpoints(source)[source['id']]\n stub_rest_get(\"#{sources_api}/sources/#{source[\"id\"]}/endpoints\", user_tenant_header, list([endpoint]))\n\n authentication = authentications(source)[source['id']]\n stub_rest_get(\"#{sources_api}/endpoints/#{endpoint['id']}/authentications\", user_tenant_header, list([authentication]))\n\n stub_rest_get(\"#{sources_api(:internal => true)}/authentications/#{authentication['id']}?expose_encrypted_attribute[]=password\", user_tenant_header, show(credentials(source)[authentication['id']]))\n end", "def ldap?\n !!ldap\n end", "def list_ldap_identity_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/aaa/ldap-identity-sources'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#list_ldap_identity_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def authenticate_with_activedirectory(attributes={}) \n username = attributes[login_with]\n password = attributes[:password]\n\n Logger.send \"Attempting to login :#{@login_with} => #{username}\"\n set_activedirectory_credentials :username => username, :password => password\n activedirectory_connect\n Logger.send \"Attempt Result: #{ActiveDirectory::Base.error}\"\n\n # Find them in the local database\n user = find_or_create_from_activedirectory(login_with => attributes[login_with]).first\n\n # Check to see if we have the same user\n unless user.nil?\n user.save if user.new_record? and ::Devise.ad_create_user\n user.login if user.respond_to?(:login)\n return user\n else\n raise DeviseActiveDirectoryAuthenticatable::ActiveDirectoryException, \"Active Directory user and entry in local database have different GUIDs. Possible database inconsistency.\"\n end\n end", "def ldap_ssl?\r\n ldap_ssl.to_s.to_i != 0\r\n end", "def credentials_error\n raise(CredentialsError, 'valid ldap credentials must be passed in order to establish a connection')\n end", "def init_ads\n # Load gem required for ADS\n require 'jdbc/dss'\n require 'sequel'\n\n # Initialize JDBC ADS driver\n Jdbc::DSS.load_driver\n Java.com.gooddata.dss.jdbc.driver.DssDriver\n\n puts \"Initializing DSS connection to #{DSS_URL} as user #{DSS_USERNAME}\"\n @dss = Sequel.connect DSS_URL, :username => DSS_USERNAME, :password => DSS_PASSWORD\n\n run_dss_script(SQL_CREATE_LOCATIONS, table: TABLE_LOCATIONS)\n run_dss_script(SQL_CREATE_SFPD, table: TABLE_SFPD)\n end", "def fill_from_ldap\n person = self.ldap_person\n if person.nil?\n if Rails.development?\n self.name = \"Susan #{self.login}\"\n self.email = \"beehive+#{self.login}@berkeley.edu\"\n self.major_code = 'undeclared'\n self.user_type = case self.login\n when 212388, 232588\n User::Types::Grad\n when 212381, 300846, 300847, 300848, 300849, 300850\n User::Types::Undergrad\n when 212386, 322587, 322588, 322589, 322590\n User::Types::Faculty\n when 212387, 322583, 322584, 322585, 322586\n User::Types::Staff\n else\n User::Types::Affiliate\n end\n return true\n else\n self.name = 'Unknown Name'\n self.email = ''\n self.major_code = ''\n self.user_type = User::Types::Affiliate\n return false\n end\n else\n self.name = \"#{person.firstname} #{person.lastname}\".titleize\n self.email = person.email\n self.major_code = person.berkeleyEduStuMajorName.to_s.downcase\n self.user_type = case\n when person.berkeleyEduStuUGCode == 'G'\n User::Types::Grad\n when person.student?\n User::Types::Undergrad\n when person.employee_academic?\n User::Types::Faculty\n when person.employee?\n User::Types::Staff\n else\n User::Types::Affiliate\n end\n return true\n end\n end", "def list_ldap_identity_sources(opts = {})\n data, _status_code, _headers = list_ldap_identity_sources_with_http_info(opts)\n data\n end", "def bind\n conn = Net::LDAP.new :host => @config[:server],\n :port => @config[:port],\n :base => @config[:base]\n if @config[:encryption]\n conn.encryption @config[:encryption]\n end\n \n raise \"Anonymous Bind is disabled\" if @config[:password] == \"\" && !(@config[:anonymous_bind])\n \n conn.auth \"#{@config[:username]}@#{@config[:domain]}\", @config[:password]\n \n begin\n Timeout::timeout(10){\n if conn.bind\n return conn\n else\n raise 'Query User Rejected'\n end\n }\n rescue Timeout::Error\n raise 'Unable to connect to LDAP Server'\n rescue Errno::ECONNRESET\n if @config[:allow_fallback]\n @config[:port] = @config[:allow_fallback]\n @config[:encryption] = false\n return Adauth::Connection.new(@config).bind\n end\n end\n end", "def reconnect\n\t\tself.log.info \"Reconnecting to %s...\" % [ self.uri ]\n\t\t@conn = self.connect\n\t\tself.log.info \"...reconnected.\"\n\n\t\treturn true\n\trescue LDAP::ResultError => err\n\t\tself.log.error \"%s while attempting to reconnect to %s: %s\" %\n\t\t\t[ err.class.name, self.uri, err.message ]\n\t\traise \"Couldn't reconnect to %s: %s: %s\" %\n\t\t\t[ self.uri, err.class.name, err.message ]\n\tend", "def ldap_connect(domain,binddn=BINDUSER,bindpw=BINDPASS)\n binddn = binddn + \"@\" + domain\n ldap = Net::LDAP.new(:host => domain,\n :port => 389,\n :auth => {\n :method => :simple,\n :username => binddn,\n :password => bindpw,\n })\n return ldap\n end", "def open_id_authentication\n authenticate_with_open_id(params[:openid_url], \n :required => [ :nickname ],\n :optional => [ :email, :fullname ]) do |result, identity_url, registration|\n if result.successful?\n successful_openid_login(identity_url, registration)\n else\n failed_login(result.message || \"Sorry could not log in with identity URL: #{identity_url}\")\n end\n end\n end", "def config_client_LDAP\n\t\tldap_conf = File.read('/etc/openldap/ldap.conf')\n\n\t\t# Set the BASE suffix to match the BASE suffix from the slapd conf file\n\t\tldap_conf = ldap_conf.gsub(/#BASE\\tdc=example, dc=com/,\"BASE dc=cit470_Team_4,dc=nku,dc=edu\")\n\n\t\t\n\t\t# Write the ldap.conf file\n\t\tFile.open('/etc/openldap/ldap.conf','w'){|file| file.puts ldap_conf}\n\n\t\t# Configure LDAP ACL to allow password changes\n\n\t\tldap=\"access to attrs=userPassword\\nby self write\\nby anonymous auth\\nby * none\\naccess to *\\nby self write\\nby * read\"\n\t\tFile.open('/etc/openldap/ldap.conf','a') {|file| file.puts ldap}\n\t\t\n\tend", "def set_credential_source(opts)\n opts = check_params(opts,[:sources])\n super(opts)\n end", "def connect_mongoid(source)\n if test_mongoid?\n $stderr.puts \"Mongoid #{Mongoid::VERSION}\", '-'*80\n\n if !ENV['QUIET'] == 'true'\n logger = ::Logger.new($stderr)\n logger.formatter = lambda { |s, d, p, m| \" #{m.ansi(:faint, :cyan)}\\n\" }\n logger.level = ::Logger::DEBUG\n Mongoid.logger = logger\n Mongo::Logger.logger = logger\n else\n Mongo::Logger.logger.level = ::Logger::WARN\n end\n\n Mongoid.connect_to(source)\n end\nend", "def ldap_server=(should) end", "def mock_ldap_connection\n fake_ldap_connection = double(\"MockLDAP\")\n allow(Ldap::Queries).to receive(:ldap_connection).and_return(fake_ldap_connection)\n fake_ldap_connection\nend", "def properly_configured?\n options = {\n open_timeout: 5,\n use_ssl: true, # all connections are forced SSL now\n verify_mode: OpenSSL::SSL::VERIFY_NONE # because we might not have a valid cert yet\n }\n Net::HTTP.start(website_alias, options) do |http|\n response = http.get(\"/tenant_aliases/#{id}/verify\")\n\n return false unless response.is_a?(Net::HTTPSuccess)\n\n response.body == \"TRUE\"\n end\n rescue SocketError, Net::OpenTimeout, Errno::ECONNREFUSED\n # SocketError if the server name doesn't exist in DNS\n # OpenTimeout if no server responds\n # ECONNREFUSED if the server responds with \"No\"\n false\n end", "def login(user, pass)\n conn = LDAP::Conn.new($ldap_conf[:server], $ldap_conf[:port])\n conn.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n conn.start_tls\n\n begin\n if conn.bind('uid=' + user + ',' + $ldap_conf[:people_dn], pass)\n get_uidNumber conn, user\n else\n False\n end\n rescue Exception => e\n nil\n end\nend", "def connect\n\t\tconn = nil\n\n\t\tcase @connect_type\n\t\twhen :tls\n\t\t\tself.log.debug \"Connecting using TLS to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::SSLConn.new( @host, @port, true )\n\t\twhen :ssl\n\t\t\tself.log.debug \"Connecting using SSL to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::SSLConn.new( @host, @port )\n\t\telse\n\t\t\tself.log.debug \"Connecting using an unencrypted connection to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::Conn.new( @host, @port )\n\t\tend\n\n\t\tconn.set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, 3 )\n\t\tconn.set_option( LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_OFF )\n\n\t\treturn conn\n\tend", "def attempt_connection\n conn = Puppet.runtime[:http]\n\n response = conn.get(test_uri, headers: test_headers, options: options)\n unless response.code.to_i == expected_code\n Puppet.notice \"Unable to connect to the server or wrong HTTP code (expected #{expected_code}) (#{test_uri}): [#{response.code}] #{response.reason}\"\n return false\n end\n return true\n rescue StandardError => e\n Puppet.notice \"Unable to connect to the server (#{test_uri}): #{e.message}\"\n return false\n end", "def ldap_config\n @@ldap_config ||= YAML::load_file(\"#{RAILS_ROOT}/config/ldap.yml\")[RAILS_ENV || 'development']\n end", "def process_login\n# Something is really wrong\n return dc_render_404('Login:') unless ( params[:record] and params[:record][:username] and params[:record][:password] )\n success = false\n unless params[:record][:password].blank? \n# user must be defined locally\n user = DcUser.find_by(username: params[:record][:username])\n if user\n# LDAP alternative. You must add gem 'net-ldap' to Gemfile \n# ldap = Net::LDAP.new(host: 'ldap.yourdomain.com')\n# ldap.auth(\"#{params[:record][:username]}@yourdomain.com\", params[:record][:password])\n# success = ldap.bind\n\n# authenticate locally\n success = user.authenticate(params[:record][:password]) unless success\n end\n end\n# \n if success\n fill_login_data(user, false)\n redirect_to '/'\n else # display login error\n flash[:error] = t('drgcms.invalid_username')\n redirect_to \"/login\"\n end\nend", "def option_ldap_check\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"option ldap-check \" + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "def ldap_dispatcher\n # Scooter doesn't support custom settings yet.\n #@ldap_dispatcher ||= LDAPDispatcher.new(openldap, { :encryption => nil, :port => 389, \n # :auth => { :method => :simple, :username => \"cn=admin,dc=example,dc=com\", :password => \"puppetlabs\" } })\n @ldap_dispatcher ||= LDAPDispatcher.new(openldap, { :encryption => nil, :port => 389 })\nend", "def verify!\n reconnect! unless active?\n end", "def test_load_failure\n # Check for load failure\n assert_raises(ActiveRecord::RecordNotFound) { Source.find(\"xxxx\") }\n end", "def test_ssl_configuration\n # raises when ssl=false and ssl opts specified\n assert_raise MongoArgumentError do\n create_client(@connect_info, :connect => false,\n :ssl => false,\n :ssl_cert => CLIENT_CERT)\n end\n\n # raises when ssl=nil and ssl opts specified\n assert_raise MongoArgumentError do\n create_client(@connect_info, :connect => false,\n :ssl_key => CLIENT_CERT)\n end\n\n # raises when verify=true and no ca_cert\n assert_raise MongoArgumentError do\n create_client(@connect_info, :connect => false,\n :ssl => true,\n :ssl_key => CLIENT_CERT,\n :ssl_cert => CLIENT_CERT,\n :ssl_verify => true)\n end\n\n # raises when key passphrase is given without key file\n assert_raise MongoArgumentError do\n create_client(@connect_info, :connect => false,\n :ssl => true,\n :ssl_key_pass_phrase => PASS_PHRASE)\n end\n end", "def ldapsearch(filter)\n raise ArgumentError.new(\"You must pass a block to ldapsearch\") unless block_given?\n\n found = false\n count = 0\n\n begin\n connection.search(search_base, 2, filter, search_attributes) do |entry|\n found = true\n yield entry\n end\n rescue SystemExit,NoMemoryError\n raise\n rescue Exception => detail\n if count == 0\n # Try reconnecting to ldap if we get an exception and we haven't yet retried.\n count += 1\n @connection = nil\n Puppet.warning \"Retrying LDAP connection\"\n retry\n else\n error = Puppet::Error.new(\"LDAP Search failed\")\n error.set_backtrace(detail.backtrace)\n raise error\n end\n end\n\n found\n end", "def check_connection(ip)\n if File.exists?(\"ssl/client.crt\") &&\n File.exists?(\"ssl/client.key\") &&\n File.exists?(\"ssl/root.crt\")\n postgres_ssl_connection(ip)\n else\n postgres_plain_connection(ip)\n end\nend", "def fetch_identity_source_ldap_server_certificate_fetch_certificate_with_http_info(identity_source_ldap_server_endpoint, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.fetch_identity_source_ldap_server_certificate_fetch_certificate ...'\n end\n # verify the required parameter 'identity_source_ldap_server_endpoint' is set\n if @api_client.config.client_side_validation && identity_source_ldap_server_endpoint.nil?\n fail ArgumentError, \"Missing the required parameter 'identity_source_ldap_server_endpoint' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.fetch_identity_source_ldap_server_certificate_fetch_certificate\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=fetch_certificate'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(identity_source_ldap_server_endpoint)\n auth_names = ['BasicAuth']\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 => 'PeerCertificateChain')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#fetch_identity_source_ldap_server_certificate_fetch_certificate\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def initialize(options = {})\n @uid = options[:uid] || \"sAMAccountName\"\n\n # Keep a reference to these as default auth for a Global Catalog if needed\n @admin_user = options[:admin_user]\n @admin_password = options[:admin_password]\n @port = options[:port]\n\n @connection = Net::LDAP.new({\n host: options[:host],\n port: options[:port],\n hosts: options[:hosts],\n instrumentation_service: options[:instrumentation_service]\n })\n\n if options[:admin_user] && options[:admin_password]\n @connection.authenticate(options[:admin_user], options[:admin_password])\n end\n\n if encryption = check_encryption(options[:encryption], options[:tls_options])\n @connection.encryption(encryption)\n end\n\n configure_virtual_attributes(options[:virtual_attributes])\n\n # enable fallback recursive group search unless option is false\n @recursive_group_search_fallback = (options[:recursive_group_search_fallback] != false)\n\n # enable posixGroup support unless option is false\n @posix_support = (options[:posix_support] != false)\n\n # search_domains is a connection of bases to perform searches\n # when a base is not explicitly provided.\n @search_domains = Array(options[:search_domains])\n\n # configure both the membership validator and the member search strategies\n configure_search_strategy(options[:search_strategy])\n\n # configure the strategy used by Domain#user? to look up a user entry for login\n configure_user_search_strategy(options[:user_search_strategy])\n\n # enables instrumenting queries\n @instrumentation_service = options[:instrumentation_service]\n end", "def connect\n if File.exists?(config_file)\n start_logging\n setup_connections\n else\n copy_sample_config\n Merb.logger.error! \"No database.yml file found in #{Merb.root}/config.\"\n Merb.logger.error! \"A sample file was created called database.sample.yml for you to copy and edit.\"\n exit(1)\n end\n end", "def valid?(auth)\n # how to connect to the ldap server: ldap, ldaps, ldap + starttls\n if @config.ldaps\n enc = { method: :simple_tls }\n elsif @config.starttls\n enc = { method: :start_tls }\n enc[:tls_options] = @config.tls_options if @config.tls_options\n else\n enc = nil # just straight ldap\n end\n conn = Net::LDAP.new(host: @config.hostname, port: @config.port,\n base: @config.basedn,\n encryption: enc)\n\n $stdout.puts \"Net::LDAP.new => #{conn.inspect}\" if @config.debug\n\n if @config.auth\n $stdout.puts \"doing auth for #{@config.rootdn.inspect}\" if @config.debug\n conn.auth @config.rootdn, @config.passdn\n # conn.get_operation_result.message has the reson for a failure\n return false unless conn.bind\n end\n\n filter = Net::LDAP::Filter.eq(@config.username_ldap_attribute,\n auth.username)\n\n $stdout.puts \"Net::LDAP::Filter.eq => #{filter.inspect}\" if @config.debug\n\n # find the user and rebind as them to test the password\n # return conn.bind_as(:filter => filter, :password => auth.password)\n $stdout.puts \"doing bind_as password.size: #{auth.password.size}...\" if @config.debug\n ret = conn.bind_as(filter: filter, password: auth.password)\n $stdout.puts \"bind_as => #{ret.inspect}\" if @config.debug\n ret\n end", "def connect\n @retries_left = RETRY_COUNT\n require 'mindset' unless defined?(::Mindset)\n begin\n @neurosky = ::Mindset.connect(connect_to)\n super\n return true\n rescue Errno::EBUSY, Errno::ECONNREFUSED => e\n @retries_left -= 1\n if @retries_left > 0\n retry\n else\n Logger.error e.message\n Logger.error e.backtrace.inspect\n return false\n end\n end\n end", "def authenticate\n @openid_url = params[:openid_url]\n\n failed = proc { |message|\n flash[:error] = message\n redirect_to(:action => \"index\")\n }\n\n authenticate_with_open_id(@openid_url) { |result, identity_url, sreg|\n if result.successful?\n if OpenIdCredential.exists?(:identity_url => identity_url)\n failed[p_(\"MultiAuth\",\n \"Because specified OpenID has already been registered, \" +\n \"it is not possible to use it. \")]\n else\n session[:identity_url] = identity_url\n redirect_to(:action => \"authenticated\")\n end\n else\n failed[result.message]\n end\n }\n end", "def ensure_ca_certificates\n final_state = run_machine(NeedCACerts.new, NeedKey)\n final_state.ssl_context\n end", "def ldap_authenticate \n filter = Net::LDAP::Filter.eq(\"uid\",\"#{username}\")\n \n ldap_connection.search(:base => ldap_treebase, :filter => filter, :attributes => ldap_attrs, :return_result => false) do |entry|\n return true\n end\n \n self.errors.add(:username, \" is invalid\")\n return false\n end", "def test_ar_validation\n source = Source.new(\"http://www.newstuff.org/my_first\")\n assert(!Source.exists?(source.uri))\n source.primary_source = false\n errors = \"\"\n assert(source.valid?, source.errors.each_full() { |msg| errors += \":\" + msg })\n \n # Now check if the uri validation works\n source.uri = \"foobar\"\n assert(!source.valid?)\n source.uri = \"foo:bar\"\n assert(source.valid?)\n end", "def attempt_connection\n conn = Puppet::Network::HttpPool.http_instance(http_server, http_port, use_ssl, verify_peer)\n\n response = conn.get(test_path, test_headers)\n unless response.code.to_i == expected_code\n Puppet.notice \"Unable to connect to the server or wrong HTTP code (expected #{expected_code}) (http#{use_ssl ? 's' : ''}://#{http_server}:#{http_port}): [#{response.code}] #{response.msg}\"\n return false\n end\n return true\n rescue StandardError => e\n Puppet.notice \"Unable to connect to the server (http#{use_ssl ? 's' : ''}://#{http_server}:#{http_port}): #{e.message}\"\n return false\n end", "def search_ldap_identity_source(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def test_ssl_with_invalid_cert\n assert_raise ConnectionFailure do\n create_client(@connect_info, :ssl => true,\n :ssl_key => CLIENT_CERT,\n :ssl_cert => CLIENT_CERT,\n :ssl_verify => true,\n :ssl_ca_cert => CA_CERT)\n end\n end", "def with_source_connection\n config = get_test_config\n conn_hash = config.source.dup\n database = conn_hash.delete(:database)\n client = Mysql2::Client.new(conn_hash)\n begin\n yield client, database\n ensure\n client.close\n end\n end", "def test_ssl_not_configured\n assert_raise Mongo::ConnectionTimeoutError do\n create_client(['localhost', 27017], :connect_timeout => 2, :ssl => true)\n end\n end", "def find_for_ldap_authentication(attributes={}, authenticator = EpiCas::LdapAuthenticator)\n authenticator.new(attributes, self).authenticate_ldap\n end", "def authenticate (ldap)\n auth=ldap.authenticate \"cn=admin,dc=example,dc=com\",'123' \n puts \"***** authentication result *******\" \n puts ldap.get_operation_result \n end", "def establish_connection!\n return if [app_path, username, password].select{|f| f.blank? }.length > 0\n Basecamp.establish_connection!(app_path, username, password, true) unless @connection_established\n @connection_established = true\n end", "def setup_ssl\n @connection.use_ssl = @config[:use_ssl]\n\n if @config[:ssl_verify_peer]\n @connection.verify_mdoe = OpenSSL::SSL::VERIFY_PEER\n @connection.ca_file = @config[:ssl_ca_file]\n else\n @connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n end", "def ds_connection\n if session[:int_key].nil? || session[:email].nil? || session[:password].nil?\n redirect_to new_login_path\n else\n @connection ||= Docusign::Base.login(\n :integrators_key => session[:int_key],\n :email => session[:email],\n :password => session[:password],\n :endpoint_url => Docusign::Config[:default_endpoint_url],\n :wiredump_dev => STDOUT #This echoes all SOAP calls to standard out. Change this to log somewhere else, or comment out to eliminate logging.\n )\n end\n end", "def validate_authentication_options!\n auth_mech = options[:auth_mech]\n user = options[:user]\n password = options[:password]\n auth_source = options[:auth_source]\n mech_properties = options[:auth_mech_properties]\n\n if auth_mech.nil?\n if user && user.empty?\n raise Mongo::Auth::InvalidConfiguration, 'Empty username is not supported for default auth mechanism'\n end\n\n if auth_source == ''\n raise Mongo::Auth::InvalidConfiguration, 'Auth source cannot be empty for default auth mechanism'\n end\n\n return\n end\n\n if !Mongo::Auth::SOURCES.key?(auth_mech)\n raise Mongo::Auth::InvalidMechanism.new(auth_mech)\n end\n\n if user.nil? && !%i(aws mongodb_x509).include?(auth_mech)\n raise Mongo::Auth::InvalidConfiguration, \"Username is required for auth mechanism #{auth_mech}\"\n end\n\n if password.nil? && !%i(aws gssapi mongodb_x509).include?(auth_mech)\n raise Mongo::Auth::InvalidConfiguration, \"Password is required for auth mechanism #{auth_mech}\"\n end\n\n if password && auth_mech == :mongodb_x509\n raise Mongo::Auth::InvalidConfiguration, 'Password is not supported for :mongodb_x509 auth mechanism'\n end\n\n if auth_mech == :aws && user && !password\n raise Mongo::Auth::InvalidConfiguration, 'Username is provided but password is not provided for :aws auth mechanism'\n end\n\n if %i(aws gssapi mongodb_x509).include?(auth_mech)\n if !['$external', nil].include?(auth_source)\n raise Mongo::Auth::InvalidConfiguration, \"#{auth_source} is an invalid auth source for #{auth_mech}; valid options are $external and nil\"\n end\n else\n # Auth source is the database name, and thus cannot be the empty string.\n if auth_source == ''\n raise Mongo::Auth::InvalidConfiguration, \"Auth source cannot be empty for auth mechanism #{auth_mech}\"\n end\n end\n\n if mech_properties && !%i(aws gssapi).include?(auth_mech)\n raise Mongo::Auth::InvalidConfiguration, \":mechanism_properties are not supported for auth mechanism #{auth_mech}\"\n end\n end", "def load_ldap ldap_result\n self.reset\n self.from = :ldap\n\n if ldap_result.nil?\n self.errors.add(:query, 'No results were found')\n return\n end\n \n [:cn, :mail, :displayName].each do |key|\n if ldap_result[key].nil?\n self.errors.add key, 'Search result was missing information'\n return\n end\n\n if ldap_result[key].size == 0\n self.errors.add key, 'Search result was missing data'\n return\n end\n \n if ldap_result[key].size != 1\n self.errors.add :query, 'There were too many matches to your search'\n return\n end\n\n if ldap_result[key][0].nil?\n self.errors.add key, 'There were no results for search'\n return\n end\n end\n\n unless ldap_result[:mail].first =~ /\\A[^@]+@[^@]+\\Z/ \n errors.add :email, 'An invalid email address was found in search result'\n end\n \n self.sn = ldap_result[:cn][0].to_s\n self.cn = ldap_result[:cn][0].to_s\n self.email = ldap_result[:mail][0].to_s\n self.displayname = ldap_result[:displayName][0].to_s\n end", "def check_ssl\n yield\n rescue OpenSSL::SSL::SSLError => e\n raise_config_error \"Invalid SSL certificate\"\n rescue Faraday::SSLError => e\n msg = e.message.presence || 'SSL certificate verify failed'\n raise_config_error(msg)\n end", "def connection= conn\n @ldap = conn\n load_users_from_groups\n end", "def authenticate_with_active_directory(username, password)\n auth_ldap = ADMapper::Connection.current_connection.dup.bind_as(\n :filter => Net::LDAP::Filter.eq( \"sAMAccountName\", username ),\n :base => ADMapper::Connection.treebase,\n :password => password\n )\n \n end" ]
[ "0.66293675", "0.64491415", "0.5752266", "0.572403", "0.56161594", "0.554347", "0.5311181", "0.525187", "0.5211923", "0.5192988", "0.5178791", "0.5158011", "0.5128041", "0.51246667", "0.50987667", "0.50920224", "0.50909466", "0.5079398", "0.50651455", "0.5054469", "0.5025407", "0.49999192", "0.49249423", "0.48821455", "0.48745838", "0.48622677", "0.48515037", "0.4833645", "0.47762704", "0.47653154", "0.47459325", "0.4712052", "0.4678488", "0.46774992", "0.46719587", "0.46663785", "0.46558475", "0.46312305", "0.4628576", "0.46276253", "0.4619744", "0.4603972", "0.4602272", "0.4602272", "0.46000177", "0.45906028", "0.45893973", "0.45840776", "0.45820564", "0.4571659", "0.4568469", "0.45612723", "0.45489916", "0.45344722", "0.4533168", "0.45151588", "0.45125556", "0.45091748", "0.4496746", "0.44927782", "0.4492243", "0.44787708", "0.4476922", "0.44758588", "0.4474829", "0.44670627", "0.4433229", "0.44327584", "0.44234768", "0.44202206", "0.44198442", "0.44143438", "0.441249", "0.44104776", "0.4409272", "0.44076312", "0.43958247", "0.43900105", "0.4389863", "0.43897355", "0.43871227", "0.4385233", "0.4377496", "0.43716097", "0.4365668", "0.4359032", "0.43587187", "0.43585545", "0.4354311", "0.43534598", "0.4350023", "0.43473837", "0.4342771", "0.4340238", "0.43364733", "0.43352148", "0.43347716", "0.43294954", "0.4322186", "0.4318457" ]
0.49810985
22
Test the configuration of an existing LDAP identity source Attempt to connect to an existing LDAP identity source and report any errors encountered.
def probe_configured_ldap_identity_source_probe_with_http_info(ldap_identity_source_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_configured_ldap_identity_source_probe ...' end # verify the required parameter 'ldap_identity_source_id' is set if @api_client.config.client_side_validation && ldap_identity_source_id.nil? fail ArgumentError, "Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_configured_ldap_identity_source_probe" end # resource path local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}?action=probe'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'LdapIdentitySourceProbeResults') if @api_client.config.debugging @api_client.config.logger.debug "API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_configured_ldap_identity_source_probe\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_connection\n ldap_con = initialize_ldap_con(self.account, self.account_password)\n ldap_con.open { }\n rescue Net::LDAP::LdapError => text\n raise \"LdapError: %s\" % text\n end", "def test_connection\n\t\tldap_con = initialize_ldap_con(self.account, self.encrypted_password)\n\t\tldap_con.open do |ldap|\n\t\tend\n\trescue Net::LDAP::LdapError => text\n\t\traise \"LdapError: \" + text\n\tend", "def activedirectory_connect\n ActiveDirectory::Base.enable_cache if ::Devise.ad_caching\n ActiveDirectory::Base.setup(::Devise.ad_settings)\n raise DeviseActiveDirectoryAuthenticatable::ActiveDirectoryException, \"Invalid Username or Password\" unless ActiveDirectory::Base.connected?\n end", "def connect_to_ldap\r\n begin\r\n @ldap = Net::LDAP.new(:host => @ldap_host,\r\n :port => @ldap_port,\r\n :auth => { :method => :simple,\r\n :username => @ldap_username,\r\n :password => @ldap_password } )\r\n @logger.info \"Connecting to LDAP: '#{@ldap_host}' on port #{@ldap_port}\"\r\n @logger.info \"Binding to LDAP as: #{@ldap_username}\"\r\n \r\n success = @ldap.bind()\r\n if (success)\r\n @logger.info \"LDAP authorization succeeded\"\r\n return true\r\n else\r\n @logger.error \"LDAP authorization failed: #{@ldap.get_operation_result.message}\"\r\n return false\r\n end\r\n rescue Net::LDAP::LdapError => error\r\n @logger.error(\"Error connecting to LDAP: #{error}\")\r\n return false\r\n end\r\n end", "def probe_unconfigured_ldap_identity_source_probe_identity_source_with_http_info(ldap_identity_source, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source' is set\n if @api_client.config.client_side_validation && ldap_identity_source.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=probe_identity_source'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ldap_identity_source)\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceProbeResults')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_unconfigured_ldap_identity_source_probe_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connect\n @logger.debug(\"Connecting to LDAP server: #{Time.now}\" )\n\n connected = false\n error = nil\n LDAP_SERVERS.each do |ldap_server| \n begin\n @ldap.host = ldap_server\n @ldap.port = 636\n @ldap.encryption :simple_tls\n @ldap.auth BIND_DN, BIND_PASS\n connected = @ldap.bind\n @logger.debug(\"bind result: #{@ldap.get_operation_result}\")\n break if connected\n raise \"Failed to connect to LDAP server #{ldap_server}. Error: #{@ldap.get_operation_result.message} (#{@ldap.get_operation_result.code})\"\n rescue => e\n connected = false\n error = \"Failed to connect to LDAP server #{ldap_server}. Error: #{e.message}\\n#{e.backtrace}\"\n end\n @logger.warn(error)\n end\n\n # raise exception if not connected\n raise ConnectError, error unless connected\n\n @logger.debug(\"connected to #{@ldap.host}.\")\n end", "def read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#read_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connect!\n com::unboundid::ldap::sdk::LDAPConnection.new(\n self.host, self.port, self.bind_dn, self.password) \n end", "def ldap_verify_and_update\n return unless self.is_ldap?\n\n scanner = LdapQuery::Scanner.search self.login, :only=>:ldap\n\n if scanner.errors.size > 0\n errors.add(:login, 'Login is invalid or cannot be found in OHSU\\'s servers')\n return\n end\n\n # Update our information from ldap\n self.assign_attributes scanner.as_user_attributes\n\n end", "def login_from_other_sources\n result = nil\n # Takes the first entry that doesn't return false\n sorcery_config.login_sources.find do |source|\n result = send(source)\n end\n return result if result\n\n nil\n end", "def start\n case ssl\n when :tls\n @connection = LDAP::SSLConn.new(host, port, true)\n when true\n @connection = LDAP::SSLConn.new(host, port)\n else\n @connection = LDAP::Conn.new(host, port)\n end\n @connection.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n @connection.set_option(LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_ON)\n @connection.simple_bind(user, password)\n rescue => detail\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end", "def search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}/search'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'filter_value'] = opts[:'filter_value'] if !opts[:'filter_value'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceSearchResultList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#search_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connection\n unless @connection\n raise Puppet::Error, \"Could not set up LDAP Connection: Missing ruby/ldap libraries\" unless Puppet.features.ldap?\n begin\n conn = Puppet::Util::Ldap::Connection.instance\n conn.start\n @connection = conn.connection\n rescue => detail\n puts detail.backtrace if Puppet[:trace]\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end\n end\n\n @connection\n end", "def bind_connection(credentials)\n Net::LDAP.new(credentials)\n rescue\n raise(ConnectionError, 'Failure connecting to LDAP host')\n end", "def ldap_connect\n ldap = Net::LDAP.new(host: host, port: Net::LDAP::DefaultPort)\n ldap\n end", "def config_ldap_start\n\n\t\t`chkconfig --level 3 ldap on`\n\t\t`service ldap start`\n\n\t\tldap_status = `service ldap status`\n\n\t\tif ldap_status.include? \"running\"\n\t\t\tputs \"LDAP Server was started correctly\"\n\t\telsif ldap_status.include? \"stopped\"\n\t\t\tputs \"LDAP server is not started or is not working correctly\"\n\t\telse\n\t\t\tputs \"Error processing LDAP status\"\n\t\tend\n\tend", "def populateLDAP\n return unless Rails.env.production?\n #quit if no email or netid to work with\n self.email ||= ''\n return if !self.email.include?('@yale.edu') && !self.netid\n\n begin\n ldap = Net::LDAP.new( :host =>\"directory.yale.edu\" , :port =>\"389\" )\n\n #set e filter, use netid, then email\n if !self.netid.blank? #netid\n f = Net::LDAP::Filter.eq('uid', self.netid)\n else\n f = Net::LDAP::Filter.eq('mail', self.email)\n end\n\n b = 'ou=People,o=yale.edu'\n p = ldap.search(:base => b, :filter => f, :return_result => true).first\n\n rescue Exception => e\n guessFromEmail\n end\n\n return unless p\n\n self.netid = ( p['uid'] ? p['uid'][0] : '' )\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n self.fname ||= ( p['givenname'] ? p['givenname'][0] : '' )\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n\n # Don't save the model, because they are going to be shown a form to edit info\n # self.save!\n end", "def initialize_ldap_con(username, password, hosts)\n result = nil\n\n hosts.each do |host|\n ldap = Net::LDAP.new({\n :host => host,\n :port => 389,\n :auth => {\n :method => :simple,\n :username => username,\n :password => password\n }\n })\n\n # If the bind succeeded, return the active connection. Else try the next host\n result = ldap if ldap.get_operation_result.code == 0\n end\n\n return result\n end", "def create_or_update_ldap_identity_source_with_http_info(ldap_identity_source_id, ldap_identity_source, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source\"\n end\n # verify the required parameter 'ldap_identity_source' is set\n if @api_client.config.client_side_validation && ldap_identity_source.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ldap_identity_source)\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#create_or_update_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def connect\n raise ArgumentError, \"You must pass a block to #connect\" unless block_given?\n\n unless @connection\n if Puppet[:ldaptls]\n ssl = :tls\n elsif Puppet[:ldapssl]\n ssl = true\n else\n ssl = false\n end\n options = {:ssl => ssl}\n if user = Puppet[:ldapuser] and user != \"\"\n options[:user] = user\n end\n if password = Puppet[:ldappassword] and password != \"\"\n options[:password] = password\n end\n @connection = Puppet::Util::Ldap::Connection.new(Puppet[:ldapserver], Puppet[:ldapport], options)\n end\n @connection.start\n begin\n yield @connection.connection\n ensure\n @connection.close\n end\n nil\n end", "def populateLDAP\n \n #quit if no email or netid to work with\n return if !self.netid\n \n ldap = Net::LDAP.new(host: 'directory.yale.edu', port: 389)\n b = 'ou=People,o=yale.edu'\n f = Net::LDAP::Filter.eq('uid', self.netid)\n a = %w(givenname sn mail knownAs class college)\n\n p = ldap.search(base: b, filter: f, attributes: a).first\n \n\n\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n if self.fname.blank?\n self.fname = ( p['givenname'] ? p['givenname'][0] : '' )\n end\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n self.save!\n end", "def probe_configured_ldap_identity_source_probe(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = probe_configured_ldap_identity_source_probe_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def ldap_authenticate\n # logger.debug(\"ldap_authenticate\")\n # ldap_time = Benchmark.realtime { ActiveLdap::Base.setup_connection }\n # logger.debug(\"LDAP: took #{ldap_time} to establish the connection\")\n authenticate_or_request_with_http_basic \"Bluepages Authentication\" do |user_name, password|\n logger.info(\"attempt to ldap authenticate: user_name #{user_name}\")\n next nil unless LdapUser.authenticate_from_email(user_name, password)\n logger.info(\"successful ldap_authenticate as #{user_name}\")\n common_authenticate(user_name)\n return true\n end\n return false\n end", "def probe_identity_source_ldap_server_probe_ldap_server_with_http_info(identity_source_ldap_server, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_identity_source_ldap_server_probe_ldap_server ...'\n end\n # verify the required parameter 'identity_source_ldap_server' is set\n if @api_client.config.client_side_validation && identity_source_ldap_server.nil?\n fail ArgumentError, \"Missing the required parameter 'identity_source_ldap_server' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_identity_source_ldap_server_probe_ldap_server\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=probe_ldap_server'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(identity_source_ldap_server)\n auth_names = ['BasicAuth']\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 => 'IdentitySourceLdapServerProbeResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_identity_source_ldap_server_probe_ldap_server\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def attempt_connection\n # All that we care about is that we are able to connect successfully via\n # https, so here we're simpling hitting a somewhat arbitrary low-impact URL\n # on the scalemgmt server.\n http = Net::HTTP.new(scalemgmt_server, scalemgmt_port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(test_path, test_headers)\n request.basic_auth(api_user, api_password)\n\n response = http.request(request)\n unless response.is_a?(Net::HTTPSuccess)\n Puppet.notice \"Unable to connect to scalemgmt server (https://#{scalemgmt_server}:#{scalemgmt_port}): [#{response.code}] #{response.msg}\"\n return false\n end\n true\n rescue Exception => e # rubocop:disable Lint/RescueException\n Puppet.notice \"Unable to connect to scalemgmt server (https://#{scalemgmt_server}:#{scalemgmt_port}): #{e.message}\"\n false\n end", "def authenticate_dn(dn, password)\n\t\tif dn.present? && password.present?\n\t\t\tinitialize_ldap_con(dn, password).bind\n\t\tend\n\tend", "def try_update_ldap\n auths = self.authentications.where(provider: 'shibboleth')\n return false if auths.length > 0\n\n auths = self.authentications.where(provider: 'ldap')\n if auths.length > 0\n uid = auths.first.uid\n else\n uid = self.login_id\n end\n begin\n Ldap_User::LDAP.replace_attribute(uid, 'mail', [self.email])\n rescue LdapMixin::LdapException => ex\n return false\n end\n return true\n end", "def connect\n @conn ||= Net::LDAP.new\n @conn.host = @host\n @conn.port = @port\n @conn.auth \"#{@login_dn},#{@base_dn}\", @password\n\n if @conn.bind\n return true\n else\n return false\n end\n end", "def load_ldap_library\n return if @ldap_library_loaded\n if @ldap_library\n if @ldap_library == 'net/ldap'\n require 'net/ldap'\n else\n require 'ldap'\n require 'ldap/control'\n end\n else\n begin\n require 'ldap'\n require 'ldap/control'\n @ldap_library = 'ldap'\n rescue LoadError\n require 'net/ldap'\n @ldap_library = 'net/ldap'\n end\n end\n @ldap_library_loaded = true\n end", "def valid_user?\n #create a new LDAP object using the ruby-net-ldap library\n @ldap = Net::LDAP.new(:base => \"dc=#{@domain},dc=#{@tld}\",\n :host => @adshost,\n :auth => {:username => \"#{@username}@#{@domain}.#{@tld}\",\n :password => @password,\n :method => :simple})\n #return a boolean indicating whether authentication was successful or not\n return @ldap.bind\n end", "def probe_unconfigured_ldap_identity_source_probe_identity_source(ldap_identity_source, opts = {})\n data, _status_code, _headers = probe_unconfigured_ldap_identity_source_probe_identity_source_with_http_info(ldap_identity_source, opts)\n data\n end", "def setup_ldap_server\n server = FakeLDAP::Server.new(port: 1389)\n server.run_tcpserver\n\n @domain = 'dc=example,dc=com'\n @toplevel_user_dn = \"cn=toplevel_user,cn=TOPLEVEL,#{@domain}\"\n @toplevel_user_password = 'toplevel_password'\n\n @regular_user_cn = 'regular_user'\n @regular_user_dn = \"cn=#{@regular_user_cn},ou=USERS,#{@domain}\"\n @regular_user_password = 'regular_password'\n @regular_user_email = \"#{@regular_user_cn}@example.com\"\n\n server.add_user(@toplevel_user_dn, @toplevel_user_password)\n server.add_user(@regular_user_dn, @regular_user_password,\n @regular_user_email)\n server\n end", "def authenticate!\n fill_user_params!\n\n cfg = ::Portus::LDAP::Configuration.new(params)\n if cfg.enabled?\n connection = initialized_adapter\n entry, admin = bind_as(connection, cfg)\n portus_login!(connection, cfg, admin) if entry\n elsif cfg.soft?\n # rubocop:disable Style/SignalException\n fail cfg.reason_message\n # rubocop:enable Style/SignalException\n else\n fail! cfg.reason_message\n end\n rescue ::Portus::LDAP::Error, Net::LDAP::Error => e\n logged_failure!(e.message)\n end", "def validate_datasource!\n return if datasource[:access] == 'proxy' && datasource[:type] == 'prometheus'\n\n raise_error 'Only Prometheus datasources with proxy access in Grafana are supported.'\n end", "def net_ldap\n @net_ldap ||= new_net_ldap\n end", "def add_sources(marshaller)\n source_dir = (source_type == SOURCE_TYPE_INTERNAL) \\\n ? SystemProperties::getCenterInternalDirectory \\\n : SystemProperties::getCenterExternalDirectory\n\n ha_configured = CommonSql.ha_configured?\n\n ConfigurationSource.get_all_sources_by_type(source_type).each do |source|\n source_xml = marshaller.factory.createConfigurationSourceType\n central_server_address = nil\n if ha_configured\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS,\n :ha_node_name => source.ha_node_name).first.value\n else\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS).first.value\n end\n source_xml.downloadURL =\n \"http://\" + central_server_address + \"/\" + source_dir\n source.configuration_signing_keys.find_each do |key|\n source_xml.getVerificationCert.add(key.cert.to_java_bytes)\n end\n marshaller.root.source.add(source_xml)\n end\n end", "def create_default_authentication_ldap_configuration(opts)\n opts = check_params(opts,[:search_base_dn,:servers])\n super(opts)\n end", "def associate_auth(source)\n return if user_authentications.where(:provider => source['provider'], :uid => source['uid'].to_s).count > 0\n self.user_authentications.create!(:provider => source['provider'], :uid => source['uid'], :nickname => source[\"user_info\"]['nickname'])\n end", "def test_local_core_connection\n \n # Change username, password, host and port in order to test the connection with a different Ensembl db server\n assert_nothing_raised do \n Ensembl::Core::DBConnection.connect('Homo sapiens',56,:username => \"anonymous\",:host => \"ensembldb.ensembl.org\", :port => 5306)\n end\n end", "def ldap_user_not_at_cartodb\n render action: 'new' and return unless verify_warden_failure\n\n username = warden.env['warden.options'][:cartodb_username]\n organization_id = warden.env['warden.options'][:organization_id]\n email = warden.env['warden.options'][:ldap_email].presence\n\n create_user(\n username: username,\n organization_id: organization_id,\n email: email,\n created_via: Carto::UserCreation::CREATED_VIA_LDAP\n )\n end", "def initialize(ldap_config)\n @ldap = Net::LDAP.new host: ldap_config['host'], port: ldap_config['port']\n @attributes_to_import = %w(uid sn givenname mail title objectclass)\n @tree_base = ldap_config['treebase']\n\n # Used to log information\n @people_saved = 0\n @picture_uploaded = 0\n end", "def initialize(conf:)\n @ldap = Net::LDAP.new host: LDAP_SERVER, # your LDAP host name or IP goes here,\n # port: '389', # unencrypted LDAP host port,\n port: '636', # TLS port\n encryption: :simple_tls,\n base: 'DC=UoA,DC=auckland,DC=ac,DC=nz', # the base of your AD tree goes here,\n auth: {\n method: :simple,\n username: conf.ldap_user, # a user w/sufficient privileges to read from AD goes here,\n password: conf.ldap_auth_token # the user's password goes here\n }\n end", "def test_nonexistent_source\n assert_error \"FATAL: database \\\"db1\\\" does not exist\\n\", \"--from db1 --to pgsync_test2\"\n end", "def test_nonexistent_source\n assert_error \"FATAL: database \\\"db1\\\" does not exist\\n\", \"--from db1 --to pgsync_test2\"\n end", "def ldap_ssl_option\n super\n end", "def stub_api_source_calls(source)\n stub_api_source_get(source, show(source))\n return unless source_available?(source)\n\n endpoint = endpoints(source)[source['id']]\n stub_rest_get(\"#{sources_api}/sources/#{source[\"id\"]}/endpoints\", user_tenant_header, list([endpoint]))\n\n authentication = authentications(source)[source['id']]\n stub_rest_get(\"#{sources_api}/endpoints/#{endpoint['id']}/authentications\", user_tenant_header, list([authentication]))\n\n stub_rest_get(\"#{sources_api(:internal => true)}/authentications/#{authentication['id']}?expose_encrypted_attribute[]=password\", user_tenant_header, show(credentials(source)[authentication['id']]))\n end", "def ldap?\n !!ldap\n end", "def list_ldap_identity_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/aaa/ldap-identity-sources'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#list_ldap_identity_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def authenticate_with_activedirectory(attributes={}) \n username = attributes[login_with]\n password = attributes[:password]\n\n Logger.send \"Attempting to login :#{@login_with} => #{username}\"\n set_activedirectory_credentials :username => username, :password => password\n activedirectory_connect\n Logger.send \"Attempt Result: #{ActiveDirectory::Base.error}\"\n\n # Find them in the local database\n user = find_or_create_from_activedirectory(login_with => attributes[login_with]).first\n\n # Check to see if we have the same user\n unless user.nil?\n user.save if user.new_record? and ::Devise.ad_create_user\n user.login if user.respond_to?(:login)\n return user\n else\n raise DeviseActiveDirectoryAuthenticatable::ActiveDirectoryException, \"Active Directory user and entry in local database have different GUIDs. Possible database inconsistency.\"\n end\n end", "def ldap_ssl?\r\n ldap_ssl.to_s.to_i != 0\r\n end", "def credentials_error\n raise(CredentialsError, 'valid ldap credentials must be passed in order to establish a connection')\n end", "def init_ads\n # Load gem required for ADS\n require 'jdbc/dss'\n require 'sequel'\n\n # Initialize JDBC ADS driver\n Jdbc::DSS.load_driver\n Java.com.gooddata.dss.jdbc.driver.DssDriver\n\n puts \"Initializing DSS connection to #{DSS_URL} as user #{DSS_USERNAME}\"\n @dss = Sequel.connect DSS_URL, :username => DSS_USERNAME, :password => DSS_PASSWORD\n\n run_dss_script(SQL_CREATE_LOCATIONS, table: TABLE_LOCATIONS)\n run_dss_script(SQL_CREATE_SFPD, table: TABLE_SFPD)\n end", "def fill_from_ldap\n person = self.ldap_person\n if person.nil?\n if Rails.development?\n self.name = \"Susan #{self.login}\"\n self.email = \"beehive+#{self.login}@berkeley.edu\"\n self.major_code = 'undeclared'\n self.user_type = case self.login\n when 212388, 232588\n User::Types::Grad\n when 212381, 300846, 300847, 300848, 300849, 300850\n User::Types::Undergrad\n when 212386, 322587, 322588, 322589, 322590\n User::Types::Faculty\n when 212387, 322583, 322584, 322585, 322586\n User::Types::Staff\n else\n User::Types::Affiliate\n end\n return true\n else\n self.name = 'Unknown Name'\n self.email = ''\n self.major_code = ''\n self.user_type = User::Types::Affiliate\n return false\n end\n else\n self.name = \"#{person.firstname} #{person.lastname}\".titleize\n self.email = person.email\n self.major_code = person.berkeleyEduStuMajorName.to_s.downcase\n self.user_type = case\n when person.berkeleyEduStuUGCode == 'G'\n User::Types::Grad\n when person.student?\n User::Types::Undergrad\n when person.employee_academic?\n User::Types::Faculty\n when person.employee?\n User::Types::Staff\n else\n User::Types::Affiliate\n end\n return true\n end\n end", "def list_ldap_identity_sources(opts = {})\n data, _status_code, _headers = list_ldap_identity_sources_with_http_info(opts)\n data\n end", "def bind\n conn = Net::LDAP.new :host => @config[:server],\n :port => @config[:port],\n :base => @config[:base]\n if @config[:encryption]\n conn.encryption @config[:encryption]\n end\n \n raise \"Anonymous Bind is disabled\" if @config[:password] == \"\" && !(@config[:anonymous_bind])\n \n conn.auth \"#{@config[:username]}@#{@config[:domain]}\", @config[:password]\n \n begin\n Timeout::timeout(10){\n if conn.bind\n return conn\n else\n raise 'Query User Rejected'\n end\n }\n rescue Timeout::Error\n raise 'Unable to connect to LDAP Server'\n rescue Errno::ECONNRESET\n if @config[:allow_fallback]\n @config[:port] = @config[:allow_fallback]\n @config[:encryption] = false\n return Adauth::Connection.new(@config).bind\n end\n end\n end", "def reconnect\n\t\tself.log.info \"Reconnecting to %s...\" % [ self.uri ]\n\t\t@conn = self.connect\n\t\tself.log.info \"...reconnected.\"\n\n\t\treturn true\n\trescue LDAP::ResultError => err\n\t\tself.log.error \"%s while attempting to reconnect to %s: %s\" %\n\t\t\t[ err.class.name, self.uri, err.message ]\n\t\traise \"Couldn't reconnect to %s: %s: %s\" %\n\t\t\t[ self.uri, err.class.name, err.message ]\n\tend", "def ldap_connect(domain,binddn=BINDUSER,bindpw=BINDPASS)\n binddn = binddn + \"@\" + domain\n ldap = Net::LDAP.new(:host => domain,\n :port => 389,\n :auth => {\n :method => :simple,\n :username => binddn,\n :password => bindpw,\n })\n return ldap\n end", "def open_id_authentication\n authenticate_with_open_id(params[:openid_url], \n :required => [ :nickname ],\n :optional => [ :email, :fullname ]) do |result, identity_url, registration|\n if result.successful?\n successful_openid_login(identity_url, registration)\n else\n failed_login(result.message || \"Sorry could not log in with identity URL: #{identity_url}\")\n end\n end\n end", "def config_client_LDAP\n\t\tldap_conf = File.read('/etc/openldap/ldap.conf')\n\n\t\t# Set the BASE suffix to match the BASE suffix from the slapd conf file\n\t\tldap_conf = ldap_conf.gsub(/#BASE\\tdc=example, dc=com/,\"BASE dc=cit470_Team_4,dc=nku,dc=edu\")\n\n\t\t\n\t\t# Write the ldap.conf file\n\t\tFile.open('/etc/openldap/ldap.conf','w'){|file| file.puts ldap_conf}\n\n\t\t# Configure LDAP ACL to allow password changes\n\n\t\tldap=\"access to attrs=userPassword\\nby self write\\nby anonymous auth\\nby * none\\naccess to *\\nby self write\\nby * read\"\n\t\tFile.open('/etc/openldap/ldap.conf','a') {|file| file.puts ldap}\n\t\t\n\tend", "def set_credential_source(opts)\n opts = check_params(opts,[:sources])\n super(opts)\n end", "def connect_mongoid(source)\n if test_mongoid?\n $stderr.puts \"Mongoid #{Mongoid::VERSION}\", '-'*80\n\n if !ENV['QUIET'] == 'true'\n logger = ::Logger.new($stderr)\n logger.formatter = lambda { |s, d, p, m| \" #{m.ansi(:faint, :cyan)}\\n\" }\n logger.level = ::Logger::DEBUG\n Mongoid.logger = logger\n Mongo::Logger.logger = logger\n else\n Mongo::Logger.logger.level = ::Logger::WARN\n end\n\n Mongoid.connect_to(source)\n end\nend", "def ldap_server=(should) end", "def mock_ldap_connection\n fake_ldap_connection = double(\"MockLDAP\")\n allow(Ldap::Queries).to receive(:ldap_connection).and_return(fake_ldap_connection)\n fake_ldap_connection\nend", "def properly_configured?\n options = {\n open_timeout: 5,\n use_ssl: true, # all connections are forced SSL now\n verify_mode: OpenSSL::SSL::VERIFY_NONE # because we might not have a valid cert yet\n }\n Net::HTTP.start(website_alias, options) do |http|\n response = http.get(\"/tenant_aliases/#{id}/verify\")\n\n return false unless response.is_a?(Net::HTTPSuccess)\n\n response.body == \"TRUE\"\n end\n rescue SocketError, Net::OpenTimeout, Errno::ECONNREFUSED\n # SocketError if the server name doesn't exist in DNS\n # OpenTimeout if no server responds\n # ECONNREFUSED if the server responds with \"No\"\n false\n end", "def login(user, pass)\n conn = LDAP::Conn.new($ldap_conf[:server], $ldap_conf[:port])\n conn.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n conn.start_tls\n\n begin\n if conn.bind('uid=' + user + ',' + $ldap_conf[:people_dn], pass)\n get_uidNumber conn, user\n else\n False\n end\n rescue Exception => e\n nil\n end\nend", "def connect\n\t\tconn = nil\n\n\t\tcase @connect_type\n\t\twhen :tls\n\t\t\tself.log.debug \"Connecting using TLS to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::SSLConn.new( @host, @port, true )\n\t\twhen :ssl\n\t\t\tself.log.debug \"Connecting using SSL to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::SSLConn.new( @host, @port )\n\t\telse\n\t\t\tself.log.debug \"Connecting using an unencrypted connection to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::Conn.new( @host, @port )\n\t\tend\n\n\t\tconn.set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, 3 )\n\t\tconn.set_option( LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_OFF )\n\n\t\treturn conn\n\tend", "def attempt_connection\n conn = Puppet.runtime[:http]\n\n response = conn.get(test_uri, headers: test_headers, options: options)\n unless response.code.to_i == expected_code\n Puppet.notice \"Unable to connect to the server or wrong HTTP code (expected #{expected_code}) (#{test_uri}): [#{response.code}] #{response.reason}\"\n return false\n end\n return true\n rescue StandardError => e\n Puppet.notice \"Unable to connect to the server (#{test_uri}): #{e.message}\"\n return false\n end", "def ldap_config\n @@ldap_config ||= YAML::load_file(\"#{RAILS_ROOT}/config/ldap.yml\")[RAILS_ENV || 'development']\n end", "def process_login\n# Something is really wrong\n return dc_render_404('Login:') unless ( params[:record] and params[:record][:username] and params[:record][:password] )\n success = false\n unless params[:record][:password].blank? \n# user must be defined locally\n user = DcUser.find_by(username: params[:record][:username])\n if user\n# LDAP alternative. You must add gem 'net-ldap' to Gemfile \n# ldap = Net::LDAP.new(host: 'ldap.yourdomain.com')\n# ldap.auth(\"#{params[:record][:username]}@yourdomain.com\", params[:record][:password])\n# success = ldap.bind\n\n# authenticate locally\n success = user.authenticate(params[:record][:password]) unless success\n end\n end\n# \n if success\n fill_login_data(user, false)\n redirect_to '/'\n else # display login error\n flash[:error] = t('drgcms.invalid_username')\n redirect_to \"/login\"\n end\nend", "def option_ldap_check\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"option ldap-check \" + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "def ldap_dispatcher\n # Scooter doesn't support custom settings yet.\n #@ldap_dispatcher ||= LDAPDispatcher.new(openldap, { :encryption => nil, :port => 389, \n # :auth => { :method => :simple, :username => \"cn=admin,dc=example,dc=com\", :password => \"puppetlabs\" } })\n @ldap_dispatcher ||= LDAPDispatcher.new(openldap, { :encryption => nil, :port => 389 })\nend", "def verify!\n reconnect! unless active?\n end", "def test_load_failure\n # Check for load failure\n assert_raises(ActiveRecord::RecordNotFound) { Source.find(\"xxxx\") }\n end", "def test_ssl_configuration\n # raises when ssl=false and ssl opts specified\n assert_raise MongoArgumentError do\n create_client(@connect_info, :connect => false,\n :ssl => false,\n :ssl_cert => CLIENT_CERT)\n end\n\n # raises when ssl=nil and ssl opts specified\n assert_raise MongoArgumentError do\n create_client(@connect_info, :connect => false,\n :ssl_key => CLIENT_CERT)\n end\n\n # raises when verify=true and no ca_cert\n assert_raise MongoArgumentError do\n create_client(@connect_info, :connect => false,\n :ssl => true,\n :ssl_key => CLIENT_CERT,\n :ssl_cert => CLIENT_CERT,\n :ssl_verify => true)\n end\n\n # raises when key passphrase is given without key file\n assert_raise MongoArgumentError do\n create_client(@connect_info, :connect => false,\n :ssl => true,\n :ssl_key_pass_phrase => PASS_PHRASE)\n end\n end", "def ldapsearch(filter)\n raise ArgumentError.new(\"You must pass a block to ldapsearch\") unless block_given?\n\n found = false\n count = 0\n\n begin\n connection.search(search_base, 2, filter, search_attributes) do |entry|\n found = true\n yield entry\n end\n rescue SystemExit,NoMemoryError\n raise\n rescue Exception => detail\n if count == 0\n # Try reconnecting to ldap if we get an exception and we haven't yet retried.\n count += 1\n @connection = nil\n Puppet.warning \"Retrying LDAP connection\"\n retry\n else\n error = Puppet::Error.new(\"LDAP Search failed\")\n error.set_backtrace(detail.backtrace)\n raise error\n end\n end\n\n found\n end", "def check_connection(ip)\n if File.exists?(\"ssl/client.crt\") &&\n File.exists?(\"ssl/client.key\") &&\n File.exists?(\"ssl/root.crt\")\n postgres_ssl_connection(ip)\n else\n postgres_plain_connection(ip)\n end\nend", "def fetch_identity_source_ldap_server_certificate_fetch_certificate_with_http_info(identity_source_ldap_server_endpoint, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.fetch_identity_source_ldap_server_certificate_fetch_certificate ...'\n end\n # verify the required parameter 'identity_source_ldap_server_endpoint' is set\n if @api_client.config.client_side_validation && identity_source_ldap_server_endpoint.nil?\n fail ArgumentError, \"Missing the required parameter 'identity_source_ldap_server_endpoint' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.fetch_identity_source_ldap_server_certificate_fetch_certificate\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=fetch_certificate'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(identity_source_ldap_server_endpoint)\n auth_names = ['BasicAuth']\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 => 'PeerCertificateChain')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#fetch_identity_source_ldap_server_certificate_fetch_certificate\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def initialize(options = {})\n @uid = options[:uid] || \"sAMAccountName\"\n\n # Keep a reference to these as default auth for a Global Catalog if needed\n @admin_user = options[:admin_user]\n @admin_password = options[:admin_password]\n @port = options[:port]\n\n @connection = Net::LDAP.new({\n host: options[:host],\n port: options[:port],\n hosts: options[:hosts],\n instrumentation_service: options[:instrumentation_service]\n })\n\n if options[:admin_user] && options[:admin_password]\n @connection.authenticate(options[:admin_user], options[:admin_password])\n end\n\n if encryption = check_encryption(options[:encryption], options[:tls_options])\n @connection.encryption(encryption)\n end\n\n configure_virtual_attributes(options[:virtual_attributes])\n\n # enable fallback recursive group search unless option is false\n @recursive_group_search_fallback = (options[:recursive_group_search_fallback] != false)\n\n # enable posixGroup support unless option is false\n @posix_support = (options[:posix_support] != false)\n\n # search_domains is a connection of bases to perform searches\n # when a base is not explicitly provided.\n @search_domains = Array(options[:search_domains])\n\n # configure both the membership validator and the member search strategies\n configure_search_strategy(options[:search_strategy])\n\n # configure the strategy used by Domain#user? to look up a user entry for login\n configure_user_search_strategy(options[:user_search_strategy])\n\n # enables instrumenting queries\n @instrumentation_service = options[:instrumentation_service]\n end", "def connect\n if File.exists?(config_file)\n start_logging\n setup_connections\n else\n copy_sample_config\n Merb.logger.error! \"No database.yml file found in #{Merb.root}/config.\"\n Merb.logger.error! \"A sample file was created called database.sample.yml for you to copy and edit.\"\n exit(1)\n end\n end", "def valid?(auth)\n # how to connect to the ldap server: ldap, ldaps, ldap + starttls\n if @config.ldaps\n enc = { method: :simple_tls }\n elsif @config.starttls\n enc = { method: :start_tls }\n enc[:tls_options] = @config.tls_options if @config.tls_options\n else\n enc = nil # just straight ldap\n end\n conn = Net::LDAP.new(host: @config.hostname, port: @config.port,\n base: @config.basedn,\n encryption: enc)\n\n $stdout.puts \"Net::LDAP.new => #{conn.inspect}\" if @config.debug\n\n if @config.auth\n $stdout.puts \"doing auth for #{@config.rootdn.inspect}\" if @config.debug\n conn.auth @config.rootdn, @config.passdn\n # conn.get_operation_result.message has the reson for a failure\n return false unless conn.bind\n end\n\n filter = Net::LDAP::Filter.eq(@config.username_ldap_attribute,\n auth.username)\n\n $stdout.puts \"Net::LDAP::Filter.eq => #{filter.inspect}\" if @config.debug\n\n # find the user and rebind as them to test the password\n # return conn.bind_as(:filter => filter, :password => auth.password)\n $stdout.puts \"doing bind_as password.size: #{auth.password.size}...\" if @config.debug\n ret = conn.bind_as(filter: filter, password: auth.password)\n $stdout.puts \"bind_as => #{ret.inspect}\" if @config.debug\n ret\n end", "def connect\n @retries_left = RETRY_COUNT\n require 'mindset' unless defined?(::Mindset)\n begin\n @neurosky = ::Mindset.connect(connect_to)\n super\n return true\n rescue Errno::EBUSY, Errno::ECONNREFUSED => e\n @retries_left -= 1\n if @retries_left > 0\n retry\n else\n Logger.error e.message\n Logger.error e.backtrace.inspect\n return false\n end\n end\n end", "def authenticate\n @openid_url = params[:openid_url]\n\n failed = proc { |message|\n flash[:error] = message\n redirect_to(:action => \"index\")\n }\n\n authenticate_with_open_id(@openid_url) { |result, identity_url, sreg|\n if result.successful?\n if OpenIdCredential.exists?(:identity_url => identity_url)\n failed[p_(\"MultiAuth\",\n \"Because specified OpenID has already been registered, \" +\n \"it is not possible to use it. \")]\n else\n session[:identity_url] = identity_url\n redirect_to(:action => \"authenticated\")\n end\n else\n failed[result.message]\n end\n }\n end", "def ensure_ca_certificates\n final_state = run_machine(NeedCACerts.new, NeedKey)\n final_state.ssl_context\n end", "def ldap_authenticate \n filter = Net::LDAP::Filter.eq(\"uid\",\"#{username}\")\n \n ldap_connection.search(:base => ldap_treebase, :filter => filter, :attributes => ldap_attrs, :return_result => false) do |entry|\n return true\n end\n \n self.errors.add(:username, \" is invalid\")\n return false\n end", "def test_ar_validation\n source = Source.new(\"http://www.newstuff.org/my_first\")\n assert(!Source.exists?(source.uri))\n source.primary_source = false\n errors = \"\"\n assert(source.valid?, source.errors.each_full() { |msg| errors += \":\" + msg })\n \n # Now check if the uri validation works\n source.uri = \"foobar\"\n assert(!source.valid?)\n source.uri = \"foo:bar\"\n assert(source.valid?)\n end", "def attempt_connection\n conn = Puppet::Network::HttpPool.http_instance(http_server, http_port, use_ssl, verify_peer)\n\n response = conn.get(test_path, test_headers)\n unless response.code.to_i == expected_code\n Puppet.notice \"Unable to connect to the server or wrong HTTP code (expected #{expected_code}) (http#{use_ssl ? 's' : ''}://#{http_server}:#{http_port}): [#{response.code}] #{response.msg}\"\n return false\n end\n return true\n rescue StandardError => e\n Puppet.notice \"Unable to connect to the server (http#{use_ssl ? 's' : ''}://#{http_server}:#{http_port}): #{e.message}\"\n return false\n end", "def search_ldap_identity_source(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def test_ssl_with_invalid_cert\n assert_raise ConnectionFailure do\n create_client(@connect_info, :ssl => true,\n :ssl_key => CLIENT_CERT,\n :ssl_cert => CLIENT_CERT,\n :ssl_verify => true,\n :ssl_ca_cert => CA_CERT)\n end\n end", "def with_source_connection\n config = get_test_config\n conn_hash = config.source.dup\n database = conn_hash.delete(:database)\n client = Mysql2::Client.new(conn_hash)\n begin\n yield client, database\n ensure\n client.close\n end\n end", "def test_ssl_not_configured\n assert_raise Mongo::ConnectionTimeoutError do\n create_client(['localhost', 27017], :connect_timeout => 2, :ssl => true)\n end\n end", "def find_for_ldap_authentication(attributes={}, authenticator = EpiCas::LdapAuthenticator)\n authenticator.new(attributes, self).authenticate_ldap\n end", "def authenticate (ldap)\n auth=ldap.authenticate \"cn=admin,dc=example,dc=com\",'123' \n puts \"***** authentication result *******\" \n puts ldap.get_operation_result \n end", "def establish_connection!\n return if [app_path, username, password].select{|f| f.blank? }.length > 0\n Basecamp.establish_connection!(app_path, username, password, true) unless @connection_established\n @connection_established = true\n end", "def setup_ssl\n @connection.use_ssl = @config[:use_ssl]\n\n if @config[:ssl_verify_peer]\n @connection.verify_mdoe = OpenSSL::SSL::VERIFY_PEER\n @connection.ca_file = @config[:ssl_ca_file]\n else\n @connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n end", "def ds_connection\n if session[:int_key].nil? || session[:email].nil? || session[:password].nil?\n redirect_to new_login_path\n else\n @connection ||= Docusign::Base.login(\n :integrators_key => session[:int_key],\n :email => session[:email],\n :password => session[:password],\n :endpoint_url => Docusign::Config[:default_endpoint_url],\n :wiredump_dev => STDOUT #This echoes all SOAP calls to standard out. Change this to log somewhere else, or comment out to eliminate logging.\n )\n end\n end", "def validate_authentication_options!\n auth_mech = options[:auth_mech]\n user = options[:user]\n password = options[:password]\n auth_source = options[:auth_source]\n mech_properties = options[:auth_mech_properties]\n\n if auth_mech.nil?\n if user && user.empty?\n raise Mongo::Auth::InvalidConfiguration, 'Empty username is not supported for default auth mechanism'\n end\n\n if auth_source == ''\n raise Mongo::Auth::InvalidConfiguration, 'Auth source cannot be empty for default auth mechanism'\n end\n\n return\n end\n\n if !Mongo::Auth::SOURCES.key?(auth_mech)\n raise Mongo::Auth::InvalidMechanism.new(auth_mech)\n end\n\n if user.nil? && !%i(aws mongodb_x509).include?(auth_mech)\n raise Mongo::Auth::InvalidConfiguration, \"Username is required for auth mechanism #{auth_mech}\"\n end\n\n if password.nil? && !%i(aws gssapi mongodb_x509).include?(auth_mech)\n raise Mongo::Auth::InvalidConfiguration, \"Password is required for auth mechanism #{auth_mech}\"\n end\n\n if password && auth_mech == :mongodb_x509\n raise Mongo::Auth::InvalidConfiguration, 'Password is not supported for :mongodb_x509 auth mechanism'\n end\n\n if auth_mech == :aws && user && !password\n raise Mongo::Auth::InvalidConfiguration, 'Username is provided but password is not provided for :aws auth mechanism'\n end\n\n if %i(aws gssapi mongodb_x509).include?(auth_mech)\n if !['$external', nil].include?(auth_source)\n raise Mongo::Auth::InvalidConfiguration, \"#{auth_source} is an invalid auth source for #{auth_mech}; valid options are $external and nil\"\n end\n else\n # Auth source is the database name, and thus cannot be the empty string.\n if auth_source == ''\n raise Mongo::Auth::InvalidConfiguration, \"Auth source cannot be empty for auth mechanism #{auth_mech}\"\n end\n end\n\n if mech_properties && !%i(aws gssapi).include?(auth_mech)\n raise Mongo::Auth::InvalidConfiguration, \":mechanism_properties are not supported for auth mechanism #{auth_mech}\"\n end\n end", "def load_ldap ldap_result\n self.reset\n self.from = :ldap\n\n if ldap_result.nil?\n self.errors.add(:query, 'No results were found')\n return\n end\n \n [:cn, :mail, :displayName].each do |key|\n if ldap_result[key].nil?\n self.errors.add key, 'Search result was missing information'\n return\n end\n\n if ldap_result[key].size == 0\n self.errors.add key, 'Search result was missing data'\n return\n end\n \n if ldap_result[key].size != 1\n self.errors.add :query, 'There were too many matches to your search'\n return\n end\n\n if ldap_result[key][0].nil?\n self.errors.add key, 'There were no results for search'\n return\n end\n end\n\n unless ldap_result[:mail].first =~ /\\A[^@]+@[^@]+\\Z/ \n errors.add :email, 'An invalid email address was found in search result'\n end\n \n self.sn = ldap_result[:cn][0].to_s\n self.cn = ldap_result[:cn][0].to_s\n self.email = ldap_result[:mail][0].to_s\n self.displayname = ldap_result[:displayName][0].to_s\n end", "def check_ssl\n yield\n rescue OpenSSL::SSL::SSLError => e\n raise_config_error \"Invalid SSL certificate\"\n rescue Faraday::SSLError => e\n msg = e.message.presence || 'SSL certificate verify failed'\n raise_config_error(msg)\n end", "def connection= conn\n @ldap = conn\n load_users_from_groups\n end", "def authenticate_with_active_directory(username, password)\n auth_ldap = ADMapper::Connection.current_connection.dup.bind_as(\n :filter => Net::LDAP::Filter.eq( \"sAMAccountName\", username ),\n :base => ADMapper::Connection.treebase,\n :password => password\n )\n \n end" ]
[ "0.66293675", "0.64491415", "0.5752266", "0.572403", "0.56161594", "0.554347", "0.5311181", "0.5211923", "0.5192988", "0.5178791", "0.5158011", "0.5128041", "0.51246667", "0.50987667", "0.50920224", "0.50909466", "0.5079398", "0.50651455", "0.5054469", "0.5025407", "0.49999192", "0.49810985", "0.49249423", "0.48821455", "0.48745838", "0.48622677", "0.48515037", "0.4833645", "0.47762704", "0.47653154", "0.47459325", "0.4712052", "0.4678488", "0.46774992", "0.46719587", "0.46663785", "0.46558475", "0.46312305", "0.4628576", "0.46276253", "0.4619744", "0.4603972", "0.4602272", "0.4602272", "0.46000177", "0.45906028", "0.45893973", "0.45840776", "0.45820564", "0.4571659", "0.4568469", "0.45612723", "0.45489916", "0.45344722", "0.4533168", "0.45151588", "0.45125556", "0.45091748", "0.4496746", "0.44927782", "0.4492243", "0.44787708", "0.4476922", "0.44758588", "0.4474829", "0.44670627", "0.4433229", "0.44327584", "0.44234768", "0.44202206", "0.44198442", "0.44143438", "0.441249", "0.44104776", "0.4409272", "0.44076312", "0.43958247", "0.43900105", "0.4389863", "0.43897355", "0.43871227", "0.4385233", "0.4377496", "0.43716097", "0.4365668", "0.4359032", "0.43587187", "0.43585545", "0.4354311", "0.43534598", "0.4350023", "0.43473837", "0.4342771", "0.4340238", "0.43364733", "0.43352148", "0.43347716", "0.43294954", "0.4322186", "0.4318457" ]
0.525187
7
Test an LDAP server Attempt to connect to an LDAP server and ensure that the server can be contacted using the given URL and authentication credentials.
def probe_identity_source_ldap_server_probe_ldap_server(identity_source_ldap_server, opts = {}) data, _status_code, _headers = probe_identity_source_ldap_server_probe_ldap_server_with_http_info(identity_source_ldap_server, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_connection\n ldap_con = initialize_ldap_con(self.account, self.account_password)\n ldap_con.open { }\n rescue Net::LDAP::LdapError => text\n raise \"LdapError: %s\" % text\n end", "def connect_to_ldap\r\n begin\r\n @ldap = Net::LDAP.new(:host => @ldap_host,\r\n :port => @ldap_port,\r\n :auth => { :method => :simple,\r\n :username => @ldap_username,\r\n :password => @ldap_password } )\r\n @logger.info \"Connecting to LDAP: '#{@ldap_host}' on port #{@ldap_port}\"\r\n @logger.info \"Binding to LDAP as: #{@ldap_username}\"\r\n \r\n success = @ldap.bind()\r\n if (success)\r\n @logger.info \"LDAP authorization succeeded\"\r\n return true\r\n else\r\n @logger.error \"LDAP authorization failed: #{@ldap.get_operation_result.message}\"\r\n return false\r\n end\r\n rescue Net::LDAP::LdapError => error\r\n @logger.error(\"Error connecting to LDAP: #{error}\")\r\n return false\r\n end\r\n end", "def test_connection\n\t\tldap_con = initialize_ldap_con(self.account, self.encrypted_password)\n\t\tldap_con.open do |ldap|\n\t\tend\n\trescue Net::LDAP::LdapError => text\n\t\traise \"LdapError: \" + text\n\tend", "def connect\n @logger.debug(\"Connecting to LDAP server: #{Time.now}\" )\n\n connected = false\n error = nil\n LDAP_SERVERS.each do |ldap_server| \n begin\n @ldap.host = ldap_server\n @ldap.port = 636\n @ldap.encryption :simple_tls\n @ldap.auth BIND_DN, BIND_PASS\n connected = @ldap.bind\n @logger.debug(\"bind result: #{@ldap.get_operation_result}\")\n break if connected\n raise \"Failed to connect to LDAP server #{ldap_server}. Error: #{@ldap.get_operation_result.message} (#{@ldap.get_operation_result.code})\"\n rescue => e\n connected = false\n error = \"Failed to connect to LDAP server #{ldap_server}. Error: #{e.message}\\n#{e.backtrace}\"\n end\n @logger.warn(error)\n end\n\n # raise exception if not connected\n raise ConnectError, error unless connected\n\n @logger.debug(\"connected to #{@ldap.host}.\")\n end", "def connect\n @conn ||= Net::LDAP.new\n @conn.host = @host\n @conn.port = @port\n @conn.auth \"#{@login_dn},#{@base_dn}\", @password\n\n if @conn.bind\n return true\n else\n return false\n end\n end", "def setup_ldap_server\n server = FakeLDAP::Server.new(port: 1389)\n server.run_tcpserver\n\n @domain = 'dc=example,dc=com'\n @toplevel_user_dn = \"cn=toplevel_user,cn=TOPLEVEL,#{@domain}\"\n @toplevel_user_password = 'toplevel_password'\n\n @regular_user_cn = 'regular_user'\n @regular_user_dn = \"cn=#{@regular_user_cn},ou=USERS,#{@domain}\"\n @regular_user_password = 'regular_password'\n @regular_user_email = \"#{@regular_user_cn}@example.com\"\n\n server.add_user(@toplevel_user_dn, @toplevel_user_password)\n server.add_user(@regular_user_dn, @regular_user_password,\n @regular_user_email)\n server\n end", "def ldap_connect\n ldap = Net::LDAP.new(host: host, port: Net::LDAP::DefaultPort)\n ldap\n end", "def bind_connection(credentials)\n Net::LDAP.new(credentials)\n rescue\n raise(ConnectionError, 'Failure connecting to LDAP host')\n end", "def ldap_authenticate\n # logger.debug(\"ldap_authenticate\")\n # ldap_time = Benchmark.realtime { ActiveLdap::Base.setup_connection }\n # logger.debug(\"LDAP: took #{ldap_time} to establish the connection\")\n authenticate_or_request_with_http_basic \"Bluepages Authentication\" do |user_name, password|\n logger.info(\"attempt to ldap authenticate: user_name #{user_name}\")\n next nil unless LdapUser.authenticate_from_email(user_name, password)\n logger.info(\"successful ldap_authenticate as #{user_name}\")\n common_authenticate(user_name)\n return true\n end\n return false\n end", "def test_authentication\n status = false\n\n Net::HTTP.start(\"#{@subdomain}.#{@options[:host]}\", 80) do |http|\n req = Net::HTTP::Get.new(@options[:pathname])\n\n if authentication_set?\n req.ntlm_auth(@username, @options[:domain], @password)\n end\n\n response = http.request(req)\n\n if response.code.to_i.between?(200,399)\n status = true\n else\n status = false\n end\n end\n\n return status\n end", "def connect!\n com::unboundid::ldap::sdk::LDAPConnection.new(\n self.host, self.port, self.bind_dn, self.password) \n end", "def start\n case ssl\n when :tls\n @connection = LDAP::SSLConn.new(host, port, true)\n when true\n @connection = LDAP::SSLConn.new(host, port)\n else\n @connection = LDAP::Conn.new(host, port)\n end\n @connection.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n @connection.set_option(LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_ON)\n @connection.simple_bind(user, password)\n rescue => detail\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end", "def authenticate_user(username, password)\n conn = Net::LDAP.new(:host => SERVER, :port => PORT, :base => BASE,\n :auth => {username: \"#{username}@#{DOMAIN}\", password: password, method: :simple})\n return false if username.empty? or password.empty?\n if conn.bind\n return conn.bind\n else\n return false\n end\n # If we don't rescue this, Net::LDAP is decidedly ungraceful about failing\n # to connect to the server. We'd prefer to say authentication failed.\n rescue Net::LDAP::LdapError => e\n return false\n end", "def ldap_connect(domain,binddn=BINDUSER,bindpw=BINDPASS)\n binddn = binddn + \"@\" + domain\n ldap = Net::LDAP.new(:host => domain,\n :port => 389,\n :auth => {\n :method => :simple,\n :username => binddn,\n :password => bindpw,\n })\n return ldap\n end", "def bind\n conn = Net::LDAP.new :host => @config[:server],\n :port => @config[:port],\n :base => @config[:base]\n if @config[:encryption]\n conn.encryption @config[:encryption]\n end\n \n raise \"Anonymous Bind is disabled\" if @config[:password] == \"\" && !(@config[:anonymous_bind])\n \n conn.auth \"#{@config[:username]}@#{@config[:domain]}\", @config[:password]\n \n begin\n Timeout::timeout(10){\n if conn.bind\n return conn\n else\n raise 'Query User Rejected'\n end\n }\n rescue Timeout::Error\n raise 'Unable to connect to LDAP Server'\n rescue Errno::ECONNRESET\n if @config[:allow_fallback]\n @config[:port] = @config[:allow_fallback]\n @config[:encryption] = false\n return Adauth::Connection.new(@config).bind\n end\n end\n end", "def valid_user?\n #create a new LDAP object using the ruby-net-ldap library\n @ldap = Net::LDAP.new(:base => \"dc=#{@domain},dc=#{@tld}\",\n :host => @adshost,\n :auth => {:username => \"#{@username}@#{@domain}.#{@tld}\",\n :password => @password,\n :method => :simple})\n #return a boolean indicating whether authentication was successful or not\n return @ldap.bind\n end", "def authenticate_dn(dn, password)\n\t\tif dn.present? && password.present?\n\t\t\tinitialize_ldap_con(dn, password).bind\n\t\tend\n\tend", "def attempt_connection\n # All that we care about is that we are able to connect successfully via\n # https, so here we're simpling hitting a somewhat arbitrary low-impact URL\n # on the scalemgmt server.\n http = Net::HTTP.new(scalemgmt_server, scalemgmt_port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(test_path, test_headers)\n request.basic_auth(api_user, api_password)\n\n response = http.request(request)\n unless response.is_a?(Net::HTTPSuccess)\n Puppet.notice \"Unable to connect to scalemgmt server (https://#{scalemgmt_server}:#{scalemgmt_port}): [#{response.code}] #{response.msg}\"\n return false\n end\n true\n rescue Exception => e # rubocop:disable Lint/RescueException\n Puppet.notice \"Unable to connect to scalemgmt server (https://#{scalemgmt_server}:#{scalemgmt_port}): #{e.message}\"\n false\n end", "def authenticate(dn, password)\n if @conn.bind(:username => \"#{dn},#{@base_dn}\", :password => password)\n @conn.bind \"#{@login_dn},#{@base_dn}\", @password\n return true\n else\n return false\n end\n end", "def login(user, pass)\n conn = LDAP::Conn.new($ldap_conf[:server], $ldap_conf[:port])\n conn.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n conn.start_tls\n\n begin\n if conn.bind('uid=' + user + ',' + $ldap_conf[:people_dn], pass)\n get_uidNumber conn, user\n else\n False\n end\n rescue Exception => e\n nil\n end\nend", "def open(host, user = nil, password = nil)\n @ldap = Net::LDAP.new\n @ldap.host = host\n @ldap.port = 389\n @ldap.auth(user, password)\n @ldap.bind\n end", "def authenticate(username,password)\n begin\n @ldap.auth username + @ldap_suffix, password\n if @ldap.bind\n return true\n end\n rescue\n end\n return false\n end", "def initialize_ldap_con(username, password, hosts)\n result = nil\n\n hosts.each do |host|\n ldap = Net::LDAP.new({\n :host => host,\n :port => 389,\n :auth => {\n :method => :simple,\n :username => username,\n :password => password\n }\n })\n\n # If the bind succeeded, return the active connection. Else try the next host\n result = ldap if ldap.get_operation_result.code == 0\n end\n\n return result\n end", "def attempt_connection\n conn = Puppet::Network::HttpPool.http_instance(http_server, http_port, use_ssl, verify_peer)\n\n response = conn.get(test_path, test_headers)\n unless response.code.to_i == expected_code\n Puppet.notice \"Unable to connect to the server or wrong HTTP code (expected #{expected_code}) (http#{use_ssl ? 's' : ''}://#{http_server}:#{http_port}): [#{response.code}] #{response.msg}\"\n return false\n end\n return true\n rescue StandardError => e\n Puppet.notice \"Unable to connect to the server (http#{use_ssl ? 's' : ''}://#{http_server}:#{http_port}): #{e.message}\"\n return false\n end", "def initialize(host, port, base, username, password, use_ssl)\n @people_base = \"ou=people,#{base}\"\n @group_base = \"ou=groups,#{base}\"\n @ldap_conf = {\n :host => host,\n :port => port,\n :base => @people_base,\n :auth => {\n :method => :simple,\n :username => username,\n :password => password\n }\n }\n\n # enable SSL if n\n if use_ssl.is_a? String then use_ssl = use_ssl.downcase == 'true' ? true : false end\n if use_ssl\n @ldap_conf[:encryption] = { :method => :simple_tls }\n end\n\n # test whether it can bind\n #test_ldap = Net::LDAP.new @ldap_conf\n #raise ldap_ex(test_ldap, \"Could not bind to ldap server.\") if !test_ldap.bind\n end", "def connection\n unless @connection\n raise Puppet::Error, \"Could not set up LDAP Connection: Missing ruby/ldap libraries\" unless Puppet.features.ldap?\n begin\n conn = Puppet::Util::Ldap::Connection.instance\n conn.start\n @connection = conn.connection\n rescue => detail\n puts detail.backtrace if Puppet[:trace]\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end\n end\n\n @connection\n end", "def valid?(login, password)\n login = login.to_s\n password = password.to_s\n if password == '' || password.include?(\"\\0\") || login.include?(\"\\0\")\n false\n elsif ldap_library == 'net/ldap'\n connection.authenticate(login_format % login, password)\n begin\n if connection.bind\n logger.info(\"Authenticated #{login} by #{server}\") if logger\n true\n else\n logger.info(\"Error attempting to authenticate #{login} by #{server}: #{connection.get_operation_result.code} #{connection.get_operation_result.message}\") if logger\n switch_server unless connection.get_operation_result.code == 49\n false\n end\n rescue Net::LDAP::Error, SocketError, SystemCallError => error\n logger.info(\"Error attempting to authenticate #{login} by #{server}: #{error.message}\") if logger\n switch_server\n false\n end\n else\n connection.unbind if connection.bound?\n begin\n connection.bind(login_format % login, password)\n connection.unbind\n logger.info(\"Authenticated #{login} by #{server}\") if logger\n true\n rescue LDAP::ResultError => error\n connection.unbind if connection.bound?\n logger.info(\"Error attempting to authenticate #{login} by #{server}: #{error.message}\") if logger\n switch_server unless error.message == 'Invalid credentials'\n false\n end\n end\n end", "def bind_default_ldap_server(size_limit, domain=nil)\n vprint_status(\"Initializing LDAP connection.\")\n\n # If domain is still null the API may be able to handle it...\n init_result = wldap32.ldap_sslinitA(domain, 389, 0)\n session_handle = init_result['return']\n if session_handle == 0\n raise \"Unable to initialize ldap server: #{init_result[\"ErrorMessage\"]}\"\n end\n\n vprint_status(\"LDAP Handle: #{session_handle}\")\n\n vprint_status(\"Setting Sizelimit Option\")\n wldap32.ldap_set_option(session_handle, LDAP_OPT_SIZELIMIT, size_limit)\n\n vprint_status(\"Binding to LDAP server\")\n bind_result = wldap32.ldap_bind_sA(session_handle, nil, nil, LDAP_AUTH_NEGOTIATE)\n\n bind = bind_result['return']\n unless bind == 0\n wldap32.ldap_unbind(session_handle)\n raise \"Unable to bind to ldap server: #{ERROR_CODE_TO_CONSTANT[bind]}\"\n end\n\n if (block_given?)\n begin\n yield session_handle\n ensure\n vprint_status(\"Unbinding from LDAP service\")\n wldap32.ldap_unbind(session_handle)\n end\n else\n return session_handle\n end\n\n return session_handle\n end", "def initialize(conf:)\n @ldap = Net::LDAP.new host: LDAP_SERVER, # your LDAP host name or IP goes here,\n # port: '389', # unencrypted LDAP host port,\n port: '636', # TLS port\n encryption: :simple_tls,\n base: 'DC=UoA,DC=auckland,DC=ac,DC=nz', # the base of your AD tree goes here,\n auth: {\n method: :simple,\n username: conf.ldap_user, # a user w/sufficient privileges to read from AD goes here,\n password: conf.ldap_auth_token # the user's password goes here\n }\n end", "def connection\n return @connection if @connection\n load_ldap_library\n @connection = if ldap_library == 'net/ldap'\n Net::LDAP.new(:host=>server, :port=>(port), :encryption=>(:simple_tls if use_ssl))\n else\n (use_ssl ? LDAP::SSLConn : LDAP::Conn).new(server, port)\n end\n end", "def ldap_server=(should) end", "def valid?(auth)\n # how to connect to the ldap server: ldap, ldaps, ldap + starttls\n if @config.ldaps\n enc = { method: :simple_tls }\n elsif @config.starttls\n enc = { method: :start_tls }\n enc[:tls_options] = @config.tls_options if @config.tls_options\n else\n enc = nil # just straight ldap\n end\n conn = Net::LDAP.new(host: @config.hostname, port: @config.port,\n base: @config.basedn,\n encryption: enc)\n\n $stdout.puts \"Net::LDAP.new => #{conn.inspect}\" if @config.debug\n\n if @config.auth\n $stdout.puts \"doing auth for #{@config.rootdn.inspect}\" if @config.debug\n conn.auth @config.rootdn, @config.passdn\n # conn.get_operation_result.message has the reson for a failure\n return false unless conn.bind\n end\n\n filter = Net::LDAP::Filter.eq(@config.username_ldap_attribute,\n auth.username)\n\n $stdout.puts \"Net::LDAP::Filter.eq => #{filter.inspect}\" if @config.debug\n\n # find the user and rebind as them to test the password\n # return conn.bind_as(:filter => filter, :password => auth.password)\n $stdout.puts \"doing bind_as password.size: #{auth.password.size}...\" if @config.debug\n ret = conn.bind_as(filter: filter, password: auth.password)\n $stdout.puts \"bind_as => #{ret.inspect}\" if @config.debug\n ret\n end", "def connect\n\t\tconn = nil\n\n\t\tcase @connect_type\n\t\twhen :tls\n\t\t\tself.log.debug \"Connecting using TLS to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::SSLConn.new( @host, @port, true )\n\t\twhen :ssl\n\t\t\tself.log.debug \"Connecting using SSL to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::SSLConn.new( @host, @port )\n\t\telse\n\t\t\tself.log.debug \"Connecting using an unencrypted connection to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::Conn.new( @host, @port )\n\t\tend\n\n\t\tconn.set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, 3 )\n\t\tconn.set_option( LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_OFF )\n\n\t\treturn conn\n\tend", "def client\n Net::LDAP.new({\n host: Settings.ldap.host,\n port: Settings.ldap.port,\n encryption: { method: :simple_tls },\n auth: {\n method: :simple,\n username: Settings.ldap.application_bind,\n password: Settings.ldap.application_password\n }\n })\n end", "def authenticate(username, password)\n @username, @password = username, password\n new_net_ldap() # to force bind()\n end", "def attempt_connection\n conn = Puppet.runtime[:http]\n\n response = conn.get(test_uri, headers: test_headers, options: options)\n unless response.code.to_i == expected_code\n Puppet.notice \"Unable to connect to the server or wrong HTTP code (expected #{expected_code}) (#{test_uri}): [#{response.code}] #{response.reason}\"\n return false\n end\n return true\n rescue StandardError => e\n Puppet.notice \"Unable to connect to the server (#{test_uri}): #{e.message}\"\n return false\n end", "def ldap_server\n get_attribute_from_auth_source('host')\n end", "def connect\n raise ArgumentError, \"You must pass a block to #connect\" unless block_given?\n\n unless @connection\n if Puppet[:ldaptls]\n ssl = :tls\n elsif Puppet[:ldapssl]\n ssl = true\n else\n ssl = false\n end\n options = {:ssl => ssl}\n if user = Puppet[:ldapuser] and user != \"\"\n options[:user] = user\n end\n if password = Puppet[:ldappassword] and password != \"\"\n options[:password] = password\n end\n @connection = Puppet::Util::Ldap::Connection.new(Puppet[:ldapserver], Puppet[:ldapport], options)\n end\n @connection.start\n begin\n yield @connection.connection\n ensure\n @connection.close\n end\n nil\n end", "def new_net_ldap\n params = {\n :host => host,\n :auth => authentication_information,\n :port => 636,\n :encryption => { :method => :simple_tls }\n }\n @net_ldap = Net::LDAP.new(params)\n @net_ldap.bind || raise(BindFailedException)\n @net_ldap\n rescue Net::LDAP::Error => e\n raise(BindFailedException)\n end", "def bind(login, password)\n cfg = Rails.application.secrets.ldap\n host = cfg['host']\n port = cfg['port']\n ssl = cfg['ssl'].to_sym\n # base = cfg['base']\n users = cfg['users']\n # groups = cfg['groups']\n\n options = {\n host: host,\n port: port,\n encryption: ssl,\n }\n\n ldap = Net::LDAP.new(options)\n ldap.auth(\"cn=#{login},#{users}\", password)\n return LDAP::User.find(login) if ldap.bind\n false\n end", "def authenticate_with_active_directory(username, password)\n auth_ldap = ADMapper::Connection.current_connection.dup.bind_as(\n :filter => Net::LDAP::Filter.eq( \"sAMAccountName\", username ),\n :base => ADMapper::Connection.treebase,\n :password => password\n )\n \n end", "def mock_ldap_connection\n fake_ldap_connection = double(\"MockLDAP\")\n allow(Ldap::Queries).to receive(:ldap_connection).and_return(fake_ldap_connection)\n fake_ldap_connection\nend", "def ldap?(auth, username, password)\n require 'net/ldap'\n\n raise 'Missing ldap base' unless auth[:base]\n\n @ldap = Net::LDAP.new auth\n\n raise format('Ldap connexion fail %s', ldap.inspect) unless ldap.bind\n\n dn = ldap_search(auth[:base], filer_strip(auth[:filter], username))\n ldap.authenticate(dn, password)\n session[:user] = username if ldap.bind\n !session[:user].nil?\n end", "def config_ldap_start\n\n\t\t`chkconfig --level 3 ldap on`\n\t\t`service ldap start`\n\n\t\tldap_status = `service ldap status`\n\n\t\tif ldap_status.include? \"running\"\n\t\t\tputs \"LDAP Server was started correctly\"\n\t\telsif ldap_status.include? \"stopped\"\n\t\t\tputs \"LDAP server is not started or is not working correctly\"\n\t\telse\n\t\t\tputs \"Error processing LDAP status\"\n\t\tend\n\tend", "def ldap_verify_and_update\n return unless self.is_ldap?\n\n scanner = LdapQuery::Scanner.search self.login, :only=>:ldap\n\n if scanner.errors.size > 0\n errors.add(:login, 'Login is invalid or cannot be found in OHSU\\'s servers')\n return\n end\n\n # Update our information from ldap\n self.assign_attributes scanner.as_user_attributes\n\n end", "def negotiate_auth(opts={})\n\n to = opts['timeout'] || 20\n opts['username'] ||= ''\n opts['password'] ||= ''\n\n if opts['provider'] and opts['provider'].include? 'Negotiate'\n provider = \"Negotiate \"\n else\n provider = \"NTLM \"\n end\n\n opts['method']||= 'GET'\n opts['headers']||= {}\n\n workstation_name = Rex::Text.rand_text_alpha(rand(8)+6)\n domain_name = self.config['domain']\n\n ntlm_client = ::Net::NTLM::Client.new(\n opts['username'],\n opts['password'],\n workstation: workstation_name,\n domain: domain_name,\n )\n type1 = ntlm_client.init_context\n\n begin\n # First request to get the challenge\n opts['headers']['Authorization'] = provider + type1.encode64\n\n r = request_cgi(opts)\n resp = _send_recv(r, to)\n unless resp.kind_of? Rex::Proto::Http::Response\n return nil\n end\n\n return resp unless resp.code == 401 && resp.headers['WWW-Authenticate']\n\n # Get the challenge and craft the response\n ntlm_challenge = resp.headers['WWW-Authenticate'].scan(/#{provider}([A-Z0-9\\x2b\\x2f=]+)/ni).flatten[0]\n return resp unless ntlm_challenge\n\n ntlm_message_3 = ntlm_client.init_context(ntlm_challenge)\n\n # Send the response\n opts['headers']['Authorization'] = \"#{provider}#{ntlm_message_3.encode64}\"\n r = request_cgi(opts)\n resp = _send_recv(r, to, true)\n unless resp.kind_of? Rex::Proto::Http::Response\n return nil\n end\n return resp\n\n rescue ::Errno::EPIPE, ::Timeout::Error\n return nil\n end\n end", "def authenticate (ldap)\n auth=ldap.authenticate \"cn=admin,dc=example,dc=com\",'123' \n puts \"***** authentication result *******\" \n puts ldap.get_operation_result \n end", "def activedirectory_connect\n ActiveDirectory::Base.enable_cache if ::Devise.ad_caching\n ActiveDirectory::Base.setup(::Devise.ad_settings)\n raise DeviseActiveDirectoryAuthenticatable::ActiveDirectoryException, \"Invalid Username or Password\" unless ActiveDirectory::Base.connected?\n end", "def test_connection\n error = nil\n @basic_query_params = {\n :fields => {},\n :start_at => 0,\n :max_results => 1000000000\n }\n begin\n response = @access_client.get('/secure/Dashboard.jspa')\n\n if response.code == '502'\n error = 'Something going wrong in JIRA server side. Please, try later.'\n elsif response.code == '403'\n error = 'Please, check your access rights to JIRA.'\n end\n rescue JIRA::HTTPError\n error = 'Please check your credentials or right URL address for Jira'\n end\n check_for_correct_jira_project(error)\n end", "def properly_configured?\n options = {\n open_timeout: 5,\n use_ssl: true, # all connections are forced SSL now\n verify_mode: OpenSSL::SSL::VERIFY_NONE # because we might not have a valid cert yet\n }\n Net::HTTP.start(website_alias, options) do |http|\n response = http.get(\"/tenant_aliases/#{id}/verify\")\n\n return false unless response.is_a?(Net::HTTPSuccess)\n\n response.body == \"TRUE\"\n end\n rescue SocketError, Net::OpenTimeout, Errno::ECONNREFUSED\n # SocketError if the server name doesn't exist in DNS\n # OpenTimeout if no server responds\n # ECONNREFUSED if the server responds with \"No\"\n false\n end", "def authenticate(dn, password)\n adapter.authenticate(dn, password)\n end", "def verify\n @request = Net::HTTP::Get.new(@uri.path)\n @request.basic_auth @username, @password\n\n @response = @http.request(@request)\n @response.code.to_i == 200\n\n rescue Errno::ETIMEDOUT, Exception\n false\n end", "def ldap_authenticate \n filter = Net::LDAP::Filter.eq(\"uid\",\"#{username}\")\n \n ldap_connection.search(:base => ldap_treebase, :filter => filter, :attributes => ldap_attrs, :return_result => false) do |entry|\n return true\n end\n \n self.errors.add(:username, \" is invalid\")\n return false\n end", "def authenticate!\n user = connection.authenticate!(credentials_hash)\n\n if user\n success!(user)\n else\n fail!('Could not log in')\n end\n rescue Net::LDAP::LdapError\n fail!('Could not log in')\n end", "def is_authorized_by_ldap?(ldap_login, ldap_password)\n # Guard for bad calls\n if ldap_login.nil? || ldap_login == ''\n @logger.error 'LdapAuthenticator#is_authorized_by_ldap? aborting because of empty login.'\n return false\n end\n if ldap_password.nil? || ldap_password == ''\n @logger.error 'LdapAuthenticator#is_authorized_by_ldap? aborting because of empty password.'\n return false\n end\n\n # Perform bind\n options = ldap_options_for(ldap_login, ldap_password)\n ldap = @ldap_class.new(options)\n is_authorized = ldap.bind\n\n if !is_authorized\n ldap_error = ldap.get_operation_result\n @logger.error \"LdapAuthenticator, ldap_error from get_operation_result: #{ldap_error}\"\n end\n\n is_authorized\n end", "def process_login\n# Something is really wrong\n return dc_render_404('Login:') unless ( params[:record] and params[:record][:username] and params[:record][:password] )\n success = false\n unless params[:record][:password].blank? \n# user must be defined locally\n user = DcUser.find_by(username: params[:record][:username])\n if user\n# LDAP alternative. You must add gem 'net-ldap' to Gemfile \n# ldap = Net::LDAP.new(host: 'ldap.yourdomain.com')\n# ldap.auth(\"#{params[:record][:username]}@yourdomain.com\", params[:record][:password])\n# success = ldap.bind\n\n# authenticate locally\n success = user.authenticate(params[:record][:password]) unless success\n end\n end\n# \n if success\n fill_login_data(user, false)\n redirect_to '/'\n else # display login error\n flash[:error] = t('drgcms.invalid_username')\n redirect_to \"/login\"\n end\nend", "def creds_check(domain,username,password,dc_ip)\n #silently check if the credentials are still valid\n rpc = `rpcclient -U \"#{domain}\\\\#{username}%#{password}\" #{dc_ip} -c enumdomains | head -n 1`\n if rpc.include? \"NT_STATUS_LOGON_FAILURE\"\n puts \"\"\n puts \"ALERT! It looks like the credentials that were previously used have expired.\"\n puts \"The #{domain}\\\\#{username} account could be locked out. Please change your credentials.\"\n puts \"\"\n abort\n end\nend", "def test_ssl_basic\n client = MongoClient.new('server', 27017, :connect => false,\n :ssl => true)\n assert client.connect\n end", "def initialize server_url, login, password, params = {}\n @server_url = server_url\n unless @server_url.end_with? '/'\n @server_url << '/'\n end\n @login = login\n @password = password\n @limit = params[:limit]\n\n authenticate\n end", "def test_ssl_with_cert\n client = MongoClient.new('server', 27017, :connect => false,\n :ssl => true,\n :ssl_cert => CLIENT_CERT,\n :ssl_key => CLIENT_CERT)\n assert client.connect\n end", "def authenticate!\n fill_user_params!\n\n cfg = ::Portus::LDAP::Configuration.new(params)\n if cfg.enabled?\n connection = initialized_adapter\n entry, admin = bind_as(connection, cfg)\n portus_login!(connection, cfg, admin) if entry\n elsif cfg.soft?\n # rubocop:disable Style/SignalException\n fail cfg.reason_message\n # rubocop:enable Style/SignalException\n else\n fail! cfg.reason_message\n end\n rescue ::Portus::LDAP::Error, Net::LDAP::Error => e\n logged_failure!(e.message)\n end", "def ldap_ssl?\r\n ldap_ssl.to_s.to_i != 0\r\n end", "def valid_user?\n res = false\n \n if (@email!='') and (@password!='')\n ldap= Net::LDAP.new\n ldap.host = LDAP_HOST\n ldap.auth(\"#{LDAP_USERS_UID}\" % @email, @password)\n res = ldap.bind\n end\n \n \n return res\n end", "def check_in\n defaults = OSX::NSUserDefaults.standardUserDefaults\n server_host = defaults.stringForKey(\"server_host\")\n server_port = defaults.integerForKey(\"server_port\")\n \n drb_url = \"druby://#{server_host}:#{server_port}\"\n \n OSX::NSLog(\"Trying to connect to #{drb_url}\")\n \n @server = DRbObject.new(nil, drb_url)\n @host = DRb.uri.scan(/druby:\\/\\/(.*):\\d*/)[0][0]\n begin\n @server.check_in @host\n OSX::NSLog(\"Connected to server\")\n rescue\n @server = nil\n OSX::NSLog(\"Couldn't connect to server: #{$!}\")\n end\n end", "def test_x509_authentication\n mechanism = 'MONGODB-X509'\n\n client = create_client(@connect_info, :ssl => true,\n :ssl_cert => CLIENT_CERT,\n :ssl_key => CLIENT_CERT)\n\n return unless client.server_version > '2.5.2'\n\n db = client.db('$external')\n\n # add user for test (enable auth)\n roles = [{:role => 'readWriteAnyDatabase', :db => 'admin'},\n {:role => 'userAdminAnyDatabase', :db => 'admin'}]\n db.add_user(MONGODB_X509_USERNAME, nil, false, :roles => roles)\n\n assert db.authenticate(MONGODB_X509_USERNAME, nil, nil, nil, mechanism)\n assert db.collection_names\n\n assert db.logout\n assert_raise Mongo::OperationFailure do\n db.collection_names\n end\n\n # username and valid certificate don't match\n assert_raise Mongo::AuthenticationError do\n db.authenticate('test', nil, nil, nil, mechanism)\n end\n\n # username required\n assert_raise Mongo::AuthenticationError do\n db.authenticate(nil, nil, nil, nil, mechanism)\n end\n\n assert MongoClient.from_uri(\n \"mongodb://#{MONGODB_X509_USERNAME}@#{@uri_info}/?ssl=true;authMechanism=#{mechanism}\",\n :ssl_cert => CLIENT_CERT,\n :ssl_key => CLIENT_CERT)\n assert db.authenticate(MONGODB_X509_USERNAME, nil, nil, nil, mechanism)\n assert db.collection_names\n\n # clean up and remove all users\n db.command(:dropAllUsersFromDatabase => 1)\n db.logout\n end", "def initialize(server_url)\n uri = URI.parse(server_url)\n @host = uri.host\n @port = uri.port\n @username = uri.user\n @password = uri.password\n @use_ssl = (uri.scheme == \"https\")\n end", "def smb_cred_check(host, port=445, user='Administrator', passorhash=nil, domain='.', hostname='*SMBSERVER')\n begin\n socket = Rex::Socket.create_tcp({ 'PeerHost' => host, 'PeerPort' => port.to_i })\n smb = Rex::Proto::SMB::SimpleClient.new(socket, port.to_i == 445)\n smb.login(hostname,user,passorhash,domain)\n smb.connect(\"\\\\\\\\#{host}\\\\IPC$\")\n if (not smb.client.auth_user)\n auth=false\n else\n auth=true\n end\n socket.close\n return auth\n rescue => e\n puts \"Error Connecting to #{host}\".light_red + \"!\".white\n if @hashpass and \"#{e}\" =~ /STATUS_LOGON_FAILURE \\(Command=115 WordCount=0\\)/\n puts \"Make sure your hash format meets requirements\".light_yellow + \"!\".white\n puts \"If NTLM Hash Only, Pad with x32 0's\".light_yellow + \": 00000000000000000000000000000000:8846f7eaee8fb117ad06bdd830b7586c\".white\n puts \"Otherwise\".light_yellow + \": e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c\".white\n else\n puts \"\\t=> \".white + \"#{e}\".light_red\n end\n return false\n end\nend", "def populateLDAP\n \n #quit if no email or netid to work with\n return if !self.netid\n \n ldap = Net::LDAP.new(host: 'directory.yale.edu', port: 389)\n b = 'ou=People,o=yale.edu'\n f = Net::LDAP::Filter.eq('uid', self.netid)\n a = %w(givenname sn mail knownAs class college)\n\n p = ldap.search(base: b, filter: f, attributes: a).first\n \n\n\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n if self.fname.blank?\n self.fname = ( p['givenname'] ? p['givenname'][0] : '' )\n end\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n self.save!\n end", "def test_ssl_with_invalid_cert\n assert_raise ConnectionFailure do\n MongoClient.new('server', 27017, :ssl => true,\n :ssl_key => CLIENT_CERT,\n :ssl_cert => CLIENT_CERT,\n :ssl_verify => true,\n :ssl_ca_cert => CA_CERT)\n end\n end", "def ldap_login(username, password)\n ldap_session = new_ldap_session\n bind_args = args_for(username, password)\n authenticated_user = ldap_session.bind_as(bind_args)\n\n authenticated_user ? authenticated_user.first : false\n end", "def auth(sample_uri = SAMPLE_URI.call)\n auth_page = @agent.get(sample_uri)\n return false if auth_page.uri.hostname != 'wlanauth.noc.titech.ac.jp'\n\n auth_page.form do |form|\n form.buttonClicked = 4\n form.redirect_url = sample_uri\n form.username = @private['username']\n form.password = @private['password']\n end.submit\n\n return is_connected?\n end", "def bind( host, port, credentials, databag_name, use_tls ) # :yields: host, port, credentials, databag_name, use_tls\n\n credentials = credentials.kind_of?(Hash) ? credentials.to_hash : credentials.to_s\n\n unless databag_name.kind_of?(String) or databag_name.kind_of?(Symbol)\n raise \"Invalid databag_name: #{databag_name}\"\n end\n\n if credentials.kind_of?(String) and credentials.length > 0\n\n # Pull named credentials from the databag\n\n require 'chef/data_bag_item'\n require 'chef/encrypted_data_bag_item'\n\n secret = Chef::EncryptedDataBagItem.load_secret\n credentials = Chef::EncryptedDataBagItem.load( databag_name.to_s, credentials, secret ).to_hash\n end\n\n unless credentials.kind_of?(Hash) and credentials.key?('bind_dn') and credentials.key?('password')\n raise \"Invalid credentials: #{credentials}\"\n end\n\n args = {\n host: host,\n port: port,\n auth: {\n method: :simple,\n username: credentials['bind_dn'],\n password: credentials['password']\n }\n }\n\n args[:encryption] = :simple_tls if use_tls\n\n @ldap = Net::LDAP.new args\n \n raise \"Unable to bind: #{@ldap.get_operation_result.message}\" unless @ldap.get_operation_result.message == 'Success'\n @ldap\n end", "def initialize(options = {})\n @uid = options[:uid] || \"sAMAccountName\"\n\n # Keep a reference to these as default auth for a Global Catalog if needed\n @admin_user = options[:admin_user]\n @admin_password = options[:admin_password]\n @port = options[:port]\n\n @connection = Net::LDAP.new({\n host: options[:host],\n port: options[:port],\n hosts: options[:hosts],\n instrumentation_service: options[:instrumentation_service]\n })\n\n if options[:admin_user] && options[:admin_password]\n @connection.authenticate(options[:admin_user], options[:admin_password])\n end\n\n if encryption = check_encryption(options[:encryption], options[:tls_options])\n @connection.encryption(encryption)\n end\n\n configure_virtual_attributes(options[:virtual_attributes])\n\n # enable fallback recursive group search unless option is false\n @recursive_group_search_fallback = (options[:recursive_group_search_fallback] != false)\n\n # enable posixGroup support unless option is false\n @posix_support = (options[:posix_support] != false)\n\n # search_domains is a connection of bases to perform searches\n # when a base is not explicitly provided.\n @search_domains = Array(options[:search_domains])\n\n # configure both the membership validator and the member search strategies\n configure_search_strategy(options[:search_strategy])\n\n # configure the strategy used by Domain#user? to look up a user entry for login\n configure_user_search_strategy(options[:user_search_strategy])\n\n # enables instrumenting queries\n @instrumentation_service = options[:instrumentation_service]\n end", "def ldap_ping\n search_attrs = {\n :base => \"\",\n :scope => Net::LDAP::SearchScope_BaseObject,\n :attributes => [1.1]\n }\n result = false\n @net_ldap.search(search_attrs) { result = true }\n result\n end", "def compare_domain(args)\r\n server_list = args[:server_list]\r\n domain = args[:domain_name]\r\n rtype = args[:rtype]\r\n rdata = args[:actual_rdata]\r\n rdata = (rtype == \"NAPTR\") ? rdata : rdata.downcase\r\n r = \"\"\r\n failed_rlist = []\r\n @timeout = 30\r\n sleep 15 if args[:sleepfirst]\r\n server_list.each do |server|\r\n dig_pass = \"succeed to dig @#{server} #{domain} #{rtype} => #{rdata}\"\r\n dig = `dig @#{server} #{domain} #{rtype}`\r\n if dig.include?(rdata)\r\n puts dig_pass\r\n else\r\n puts \"dig @#{server} #{domain} #{rtype} failed as expected!\" if args[:expected_dig_fail]\r\n return \"succeed\" if args[:expected_dig_fail]\r\n begin\r\n Timeout::timeout(@timeout){\r\n while !dig.include?(rdata)\r\n sleep 5\r\n dig_retry = `dig @#{server} #{domain} #{rtype}`\r\n puts dig_pass if dig_retry.include?(rdata)\r\n break if dig_retry.include?(rdata)\r\n end\r\n }\r\n rescue Timeout::Error\r\n puts \"Error => dig @#{server} #{domain} #{rtype} timed out!\"\r\n failed_rlist << \"failed\"\r\n end\r\n end\r\n end\r\n failed_rlist.empty? ? 'succeed' : 'failed'\r\n end", "def net_ldap\n @net_ldap ||= new_net_ldap\n end", "def ldap?\n !!ldap\n end", "def login(satellite_url, satellite_login, satellite_password)\n t = 0\n @client = XMLRPC::Client.new2(satellite_url)\n begin\n @key = @client.call('auth.login', satellite_login, satellite_password, timeout=480)\n rescue EOFError, TimeoutError, RuntimeError => ex\n t += 1\n if t > 3 # Give up after 3 attempts\n puts 'Too many attempts to authenticate. Exiting.'\n exit\n end\n puts \"#{ex.class}, retrying authentication...\"\n retry\n rescue XMLRPC::FaultException\n puts 'Login failed, invalid credentials.'\n exit\n end\nend", "def check_connection\n one_wait = 5\n max_wait = 15\n request = Net::HTTP::Get.new('/selenium-server/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@host, @port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy,\n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy,\n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n p(\"-- ERROR: couldn't connect to Selenium RC on \" + @host)\n return false\n end\n return true\n end", "def checkConnect(dns, sshport)\n connectionTimeout = Time.now \n connectionTimeout = connectionTimeout + (10 * 10)\n connection = false\n\n while ((connection == false) && ( Time.now < connectionTimeout )) do \n if dns.nil? || dns.empty? then\n log(\"ERROR\", \"Invalid dns\" + dns)\n return false\n end\n log(\"INFO\", \"Checking connectivity to: \" + dns)\n\n connection = ssh2_connect(dns, sshport)\n if connection == false then\n sleep(10)\n end\n end\n\n if connection == false then\n log(\"ERROR\", \"Failed to connect to \" + dns )\n return false\n else\n return true\n end\n end", "def basic_auth(user, password, domain = T.unsafe(nil)); end", "def connect(username, password, server)\n jid = \"#{username}@#{server}\"\n client.setup(jid, password)\n client.run\n end", "def initialize(username, password, adshost, domain, tld)\n @username = username\n @password = password\n @adshost = adshost\n @domain = domain\n @tld = tld\n end", "def query_ldap(session_handle, base, scope, filter, fields)\n vprint_status(\"Searching LDAP directory\")\n search = wldap32.ldap_search_sA(session_handle, base, scope, filter, nil, 0, 4)\n vprint_status(\"search: #{search}\")\n\n if search['return'] == LDAP_SIZELIMIT_EXCEEDED\n print_error(\"LDAP_SIZELIMIT_EXCEEDED, parsing what we retrieved, try increasing the MAX_SEARCH value [0:LDAP_NO_LIMIT]\")\n elsif search['return'] != Error::SUCCESS\n print_error(\"No results\")\n wldap32.ldap_msgfree(search['res'])\n return\n end\n\n search_count = wldap32.ldap_count_entries(session_handle, search['res'])['return']\n\n if search_count == 0\n print_error(\"No entries retrieved\")\n wldap32.ldap_msgfree(search['res'])\n return\n end\n\n print_status(\"Entries retrieved: #{search_count}\")\n\n pEntries = []\n entry_results = []\n\n if datastore['MAX_SEARCH'] == 0\n max_search = search_count\n else\n max_search = [datastore['MAX_SEARCH'], search_count].min\n end\n\n 0.upto(max_search - 1) do |i|\n\n if(i==0)\n pEntries[0] = wldap32.ldap_first_entry(session_handle, search['res'])['return']\n end\n\n if(pEntries[i] == 0)\n print_error(\"Failed to get entry\")\n wldap32.ldap_msgfree(search['res'])\n return\n end\n\n vprint_status(\"Entry #{i}: 0x#{pEntries[i].to_s(16)}\")\n\n entry = get_entry(pEntries[i])\n\n # Entries are a linked list...\n if client.arch == ARCH_X64\n pEntries[i+1] = entry[4]\n else\n pEntries[i+1] = entry[3]\n end\n\n ber = get_ber(entry)\n\n field_results = []\n fields.each do |field|\n vprint_status(\"Field: #{field}\")\n\n values = get_values_from_ber(ber, field)\n\n values_result = \"\"\n values_result = values.join(',') if values\n vprint_status(\"Values #{values}\")\n\n field_results << {:type => 'unknown', :value => values_result}\n end\n\n entry_results << field_results\n end\n\n return {\n :fields => fields,\n :results => entry_results\n }\n end", "def config_client_LDAP\n\t\tldap_conf = File.read('/etc/openldap/ldap.conf')\n\n\t\t# Set the BASE suffix to match the BASE suffix from the slapd conf file\n\t\tldap_conf = ldap_conf.gsub(/#BASE\\tdc=example, dc=com/,\"BASE dc=cit470_Team_4,dc=nku,dc=edu\")\n\n\t\t\n\t\t# Write the ldap.conf file\n\t\tFile.open('/etc/openldap/ldap.conf','w'){|file| file.puts ldap_conf}\n\n\t\t# Configure LDAP ACL to allow password changes\n\n\t\tldap=\"access to attrs=userPassword\\nby self write\\nby anonymous auth\\nby * none\\naccess to *\\nby self write\\nby * read\"\n\t\tFile.open('/etc/openldap/ldap.conf','a') {|file| file.puts ldap}\n\t\t\n\tend", "def load_ldap_library\n return if @ldap_library_loaded\n if @ldap_library\n if @ldap_library == 'net/ldap'\n require 'net/ldap'\n else\n require 'ldap'\n require 'ldap/control'\n end\n else\n begin\n require 'ldap'\n require 'ldap/control'\n @ldap_library = 'ldap'\n rescue LoadError\n require 'net/ldap'\n @ldap_library = 'net/ldap'\n end\n end\n @ldap_library_loaded = true\n end", "def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy, \n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy, \n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n puts(\"-- ERROR: couldn't connect to test host on \" + @url.host.to_s)\n return false\n end\n puts(\"-- SUCCESS: test host is alive !\\n\")\n return true\nend", "def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :pwdays => 0,\n :notify => false,\n }\n\n if entry.respond_to? :mail\n acct[:mail] = entry.mail.first.to_s\n else\n acct[:mail] = \"im-bigdata-pgh-sysadmins@wwpdl.vnet.ibm.com\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n next # These passwords have already expired.\n end\n\n # Send a notice 14, 7, 3, 2 and 1 days before expiration\n if [14, 7, 3, 2, 1].include? numDays\n acct[:notify] = true\n acct[:pwDays] = numDays\n end\n\n $accounts.push acct\n end\nend", "def connect_to_server\n if server_url.present?\n @client = FHIR::Client.new(server_url)\n @client.use_r4\n @client.additional_headers = { 'Accept-Encoding' => 'identity' } # \n @client.set_basic_auth(\"fhiruser\",\"change-password\")\n cookies[:server_url] = server_url\n session[:server_url] = server_url \n end\n rescue => exception\n err = \"Connection failed: Ensure provided url points to a valid FHIR server\"\n redirect_to root_path, flash: { error: err }\n \n end", "def ssl_connect()\n $log.debug(\"Initiating SSL Connect Test\")\n disable_validations\n s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) }\n s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context)\n s.sync_close = true\n\n @socket = BufferedIO.new(s)\n @socket.read_timeout = @read_timeout\n @socket.debug_output = @debug_output\n\n if proxy?\n @socket.writeline sprintf('CONNECT %s:%s HTTP/%s', @address, @port, HTTPVersion)\n @socket.writeline \"Host: #{@address}:#{@port}\"\n @socket.writeline ''\n HTTPResponse.read_new(@socket).value\n end\n\n begin\n s.connect\n return ResultContainer.new(true, nil)\n rescue OpenSSL::SSL::SSLError => ex\n return ResultContainer.new(false, ex)\n rescue => ex2\n return ResultContainer.new(false, ex2)\n end\n end", "def test_ca_server\n Puppet.settings.stubs(:value).returns \"eh\"\n Puppet.settings.expects(:value).with(:ca_server).returns(\"myca\")\n Puppet.settings.expects(:value).with(:ca_port).returns(321)\n Puppet.settings.stubs(:value).with(:http_proxy_host).returns(nil)\n Puppet.settings.stubs(:value).with(:http_proxy_port).returns(nil)\n Puppet.settings.stubs(:value).with(:http_keepalive).returns(false)\n Puppet.settings.stubs(:value).with(:configtimeout).returns(180)\n\n # Just throw an error; the important thing is the values, not what happens next.\n Net::HTTP.stubs(:new).with(\"myca\", 321, nil, nil).raises(ArgumentError)\n assert_raise(ArgumentError) { Puppet::Network::Client.ca.new }\n end", "def attempt_login(credential)\n ssl = false if ssl.nil?\n\n result_opts = {\n credential: credential,\n status: Metasploit::Model::Login::Status::INCORRECT,\n proof: nil,\n host: host,\n port: port,\n protocol: 'tcp'\n }\n\n if ssl\n result_opts[:service_name] = 'https'\n else\n result_opts[:service_name] = 'http'\n end\n\n http_client = Rex::Proto::Http::Client.new(\n host, port, {}, ssl, ssl_version,\n nil, credential.public, credential.private\n )\n\n http_client = config_client(http_client)\n\n if credential.realm\n http_client.set_config('domain' => credential.realm)\n end\n\n begin\n http_client.connect\n request = http_client.request_cgi(\n 'uri' => uri,\n 'method' => method\n )\n\n response = http_client.send_recv(request)\n if response && response.code == 200\n result_opts.merge!(status: Metasploit::Model::Login::Status::SUCCESSFUL, proof: response.headers)\n end\n rescue ::EOFError, Errno::ETIMEDOUT, Rex::ConnectionError, ::Timeout::Error\n result_opts.merge!(status: Metasploit::Model::Login::Status::UNABLE_TO_CONNECT)\n ensure\n http_client.close\n end\n\n Result.new(result_opts)\n end", "def enable_ldap_auth?\r\n enable_ldap_auth.to_s.to_i != 0\r\n end", "def establish_connection\n @connection = Net::IMAP.new(@server)\n @connection.authenticate(@authentication, @username, @password)\n end", "def get_users(host, base='dc=griddynamics,dc=net', scope=LDAP::LDAP_SCOPE_SUBTREE, filter='(objectclass=person)')\n\n puts \"Getting users from #{host} with base #{base} with filter #{filter}\"\n\n attrs = ['uid', 'mail', 'sn', 'givenName' ,'cn', 'sshPublicKey']\n\n conn = LDAP::Conn.new(host)\n\n puts \"Connection received: #{conn.inspect}\"\n\n conn.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n\n puts conn.bind('','')\n\n conn.perror(\"bind\")\n\n begin\n users = Hash.new\n\n conn.search(base, scope, filter, attrs) { |entry|\n groups = []\n entry.dn.split(',').each { |dn|\n tmp = dn.split('=')\n if tmp[0] == 'ou'\n groups << tmp[1]\n end\n }\n\n if groups.include?('people') and groups.include?('griddynamics') and not groups.include?('deleted')\n users[entry.vals('uid')[0].dup] = {\n :email => entry.vals('mail')[0].dup,\n :name => entry.vals('givenName')[0].dup,\n :last_name => entry.vals('sn')[0].dup,\n :full_name => entry.vals('cn')[0].dup,\n :ssh_public_key => entry.vals('sshPublicKey').nil? ? nil : entry.vals('sshPublicKey')[0].dup,\n :groups => groups.dup\n }\n end\n }\n return users\n rescue LDAP::ResultError\n conn.perror(\"search\")\n exit\n end\n conn.perror(\"search\")\n conn.unbind\nend", "def authenticate\n authenticate_or_request_with_http_basic('Administration') do |username, password|\n username == 'igp' && password == 'ehkra!Q2w#e'\n end\n end", "def test_LogIn_InvalidCredentials\n\n loginpage = Hudl_Login_Page.new @@driver\n\n loginpage.LogIn(@@invalidusername, @@invalidpassword)\n\n loginpage.VerifyPage()\n\n end", "def test_ssl_not_configured\n assert_raise Mongo::ConnectionTimeoutError do\n create_client(['localhost', 27017], :connect_timeout => 2, :ssl => true)\n end\n end", "def populateLDAP\n return unless Rails.env.production?\n #quit if no email or netid to work with\n self.email ||= ''\n return if !self.email.include?('@yale.edu') && !self.netid\n\n begin\n ldap = Net::LDAP.new( :host =>\"directory.yale.edu\" , :port =>\"389\" )\n\n #set e filter, use netid, then email\n if !self.netid.blank? #netid\n f = Net::LDAP::Filter.eq('uid', self.netid)\n else\n f = Net::LDAP::Filter.eq('mail', self.email)\n end\n\n b = 'ou=People,o=yale.edu'\n p = ldap.search(:base => b, :filter => f, :return_result => true).first\n\n rescue Exception => e\n guessFromEmail\n end\n\n return unless p\n\n self.netid = ( p['uid'] ? p['uid'][0] : '' )\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n self.fname ||= ( p['givenname'] ? p['givenname'][0] : '' )\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n\n # Don't save the model, because they are going to be shown a form to edit info\n # self.save!\n end", "def checkCredentials(username, passcode, domaincode = '127000000001')\r\n\r\n _dprint(\"checkCredentials(#{username}, #{passcode}, #{domaincode}) called ...\")\r\n\r\n validCredentials = false\r\n offline_challenge = ''\r\n offline_response = ''\r\n chap_password = ''\r\n chap_challenge = ''\r\n valid_tag = \"VERIFY:VALID\"\r\n\r\n _dprint(\"Checking Credentials...\")\r\n\r\n mesg = \"VERIFY:\" + username + \"\\t\" + passcode + \"\\t\" + domaincode\r\n mesg = <<XML\r\n <transaction>\r\n <type format=\"base\">2</type>\r\n <data>\r\n <user-id>#{username}</user-id>\r\n <passcode>#{passcode}</passcode>\r\n <domaincode>#{domaincode}</domaincode>\r\n <offline-challenge encoding=\"none\">#{offline_challenge}</offline-challenge>\r\n <offline-response encoding=\"none\">#{offline_response}</offline-response>\r\n <chap-password encoding=\"none\">#{chap_password}</chap-password>\r\n <chap-challenge encoding=\"none\">#{chap_challenge}</chap-challenge>\r\n <result>null</result>\r\n </data>\r\n </transaction>\r\nXML\r\n\r\n reconnect {\r\n\r\n xml = _request(mesg)\r\n response = XPath.first(xml, '//data/result')\r\n\r\n if response =~ /VALID/\r\n validCredentials = true\r\n else\r\n validCredentials = false\r\n end\r\n _dprint(\"Read response: verdict = \" + validCredentials.to_s)\r\n }\r\n\r\n _dprint(\"Returning Results...\")\r\n return validCredentials\r\n end", "def login\n response = get \"server\"\n response.code == 200\n end" ]
[ "0.7332496", "0.716179", "0.7016753", "0.6997815", "0.6774702", "0.67350805", "0.6553843", "0.6403802", "0.6242816", "0.6238672", "0.6194347", "0.60718524", "0.6027174", "0.6009716", "0.6002841", "0.5976526", "0.59697014", "0.58843267", "0.58474225", "0.5833461", "0.58297074", "0.5808741", "0.5734035", "0.5718752", "0.569323", "0.5630867", "0.5603534", "0.5598421", "0.55961365", "0.5594565", "0.55497974", "0.55061096", "0.54950684", "0.5491705", "0.5453817", "0.54126626", "0.53947985", "0.53932536", "0.53863686", "0.5384853", "0.53359973", "0.5315429", "0.52327764", "0.52248263", "0.52243793", "0.5197246", "0.51921505", "0.51797616", "0.51359946", "0.5113354", "0.51120806", "0.5109113", "0.51032513", "0.50714254", "0.5042346", "0.49884647", "0.49611253", "0.4960228", "0.49486473", "0.49432537", "0.49226928", "0.4918401", "0.49096033", "0.49051324", "0.49026048", "0.4901814", "0.48849824", "0.4860134", "0.48580572", "0.4849498", "0.4842292", "0.4834751", "0.4828861", "0.48226303", "0.48041937", "0.48031807", "0.47816235", "0.4774941", "0.47689", "0.4761835", "0.47498286", "0.47453722", "0.47349578", "0.47314695", "0.47154328", "0.47132844", "0.47063273", "0.46983233", "0.46979147", "0.46904835", "0.46735796", "0.46698102", "0.466856", "0.46511155", "0.46352768", "0.4634032", "0.4628361", "0.46245927", "0.4619113", "0.46182534", "0.46164274" ]
0.0
-1
Test an LDAP server Attempt to connect to an LDAP server and ensure that the server can be contacted using the given URL and authentication credentials.
def probe_identity_source_ldap_server_probe_ldap_server_with_http_info(identity_source_ldap_server, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_identity_source_ldap_server_probe_ldap_server ...' end # verify the required parameter 'identity_source_ldap_server' is set if @api_client.config.client_side_validation && identity_source_ldap_server.nil? fail ArgumentError, "Missing the required parameter 'identity_source_ldap_server' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_identity_source_ldap_server_probe_ldap_server" end # resource path local_var_path = '/aaa/ldap-identity-sources?action=probe_ldap_server' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(identity_source_ldap_server) auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'IdentitySourceLdapServerProbeResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_identity_source_ldap_server_probe_ldap_server\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_connection\n ldap_con = initialize_ldap_con(self.account, self.account_password)\n ldap_con.open { }\n rescue Net::LDAP::LdapError => text\n raise \"LdapError: %s\" % text\n end", "def connect_to_ldap\r\n begin\r\n @ldap = Net::LDAP.new(:host => @ldap_host,\r\n :port => @ldap_port,\r\n :auth => { :method => :simple,\r\n :username => @ldap_username,\r\n :password => @ldap_password } )\r\n @logger.info \"Connecting to LDAP: '#{@ldap_host}' on port #{@ldap_port}\"\r\n @logger.info \"Binding to LDAP as: #{@ldap_username}\"\r\n \r\n success = @ldap.bind()\r\n if (success)\r\n @logger.info \"LDAP authorization succeeded\"\r\n return true\r\n else\r\n @logger.error \"LDAP authorization failed: #{@ldap.get_operation_result.message}\"\r\n return false\r\n end\r\n rescue Net::LDAP::LdapError => error\r\n @logger.error(\"Error connecting to LDAP: #{error}\")\r\n return false\r\n end\r\n end", "def test_connection\n\t\tldap_con = initialize_ldap_con(self.account, self.encrypted_password)\n\t\tldap_con.open do |ldap|\n\t\tend\n\trescue Net::LDAP::LdapError => text\n\t\traise \"LdapError: \" + text\n\tend", "def connect\n @logger.debug(\"Connecting to LDAP server: #{Time.now}\" )\n\n connected = false\n error = nil\n LDAP_SERVERS.each do |ldap_server| \n begin\n @ldap.host = ldap_server\n @ldap.port = 636\n @ldap.encryption :simple_tls\n @ldap.auth BIND_DN, BIND_PASS\n connected = @ldap.bind\n @logger.debug(\"bind result: #{@ldap.get_operation_result}\")\n break if connected\n raise \"Failed to connect to LDAP server #{ldap_server}. Error: #{@ldap.get_operation_result.message} (#{@ldap.get_operation_result.code})\"\n rescue => e\n connected = false\n error = \"Failed to connect to LDAP server #{ldap_server}. Error: #{e.message}\\n#{e.backtrace}\"\n end\n @logger.warn(error)\n end\n\n # raise exception if not connected\n raise ConnectError, error unless connected\n\n @logger.debug(\"connected to #{@ldap.host}.\")\n end", "def connect\n @conn ||= Net::LDAP.new\n @conn.host = @host\n @conn.port = @port\n @conn.auth \"#{@login_dn},#{@base_dn}\", @password\n\n if @conn.bind\n return true\n else\n return false\n end\n end", "def setup_ldap_server\n server = FakeLDAP::Server.new(port: 1389)\n server.run_tcpserver\n\n @domain = 'dc=example,dc=com'\n @toplevel_user_dn = \"cn=toplevel_user,cn=TOPLEVEL,#{@domain}\"\n @toplevel_user_password = 'toplevel_password'\n\n @regular_user_cn = 'regular_user'\n @regular_user_dn = \"cn=#{@regular_user_cn},ou=USERS,#{@domain}\"\n @regular_user_password = 'regular_password'\n @regular_user_email = \"#{@regular_user_cn}@example.com\"\n\n server.add_user(@toplevel_user_dn, @toplevel_user_password)\n server.add_user(@regular_user_dn, @regular_user_password,\n @regular_user_email)\n server\n end", "def ldap_connect\n ldap = Net::LDAP.new(host: host, port: Net::LDAP::DefaultPort)\n ldap\n end", "def bind_connection(credentials)\n Net::LDAP.new(credentials)\n rescue\n raise(ConnectionError, 'Failure connecting to LDAP host')\n end", "def ldap_authenticate\n # logger.debug(\"ldap_authenticate\")\n # ldap_time = Benchmark.realtime { ActiveLdap::Base.setup_connection }\n # logger.debug(\"LDAP: took #{ldap_time} to establish the connection\")\n authenticate_or_request_with_http_basic \"Bluepages Authentication\" do |user_name, password|\n logger.info(\"attempt to ldap authenticate: user_name #{user_name}\")\n next nil unless LdapUser.authenticate_from_email(user_name, password)\n logger.info(\"successful ldap_authenticate as #{user_name}\")\n common_authenticate(user_name)\n return true\n end\n return false\n end", "def test_authentication\n status = false\n\n Net::HTTP.start(\"#{@subdomain}.#{@options[:host]}\", 80) do |http|\n req = Net::HTTP::Get.new(@options[:pathname])\n\n if authentication_set?\n req.ntlm_auth(@username, @options[:domain], @password)\n end\n\n response = http.request(req)\n\n if response.code.to_i.between?(200,399)\n status = true\n else\n status = false\n end\n end\n\n return status\n end", "def connect!\n com::unboundid::ldap::sdk::LDAPConnection.new(\n self.host, self.port, self.bind_dn, self.password) \n end", "def start\n case ssl\n when :tls\n @connection = LDAP::SSLConn.new(host, port, true)\n when true\n @connection = LDAP::SSLConn.new(host, port)\n else\n @connection = LDAP::Conn.new(host, port)\n end\n @connection.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n @connection.set_option(LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_ON)\n @connection.simple_bind(user, password)\n rescue => detail\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end", "def authenticate_user(username, password)\n conn = Net::LDAP.new(:host => SERVER, :port => PORT, :base => BASE,\n :auth => {username: \"#{username}@#{DOMAIN}\", password: password, method: :simple})\n return false if username.empty? or password.empty?\n if conn.bind\n return conn.bind\n else\n return false\n end\n # If we don't rescue this, Net::LDAP is decidedly ungraceful about failing\n # to connect to the server. We'd prefer to say authentication failed.\n rescue Net::LDAP::LdapError => e\n return false\n end", "def ldap_connect(domain,binddn=BINDUSER,bindpw=BINDPASS)\n binddn = binddn + \"@\" + domain\n ldap = Net::LDAP.new(:host => domain,\n :port => 389,\n :auth => {\n :method => :simple,\n :username => binddn,\n :password => bindpw,\n })\n return ldap\n end", "def bind\n conn = Net::LDAP.new :host => @config[:server],\n :port => @config[:port],\n :base => @config[:base]\n if @config[:encryption]\n conn.encryption @config[:encryption]\n end\n \n raise \"Anonymous Bind is disabled\" if @config[:password] == \"\" && !(@config[:anonymous_bind])\n \n conn.auth \"#{@config[:username]}@#{@config[:domain]}\", @config[:password]\n \n begin\n Timeout::timeout(10){\n if conn.bind\n return conn\n else\n raise 'Query User Rejected'\n end\n }\n rescue Timeout::Error\n raise 'Unable to connect to LDAP Server'\n rescue Errno::ECONNRESET\n if @config[:allow_fallback]\n @config[:port] = @config[:allow_fallback]\n @config[:encryption] = false\n return Adauth::Connection.new(@config).bind\n end\n end\n end", "def valid_user?\n #create a new LDAP object using the ruby-net-ldap library\n @ldap = Net::LDAP.new(:base => \"dc=#{@domain},dc=#{@tld}\",\n :host => @adshost,\n :auth => {:username => \"#{@username}@#{@domain}.#{@tld}\",\n :password => @password,\n :method => :simple})\n #return a boolean indicating whether authentication was successful or not\n return @ldap.bind\n end", "def authenticate_dn(dn, password)\n\t\tif dn.present? && password.present?\n\t\t\tinitialize_ldap_con(dn, password).bind\n\t\tend\n\tend", "def attempt_connection\n # All that we care about is that we are able to connect successfully via\n # https, so here we're simpling hitting a somewhat arbitrary low-impact URL\n # on the scalemgmt server.\n http = Net::HTTP.new(scalemgmt_server, scalemgmt_port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(test_path, test_headers)\n request.basic_auth(api_user, api_password)\n\n response = http.request(request)\n unless response.is_a?(Net::HTTPSuccess)\n Puppet.notice \"Unable to connect to scalemgmt server (https://#{scalemgmt_server}:#{scalemgmt_port}): [#{response.code}] #{response.msg}\"\n return false\n end\n true\n rescue Exception => e # rubocop:disable Lint/RescueException\n Puppet.notice \"Unable to connect to scalemgmt server (https://#{scalemgmt_server}:#{scalemgmt_port}): #{e.message}\"\n false\n end", "def authenticate(dn, password)\n if @conn.bind(:username => \"#{dn},#{@base_dn}\", :password => password)\n @conn.bind \"#{@login_dn},#{@base_dn}\", @password\n return true\n else\n return false\n end\n end", "def login(user, pass)\n conn = LDAP::Conn.new($ldap_conf[:server], $ldap_conf[:port])\n conn.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n conn.start_tls\n\n begin\n if conn.bind('uid=' + user + ',' + $ldap_conf[:people_dn], pass)\n get_uidNumber conn, user\n else\n False\n end\n rescue Exception => e\n nil\n end\nend", "def open(host, user = nil, password = nil)\n @ldap = Net::LDAP.new\n @ldap.host = host\n @ldap.port = 389\n @ldap.auth(user, password)\n @ldap.bind\n end", "def authenticate(username,password)\n begin\n @ldap.auth username + @ldap_suffix, password\n if @ldap.bind\n return true\n end\n rescue\n end\n return false\n end", "def initialize_ldap_con(username, password, hosts)\n result = nil\n\n hosts.each do |host|\n ldap = Net::LDAP.new({\n :host => host,\n :port => 389,\n :auth => {\n :method => :simple,\n :username => username,\n :password => password\n }\n })\n\n # If the bind succeeded, return the active connection. Else try the next host\n result = ldap if ldap.get_operation_result.code == 0\n end\n\n return result\n end", "def attempt_connection\n conn = Puppet::Network::HttpPool.http_instance(http_server, http_port, use_ssl, verify_peer)\n\n response = conn.get(test_path, test_headers)\n unless response.code.to_i == expected_code\n Puppet.notice \"Unable to connect to the server or wrong HTTP code (expected #{expected_code}) (http#{use_ssl ? 's' : ''}://#{http_server}:#{http_port}): [#{response.code}] #{response.msg}\"\n return false\n end\n return true\n rescue StandardError => e\n Puppet.notice \"Unable to connect to the server (http#{use_ssl ? 's' : ''}://#{http_server}:#{http_port}): #{e.message}\"\n return false\n end", "def initialize(host, port, base, username, password, use_ssl)\n @people_base = \"ou=people,#{base}\"\n @group_base = \"ou=groups,#{base}\"\n @ldap_conf = {\n :host => host,\n :port => port,\n :base => @people_base,\n :auth => {\n :method => :simple,\n :username => username,\n :password => password\n }\n }\n\n # enable SSL if n\n if use_ssl.is_a? String then use_ssl = use_ssl.downcase == 'true' ? true : false end\n if use_ssl\n @ldap_conf[:encryption] = { :method => :simple_tls }\n end\n\n # test whether it can bind\n #test_ldap = Net::LDAP.new @ldap_conf\n #raise ldap_ex(test_ldap, \"Could not bind to ldap server.\") if !test_ldap.bind\n end", "def connection\n unless @connection\n raise Puppet::Error, \"Could not set up LDAP Connection: Missing ruby/ldap libraries\" unless Puppet.features.ldap?\n begin\n conn = Puppet::Util::Ldap::Connection.instance\n conn.start\n @connection = conn.connection\n rescue => detail\n puts detail.backtrace if Puppet[:trace]\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end\n end\n\n @connection\n end", "def valid?(login, password)\n login = login.to_s\n password = password.to_s\n if password == '' || password.include?(\"\\0\") || login.include?(\"\\0\")\n false\n elsif ldap_library == 'net/ldap'\n connection.authenticate(login_format % login, password)\n begin\n if connection.bind\n logger.info(\"Authenticated #{login} by #{server}\") if logger\n true\n else\n logger.info(\"Error attempting to authenticate #{login} by #{server}: #{connection.get_operation_result.code} #{connection.get_operation_result.message}\") if logger\n switch_server unless connection.get_operation_result.code == 49\n false\n end\n rescue Net::LDAP::Error, SocketError, SystemCallError => error\n logger.info(\"Error attempting to authenticate #{login} by #{server}: #{error.message}\") if logger\n switch_server\n false\n end\n else\n connection.unbind if connection.bound?\n begin\n connection.bind(login_format % login, password)\n connection.unbind\n logger.info(\"Authenticated #{login} by #{server}\") if logger\n true\n rescue LDAP::ResultError => error\n connection.unbind if connection.bound?\n logger.info(\"Error attempting to authenticate #{login} by #{server}: #{error.message}\") if logger\n switch_server unless error.message == 'Invalid credentials'\n false\n end\n end\n end", "def bind_default_ldap_server(size_limit, domain=nil)\n vprint_status(\"Initializing LDAP connection.\")\n\n # If domain is still null the API may be able to handle it...\n init_result = wldap32.ldap_sslinitA(domain, 389, 0)\n session_handle = init_result['return']\n if session_handle == 0\n raise \"Unable to initialize ldap server: #{init_result[\"ErrorMessage\"]}\"\n end\n\n vprint_status(\"LDAP Handle: #{session_handle}\")\n\n vprint_status(\"Setting Sizelimit Option\")\n wldap32.ldap_set_option(session_handle, LDAP_OPT_SIZELIMIT, size_limit)\n\n vprint_status(\"Binding to LDAP server\")\n bind_result = wldap32.ldap_bind_sA(session_handle, nil, nil, LDAP_AUTH_NEGOTIATE)\n\n bind = bind_result['return']\n unless bind == 0\n wldap32.ldap_unbind(session_handle)\n raise \"Unable to bind to ldap server: #{ERROR_CODE_TO_CONSTANT[bind]}\"\n end\n\n if (block_given?)\n begin\n yield session_handle\n ensure\n vprint_status(\"Unbinding from LDAP service\")\n wldap32.ldap_unbind(session_handle)\n end\n else\n return session_handle\n end\n\n return session_handle\n end", "def initialize(conf:)\n @ldap = Net::LDAP.new host: LDAP_SERVER, # your LDAP host name or IP goes here,\n # port: '389', # unencrypted LDAP host port,\n port: '636', # TLS port\n encryption: :simple_tls,\n base: 'DC=UoA,DC=auckland,DC=ac,DC=nz', # the base of your AD tree goes here,\n auth: {\n method: :simple,\n username: conf.ldap_user, # a user w/sufficient privileges to read from AD goes here,\n password: conf.ldap_auth_token # the user's password goes here\n }\n end", "def connection\n return @connection if @connection\n load_ldap_library\n @connection = if ldap_library == 'net/ldap'\n Net::LDAP.new(:host=>server, :port=>(port), :encryption=>(:simple_tls if use_ssl))\n else\n (use_ssl ? LDAP::SSLConn : LDAP::Conn).new(server, port)\n end\n end", "def ldap_server=(should) end", "def valid?(auth)\n # how to connect to the ldap server: ldap, ldaps, ldap + starttls\n if @config.ldaps\n enc = { method: :simple_tls }\n elsif @config.starttls\n enc = { method: :start_tls }\n enc[:tls_options] = @config.tls_options if @config.tls_options\n else\n enc = nil # just straight ldap\n end\n conn = Net::LDAP.new(host: @config.hostname, port: @config.port,\n base: @config.basedn,\n encryption: enc)\n\n $stdout.puts \"Net::LDAP.new => #{conn.inspect}\" if @config.debug\n\n if @config.auth\n $stdout.puts \"doing auth for #{@config.rootdn.inspect}\" if @config.debug\n conn.auth @config.rootdn, @config.passdn\n # conn.get_operation_result.message has the reson for a failure\n return false unless conn.bind\n end\n\n filter = Net::LDAP::Filter.eq(@config.username_ldap_attribute,\n auth.username)\n\n $stdout.puts \"Net::LDAP::Filter.eq => #{filter.inspect}\" if @config.debug\n\n # find the user and rebind as them to test the password\n # return conn.bind_as(:filter => filter, :password => auth.password)\n $stdout.puts \"doing bind_as password.size: #{auth.password.size}...\" if @config.debug\n ret = conn.bind_as(filter: filter, password: auth.password)\n $stdout.puts \"bind_as => #{ret.inspect}\" if @config.debug\n ret\n end", "def connect\n\t\tconn = nil\n\n\t\tcase @connect_type\n\t\twhen :tls\n\t\t\tself.log.debug \"Connecting using TLS to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::SSLConn.new( @host, @port, true )\n\t\twhen :ssl\n\t\t\tself.log.debug \"Connecting using SSL to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::SSLConn.new( @host, @port )\n\t\telse\n\t\t\tself.log.debug \"Connecting using an unencrypted connection to %s:%d\" % [ @host, @port ]\n\t\t\tconn = LDAP::Conn.new( @host, @port )\n\t\tend\n\n\t\tconn.set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, 3 )\n\t\tconn.set_option( LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_OFF )\n\n\t\treturn conn\n\tend", "def client\n Net::LDAP.new({\n host: Settings.ldap.host,\n port: Settings.ldap.port,\n encryption: { method: :simple_tls },\n auth: {\n method: :simple,\n username: Settings.ldap.application_bind,\n password: Settings.ldap.application_password\n }\n })\n end", "def authenticate(username, password)\n @username, @password = username, password\n new_net_ldap() # to force bind()\n end", "def attempt_connection\n conn = Puppet.runtime[:http]\n\n response = conn.get(test_uri, headers: test_headers, options: options)\n unless response.code.to_i == expected_code\n Puppet.notice \"Unable to connect to the server or wrong HTTP code (expected #{expected_code}) (#{test_uri}): [#{response.code}] #{response.reason}\"\n return false\n end\n return true\n rescue StandardError => e\n Puppet.notice \"Unable to connect to the server (#{test_uri}): #{e.message}\"\n return false\n end", "def ldap_server\n get_attribute_from_auth_source('host')\n end", "def connect\n raise ArgumentError, \"You must pass a block to #connect\" unless block_given?\n\n unless @connection\n if Puppet[:ldaptls]\n ssl = :tls\n elsif Puppet[:ldapssl]\n ssl = true\n else\n ssl = false\n end\n options = {:ssl => ssl}\n if user = Puppet[:ldapuser] and user != \"\"\n options[:user] = user\n end\n if password = Puppet[:ldappassword] and password != \"\"\n options[:password] = password\n end\n @connection = Puppet::Util::Ldap::Connection.new(Puppet[:ldapserver], Puppet[:ldapport], options)\n end\n @connection.start\n begin\n yield @connection.connection\n ensure\n @connection.close\n end\n nil\n end", "def new_net_ldap\n params = {\n :host => host,\n :auth => authentication_information,\n :port => 636,\n :encryption => { :method => :simple_tls }\n }\n @net_ldap = Net::LDAP.new(params)\n @net_ldap.bind || raise(BindFailedException)\n @net_ldap\n rescue Net::LDAP::Error => e\n raise(BindFailedException)\n end", "def bind(login, password)\n cfg = Rails.application.secrets.ldap\n host = cfg['host']\n port = cfg['port']\n ssl = cfg['ssl'].to_sym\n # base = cfg['base']\n users = cfg['users']\n # groups = cfg['groups']\n\n options = {\n host: host,\n port: port,\n encryption: ssl,\n }\n\n ldap = Net::LDAP.new(options)\n ldap.auth(\"cn=#{login},#{users}\", password)\n return LDAP::User.find(login) if ldap.bind\n false\n end", "def authenticate_with_active_directory(username, password)\n auth_ldap = ADMapper::Connection.current_connection.dup.bind_as(\n :filter => Net::LDAP::Filter.eq( \"sAMAccountName\", username ),\n :base => ADMapper::Connection.treebase,\n :password => password\n )\n \n end", "def mock_ldap_connection\n fake_ldap_connection = double(\"MockLDAP\")\n allow(Ldap::Queries).to receive(:ldap_connection).and_return(fake_ldap_connection)\n fake_ldap_connection\nend", "def ldap?(auth, username, password)\n require 'net/ldap'\n\n raise 'Missing ldap base' unless auth[:base]\n\n @ldap = Net::LDAP.new auth\n\n raise format('Ldap connexion fail %s', ldap.inspect) unless ldap.bind\n\n dn = ldap_search(auth[:base], filer_strip(auth[:filter], username))\n ldap.authenticate(dn, password)\n session[:user] = username if ldap.bind\n !session[:user].nil?\n end", "def ldap_verify_and_update\n return unless self.is_ldap?\n\n scanner = LdapQuery::Scanner.search self.login, :only=>:ldap\n\n if scanner.errors.size > 0\n errors.add(:login, 'Login is invalid or cannot be found in OHSU\\'s servers')\n return\n end\n\n # Update our information from ldap\n self.assign_attributes scanner.as_user_attributes\n\n end", "def config_ldap_start\n\n\t\t`chkconfig --level 3 ldap on`\n\t\t`service ldap start`\n\n\t\tldap_status = `service ldap status`\n\n\t\tif ldap_status.include? \"running\"\n\t\t\tputs \"LDAP Server was started correctly\"\n\t\telsif ldap_status.include? \"stopped\"\n\t\t\tputs \"LDAP server is not started or is not working correctly\"\n\t\telse\n\t\t\tputs \"Error processing LDAP status\"\n\t\tend\n\tend", "def negotiate_auth(opts={})\n\n to = opts['timeout'] || 20\n opts['username'] ||= ''\n opts['password'] ||= ''\n\n if opts['provider'] and opts['provider'].include? 'Negotiate'\n provider = \"Negotiate \"\n else\n provider = \"NTLM \"\n end\n\n opts['method']||= 'GET'\n opts['headers']||= {}\n\n workstation_name = Rex::Text.rand_text_alpha(rand(8)+6)\n domain_name = self.config['domain']\n\n ntlm_client = ::Net::NTLM::Client.new(\n opts['username'],\n opts['password'],\n workstation: workstation_name,\n domain: domain_name,\n )\n type1 = ntlm_client.init_context\n\n begin\n # First request to get the challenge\n opts['headers']['Authorization'] = provider + type1.encode64\n\n r = request_cgi(opts)\n resp = _send_recv(r, to)\n unless resp.kind_of? Rex::Proto::Http::Response\n return nil\n end\n\n return resp unless resp.code == 401 && resp.headers['WWW-Authenticate']\n\n # Get the challenge and craft the response\n ntlm_challenge = resp.headers['WWW-Authenticate'].scan(/#{provider}([A-Z0-9\\x2b\\x2f=]+)/ni).flatten[0]\n return resp unless ntlm_challenge\n\n ntlm_message_3 = ntlm_client.init_context(ntlm_challenge)\n\n # Send the response\n opts['headers']['Authorization'] = \"#{provider}#{ntlm_message_3.encode64}\"\n r = request_cgi(opts)\n resp = _send_recv(r, to, true)\n unless resp.kind_of? Rex::Proto::Http::Response\n return nil\n end\n return resp\n\n rescue ::Errno::EPIPE, ::Timeout::Error\n return nil\n end\n end", "def authenticate (ldap)\n auth=ldap.authenticate \"cn=admin,dc=example,dc=com\",'123' \n puts \"***** authentication result *******\" \n puts ldap.get_operation_result \n end", "def activedirectory_connect\n ActiveDirectory::Base.enable_cache if ::Devise.ad_caching\n ActiveDirectory::Base.setup(::Devise.ad_settings)\n raise DeviseActiveDirectoryAuthenticatable::ActiveDirectoryException, \"Invalid Username or Password\" unless ActiveDirectory::Base.connected?\n end", "def test_connection\n error = nil\n @basic_query_params = {\n :fields => {},\n :start_at => 0,\n :max_results => 1000000000\n }\n begin\n response = @access_client.get('/secure/Dashboard.jspa')\n\n if response.code == '502'\n error = 'Something going wrong in JIRA server side. Please, try later.'\n elsif response.code == '403'\n error = 'Please, check your access rights to JIRA.'\n end\n rescue JIRA::HTTPError\n error = 'Please check your credentials or right URL address for Jira'\n end\n check_for_correct_jira_project(error)\n end", "def properly_configured?\n options = {\n open_timeout: 5,\n use_ssl: true, # all connections are forced SSL now\n verify_mode: OpenSSL::SSL::VERIFY_NONE # because we might not have a valid cert yet\n }\n Net::HTTP.start(website_alias, options) do |http|\n response = http.get(\"/tenant_aliases/#{id}/verify\")\n\n return false unless response.is_a?(Net::HTTPSuccess)\n\n response.body == \"TRUE\"\n end\n rescue SocketError, Net::OpenTimeout, Errno::ECONNREFUSED\n # SocketError if the server name doesn't exist in DNS\n # OpenTimeout if no server responds\n # ECONNREFUSED if the server responds with \"No\"\n false\n end", "def authenticate(dn, password)\n adapter.authenticate(dn, password)\n end", "def verify\n @request = Net::HTTP::Get.new(@uri.path)\n @request.basic_auth @username, @password\n\n @response = @http.request(@request)\n @response.code.to_i == 200\n\n rescue Errno::ETIMEDOUT, Exception\n false\n end", "def ldap_authenticate \n filter = Net::LDAP::Filter.eq(\"uid\",\"#{username}\")\n \n ldap_connection.search(:base => ldap_treebase, :filter => filter, :attributes => ldap_attrs, :return_result => false) do |entry|\n return true\n end\n \n self.errors.add(:username, \" is invalid\")\n return false\n end", "def authenticate!\n user = connection.authenticate!(credentials_hash)\n\n if user\n success!(user)\n else\n fail!('Could not log in')\n end\n rescue Net::LDAP::LdapError\n fail!('Could not log in')\n end", "def is_authorized_by_ldap?(ldap_login, ldap_password)\n # Guard for bad calls\n if ldap_login.nil? || ldap_login == ''\n @logger.error 'LdapAuthenticator#is_authorized_by_ldap? aborting because of empty login.'\n return false\n end\n if ldap_password.nil? || ldap_password == ''\n @logger.error 'LdapAuthenticator#is_authorized_by_ldap? aborting because of empty password.'\n return false\n end\n\n # Perform bind\n options = ldap_options_for(ldap_login, ldap_password)\n ldap = @ldap_class.new(options)\n is_authorized = ldap.bind\n\n if !is_authorized\n ldap_error = ldap.get_operation_result\n @logger.error \"LdapAuthenticator, ldap_error from get_operation_result: #{ldap_error}\"\n end\n\n is_authorized\n end", "def process_login\n# Something is really wrong\n return dc_render_404('Login:') unless ( params[:record] and params[:record][:username] and params[:record][:password] )\n success = false\n unless params[:record][:password].blank? \n# user must be defined locally\n user = DcUser.find_by(username: params[:record][:username])\n if user\n# LDAP alternative. You must add gem 'net-ldap' to Gemfile \n# ldap = Net::LDAP.new(host: 'ldap.yourdomain.com')\n# ldap.auth(\"#{params[:record][:username]}@yourdomain.com\", params[:record][:password])\n# success = ldap.bind\n\n# authenticate locally\n success = user.authenticate(params[:record][:password]) unless success\n end\n end\n# \n if success\n fill_login_data(user, false)\n redirect_to '/'\n else # display login error\n flash[:error] = t('drgcms.invalid_username')\n redirect_to \"/login\"\n end\nend", "def creds_check(domain,username,password,dc_ip)\n #silently check if the credentials are still valid\n rpc = `rpcclient -U \"#{domain}\\\\#{username}%#{password}\" #{dc_ip} -c enumdomains | head -n 1`\n if rpc.include? \"NT_STATUS_LOGON_FAILURE\"\n puts \"\"\n puts \"ALERT! It looks like the credentials that were previously used have expired.\"\n puts \"The #{domain}\\\\#{username} account could be locked out. Please change your credentials.\"\n puts \"\"\n abort\n end\nend", "def test_ssl_basic\n client = MongoClient.new('server', 27017, :connect => false,\n :ssl => true)\n assert client.connect\n end", "def initialize server_url, login, password, params = {}\n @server_url = server_url\n unless @server_url.end_with? '/'\n @server_url << '/'\n end\n @login = login\n @password = password\n @limit = params[:limit]\n\n authenticate\n end", "def test_ssl_with_cert\n client = MongoClient.new('server', 27017, :connect => false,\n :ssl => true,\n :ssl_cert => CLIENT_CERT,\n :ssl_key => CLIENT_CERT)\n assert client.connect\n end", "def authenticate!\n fill_user_params!\n\n cfg = ::Portus::LDAP::Configuration.new(params)\n if cfg.enabled?\n connection = initialized_adapter\n entry, admin = bind_as(connection, cfg)\n portus_login!(connection, cfg, admin) if entry\n elsif cfg.soft?\n # rubocop:disable Style/SignalException\n fail cfg.reason_message\n # rubocop:enable Style/SignalException\n else\n fail! cfg.reason_message\n end\n rescue ::Portus::LDAP::Error, Net::LDAP::Error => e\n logged_failure!(e.message)\n end", "def ldap_ssl?\r\n ldap_ssl.to_s.to_i != 0\r\n end", "def valid_user?\n res = false\n \n if (@email!='') and (@password!='')\n ldap= Net::LDAP.new\n ldap.host = LDAP_HOST\n ldap.auth(\"#{LDAP_USERS_UID}\" % @email, @password)\n res = ldap.bind\n end\n \n \n return res\n end", "def check_in\n defaults = OSX::NSUserDefaults.standardUserDefaults\n server_host = defaults.stringForKey(\"server_host\")\n server_port = defaults.integerForKey(\"server_port\")\n \n drb_url = \"druby://#{server_host}:#{server_port}\"\n \n OSX::NSLog(\"Trying to connect to #{drb_url}\")\n \n @server = DRbObject.new(nil, drb_url)\n @host = DRb.uri.scan(/druby:\\/\\/(.*):\\d*/)[0][0]\n begin\n @server.check_in @host\n OSX::NSLog(\"Connected to server\")\n rescue\n @server = nil\n OSX::NSLog(\"Couldn't connect to server: #{$!}\")\n end\n end", "def test_x509_authentication\n mechanism = 'MONGODB-X509'\n\n client = create_client(@connect_info, :ssl => true,\n :ssl_cert => CLIENT_CERT,\n :ssl_key => CLIENT_CERT)\n\n return unless client.server_version > '2.5.2'\n\n db = client.db('$external')\n\n # add user for test (enable auth)\n roles = [{:role => 'readWriteAnyDatabase', :db => 'admin'},\n {:role => 'userAdminAnyDatabase', :db => 'admin'}]\n db.add_user(MONGODB_X509_USERNAME, nil, false, :roles => roles)\n\n assert db.authenticate(MONGODB_X509_USERNAME, nil, nil, nil, mechanism)\n assert db.collection_names\n\n assert db.logout\n assert_raise Mongo::OperationFailure do\n db.collection_names\n end\n\n # username and valid certificate don't match\n assert_raise Mongo::AuthenticationError do\n db.authenticate('test', nil, nil, nil, mechanism)\n end\n\n # username required\n assert_raise Mongo::AuthenticationError do\n db.authenticate(nil, nil, nil, nil, mechanism)\n end\n\n assert MongoClient.from_uri(\n \"mongodb://#{MONGODB_X509_USERNAME}@#{@uri_info}/?ssl=true;authMechanism=#{mechanism}\",\n :ssl_cert => CLIENT_CERT,\n :ssl_key => CLIENT_CERT)\n assert db.authenticate(MONGODB_X509_USERNAME, nil, nil, nil, mechanism)\n assert db.collection_names\n\n # clean up and remove all users\n db.command(:dropAllUsersFromDatabase => 1)\n db.logout\n end", "def initialize(server_url)\n uri = URI.parse(server_url)\n @host = uri.host\n @port = uri.port\n @username = uri.user\n @password = uri.password\n @use_ssl = (uri.scheme == \"https\")\n end", "def smb_cred_check(host, port=445, user='Administrator', passorhash=nil, domain='.', hostname='*SMBSERVER')\n begin\n socket = Rex::Socket.create_tcp({ 'PeerHost' => host, 'PeerPort' => port.to_i })\n smb = Rex::Proto::SMB::SimpleClient.new(socket, port.to_i == 445)\n smb.login(hostname,user,passorhash,domain)\n smb.connect(\"\\\\\\\\#{host}\\\\IPC$\")\n if (not smb.client.auth_user)\n auth=false\n else\n auth=true\n end\n socket.close\n return auth\n rescue => e\n puts \"Error Connecting to #{host}\".light_red + \"!\".white\n if @hashpass and \"#{e}\" =~ /STATUS_LOGON_FAILURE \\(Command=115 WordCount=0\\)/\n puts \"Make sure your hash format meets requirements\".light_yellow + \"!\".white\n puts \"If NTLM Hash Only, Pad with x32 0's\".light_yellow + \": 00000000000000000000000000000000:8846f7eaee8fb117ad06bdd830b7586c\".white\n puts \"Otherwise\".light_yellow + \": e52cac67419a9a224a3b108f3fa6cb6d:8846f7eaee8fb117ad06bdd830b7586c\".white\n else\n puts \"\\t=> \".white + \"#{e}\".light_red\n end\n return false\n end\nend", "def populateLDAP\n \n #quit if no email or netid to work with\n return if !self.netid\n \n ldap = Net::LDAP.new(host: 'directory.yale.edu', port: 389)\n b = 'ou=People,o=yale.edu'\n f = Net::LDAP::Filter.eq('uid', self.netid)\n a = %w(givenname sn mail knownAs class college)\n\n p = ldap.search(base: b, filter: f, attributes: a).first\n \n\n\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n if self.fname.blank?\n self.fname = ( p['givenname'] ? p['givenname'][0] : '' )\n end\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n self.save!\n end", "def test_ssl_with_invalid_cert\n assert_raise ConnectionFailure do\n MongoClient.new('server', 27017, :ssl => true,\n :ssl_key => CLIENT_CERT,\n :ssl_cert => CLIENT_CERT,\n :ssl_verify => true,\n :ssl_ca_cert => CA_CERT)\n end\n end", "def ldap_login(username, password)\n ldap_session = new_ldap_session\n bind_args = args_for(username, password)\n authenticated_user = ldap_session.bind_as(bind_args)\n\n authenticated_user ? authenticated_user.first : false\n end", "def auth(sample_uri = SAMPLE_URI.call)\n auth_page = @agent.get(sample_uri)\n return false if auth_page.uri.hostname != 'wlanauth.noc.titech.ac.jp'\n\n auth_page.form do |form|\n form.buttonClicked = 4\n form.redirect_url = sample_uri\n form.username = @private['username']\n form.password = @private['password']\n end.submit\n\n return is_connected?\n end", "def bind( host, port, credentials, databag_name, use_tls ) # :yields: host, port, credentials, databag_name, use_tls\n\n credentials = credentials.kind_of?(Hash) ? credentials.to_hash : credentials.to_s\n\n unless databag_name.kind_of?(String) or databag_name.kind_of?(Symbol)\n raise \"Invalid databag_name: #{databag_name}\"\n end\n\n if credentials.kind_of?(String) and credentials.length > 0\n\n # Pull named credentials from the databag\n\n require 'chef/data_bag_item'\n require 'chef/encrypted_data_bag_item'\n\n secret = Chef::EncryptedDataBagItem.load_secret\n credentials = Chef::EncryptedDataBagItem.load( databag_name.to_s, credentials, secret ).to_hash\n end\n\n unless credentials.kind_of?(Hash) and credentials.key?('bind_dn') and credentials.key?('password')\n raise \"Invalid credentials: #{credentials}\"\n end\n\n args = {\n host: host,\n port: port,\n auth: {\n method: :simple,\n username: credentials['bind_dn'],\n password: credentials['password']\n }\n }\n\n args[:encryption] = :simple_tls if use_tls\n\n @ldap = Net::LDAP.new args\n \n raise \"Unable to bind: #{@ldap.get_operation_result.message}\" unless @ldap.get_operation_result.message == 'Success'\n @ldap\n end", "def initialize(options = {})\n @uid = options[:uid] || \"sAMAccountName\"\n\n # Keep a reference to these as default auth for a Global Catalog if needed\n @admin_user = options[:admin_user]\n @admin_password = options[:admin_password]\n @port = options[:port]\n\n @connection = Net::LDAP.new({\n host: options[:host],\n port: options[:port],\n hosts: options[:hosts],\n instrumentation_service: options[:instrumentation_service]\n })\n\n if options[:admin_user] && options[:admin_password]\n @connection.authenticate(options[:admin_user], options[:admin_password])\n end\n\n if encryption = check_encryption(options[:encryption], options[:tls_options])\n @connection.encryption(encryption)\n end\n\n configure_virtual_attributes(options[:virtual_attributes])\n\n # enable fallback recursive group search unless option is false\n @recursive_group_search_fallback = (options[:recursive_group_search_fallback] != false)\n\n # enable posixGroup support unless option is false\n @posix_support = (options[:posix_support] != false)\n\n # search_domains is a connection of bases to perform searches\n # when a base is not explicitly provided.\n @search_domains = Array(options[:search_domains])\n\n # configure both the membership validator and the member search strategies\n configure_search_strategy(options[:search_strategy])\n\n # configure the strategy used by Domain#user? to look up a user entry for login\n configure_user_search_strategy(options[:user_search_strategy])\n\n # enables instrumenting queries\n @instrumentation_service = options[:instrumentation_service]\n end", "def ldap_ping\n search_attrs = {\n :base => \"\",\n :scope => Net::LDAP::SearchScope_BaseObject,\n :attributes => [1.1]\n }\n result = false\n @net_ldap.search(search_attrs) { result = true }\n result\n end", "def compare_domain(args)\r\n server_list = args[:server_list]\r\n domain = args[:domain_name]\r\n rtype = args[:rtype]\r\n rdata = args[:actual_rdata]\r\n rdata = (rtype == \"NAPTR\") ? rdata : rdata.downcase\r\n r = \"\"\r\n failed_rlist = []\r\n @timeout = 30\r\n sleep 15 if args[:sleepfirst]\r\n server_list.each do |server|\r\n dig_pass = \"succeed to dig @#{server} #{domain} #{rtype} => #{rdata}\"\r\n dig = `dig @#{server} #{domain} #{rtype}`\r\n if dig.include?(rdata)\r\n puts dig_pass\r\n else\r\n puts \"dig @#{server} #{domain} #{rtype} failed as expected!\" if args[:expected_dig_fail]\r\n return \"succeed\" if args[:expected_dig_fail]\r\n begin\r\n Timeout::timeout(@timeout){\r\n while !dig.include?(rdata)\r\n sleep 5\r\n dig_retry = `dig @#{server} #{domain} #{rtype}`\r\n puts dig_pass if dig_retry.include?(rdata)\r\n break if dig_retry.include?(rdata)\r\n end\r\n }\r\n rescue Timeout::Error\r\n puts \"Error => dig @#{server} #{domain} #{rtype} timed out!\"\r\n failed_rlist << \"failed\"\r\n end\r\n end\r\n end\r\n failed_rlist.empty? ? 'succeed' : 'failed'\r\n end", "def net_ldap\n @net_ldap ||= new_net_ldap\n end", "def ldap?\n !!ldap\n end", "def login(satellite_url, satellite_login, satellite_password)\n t = 0\n @client = XMLRPC::Client.new2(satellite_url)\n begin\n @key = @client.call('auth.login', satellite_login, satellite_password, timeout=480)\n rescue EOFError, TimeoutError, RuntimeError => ex\n t += 1\n if t > 3 # Give up after 3 attempts\n puts 'Too many attempts to authenticate. Exiting.'\n exit\n end\n puts \"#{ex.class}, retrying authentication...\"\n retry\n rescue XMLRPC::FaultException\n puts 'Login failed, invalid credentials.'\n exit\n end\nend", "def check_connection\n one_wait = 5\n max_wait = 15\n request = Net::HTTP::Get.new('/selenium-server/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@host, @port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy,\n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy,\n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n p(\"-- ERROR: couldn't connect to Selenium RC on \" + @host)\n return false\n end\n return true\n end", "def checkConnect(dns, sshport)\n connectionTimeout = Time.now \n connectionTimeout = connectionTimeout + (10 * 10)\n connection = false\n\n while ((connection == false) && ( Time.now < connectionTimeout )) do \n if dns.nil? || dns.empty? then\n log(\"ERROR\", \"Invalid dns\" + dns)\n return false\n end\n log(\"INFO\", \"Checking connectivity to: \" + dns)\n\n connection = ssh2_connect(dns, sshport)\n if connection == false then\n sleep(10)\n end\n end\n\n if connection == false then\n log(\"ERROR\", \"Failed to connect to \" + dns )\n return false\n else\n return true\n end\n end", "def basic_auth(user, password, domain = T.unsafe(nil)); end", "def connect(username, password, server)\n jid = \"#{username}@#{server}\"\n client.setup(jid, password)\n client.run\n end", "def initialize(username, password, adshost, domain, tld)\n @username = username\n @password = password\n @adshost = adshost\n @domain = domain\n @tld = tld\n end", "def query_ldap(session_handle, base, scope, filter, fields)\n vprint_status(\"Searching LDAP directory\")\n search = wldap32.ldap_search_sA(session_handle, base, scope, filter, nil, 0, 4)\n vprint_status(\"search: #{search}\")\n\n if search['return'] == LDAP_SIZELIMIT_EXCEEDED\n print_error(\"LDAP_SIZELIMIT_EXCEEDED, parsing what we retrieved, try increasing the MAX_SEARCH value [0:LDAP_NO_LIMIT]\")\n elsif search['return'] != Error::SUCCESS\n print_error(\"No results\")\n wldap32.ldap_msgfree(search['res'])\n return\n end\n\n search_count = wldap32.ldap_count_entries(session_handle, search['res'])['return']\n\n if search_count == 0\n print_error(\"No entries retrieved\")\n wldap32.ldap_msgfree(search['res'])\n return\n end\n\n print_status(\"Entries retrieved: #{search_count}\")\n\n pEntries = []\n entry_results = []\n\n if datastore['MAX_SEARCH'] == 0\n max_search = search_count\n else\n max_search = [datastore['MAX_SEARCH'], search_count].min\n end\n\n 0.upto(max_search - 1) do |i|\n\n if(i==0)\n pEntries[0] = wldap32.ldap_first_entry(session_handle, search['res'])['return']\n end\n\n if(pEntries[i] == 0)\n print_error(\"Failed to get entry\")\n wldap32.ldap_msgfree(search['res'])\n return\n end\n\n vprint_status(\"Entry #{i}: 0x#{pEntries[i].to_s(16)}\")\n\n entry = get_entry(pEntries[i])\n\n # Entries are a linked list...\n if client.arch == ARCH_X64\n pEntries[i+1] = entry[4]\n else\n pEntries[i+1] = entry[3]\n end\n\n ber = get_ber(entry)\n\n field_results = []\n fields.each do |field|\n vprint_status(\"Field: #{field}\")\n\n values = get_values_from_ber(ber, field)\n\n values_result = \"\"\n values_result = values.join(',') if values\n vprint_status(\"Values #{values}\")\n\n field_results << {:type => 'unknown', :value => values_result}\n end\n\n entry_results << field_results\n end\n\n return {\n :fields => fields,\n :results => entry_results\n }\n end", "def config_client_LDAP\n\t\tldap_conf = File.read('/etc/openldap/ldap.conf')\n\n\t\t# Set the BASE suffix to match the BASE suffix from the slapd conf file\n\t\tldap_conf = ldap_conf.gsub(/#BASE\\tdc=example, dc=com/,\"BASE dc=cit470_Team_4,dc=nku,dc=edu\")\n\n\t\t\n\t\t# Write the ldap.conf file\n\t\tFile.open('/etc/openldap/ldap.conf','w'){|file| file.puts ldap_conf}\n\n\t\t# Configure LDAP ACL to allow password changes\n\n\t\tldap=\"access to attrs=userPassword\\nby self write\\nby anonymous auth\\nby * none\\naccess to *\\nby self write\\nby * read\"\n\t\tFile.open('/etc/openldap/ldap.conf','a') {|file| file.puts ldap}\n\t\t\n\tend", "def load_ldap_library\n return if @ldap_library_loaded\n if @ldap_library\n if @ldap_library == 'net/ldap'\n require 'net/ldap'\n else\n require 'ldap'\n require 'ldap/control'\n end\n else\n begin\n require 'ldap'\n require 'ldap/control'\n @ldap_library = 'ldap'\n rescue LoadError\n require 'net/ldap'\n @ldap_library = 'net/ldap'\n end\n end\n @ldap_library_loaded = true\n end", "def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy, \n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy, \n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n puts(\"-- ERROR: couldn't connect to test host on \" + @url.host.to_s)\n return false\n end\n puts(\"-- SUCCESS: test host is alive !\\n\")\n return true\nend", "def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :pwdays => 0,\n :notify => false,\n }\n\n if entry.respond_to? :mail\n acct[:mail] = entry.mail.first.to_s\n else\n acct[:mail] = \"im-bigdata-pgh-sysadmins@wwpdl.vnet.ibm.com\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n next # These passwords have already expired.\n end\n\n # Send a notice 14, 7, 3, 2 and 1 days before expiration\n if [14, 7, 3, 2, 1].include? numDays\n acct[:notify] = true\n acct[:pwDays] = numDays\n end\n\n $accounts.push acct\n end\nend", "def connect_to_server\n if server_url.present?\n @client = FHIR::Client.new(server_url)\n @client.use_r4\n @client.additional_headers = { 'Accept-Encoding' => 'identity' } # \n @client.set_basic_auth(\"fhiruser\",\"change-password\")\n cookies[:server_url] = server_url\n session[:server_url] = server_url \n end\n rescue => exception\n err = \"Connection failed: Ensure provided url points to a valid FHIR server\"\n redirect_to root_path, flash: { error: err }\n \n end", "def ssl_connect()\n $log.debug(\"Initiating SSL Connect Test\")\n disable_validations\n s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) }\n s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context)\n s.sync_close = true\n\n @socket = BufferedIO.new(s)\n @socket.read_timeout = @read_timeout\n @socket.debug_output = @debug_output\n\n if proxy?\n @socket.writeline sprintf('CONNECT %s:%s HTTP/%s', @address, @port, HTTPVersion)\n @socket.writeline \"Host: #{@address}:#{@port}\"\n @socket.writeline ''\n HTTPResponse.read_new(@socket).value\n end\n\n begin\n s.connect\n return ResultContainer.new(true, nil)\n rescue OpenSSL::SSL::SSLError => ex\n return ResultContainer.new(false, ex)\n rescue => ex2\n return ResultContainer.new(false, ex2)\n end\n end", "def test_ca_server\n Puppet.settings.stubs(:value).returns \"eh\"\n Puppet.settings.expects(:value).with(:ca_server).returns(\"myca\")\n Puppet.settings.expects(:value).with(:ca_port).returns(321)\n Puppet.settings.stubs(:value).with(:http_proxy_host).returns(nil)\n Puppet.settings.stubs(:value).with(:http_proxy_port).returns(nil)\n Puppet.settings.stubs(:value).with(:http_keepalive).returns(false)\n Puppet.settings.stubs(:value).with(:configtimeout).returns(180)\n\n # Just throw an error; the important thing is the values, not what happens next.\n Net::HTTP.stubs(:new).with(\"myca\", 321, nil, nil).raises(ArgumentError)\n assert_raise(ArgumentError) { Puppet::Network::Client.ca.new }\n end", "def enable_ldap_auth?\r\n enable_ldap_auth.to_s.to_i != 0\r\n end", "def attempt_login(credential)\n ssl = false if ssl.nil?\n\n result_opts = {\n credential: credential,\n status: Metasploit::Model::Login::Status::INCORRECT,\n proof: nil,\n host: host,\n port: port,\n protocol: 'tcp'\n }\n\n if ssl\n result_opts[:service_name] = 'https'\n else\n result_opts[:service_name] = 'http'\n end\n\n http_client = Rex::Proto::Http::Client.new(\n host, port, {}, ssl, ssl_version,\n nil, credential.public, credential.private\n )\n\n http_client = config_client(http_client)\n\n if credential.realm\n http_client.set_config('domain' => credential.realm)\n end\n\n begin\n http_client.connect\n request = http_client.request_cgi(\n 'uri' => uri,\n 'method' => method\n )\n\n response = http_client.send_recv(request)\n if response && response.code == 200\n result_opts.merge!(status: Metasploit::Model::Login::Status::SUCCESSFUL, proof: response.headers)\n end\n rescue ::EOFError, Errno::ETIMEDOUT, Rex::ConnectionError, ::Timeout::Error\n result_opts.merge!(status: Metasploit::Model::Login::Status::UNABLE_TO_CONNECT)\n ensure\n http_client.close\n end\n\n Result.new(result_opts)\n end", "def establish_connection\n @connection = Net::IMAP.new(@server)\n @connection.authenticate(@authentication, @username, @password)\n end", "def get_users(host, base='dc=griddynamics,dc=net', scope=LDAP::LDAP_SCOPE_SUBTREE, filter='(objectclass=person)')\n\n puts \"Getting users from #{host} with base #{base} with filter #{filter}\"\n\n attrs = ['uid', 'mail', 'sn', 'givenName' ,'cn', 'sshPublicKey']\n\n conn = LDAP::Conn.new(host)\n\n puts \"Connection received: #{conn.inspect}\"\n\n conn.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n\n puts conn.bind('','')\n\n conn.perror(\"bind\")\n\n begin\n users = Hash.new\n\n conn.search(base, scope, filter, attrs) { |entry|\n groups = []\n entry.dn.split(',').each { |dn|\n tmp = dn.split('=')\n if tmp[0] == 'ou'\n groups << tmp[1]\n end\n }\n\n if groups.include?('people') and groups.include?('griddynamics') and not groups.include?('deleted')\n users[entry.vals('uid')[0].dup] = {\n :email => entry.vals('mail')[0].dup,\n :name => entry.vals('givenName')[0].dup,\n :last_name => entry.vals('sn')[0].dup,\n :full_name => entry.vals('cn')[0].dup,\n :ssh_public_key => entry.vals('sshPublicKey').nil? ? nil : entry.vals('sshPublicKey')[0].dup,\n :groups => groups.dup\n }\n end\n }\n return users\n rescue LDAP::ResultError\n conn.perror(\"search\")\n exit\n end\n conn.perror(\"search\")\n conn.unbind\nend", "def authenticate\n authenticate_or_request_with_http_basic('Administration') do |username, password|\n username == 'igp' && password == 'ehkra!Q2w#e'\n end\n end", "def test_LogIn_InvalidCredentials\n\n loginpage = Hudl_Login_Page.new @@driver\n\n loginpage.LogIn(@@invalidusername, @@invalidpassword)\n\n loginpage.VerifyPage()\n\n end", "def test_ssl_not_configured\n assert_raise Mongo::ConnectionTimeoutError do\n create_client(['localhost', 27017], :connect_timeout => 2, :ssl => true)\n end\n end", "def populateLDAP\n return unless Rails.env.production?\n #quit if no email or netid to work with\n self.email ||= ''\n return if !self.email.include?('@yale.edu') && !self.netid\n\n begin\n ldap = Net::LDAP.new( :host =>\"directory.yale.edu\" , :port =>\"389\" )\n\n #set e filter, use netid, then email\n if !self.netid.blank? #netid\n f = Net::LDAP::Filter.eq('uid', self.netid)\n else\n f = Net::LDAP::Filter.eq('mail', self.email)\n end\n\n b = 'ou=People,o=yale.edu'\n p = ldap.search(:base => b, :filter => f, :return_result => true).first\n\n rescue Exception => e\n guessFromEmail\n end\n\n return unless p\n\n self.netid = ( p['uid'] ? p['uid'][0] : '' )\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n self.fname ||= ( p['givenname'] ? p['givenname'][0] : '' )\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n\n # Don't save the model, because they are going to be shown a form to edit info\n # self.save!\n end", "def checkCredentials(username, passcode, domaincode = '127000000001')\r\n\r\n _dprint(\"checkCredentials(#{username}, #{passcode}, #{domaincode}) called ...\")\r\n\r\n validCredentials = false\r\n offline_challenge = ''\r\n offline_response = ''\r\n chap_password = ''\r\n chap_challenge = ''\r\n valid_tag = \"VERIFY:VALID\"\r\n\r\n _dprint(\"Checking Credentials...\")\r\n\r\n mesg = \"VERIFY:\" + username + \"\\t\" + passcode + \"\\t\" + domaincode\r\n mesg = <<XML\r\n <transaction>\r\n <type format=\"base\">2</type>\r\n <data>\r\n <user-id>#{username}</user-id>\r\n <passcode>#{passcode}</passcode>\r\n <domaincode>#{domaincode}</domaincode>\r\n <offline-challenge encoding=\"none\">#{offline_challenge}</offline-challenge>\r\n <offline-response encoding=\"none\">#{offline_response}</offline-response>\r\n <chap-password encoding=\"none\">#{chap_password}</chap-password>\r\n <chap-challenge encoding=\"none\">#{chap_challenge}</chap-challenge>\r\n <result>null</result>\r\n </data>\r\n </transaction>\r\nXML\r\n\r\n reconnect {\r\n\r\n xml = _request(mesg)\r\n response = XPath.first(xml, '//data/result')\r\n\r\n if response =~ /VALID/\r\n validCredentials = true\r\n else\r\n validCredentials = false\r\n end\r\n _dprint(\"Read response: verdict = \" + validCredentials.to_s)\r\n }\r\n\r\n _dprint(\"Returning Results...\")\r\n return validCredentials\r\n end", "def login\n response = get \"server\"\n response.code == 200\n end" ]
[ "0.73327774", "0.71625626", "0.701722", "0.6998361", "0.6775667", "0.67354745", "0.65543354", "0.64039254", "0.6243879", "0.62393695", "0.6194514", "0.6072402", "0.6027921", "0.60106206", "0.60029", "0.5978302", "0.59705025", "0.5884109", "0.58482414", "0.58342403", "0.5829879", "0.581004", "0.5734995", "0.5717391", "0.56934285", "0.56308144", "0.5605697", "0.5598388", "0.5596386", "0.55941373", "0.5549832", "0.55077076", "0.5495487", "0.54912573", "0.5454982", "0.5411441", "0.53943706", "0.5393386", "0.53867763", "0.53862196", "0.53374314", "0.53151137", "0.52343154", "0.5226434", "0.5226228", "0.51965004", "0.51927936", "0.5181528", "0.51357776", "0.51127654", "0.5112356", "0.5108718", "0.51042473", "0.5071441", "0.5044155", "0.4990418", "0.49619928", "0.4960262", "0.4948065", "0.49431053", "0.49239832", "0.49193922", "0.49110404", "0.49040335", "0.49032116", "0.49003437", "0.48847395", "0.48612258", "0.4857865", "0.4850279", "0.48429114", "0.4835063", "0.4828697", "0.4823216", "0.4803975", "0.48037088", "0.47827432", "0.47753778", "0.4769023", "0.47611707", "0.47497538", "0.47443447", "0.4735128", "0.47321936", "0.47172868", "0.47147527", "0.47061744", "0.4698549", "0.46966603", "0.46899775", "0.46723193", "0.46703893", "0.46691528", "0.4649905", "0.4635197", "0.46350038", "0.46293", "0.46242043", "0.46203747", "0.46182695", "0.46161258" ]
0.0
-1
Probe an LDAP identity source Verify that the configuration of an LDAP identity source is correct before actually creating the source.
def probe_unconfigured_ldap_identity_source_probe_identity_source(ldap_identity_source, opts = {}) data, _status_code, _headers = probe_unconfigured_ldap_identity_source_probe_identity_source_with_http_info(ldap_identity_source, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probe_unconfigured_ldap_identity_source_probe_identity_source_with_http_info(ldap_identity_source, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source' is set\n if @api_client.config.client_side_validation && ldap_identity_source.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=probe_identity_source'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ldap_identity_source)\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceProbeResults')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_unconfigured_ldap_identity_source_probe_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def probe_configured_ldap_identity_source_probe_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_configured_ldap_identity_source_probe ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_configured_ldap_identity_source_probe\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}?action=probe'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceProbeResults')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_configured_ldap_identity_source_probe\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def probe_configured_ldap_identity_source_probe(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = probe_configured_ldap_identity_source_probe_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def probe_identity_source_ldap_server_probe_ldap_server_with_http_info(identity_source_ldap_server, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_identity_source_ldap_server_probe_ldap_server ...'\n end\n # verify the required parameter 'identity_source_ldap_server' is set\n if @api_client.config.client_side_validation && identity_source_ldap_server.nil?\n fail ArgumentError, \"Missing the required parameter 'identity_source_ldap_server' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_identity_source_ldap_server_probe_ldap_server\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=probe_ldap_server'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(identity_source_ldap_server)\n auth_names = ['BasicAuth']\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 => 'IdentitySourceLdapServerProbeResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_identity_source_ldap_server_probe_ldap_server\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def probe_identity_source_ldap_server_probe_ldap_server(identity_source_ldap_server, opts = {})\n data, _status_code, _headers = probe_identity_source_ldap_server_probe_ldap_server_with_http_info(identity_source_ldap_server, opts)\n data\n end", "def search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}/search'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'filter_value'] = opts[:'filter_value'] if !opts[:'filter_value'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceSearchResultList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#search_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#read_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def init_from_source\n raise 'Missing source_data' if source_data.nil?\n self.source_fingerprint ||= Digest::SHA2.hexdigest(source_data)\n self.database ||= record.database\n self.uid ||= record.uid\n init_optional_attributes\n end", "def search_ldap_identity_source(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def populateLDAP\n \n #quit if no email or netid to work with\n return if !self.netid\n \n ldap = Net::LDAP.new(host: 'directory.yale.edu', port: 389)\n b = 'ou=People,o=yale.edu'\n f = Net::LDAP::Filter.eq('uid', self.netid)\n a = %w(givenname sn mail knownAs class college)\n\n p = ldap.search(base: b, filter: f, attributes: a).first\n \n\n\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n if self.fname.blank?\n self.fname = ( p['givenname'] ? p['givenname'][0] : '' )\n end\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n self.save!\n end", "def read_ldap_identity_source(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def create_or_update_ldap_identity_source_with_http_info(ldap_identity_source_id, ldap_identity_source, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source\"\n end\n # verify the required parameter 'ldap_identity_source' is set\n if @api_client.config.client_side_validation && ldap_identity_source.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ldap_identity_source)\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#create_or_update_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_source_from_ccid\n creditcard = Creditcard.find_by_id( @creditcard_id )\n if creditcard\n self.source = creditcard\n end\n end", "def ldap_verify_and_update\n return unless self.is_ldap?\n\n scanner = LdapQuery::Scanner.search self.login, :only=>:ldap\n\n if scanner.errors.size > 0\n errors.add(:login, 'Login is invalid or cannot be found in OHSU\\'s servers')\n return\n end\n\n # Update our information from ldap\n self.assign_attributes scanner.as_user_attributes\n\n end", "def test_load\n @valid_source.save\n source_loaded = Source.find(@valid_source.uri)\n assert_kind_of(Source, source_loaded)\n assert_equal(@valid_source.primary_source, source_loaded.primary_source)\n assert_equal(@valid_source.uri, source_loaded.uri)\n end", "def verify_source\n # subclasses must implement this method\n puts \"verify_source - not overloaded. file=#{filename}\"\n end", "def test_initialize_finds_records\n prov = mkprovider\n prov.default_target = :yayness\n\n prov.target_object(:yayness).write \"bill a c\\njill b d\"\n\n prov.prefetch\n\n # Now make a resource\n bill = @type.new :name => \"bill\"\n\n assert_equal(\"a\", bill.provider.one, \"Record was not found in memory\")\n end", "def check # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength\n # initial values for response object\n result = {\n summary: {\n valid: false,\n timestamp: Time.now.iso8601,\n location: @target,\n profile: nil,\n controls: 0,\n },\n errors: [],\n warnings: [],\n }\n\n entry = lambda { |file, line, column, control, msg|\n {\n file: file,\n line: line,\n column: column,\n control_id: control,\n msg: msg,\n }\n }\n\n warn = lambda { |file, line, column, control, msg|\n @logger.warn(msg)\n result[:warnings].push(entry.call(file, line, column, control, msg))\n }\n\n error = lambda { |file, line, column, control, msg|\n @logger.error(msg)\n result[:errors].push(entry.call(file, line, column, control, msg))\n }\n\n @logger.info \"Checking profile in #{@target}\"\n meta_path = @source_reader.target.abs_path(@source_reader.metadata.ref)\n\n # verify metadata\n m_errors, m_warnings = metadata.valid\n m_errors.each { |msg| error.call(meta_path, 0, 0, nil, msg) }\n m_warnings.each { |msg| warn.call(meta_path, 0, 0, nil, msg) }\n m_unsupported = metadata.unsupported\n m_unsupported.each { |u| warn.call(meta_path, 0, 0, nil, \"doesn't support: #{u}\") }\n @logger.info \"Metadata OK.\" if m_errors.empty? && m_unsupported.empty?\n\n # only run the vendor check if the legacy profile-path is not used as argument\n if @legacy_profile_path == false\n # verify that a lockfile is present if we have dependencies\n unless metadata.dependencies.empty?\n error.call(meta_path, 0, 0, nil, \"Your profile needs to be vendored with `inspec vendor`.\") unless lockfile_exists?\n end\n\n if lockfile_exists?\n # verify if metadata and lockfile are out of sync\n if lockfile.deps.size != metadata.dependencies.size\n error.call(meta_path, 0, 0, nil, \"inspec.yml and inspec.lock are out-of-sync. Please re-vendor with `inspec vendor`.\")\n end\n\n # verify if metadata and lockfile have the same dependency names\n metadata.dependencies.each do |dep|\n # Skip if the dependency does not specify a name\n next if dep[:name].nil?\n\n # TODO: should we also verify that the soure is the same?\n unless lockfile.deps.map { |x| x[:name] }.include? dep[:name]\n error.call(meta_path, 0, 0, nil, \"Cannot find #{dep[:name]} in lockfile. Please re-vendor with `inspec vendor`.\")\n end\n end\n end\n end\n\n # extract profile name\n result[:summary][:profile] = metadata.params[:name]\n\n count = controls_count\n result[:summary][:controls] = count\n if count == 0\n warn.call(nil, nil, nil, nil, \"No controls or tests were defined.\")\n else\n @logger.info(\"Found #{count} controls.\")\n end\n\n # iterate over hash of groups\n params[:controls].each do |id, control|\n sfile = control[:source_location][:ref]\n sline = control[:source_location][:line]\n error.call(sfile, sline, nil, id, \"Avoid controls with empty IDs\") if id.nil? || id.empty?\n next if id.start_with? \"(generated \"\n\n warn.call(sfile, sline, nil, id, \"Control #{id} has no title\") if control[:title].to_s.empty?\n warn.call(sfile, sline, nil, id, \"Control #{id} has no descriptions\") if control[:descriptions][:default].to_s.empty?\n warn.call(sfile, sline, nil, id, \"Control #{id} has impact > 1.0\") if control[:impact].to_f > 1.0\n warn.call(sfile, sline, nil, id, \"Control #{id} has impact < 0.0\") if control[:impact].to_f < 0.0\n warn.call(sfile, sline, nil, id, \"Control #{id} has no tests defined\") if control[:checks].nil? || control[:checks].empty?\n end\n\n # profile is valid if we could not find any error\n result[:summary][:valid] = result[:errors].empty?\n\n @logger.info \"Control definitions OK.\" if result[:warnings].empty?\n result\n end", "def config_ldap_start\n\n\t\t`chkconfig --level 3 ldap on`\n\t\t`service ldap start`\n\n\t\tldap_status = `service ldap status`\n\n\t\tif ldap_status.include? \"running\"\n\t\t\tputs \"LDAP Server was started correctly\"\n\t\telsif ldap_status.include? \"stopped\"\n\t\t\tputs \"LDAP server is not started or is not working correctly\"\n\t\telse\n\t\t\tputs \"Error processing LDAP status\"\n\t\tend\n\tend", "def populateLDAP\n return unless Rails.env.production?\n #quit if no email or netid to work with\n self.email ||= ''\n return if !self.email.include?('@yale.edu') && !self.netid\n\n begin\n ldap = Net::LDAP.new( :host =>\"directory.yale.edu\" , :port =>\"389\" )\n\n #set e filter, use netid, then email\n if !self.netid.blank? #netid\n f = Net::LDAP::Filter.eq('uid', self.netid)\n else\n f = Net::LDAP::Filter.eq('mail', self.email)\n end\n\n b = 'ou=People,o=yale.edu'\n p = ldap.search(:base => b, :filter => f, :return_result => true).first\n\n rescue Exception => e\n guessFromEmail\n end\n\n return unless p\n\n self.netid = ( p['uid'] ? p['uid'][0] : '' )\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n self.fname ||= ( p['givenname'] ? p['givenname'][0] : '' )\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n\n # Don't save the model, because they are going to be shown a form to edit info\n # self.save!\n end", "def fetch_identity_source_ldap_server_certificate_fetch_certificate_with_http_info(identity_source_ldap_server_endpoint, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.fetch_identity_source_ldap_server_certificate_fetch_certificate ...'\n end\n # verify the required parameter 'identity_source_ldap_server_endpoint' is set\n if @api_client.config.client_side_validation && identity_source_ldap_server_endpoint.nil?\n fail ArgumentError, \"Missing the required parameter 'identity_source_ldap_server_endpoint' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.fetch_identity_source_ldap_server_certificate_fetch_certificate\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=fetch_certificate'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(identity_source_ldap_server_endpoint)\n auth_names = ['BasicAuth']\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 => 'PeerCertificateChain')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#fetch_identity_source_ldap_server_certificate_fetch_certificate\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def stub_api_source_calls(source)\n stub_api_source_get(source, show(source))\n return unless source_available?(source)\n\n endpoint = endpoints(source)[source['id']]\n stub_rest_get(\"#{sources_api}/sources/#{source[\"id\"]}/endpoints\", user_tenant_header, list([endpoint]))\n\n authentication = authentications(source)[source['id']]\n stub_rest_get(\"#{sources_api}/endpoints/#{endpoint['id']}/authentications\", user_tenant_header, list([authentication]))\n\n stub_rest_get(\"#{sources_api(:internal => true)}/authentications/#{authentication['id']}?expose_encrypted_attribute[]=password\", user_tenant_header, show(credentials(source)[authentication['id']]))\n end", "def patient_lookup\n return unless patient_identifier_changed?\n self.patient = patient_lookup_entity_id || patient_lookup_id\n end", "def set_cla_source\n @cla_source = ClaSource.find(params[:id])\n end", "def setup\n generate_ca_certificate unless @host.certificate\n end", "def test_connection\n\t\tldap_con = initialize_ldap_con(self.account, self.encrypted_password)\n\t\tldap_con.open do |ldap|\n\t\tend\n\trescue Net::LDAP::LdapError => text\n\t\traise \"LdapError: \" + text\n\tend", "def associate_auth(source)\n return if user_authentications.where(:provider => source['provider'], :uid => source['uid'].to_s).count > 0\n self.user_authentications.create!(:provider => source['provider'], :uid => source['uid'], :nickname => source[\"user_info\"]['nickname'])\n end", "def initialize(ldap_config)\n @ldap = Net::LDAP.new host: ldap_config['host'], port: ldap_config['port']\n @attributes_to_import = %w(uid sn givenname mail title objectclass)\n @tree_base = ldap_config['treebase']\n\n # Used to log information\n @people_saved = 0\n @picture_uploaded = 0\n end", "def set_credential_source(opts)\n opts = check_params(opts,[:sources])\n super(opts)\n end", "def add_sources(marshaller)\n source_dir = (source_type == SOURCE_TYPE_INTERNAL) \\\n ? SystemProperties::getCenterInternalDirectory \\\n : SystemProperties::getCenterExternalDirectory\n\n ha_configured = CommonSql.ha_configured?\n\n ConfigurationSource.get_all_sources_by_type(source_type).each do |source|\n source_xml = marshaller.factory.createConfigurationSourceType\n central_server_address = nil\n if ha_configured\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS,\n :ha_node_name => source.ha_node_name).first.value\n else\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS).first.value\n end\n source_xml.downloadURL =\n \"http://\" + central_server_address + \"/\" + source_dir\n source.configuration_signing_keys.find_each do |key|\n source_xml.getVerificationCert.add(key.cert.to_java_bytes)\n end\n marshaller.root.source.add(source_xml)\n end\n end", "def list_ldap_identity_sources(opts = {})\n data, _status_code, _headers = list_ldap_identity_sources_with_http_info(opts)\n data\n end", "def correct_user\n @source = current_user.sources.find_by(id: params[:id])\n redirect_to root_url if @source.nil?\n end", "def test_connection\n ldap_con = initialize_ldap_con(self.account, self.account_password)\n ldap_con.open { }\n rescue Net::LDAP::LdapError => text\n raise \"LdapError: %s\" % text\n end", "def login_from_other_sources\n result = nil\n # Takes the first entry that doesn't return false\n sorcery_config.login_sources.find do |source|\n result = send(source)\n end\n return result if result\n\n nil\n end", "def check_source_state\n super\n end", "def load_ldap_library\n return if @ldap_library_loaded\n if @ldap_library\n if @ldap_library == 'net/ldap'\n require 'net/ldap'\n else\n require 'ldap'\n require 'ldap/control'\n end\n else\n begin\n require 'ldap'\n require 'ldap/control'\n @ldap_library = 'ldap'\n rescue LoadError\n require 'net/ldap'\n @ldap_library = 'net/ldap'\n end\n end\n @ldap_library_loaded = true\n end", "def verify_property source_list, &block\n count = 0\n source_list.each do |source|\n target = @dst + source.relative_path_from(@src)\n if target.exist?\n count += 1\n yield source, target, source.basename.to_s\n end\n end\n assert count > 0, 'There was no file to test'\n end", "def load_ldap ldap_result\n self.reset\n self.from = :ldap\n\n if ldap_result.nil?\n self.errors.add(:query, 'No results were found')\n return\n end\n \n [:cn, :mail, :displayName].each do |key|\n if ldap_result[key].nil?\n self.errors.add key, 'Search result was missing information'\n return\n end\n\n if ldap_result[key].size == 0\n self.errors.add key, 'Search result was missing data'\n return\n end\n \n if ldap_result[key].size != 1\n self.errors.add :query, 'There were too many matches to your search'\n return\n end\n\n if ldap_result[key][0].nil?\n self.errors.add key, 'There were no results for search'\n return\n end\n end\n\n unless ldap_result[:mail].first =~ /\\A[^@]+@[^@]+\\Z/ \n errors.add :email, 'An invalid email address was found in search result'\n end\n \n self.sn = ldap_result[:cn][0].to_s\n self.cn = ldap_result[:cn][0].to_s\n self.email = ldap_result[:mail][0].to_s\n self.displayname = ldap_result[:displayName][0].to_s\n end", "def ensure_ca_certificates\n final_state = run_machine(NeedCACerts.new, NeedKey)\n final_state.ssl_context\n end", "def get_authentication_source_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_authentication_source ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling UserApi.get_authentication_source\"\n end\n # resource path\n local_var_path = '/api/3/authentication_sources/{id}'.sub('{' + 'id' + '}', id.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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = 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 => 'AuthenticationSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_authentication_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def run_prepare(opts, sources, devices, rng, io)\n sources.parse(@sources)\n mods = opts.categories ? sources.parse_mods(opts.categories) : nil\n sources.apply_mods(mods) if mods\n\n devices.storage_mount\n number = opts.number || rng.generate(sources.count)\n source = sources.get(number)\n\n puts io.run_info_table(source, number)\n source\n end", "def check_sources\n case self.source\n when \"rubygems\"\n return false if self.gem_name.empty?\n require 'net/http'\n begin\n r = Net::HTTP.get_response(URI.parse(\"http://rubygems.org/gems/#{self.gem_name}\"))\n Net::HTTPSuccess === r ? (return true) : errors.add(:gem_name, \"#{self.gem_name} is not a valid rubygem\")\n rescue\n errors.add(:gem_name, \"#{self.gem_name} failed.\")\n end\n when \"git\"\n if self.source_url.empty?\n errors.add(:source_url, \"can't be blank\")\n return false\n end\n require 'command_check'\n if command?('git')\n git_ls = system(\"git\", \"ls-remote\", self.source_url)\n if git_ls != true\n errors.add(:source_url, \"#{self.source_url} is not a valid git repository\")\n end\n end\n when \"path\"\n if self.source_url.empty?\n errors.add(:source_url, \"can't be blank\")\n return false\n end\n # Use Dir to see if a gemfile exists in that directory, and protect\n # it with File.directory? to keep out wildcards (resource hog).\n # Make the two cases somewhat indistinguishable to avoid revealing\n # irrelevant system properties.\n if (!File.directory? self.source_url or\n Dir.glob(\"#{self.source_url}/*.gemspec\").empty?)\n errors.add(:source_url, \"Gemspec not found in #{self.source_url}\")\n end\n end\n end", "def set_founding_source\n @founding_source = FoundingSource.find(params[:id])\n end", "def bind_by_username_with_preauthentication\n raise CASServer::AuthenticatorError, \"A password must be specified in the configuration for the authenticator user!\" unless\n @options[:ldap][:auth_password]\n\n @ldap.authenticate(@options[:ldap][:auth_user], @options[:ldap][:auth_password])\n\n @ldap.bind_as(:base => @options[:ldap][:base], :password => @password, :filter => user_filter)\n end", "def set_record_source_bundle\n # TODO: figure out what scenarios lead to no params[:bundle_id] here\n @source = @bundle = params[:bundle_id] ? Bundle.available.find(params[:bundle_id]) : Bundle.default\n return unless @bundle\n\n add_breadcrumb 'Master Patient List', bundle_records_path(@bundle)\n @title = 'Master Patient List'\n end", "def boot_from_iscsi?\n delegate(provider, :boot_from_iscsi?)\n end", "def set_record_source_vendor\n @bundle = params[:bundle_id] ? Bundle.available.find(params[:bundle_id]) : Bundle.default\n @vendor = Vendor.find(params[:vendor_id])\n @source = @vendor\n breadcrumbs_for_vendor_path\n @title = \"#{@vendor.name} Uploaded Patients\"\n end", "def check_config_and_start_agent\n return unless monitoring? && has_correct_license_key?\n return if using_forking_dispatcher?\n\n setup_and_start_agent\n end", "def ldapsearch(filter)\n raise ArgumentError.new(\"You must pass a block to ldapsearch\") unless block_given?\n\n found = false\n count = 0\n\n begin\n connection.search(search_base, 2, filter, search_attributes) do |entry|\n found = true\n yield entry\n end\n rescue SystemExit,NoMemoryError\n raise\n rescue Exception => detail\n if count == 0\n # Try reconnecting to ldap if we get an exception and we haven't yet retried.\n count += 1\n @connection = nil\n Puppet.warning \"Retrying LDAP connection\"\n retry\n else\n error = Puppet::Error.new(\"LDAP Search failed\")\n error.set_backtrace(detail.backtrace)\n raise error\n end\n end\n\n found\n end", "def set_probe_configuration\n @probe_configuration = ProbeConfiguration.find(params[:id])\n end", "def certificate_check_state\n super\n end", "def show\n @ldap_auth_header = Irm::LdapAuthHeader.list_all.find(params[:id])\n puts @ldap_auth_header.ldap_source.name\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ldap_auth_header }\n end\n end", "def valid_user?\n #create a new LDAP object using the ruby-net-ldap library\n @ldap = Net::LDAP.new(:base => \"dc=#{@domain},dc=#{@tld}\",\n :host => @adshost,\n :auth => {:username => \"#{@username}@#{@domain}.#{@tld}\",\n :password => @password,\n :method => :simple})\n #return a boolean indicating whether authentication was successful or not\n return @ldap.bind\n end", "def set_email_source_account\n @email_source_account = EmailSourceAccount.find(params[:id])\n end", "def set_source\n @source = Source.find(params[:id])\n end", "def get_authentication_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_authentication_sources ...'\n end\n # resource path\n local_var_path = '/api/3/authentication_sources'\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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = 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 => 'ResourcesAuthenticationSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_authentication_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_source\n @source = Source.find(params[:id])\n end", "def set_source\n @source = Source.find(params[:id])\n end", "def set_source\n @source = Source.find(params[:id])\n end", "def _validate_source(s)\n if git = s[:git]\n tag, commit = s.values_at(:tag, :commit)\n version = spec.version.to_s\n\n if git =~ %r{http://EXAMPLE}\n results.add_error('source', 'The Git source still contains the ' \\\n 'example URL.')\n end\n if commit && commit.downcase =~ /head/\n results.add_error('source', 'The commit of a Git source cannot be' \\\n ' `HEAD`.')\n end\n if tag && !tag.to_s.include?(version)\n results.add_warning('source', 'The version should be included in' \\\n ' the Git tag.')\n end\n if tag.nil?\n results.add_warning('source', 'Git sources should specify a tag.', true)\n end\n end\n\n perform_github_source_checks(s)\n check_git_ssh_source(s)\n end", "def fill_from_ldap\n person = self.ldap_person\n if person.nil?\n if Rails.development?\n self.name = \"Susan #{self.login}\"\n self.email = \"beehive+#{self.login}@berkeley.edu\"\n self.major_code = 'undeclared'\n self.user_type = case self.login\n when 212388, 232588\n User::Types::Grad\n when 212381, 300846, 300847, 300848, 300849, 300850\n User::Types::Undergrad\n when 212386, 322587, 322588, 322589, 322590\n User::Types::Faculty\n when 212387, 322583, 322584, 322585, 322586\n User::Types::Staff\n else\n User::Types::Affiliate\n end\n return true\n else\n self.name = 'Unknown Name'\n self.email = ''\n self.major_code = ''\n self.user_type = User::Types::Affiliate\n return false\n end\n else\n self.name = \"#{person.firstname} #{person.lastname}\".titleize\n self.email = person.email\n self.major_code = person.berkeleyEduStuMajorName.to_s.downcase\n self.user_type = case\n when person.berkeleyEduStuUGCode == 'G'\n User::Types::Grad\n when person.student?\n User::Types::Undergrad\n when person.employee_academic?\n User::Types::Faculty\n when person.employee?\n User::Types::Staff\n else\n User::Types::Affiliate\n end\n return true\n end\n end", "def test_source_lists\n config=<<EOF\nsource_list \"test\", %w(test-1.example.com)\n\nsource_list \"has_ipv4\", \"0.0.0.0/0\"\n\nsource_list \"has_ipv6\", \"2000::/3\"\nEOF\n\n Configuration.current = ConfigurationBuilder.parse(config)\n\n a = Alert.new\n a.subject = \"www.example.com\"\n\n assert( a.in_source_list?(\"test\") )\n assert_equal( %w(test has_ipv4).sort, a.source_lists.sort )\n\n a.subject = \"www2.example.com\"\n assert( a.in_source_list?(\"has_ipv6\") )\n assert_equal( %w(has_ipv6 has_ipv4).sort, a.source_lists.sort )\n end", "def identify( source=nil, **options )\n\t\tresponse = self.server.run_with_json_template( :identify, source, **options )\n\n\t\tdata = response.first\n\t\treturn Hglib::Repo::Id.new( **data )\n\tend", "def source_id=(value)\n @source_id = value\n end", "def set_source_ref\n @source_ref = SourceRef.find(params[:id])\n end", "def primary_source\n predicate(:talia, :primary_source) == true\n end", "def primary_source\n predicate(:talia, :primary_source) == true\n end", "def list_ldap_identity_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/aaa/ldap-identity-sources'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#list_ldap_identity_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def ldap_server=(should) end", "def protect_sources\n @protected_sources = sources\n end", "def assert_source_attribute_is_set\n # Ensure the user specified the required source attribute\n if node['visualstudio']['source'].nil?\n fail 'The required attribute node[\\'visualstudio\\'][\\'source\\'] is empty, ' \\\n 'set this and run again!'\n end\n end", "def source_check_state\n super\n end", "def initialize\n @verify_certificates = true\n end", "def verify_aud; end", "def verify_aud; end", "def set_source\n @source = Source.find params[:id]\n end", "def authenticate_dn(dn, password)\n\t\tif dn.present? && password.present?\n\t\t\tinitialize_ldap_con(dn, password).bind\n\t\tend\n\tend", "def ldap_authenticate \n filter = Net::LDAP::Filter.eq(\"uid\",\"#{username}\")\n \n ldap_connection.search(:base => ldap_treebase, :filter => filter, :attributes => ldap_attrs, :return_result => false) do |entry|\n return true\n end\n \n self.errors.add(:username, \" is invalid\")\n return false\n end", "def set_external_supplied\n @external_supplied = ExternalSupplied.find(params[:id])\n end", "def load_trust_ca\n load_cacerts(@cert_store)\n change_notify\n end", "def delete_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.delete_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.delete_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#delete_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find_matching_identities (inCertificateSubjects)\n #get identities using the commmand line tool security\n identities=`security find-identity -v -p codesigning`\n #create an array\n identities=identities.split(\"\\n\")\n\n #identity_labels is the common name of all the matching certs.\n identity_labels=[]\n \n #loop over the certs that came in and compare to each identity from the keychain\n inCertificateSubjects.each{|certSubject| \n identities.each { |id| \n #only use identities that start with iPhone. This could cause issues later.\n if id[/iPhone.*/] then\n #we have a trailing quote, so need to delete it\n label=id[/iPhone.*/].delete!(\"\\\"\")\n #if we match, then we found an identity that should be saved and\n #we add it to our array\n if (label==certSubject) then\n identity_labels.push certSubject\n $stderr.puts \"Matched #{label}\"\n end\n end\n }\n }\n return identity_labels\nend", "def get_ldap_id\n\t\tself.id = Devise::LDAP::Adapter.get_ldap_param(self.username,\"uidnumber\").first\n end", "def set_plasmid_probe\n @plasmid_probe = PlasmidProbe.find(params[:id])\n end", "def start\n case ssl\n when :tls\n @connection = LDAP::SSLConn.new(host, port, true)\n when true\n @connection = LDAP::SSLConn.new(host, port)\n else\n @connection = LDAP::Conn.new(host, port)\n end\n @connection.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n @connection.set_option(LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_ON)\n @connection.simple_bind(user, password)\n rescue => detail\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end", "def verify_iss; end", "def verify_iss; end", "def ensure_valid_checkid_request\n self.openid_request = checkid_request\n if !openid_request.is_a?(OpenID::Server::CheckIDRequest)\n redirect_to root_path, :alert => t(:identity_verification_request_invalid)\n elsif !allow_verification?\n flash[:notice] = logged_in? && !pape_requirements_met?(auth_time) ?\n t(:service_provider_requires_reauthentication_last_login_too_long_ago) :\n t(:login_to_verify_identity)\n session[:return_to] = proceed_path\n redirect_to login_path\n end\n end", "def find_for_ldap_authentication(attributes={}, authenticator = EpiCas::LdapAuthenticator)\n authenticator.new(attributes, self).authenticate_ldap\n end", "def create_or_update_ldap_identity_source(ldap_identity_source_id, ldap_identity_source, opts = {})\n data, _status_code, _headers = create_or_update_ldap_identity_source_with_http_info(ldap_identity_source_id, ldap_identity_source, opts)\n data\n end", "def find(source = @source)\n scope = 0\n filter = \"(objectClass=*)\"\n if source.respond_to?(:search2_ext)\n source.search2(\n to_s,\n scope,\n filter\n )\n elsif source.respond_to?(:search)\n Array(source.search(\n :base => to_s,\n :scope => scope,\n :filter => filter,\n :limit => 1\n ))\n else\n raise RuntimeError, \"missing or invalid source for LDAP search\", caller\n end.first\n end", "def verify_source_arguments source, importer, formatter\n # Fail if already registered (require explicit removal rather than overwrite)\n fail ArgumentError, \"#{source} has already been registered\" if @importers[source]\n\n # Fail if either importer or exporter is not a class\n fail ArgumentError, \"importer must be provided as class not object\" unless (importer.superclasses.include? Importer)\n fail ArgumentError, \"exporter must be provided as class not object\" unless (formatter.superclasses.include?(Formatter))\n\n # Fail if source is not a symbol\n fail ArgumentError, \"source must be a symbol\" unless (source.is_a?(Symbol) || source.is_a?(String))\n end", "def set_check_source_state(opts)\n opts = check_params(opts,[:states])\n super(opts)\n end", "def registering_source\n if rpx_identifier.include?(\"google\")\n \"Google\"\n elsif rpx_identifier.include?(\"facebook\")\n \"FaceBook\"\n elsif rpx_identifier.include?(\"twitter\")\n \"Twitter\"\n elsif rpx_identifier.include?(\"yahoo\")\n \"Yahoo\"\n elsif rpx_identifier.include?(\"aol\")\n \"Aol\"\n else\n \"Unknown\"\n end\n end", "def verify\n # nothing to do here, so just return\n end", "def get_ldap_details(username)\n search_filter = Net::LDAP::Filter.eq(\"uid\", username)\n result = LDAP_CONNECTION.search(:filter => search_filter)\n puts result.inspect\nend", "def connect_to_ldap\r\n begin\r\n @ldap = Net::LDAP.new(:host => @ldap_host,\r\n :port => @ldap_port,\r\n :auth => { :method => :simple,\r\n :username => @ldap_username,\r\n :password => @ldap_password } )\r\n @logger.info \"Connecting to LDAP: '#{@ldap_host}' on port #{@ldap_port}\"\r\n @logger.info \"Binding to LDAP as: #{@ldap_username}\"\r\n \r\n success = @ldap.bind()\r\n if (success)\r\n @logger.info \"LDAP authorization succeeded\"\r\n return true\r\n else\r\n @logger.error \"LDAP authorization failed: #{@ldap.get_operation_result.message}\"\r\n return false\r\n end\r\n rescue Net::LDAP::LdapError => error\r\n @logger.error(\"Error connecting to LDAP: #{error}\")\r\n return false\r\n end\r\n end", "def certificate_verification_state\n super\n end", "def test_create_typeless\n # rec = SourceRecord.new\n source = Source.new(\"http://www.newstuff.org/my_nuff\")\n assert_not_nil(source)\n assert_property(source.types, N::TALIA.Source)\n end", "def prepare_domain(domain)\n domain.start unless domain.active\n wait_for_ip_address(domain)\n end" ]
[ "0.68749434", "0.6635697", "0.6583088", "0.6053089", "0.5782503", "0.55669475", "0.5522772", "0.5063628", "0.5029683", "0.4997031", "0.4904828", "0.48154947", "0.4751302", "0.47235876", "0.46993345", "0.46986765", "0.4696389", "0.46951333", "0.46795785", "0.46706608", "0.46525392", "0.46271732", "0.46027285", "0.45799083", "0.45688373", "0.45568085", "0.45404217", "0.45171502", "0.4488656", "0.44882205", "0.44596705", "0.44367865", "0.443621", "0.44206792", "0.4408356", "0.43970427", "0.4396975", "0.43930748", "0.43891236", "0.43871677", "0.43860263", "0.43820027", "0.43598884", "0.4359085", "0.43571547", "0.43231714", "0.43189013", "0.43034753", "0.42951307", "0.42857933", "0.42812574", "0.42718", "0.42668423", "0.42597494", "0.42589486", "0.42514032", "0.4251375", "0.4251375", "0.4251375", "0.42498568", "0.42493922", "0.4248505", "0.42447525", "0.42438698", "0.4224567", "0.42215714", "0.42215714", "0.42196587", "0.4216215", "0.42152423", "0.4214984", "0.42086744", "0.42031923", "0.41972762", "0.41972762", "0.4193479", "0.41891834", "0.41877082", "0.41862184", "0.41859764", "0.41693914", "0.4164432", "0.41619837", "0.41584834", "0.4157324", "0.41571826", "0.41571826", "0.41560128", "0.41498056", "0.41446903", "0.41367096", "0.41362786", "0.4123109", "0.41219595", "0.412159", "0.41215137", "0.41210613", "0.41143733", "0.40966776", "0.40915132" ]
0.64369255
3
Probe an LDAP identity source Verify that the configuration of an LDAP identity source is correct before actually creating the source.
def probe_unconfigured_ldap_identity_source_probe_identity_source_with_http_info(ldap_identity_source, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_identity_source ...' end # verify the required parameter 'ldap_identity_source' is set if @api_client.config.client_side_validation && ldap_identity_source.nil? fail ArgumentError, "Missing the required parameter 'ldap_identity_source' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_identity_source" end # resource path local_var_path = '/aaa/ldap-identity-sources?action=probe_identity_source' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(ldap_identity_source) auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'LdapIdentitySourceProbeResults') if @api_client.config.debugging @api_client.config.logger.debug "API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_unconfigured_ldap_identity_source_probe_identity_source\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probe_configured_ldap_identity_source_probe_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_configured_ldap_identity_source_probe ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_configured_ldap_identity_source_probe\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}?action=probe'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceProbeResults')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_configured_ldap_identity_source_probe\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def probe_configured_ldap_identity_source_probe(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = probe_configured_ldap_identity_source_probe_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def probe_unconfigured_ldap_identity_source_probe_identity_source(ldap_identity_source, opts = {})\n data, _status_code, _headers = probe_unconfigured_ldap_identity_source_probe_identity_source_with_http_info(ldap_identity_source, opts)\n data\n end", "def probe_identity_source_ldap_server_probe_ldap_server_with_http_info(identity_source_ldap_server, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_identity_source_ldap_server_probe_ldap_server ...'\n end\n # verify the required parameter 'identity_source_ldap_server' is set\n if @api_client.config.client_side_validation && identity_source_ldap_server.nil?\n fail ArgumentError, \"Missing the required parameter 'identity_source_ldap_server' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_identity_source_ldap_server_probe_ldap_server\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=probe_ldap_server'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(identity_source_ldap_server)\n auth_names = ['BasicAuth']\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 => 'IdentitySourceLdapServerProbeResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_identity_source_ldap_server_probe_ldap_server\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def probe_identity_source_ldap_server_probe_ldap_server(identity_source_ldap_server, opts = {})\n data, _status_code, _headers = probe_identity_source_ldap_server_probe_ldap_server_with_http_info(identity_source_ldap_server, opts)\n data\n end", "def search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}/search'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'filter_value'] = opts[:'filter_value'] if !opts[:'filter_value'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceSearchResultList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#search_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#read_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def init_from_source\n raise 'Missing source_data' if source_data.nil?\n self.source_fingerprint ||= Digest::SHA2.hexdigest(source_data)\n self.database ||= record.database\n self.uid ||= record.uid\n init_optional_attributes\n end", "def search_ldap_identity_source(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def populateLDAP\n \n #quit if no email or netid to work with\n return if !self.netid\n \n ldap = Net::LDAP.new(host: 'directory.yale.edu', port: 389)\n b = 'ou=People,o=yale.edu'\n f = Net::LDAP::Filter.eq('uid', self.netid)\n a = %w(givenname sn mail knownAs class college)\n\n p = ldap.search(base: b, filter: f, attributes: a).first\n \n\n\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n if self.fname.blank?\n self.fname = ( p['givenname'] ? p['givenname'][0] : '' )\n end\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n self.save!\n end", "def read_ldap_identity_source(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def create_or_update_ldap_identity_source_with_http_info(ldap_identity_source_id, ldap_identity_source, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source\"\n end\n # verify the required parameter 'ldap_identity_source' is set\n if @api_client.config.client_side_validation && ldap_identity_source.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ldap_identity_source)\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#create_or_update_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_source_from_ccid\n creditcard = Creditcard.find_by_id( @creditcard_id )\n if creditcard\n self.source = creditcard\n end\n end", "def ldap_verify_and_update\n return unless self.is_ldap?\n\n scanner = LdapQuery::Scanner.search self.login, :only=>:ldap\n\n if scanner.errors.size > 0\n errors.add(:login, 'Login is invalid or cannot be found in OHSU\\'s servers')\n return\n end\n\n # Update our information from ldap\n self.assign_attributes scanner.as_user_attributes\n\n end", "def test_load\n @valid_source.save\n source_loaded = Source.find(@valid_source.uri)\n assert_kind_of(Source, source_loaded)\n assert_equal(@valid_source.primary_source, source_loaded.primary_source)\n assert_equal(@valid_source.uri, source_loaded.uri)\n end", "def verify_source\n # subclasses must implement this method\n puts \"verify_source - not overloaded. file=#{filename}\"\n end", "def test_initialize_finds_records\n prov = mkprovider\n prov.default_target = :yayness\n\n prov.target_object(:yayness).write \"bill a c\\njill b d\"\n\n prov.prefetch\n\n # Now make a resource\n bill = @type.new :name => \"bill\"\n\n assert_equal(\"a\", bill.provider.one, \"Record was not found in memory\")\n end", "def check # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength\n # initial values for response object\n result = {\n summary: {\n valid: false,\n timestamp: Time.now.iso8601,\n location: @target,\n profile: nil,\n controls: 0,\n },\n errors: [],\n warnings: [],\n }\n\n entry = lambda { |file, line, column, control, msg|\n {\n file: file,\n line: line,\n column: column,\n control_id: control,\n msg: msg,\n }\n }\n\n warn = lambda { |file, line, column, control, msg|\n @logger.warn(msg)\n result[:warnings].push(entry.call(file, line, column, control, msg))\n }\n\n error = lambda { |file, line, column, control, msg|\n @logger.error(msg)\n result[:errors].push(entry.call(file, line, column, control, msg))\n }\n\n @logger.info \"Checking profile in #{@target}\"\n meta_path = @source_reader.target.abs_path(@source_reader.metadata.ref)\n\n # verify metadata\n m_errors, m_warnings = metadata.valid\n m_errors.each { |msg| error.call(meta_path, 0, 0, nil, msg) }\n m_warnings.each { |msg| warn.call(meta_path, 0, 0, nil, msg) }\n m_unsupported = metadata.unsupported\n m_unsupported.each { |u| warn.call(meta_path, 0, 0, nil, \"doesn't support: #{u}\") }\n @logger.info \"Metadata OK.\" if m_errors.empty? && m_unsupported.empty?\n\n # only run the vendor check if the legacy profile-path is not used as argument\n if @legacy_profile_path == false\n # verify that a lockfile is present if we have dependencies\n unless metadata.dependencies.empty?\n error.call(meta_path, 0, 0, nil, \"Your profile needs to be vendored with `inspec vendor`.\") unless lockfile_exists?\n end\n\n if lockfile_exists?\n # verify if metadata and lockfile are out of sync\n if lockfile.deps.size != metadata.dependencies.size\n error.call(meta_path, 0, 0, nil, \"inspec.yml and inspec.lock are out-of-sync. Please re-vendor with `inspec vendor`.\")\n end\n\n # verify if metadata and lockfile have the same dependency names\n metadata.dependencies.each do |dep|\n # Skip if the dependency does not specify a name\n next if dep[:name].nil?\n\n # TODO: should we also verify that the soure is the same?\n unless lockfile.deps.map { |x| x[:name] }.include? dep[:name]\n error.call(meta_path, 0, 0, nil, \"Cannot find #{dep[:name]} in lockfile. Please re-vendor with `inspec vendor`.\")\n end\n end\n end\n end\n\n # extract profile name\n result[:summary][:profile] = metadata.params[:name]\n\n count = controls_count\n result[:summary][:controls] = count\n if count == 0\n warn.call(nil, nil, nil, nil, \"No controls or tests were defined.\")\n else\n @logger.info(\"Found #{count} controls.\")\n end\n\n # iterate over hash of groups\n params[:controls].each do |id, control|\n sfile = control[:source_location][:ref]\n sline = control[:source_location][:line]\n error.call(sfile, sline, nil, id, \"Avoid controls with empty IDs\") if id.nil? || id.empty?\n next if id.start_with? \"(generated \"\n\n warn.call(sfile, sline, nil, id, \"Control #{id} has no title\") if control[:title].to_s.empty?\n warn.call(sfile, sline, nil, id, \"Control #{id} has no descriptions\") if control[:descriptions][:default].to_s.empty?\n warn.call(sfile, sline, nil, id, \"Control #{id} has impact > 1.0\") if control[:impact].to_f > 1.0\n warn.call(sfile, sline, nil, id, \"Control #{id} has impact < 0.0\") if control[:impact].to_f < 0.0\n warn.call(sfile, sline, nil, id, \"Control #{id} has no tests defined\") if control[:checks].nil? || control[:checks].empty?\n end\n\n # profile is valid if we could not find any error\n result[:summary][:valid] = result[:errors].empty?\n\n @logger.info \"Control definitions OK.\" if result[:warnings].empty?\n result\n end", "def config_ldap_start\n\n\t\t`chkconfig --level 3 ldap on`\n\t\t`service ldap start`\n\n\t\tldap_status = `service ldap status`\n\n\t\tif ldap_status.include? \"running\"\n\t\t\tputs \"LDAP Server was started correctly\"\n\t\telsif ldap_status.include? \"stopped\"\n\t\t\tputs \"LDAP server is not started or is not working correctly\"\n\t\telse\n\t\t\tputs \"Error processing LDAP status\"\n\t\tend\n\tend", "def populateLDAP\n return unless Rails.env.production?\n #quit if no email or netid to work with\n self.email ||= ''\n return if !self.email.include?('@yale.edu') && !self.netid\n\n begin\n ldap = Net::LDAP.new( :host =>\"directory.yale.edu\" , :port =>\"389\" )\n\n #set e filter, use netid, then email\n if !self.netid.blank? #netid\n f = Net::LDAP::Filter.eq('uid', self.netid)\n else\n f = Net::LDAP::Filter.eq('mail', self.email)\n end\n\n b = 'ou=People,o=yale.edu'\n p = ldap.search(:base => b, :filter => f, :return_result => true).first\n\n rescue Exception => e\n guessFromEmail\n end\n\n return unless p\n\n self.netid = ( p['uid'] ? p['uid'][0] : '' )\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n self.fname ||= ( p['givenname'] ? p['givenname'][0] : '' )\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n\n # Don't save the model, because they are going to be shown a form to edit info\n # self.save!\n end", "def fetch_identity_source_ldap_server_certificate_fetch_certificate_with_http_info(identity_source_ldap_server_endpoint, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.fetch_identity_source_ldap_server_certificate_fetch_certificate ...'\n end\n # verify the required parameter 'identity_source_ldap_server_endpoint' is set\n if @api_client.config.client_side_validation && identity_source_ldap_server_endpoint.nil?\n fail ArgumentError, \"Missing the required parameter 'identity_source_ldap_server_endpoint' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.fetch_identity_source_ldap_server_certificate_fetch_certificate\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=fetch_certificate'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(identity_source_ldap_server_endpoint)\n auth_names = ['BasicAuth']\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 => 'PeerCertificateChain')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#fetch_identity_source_ldap_server_certificate_fetch_certificate\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def stub_api_source_calls(source)\n stub_api_source_get(source, show(source))\n return unless source_available?(source)\n\n endpoint = endpoints(source)[source['id']]\n stub_rest_get(\"#{sources_api}/sources/#{source[\"id\"]}/endpoints\", user_tenant_header, list([endpoint]))\n\n authentication = authentications(source)[source['id']]\n stub_rest_get(\"#{sources_api}/endpoints/#{endpoint['id']}/authentications\", user_tenant_header, list([authentication]))\n\n stub_rest_get(\"#{sources_api(:internal => true)}/authentications/#{authentication['id']}?expose_encrypted_attribute[]=password\", user_tenant_header, show(credentials(source)[authentication['id']]))\n end", "def patient_lookup\n return unless patient_identifier_changed?\n self.patient = patient_lookup_entity_id || patient_lookup_id\n end", "def set_cla_source\n @cla_source = ClaSource.find(params[:id])\n end", "def setup\n generate_ca_certificate unless @host.certificate\n end", "def test_connection\n\t\tldap_con = initialize_ldap_con(self.account, self.encrypted_password)\n\t\tldap_con.open do |ldap|\n\t\tend\n\trescue Net::LDAP::LdapError => text\n\t\traise \"LdapError: \" + text\n\tend", "def associate_auth(source)\n return if user_authentications.where(:provider => source['provider'], :uid => source['uid'].to_s).count > 0\n self.user_authentications.create!(:provider => source['provider'], :uid => source['uid'], :nickname => source[\"user_info\"]['nickname'])\n end", "def initialize(ldap_config)\n @ldap = Net::LDAP.new host: ldap_config['host'], port: ldap_config['port']\n @attributes_to_import = %w(uid sn givenname mail title objectclass)\n @tree_base = ldap_config['treebase']\n\n # Used to log information\n @people_saved = 0\n @picture_uploaded = 0\n end", "def set_credential_source(opts)\n opts = check_params(opts,[:sources])\n super(opts)\n end", "def add_sources(marshaller)\n source_dir = (source_type == SOURCE_TYPE_INTERNAL) \\\n ? SystemProperties::getCenterInternalDirectory \\\n : SystemProperties::getCenterExternalDirectory\n\n ha_configured = CommonSql.ha_configured?\n\n ConfigurationSource.get_all_sources_by_type(source_type).each do |source|\n source_xml = marshaller.factory.createConfigurationSourceType\n central_server_address = nil\n if ha_configured\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS,\n :ha_node_name => source.ha_node_name).first.value\n else\n central_server_address = SystemParameter.where(\n :key => SystemParameter::CENTRAL_SERVER_ADDRESS).first.value\n end\n source_xml.downloadURL =\n \"http://\" + central_server_address + \"/\" + source_dir\n source.configuration_signing_keys.find_each do |key|\n source_xml.getVerificationCert.add(key.cert.to_java_bytes)\n end\n marshaller.root.source.add(source_xml)\n end\n end", "def list_ldap_identity_sources(opts = {})\n data, _status_code, _headers = list_ldap_identity_sources_with_http_info(opts)\n data\n end", "def correct_user\n @source = current_user.sources.find_by(id: params[:id])\n redirect_to root_url if @source.nil?\n end", "def test_connection\n ldap_con = initialize_ldap_con(self.account, self.account_password)\n ldap_con.open { }\n rescue Net::LDAP::LdapError => text\n raise \"LdapError: %s\" % text\n end", "def login_from_other_sources\n result = nil\n # Takes the first entry that doesn't return false\n sorcery_config.login_sources.find do |source|\n result = send(source)\n end\n return result if result\n\n nil\n end", "def check_source_state\n super\n end", "def load_ldap_library\n return if @ldap_library_loaded\n if @ldap_library\n if @ldap_library == 'net/ldap'\n require 'net/ldap'\n else\n require 'ldap'\n require 'ldap/control'\n end\n else\n begin\n require 'ldap'\n require 'ldap/control'\n @ldap_library = 'ldap'\n rescue LoadError\n require 'net/ldap'\n @ldap_library = 'net/ldap'\n end\n end\n @ldap_library_loaded = true\n end", "def verify_property source_list, &block\n count = 0\n source_list.each do |source|\n target = @dst + source.relative_path_from(@src)\n if target.exist?\n count += 1\n yield source, target, source.basename.to_s\n end\n end\n assert count > 0, 'There was no file to test'\n end", "def load_ldap ldap_result\n self.reset\n self.from = :ldap\n\n if ldap_result.nil?\n self.errors.add(:query, 'No results were found')\n return\n end\n \n [:cn, :mail, :displayName].each do |key|\n if ldap_result[key].nil?\n self.errors.add key, 'Search result was missing information'\n return\n end\n\n if ldap_result[key].size == 0\n self.errors.add key, 'Search result was missing data'\n return\n end\n \n if ldap_result[key].size != 1\n self.errors.add :query, 'There were too many matches to your search'\n return\n end\n\n if ldap_result[key][0].nil?\n self.errors.add key, 'There were no results for search'\n return\n end\n end\n\n unless ldap_result[:mail].first =~ /\\A[^@]+@[^@]+\\Z/ \n errors.add :email, 'An invalid email address was found in search result'\n end\n \n self.sn = ldap_result[:cn][0].to_s\n self.cn = ldap_result[:cn][0].to_s\n self.email = ldap_result[:mail][0].to_s\n self.displayname = ldap_result[:displayName][0].to_s\n end", "def ensure_ca_certificates\n final_state = run_machine(NeedCACerts.new, NeedKey)\n final_state.ssl_context\n end", "def get_authentication_source_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_authentication_source ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling UserApi.get_authentication_source\"\n end\n # resource path\n local_var_path = '/api/3/authentication_sources/{id}'.sub('{' + 'id' + '}', id.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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = 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 => 'AuthenticationSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_authentication_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def run_prepare(opts, sources, devices, rng, io)\n sources.parse(@sources)\n mods = opts.categories ? sources.parse_mods(opts.categories) : nil\n sources.apply_mods(mods) if mods\n\n devices.storage_mount\n number = opts.number || rng.generate(sources.count)\n source = sources.get(number)\n\n puts io.run_info_table(source, number)\n source\n end", "def check_sources\n case self.source\n when \"rubygems\"\n return false if self.gem_name.empty?\n require 'net/http'\n begin\n r = Net::HTTP.get_response(URI.parse(\"http://rubygems.org/gems/#{self.gem_name}\"))\n Net::HTTPSuccess === r ? (return true) : errors.add(:gem_name, \"#{self.gem_name} is not a valid rubygem\")\n rescue\n errors.add(:gem_name, \"#{self.gem_name} failed.\")\n end\n when \"git\"\n if self.source_url.empty?\n errors.add(:source_url, \"can't be blank\")\n return false\n end\n require 'command_check'\n if command?('git')\n git_ls = system(\"git\", \"ls-remote\", self.source_url)\n if git_ls != true\n errors.add(:source_url, \"#{self.source_url} is not a valid git repository\")\n end\n end\n when \"path\"\n if self.source_url.empty?\n errors.add(:source_url, \"can't be blank\")\n return false\n end\n # Use Dir to see if a gemfile exists in that directory, and protect\n # it with File.directory? to keep out wildcards (resource hog).\n # Make the two cases somewhat indistinguishable to avoid revealing\n # irrelevant system properties.\n if (!File.directory? self.source_url or\n Dir.glob(\"#{self.source_url}/*.gemspec\").empty?)\n errors.add(:source_url, \"Gemspec not found in #{self.source_url}\")\n end\n end\n end", "def set_founding_source\n @founding_source = FoundingSource.find(params[:id])\n end", "def bind_by_username_with_preauthentication\n raise CASServer::AuthenticatorError, \"A password must be specified in the configuration for the authenticator user!\" unless\n @options[:ldap][:auth_password]\n\n @ldap.authenticate(@options[:ldap][:auth_user], @options[:ldap][:auth_password])\n\n @ldap.bind_as(:base => @options[:ldap][:base], :password => @password, :filter => user_filter)\n end", "def set_record_source_bundle\n # TODO: figure out what scenarios lead to no params[:bundle_id] here\n @source = @bundle = params[:bundle_id] ? Bundle.available.find(params[:bundle_id]) : Bundle.default\n return unless @bundle\n\n add_breadcrumb 'Master Patient List', bundle_records_path(@bundle)\n @title = 'Master Patient List'\n end", "def boot_from_iscsi?\n delegate(provider, :boot_from_iscsi?)\n end", "def set_record_source_vendor\n @bundle = params[:bundle_id] ? Bundle.available.find(params[:bundle_id]) : Bundle.default\n @vendor = Vendor.find(params[:vendor_id])\n @source = @vendor\n breadcrumbs_for_vendor_path\n @title = \"#{@vendor.name} Uploaded Patients\"\n end", "def check_config_and_start_agent\n return unless monitoring? && has_correct_license_key?\n return if using_forking_dispatcher?\n\n setup_and_start_agent\n end", "def ldapsearch(filter)\n raise ArgumentError.new(\"You must pass a block to ldapsearch\") unless block_given?\n\n found = false\n count = 0\n\n begin\n connection.search(search_base, 2, filter, search_attributes) do |entry|\n found = true\n yield entry\n end\n rescue SystemExit,NoMemoryError\n raise\n rescue Exception => detail\n if count == 0\n # Try reconnecting to ldap if we get an exception and we haven't yet retried.\n count += 1\n @connection = nil\n Puppet.warning \"Retrying LDAP connection\"\n retry\n else\n error = Puppet::Error.new(\"LDAP Search failed\")\n error.set_backtrace(detail.backtrace)\n raise error\n end\n end\n\n found\n end", "def set_probe_configuration\n @probe_configuration = ProbeConfiguration.find(params[:id])\n end", "def certificate_check_state\n super\n end", "def show\n @ldap_auth_header = Irm::LdapAuthHeader.list_all.find(params[:id])\n puts @ldap_auth_header.ldap_source.name\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ldap_auth_header }\n end\n end", "def valid_user?\n #create a new LDAP object using the ruby-net-ldap library\n @ldap = Net::LDAP.new(:base => \"dc=#{@domain},dc=#{@tld}\",\n :host => @adshost,\n :auth => {:username => \"#{@username}@#{@domain}.#{@tld}\",\n :password => @password,\n :method => :simple})\n #return a boolean indicating whether authentication was successful or not\n return @ldap.bind\n end", "def set_email_source_account\n @email_source_account = EmailSourceAccount.find(params[:id])\n end", "def set_source\n @source = Source.find(params[:id])\n end", "def get_authentication_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_authentication_sources ...'\n end\n # resource path\n local_var_path = '/api/3/authentication_sources'\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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = 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 => 'ResourcesAuthenticationSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_authentication_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_source\n @source = Source.find(params[:id])\n end", "def set_source\n @source = Source.find(params[:id])\n end", "def set_source\n @source = Source.find(params[:id])\n end", "def _validate_source(s)\n if git = s[:git]\n tag, commit = s.values_at(:tag, :commit)\n version = spec.version.to_s\n\n if git =~ %r{http://EXAMPLE}\n results.add_error('source', 'The Git source still contains the ' \\\n 'example URL.')\n end\n if commit && commit.downcase =~ /head/\n results.add_error('source', 'The commit of a Git source cannot be' \\\n ' `HEAD`.')\n end\n if tag && !tag.to_s.include?(version)\n results.add_warning('source', 'The version should be included in' \\\n ' the Git tag.')\n end\n if tag.nil?\n results.add_warning('source', 'Git sources should specify a tag.', true)\n end\n end\n\n perform_github_source_checks(s)\n check_git_ssh_source(s)\n end", "def fill_from_ldap\n person = self.ldap_person\n if person.nil?\n if Rails.development?\n self.name = \"Susan #{self.login}\"\n self.email = \"beehive+#{self.login}@berkeley.edu\"\n self.major_code = 'undeclared'\n self.user_type = case self.login\n when 212388, 232588\n User::Types::Grad\n when 212381, 300846, 300847, 300848, 300849, 300850\n User::Types::Undergrad\n when 212386, 322587, 322588, 322589, 322590\n User::Types::Faculty\n when 212387, 322583, 322584, 322585, 322586\n User::Types::Staff\n else\n User::Types::Affiliate\n end\n return true\n else\n self.name = 'Unknown Name'\n self.email = ''\n self.major_code = ''\n self.user_type = User::Types::Affiliate\n return false\n end\n else\n self.name = \"#{person.firstname} #{person.lastname}\".titleize\n self.email = person.email\n self.major_code = person.berkeleyEduStuMajorName.to_s.downcase\n self.user_type = case\n when person.berkeleyEduStuUGCode == 'G'\n User::Types::Grad\n when person.student?\n User::Types::Undergrad\n when person.employee_academic?\n User::Types::Faculty\n when person.employee?\n User::Types::Staff\n else\n User::Types::Affiliate\n end\n return true\n end\n end", "def test_source_lists\n config=<<EOF\nsource_list \"test\", %w(test-1.example.com)\n\nsource_list \"has_ipv4\", \"0.0.0.0/0\"\n\nsource_list \"has_ipv6\", \"2000::/3\"\nEOF\n\n Configuration.current = ConfigurationBuilder.parse(config)\n\n a = Alert.new\n a.subject = \"www.example.com\"\n\n assert( a.in_source_list?(\"test\") )\n assert_equal( %w(test has_ipv4).sort, a.source_lists.sort )\n\n a.subject = \"www2.example.com\"\n assert( a.in_source_list?(\"has_ipv6\") )\n assert_equal( %w(has_ipv6 has_ipv4).sort, a.source_lists.sort )\n end", "def identify( source=nil, **options )\n\t\tresponse = self.server.run_with_json_template( :identify, source, **options )\n\n\t\tdata = response.first\n\t\treturn Hglib::Repo::Id.new( **data )\n\tend", "def source_id=(value)\n @source_id = value\n end", "def set_source_ref\n @source_ref = SourceRef.find(params[:id])\n end", "def primary_source\n predicate(:talia, :primary_source) == true\n end", "def primary_source\n predicate(:talia, :primary_source) == true\n end", "def list_ldap_identity_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/aaa/ldap-identity-sources'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#list_ldap_identity_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def ldap_server=(should) end", "def protect_sources\n @protected_sources = sources\n end", "def assert_source_attribute_is_set\n # Ensure the user specified the required source attribute\n if node['visualstudio']['source'].nil?\n fail 'The required attribute node[\\'visualstudio\\'][\\'source\\'] is empty, ' \\\n 'set this and run again!'\n end\n end", "def source_check_state\n super\n end", "def initialize\n @verify_certificates = true\n end", "def verify_aud; end", "def verify_aud; end", "def set_source\n @source = Source.find params[:id]\n end", "def authenticate_dn(dn, password)\n\t\tif dn.present? && password.present?\n\t\t\tinitialize_ldap_con(dn, password).bind\n\t\tend\n\tend", "def ldap_authenticate \n filter = Net::LDAP::Filter.eq(\"uid\",\"#{username}\")\n \n ldap_connection.search(:base => ldap_treebase, :filter => filter, :attributes => ldap_attrs, :return_result => false) do |entry|\n return true\n end\n \n self.errors.add(:username, \" is invalid\")\n return false\n end", "def set_external_supplied\n @external_supplied = ExternalSupplied.find(params[:id])\n end", "def load_trust_ca\n load_cacerts(@cert_store)\n change_notify\n end", "def delete_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.delete_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.delete_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#delete_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find_matching_identities (inCertificateSubjects)\n #get identities using the commmand line tool security\n identities=`security find-identity -v -p codesigning`\n #create an array\n identities=identities.split(\"\\n\")\n\n #identity_labels is the common name of all the matching certs.\n identity_labels=[]\n \n #loop over the certs that came in and compare to each identity from the keychain\n inCertificateSubjects.each{|certSubject| \n identities.each { |id| \n #only use identities that start with iPhone. This could cause issues later.\n if id[/iPhone.*/] then\n #we have a trailing quote, so need to delete it\n label=id[/iPhone.*/].delete!(\"\\\"\")\n #if we match, then we found an identity that should be saved and\n #we add it to our array\n if (label==certSubject) then\n identity_labels.push certSubject\n $stderr.puts \"Matched #{label}\"\n end\n end\n }\n }\n return identity_labels\nend", "def get_ldap_id\n\t\tself.id = Devise::LDAP::Adapter.get_ldap_param(self.username,\"uidnumber\").first\n end", "def set_plasmid_probe\n @plasmid_probe = PlasmidProbe.find(params[:id])\n end", "def start\n case ssl\n when :tls\n @connection = LDAP::SSLConn.new(host, port, true)\n when true\n @connection = LDAP::SSLConn.new(host, port)\n else\n @connection = LDAP::Conn.new(host, port)\n end\n @connection.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n @connection.set_option(LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_ON)\n @connection.simple_bind(user, password)\n rescue => detail\n raise Puppet::Error, \"Could not connect to LDAP: #{detail}\"\n end", "def verify_iss; end", "def verify_iss; end", "def ensure_valid_checkid_request\n self.openid_request = checkid_request\n if !openid_request.is_a?(OpenID::Server::CheckIDRequest)\n redirect_to root_path, :alert => t(:identity_verification_request_invalid)\n elsif !allow_verification?\n flash[:notice] = logged_in? && !pape_requirements_met?(auth_time) ?\n t(:service_provider_requires_reauthentication_last_login_too_long_ago) :\n t(:login_to_verify_identity)\n session[:return_to] = proceed_path\n redirect_to login_path\n end\n end", "def find_for_ldap_authentication(attributes={}, authenticator = EpiCas::LdapAuthenticator)\n authenticator.new(attributes, self).authenticate_ldap\n end", "def create_or_update_ldap_identity_source(ldap_identity_source_id, ldap_identity_source, opts = {})\n data, _status_code, _headers = create_or_update_ldap_identity_source_with_http_info(ldap_identity_source_id, ldap_identity_source, opts)\n data\n end", "def find(source = @source)\n scope = 0\n filter = \"(objectClass=*)\"\n if source.respond_to?(:search2_ext)\n source.search2(\n to_s,\n scope,\n filter\n )\n elsif source.respond_to?(:search)\n Array(source.search(\n :base => to_s,\n :scope => scope,\n :filter => filter,\n :limit => 1\n ))\n else\n raise RuntimeError, \"missing or invalid source for LDAP search\", caller\n end.first\n end", "def verify_source_arguments source, importer, formatter\n # Fail if already registered (require explicit removal rather than overwrite)\n fail ArgumentError, \"#{source} has already been registered\" if @importers[source]\n\n # Fail if either importer or exporter is not a class\n fail ArgumentError, \"importer must be provided as class not object\" unless (importer.superclasses.include? Importer)\n fail ArgumentError, \"exporter must be provided as class not object\" unless (formatter.superclasses.include?(Formatter))\n\n # Fail if source is not a symbol\n fail ArgumentError, \"source must be a symbol\" unless (source.is_a?(Symbol) || source.is_a?(String))\n end", "def set_check_source_state(opts)\n opts = check_params(opts,[:states])\n super(opts)\n end", "def registering_source\n if rpx_identifier.include?(\"google\")\n \"Google\"\n elsif rpx_identifier.include?(\"facebook\")\n \"FaceBook\"\n elsif rpx_identifier.include?(\"twitter\")\n \"Twitter\"\n elsif rpx_identifier.include?(\"yahoo\")\n \"Yahoo\"\n elsif rpx_identifier.include?(\"aol\")\n \"Aol\"\n else\n \"Unknown\"\n end\n end", "def verify\n # nothing to do here, so just return\n end", "def get_ldap_details(username)\n search_filter = Net::LDAP::Filter.eq(\"uid\", username)\n result = LDAP_CONNECTION.search(:filter => search_filter)\n puts result.inspect\nend", "def connect_to_ldap\r\n begin\r\n @ldap = Net::LDAP.new(:host => @ldap_host,\r\n :port => @ldap_port,\r\n :auth => { :method => :simple,\r\n :username => @ldap_username,\r\n :password => @ldap_password } )\r\n @logger.info \"Connecting to LDAP: '#{@ldap_host}' on port #{@ldap_port}\"\r\n @logger.info \"Binding to LDAP as: #{@ldap_username}\"\r\n \r\n success = @ldap.bind()\r\n if (success)\r\n @logger.info \"LDAP authorization succeeded\"\r\n return true\r\n else\r\n @logger.error \"LDAP authorization failed: #{@ldap.get_operation_result.message}\"\r\n return false\r\n end\r\n rescue Net::LDAP::LdapError => error\r\n @logger.error(\"Error connecting to LDAP: #{error}\")\r\n return false\r\n end\r\n end", "def certificate_verification_state\n super\n end", "def test_create_typeless\n # rec = SourceRecord.new\n source = Source.new(\"http://www.newstuff.org/my_nuff\")\n assert_not_nil(source)\n assert_property(source.types, N::TALIA.Source)\n end", "def prepare_domain(domain)\n domain.start unless domain.active\n wait_for_ip_address(domain)\n end" ]
[ "0.6635697", "0.6583088", "0.64369255", "0.6053089", "0.5782503", "0.55669475", "0.5522772", "0.5063628", "0.5029683", "0.4997031", "0.4904828", "0.48154947", "0.4751302", "0.47235876", "0.46993345", "0.46986765", "0.4696389", "0.46951333", "0.46795785", "0.46706608", "0.46525392", "0.46271732", "0.46027285", "0.45799083", "0.45688373", "0.45568085", "0.45404217", "0.45171502", "0.4488656", "0.44882205", "0.44596705", "0.44367865", "0.443621", "0.44206792", "0.4408356", "0.43970427", "0.4396975", "0.43930748", "0.43891236", "0.43871677", "0.43860263", "0.43820027", "0.43598884", "0.4359085", "0.43571547", "0.43231714", "0.43189013", "0.43034753", "0.42951307", "0.42857933", "0.42812574", "0.42718", "0.42668423", "0.42597494", "0.42589486", "0.42514032", "0.4251375", "0.4251375", "0.4251375", "0.42498568", "0.42493922", "0.4248505", "0.42447525", "0.42438698", "0.4224567", "0.42215714", "0.42215714", "0.42196587", "0.4216215", "0.42152423", "0.4214984", "0.42086744", "0.42031923", "0.41972762", "0.41972762", "0.4193479", "0.41891834", "0.41877082", "0.41862184", "0.41859764", "0.41693914", "0.4164432", "0.41619837", "0.41584834", "0.4157324", "0.41571826", "0.41571826", "0.41560128", "0.41498056", "0.41446903", "0.41367096", "0.41362786", "0.4123109", "0.41219595", "0.412159", "0.41215137", "0.41210613", "0.41143733", "0.40966776", "0.40915132" ]
0.68749434
0
Read a single LDAP identity source Return details about one LDAP identity source
def read_ldap_identity_source(ldap_identity_source_id, opts = {}) data, _status_code, _headers = read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#read_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @ldap_auth_header = Irm::LdapAuthHeader.list_all.find(params[:id])\n puts @ldap_auth_header.ldap_source.name\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ldap_auth_header }\n end\n end", "def search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}/search'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'filter_value'] = opts[:'filter_value'] if !opts[:'filter_value'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceSearchResultList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#search_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_ldap_details(username)\n search_filter = Net::LDAP::Filter.eq(\"uid\", username)\n result = LDAP_CONNECTION.search(:filter => search_filter)\n puts result.inspect\nend", "def search_ldap_identity_source(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def get_ldap_id\n\t\tself.id = Devise::LDAP::Adapter.get_ldap_param(self.username,\"uidnumber\").first\n end", "def get_user_details_from_ldap(username)\n\tresult_attrs = [\"uid\", \"displayName\", \"mail\"]\n\tsearch_filter = Net::LDAP::Filter.eq(\"uid\", username)\n\tLDAP_CONNECTION.search(:filter => search_filter, :attributes => result_attrs) { |item| \n\t puts \"#{item.uid.first}: #{item.displayName.first} (#{item.mail.first})\" \n\t}\n\t\nend", "def ldap\n @attributes[:ldap]\n end", "def student_id\n @net_ldap_entry[:berkeleyedustuid].first\n end", "def get_source_data(source_name:, catalog_id:)\n response = HTTParty.get(\"#{@host}/api/sources/#{source_name}\", query: {\n catalog_id: catalog_id,\n api_key: @api_key\n })\n \n return response[\"source\"]\n end", "def find(source = @source)\n scope = 0\n filter = \"(objectClass=*)\"\n if source.respond_to?(:search2_ext)\n source.search2(\n to_s,\n scope,\n filter\n )\n elsif source.respond_to?(:search)\n Array(source.search(\n :base => to_s,\n :scope => scope,\n :filter => filter,\n :limit => 1\n ))\n else\n raise RuntimeError, \"missing or invalid source for LDAP search\", caller\n end.first\n end", "def read_server_role(srcn)\n\n filter1 = Net::LDAP::Filter.eq( \"objectclass\", \"serverRole\" )\n filter2 = Net::LDAP::Filter.eq( \"cn\", srcn )\n filter = Net::LDAP::Filter.join(filter1, filter2)\n attrs = [ ]\n\n $conn.search(:base => $basedomainsr,\n :filter => filter) do |entry|\n serverrole = entry\n\n return serverrole\n end\nend", "def ldap_username\n @attributes[:ldap_username]\n end", "def ldap_server\n get_attribute_from_auth_source('host')\n end", "def probe_unconfigured_ldap_identity_source_probe_identity_source_with_http_info(ldap_identity_source, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source' is set\n if @api_client.config.client_side_validation && ldap_identity_source.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=probe_identity_source'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ldap_identity_source)\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceProbeResults')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_unconfigured_ldap_identity_source_probe_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def source\n @source ||= ::Incident.includes(current_user: :contacts).find_by(uuid: payload[\"source\"][\"id\"])\n end", "def all_info\n LdapUser.retrieve_all_information self.login \n end", "def source_id\n @ole.sourceID\n end", "def source_id\n @ole.sourceID\n end", "def source_id\n @ole.sourceID\n end", "def source_id\n @ole.sourceID\n end", "def source_account_id\n data[:source_account_id]\n end", "def source_get\n db_select 'source'\n end", "def get_entry( c, dn ) # :yields: connection_info, distinguished_name\n \n self.bind( c.host, c.port, c.credentials, c.databag_name, c.use_tls ) unless @ldap\n \n entry = @ldap.search( \n base: dn, \n filter: Net::LDAP::Filter.eq( 'objectClass', '*' ),\n scope: Net::LDAP::SearchScope_BaseObject,\n attributes: [ '*' ]\n )\n \n raise \"Error while searching: #{@ldap.get_operation_result.message}\" unless @ldap.get_operation_result.message =~ /(Success|No Such Object)/\n return entry ? entry.first : entry\n end", "def ldap_domain\n @attributes[:ldap_domain]\n end", "def get_authentication_source_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_authentication_source ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling UserApi.get_authentication_source\"\n end\n # resource path\n local_var_path = '/api/3/authentication_sources/{id}'.sub('{' + 'id' + '}', id.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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = 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 => 'AuthenticationSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_authentication_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_authentication_source(id, opts = {})\n data, _status_code, _headers = get_authentication_source_with_http_info(id, opts)\n data\n end", "def probe_configured_ldap_identity_source_probe_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_configured_ldap_identity_source_probe ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_configured_ldap_identity_source_probe\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}?action=probe'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceProbeResults')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_configured_ldap_identity_source_probe\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_ldap_identity_sources(opts = {})\n data, _status_code, _headers = list_ldap_identity_sources_with_http_info(opts)\n data\n end", "def list_ldap_identity_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/aaa/ldap-identity-sources'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#list_ldap_identity_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def given_name\n @net_ldap_entry[:givenname].first\n end", "def group_get_info(attribs, dir_info)\n attribs = group_record_name_alternatives(attribs)\n\n check_critical_attribute( attribs, :record_name )\n\n command = {action: 'read', scope: 'Groups', value: nil}\n user_attrs = attribs.merge(command)\n\n dscl( user_attrs, dir_info )\n end", "def find_by_external_authentication_uid(external_authentication_uid)\n finder = table.where(:external_authentication_uid => external_authentication_uid)\n if user_data = execute_sql(:read, :user) { finder.first }\n inflate_model(user_data)\n else\n nil\n end\n end", "def get_ldap_data\n if Rails.env.production?\n result = LdapHelper::find_user(self.username)\n\n if result\n self.legacy_id ||= result.try(:employeeNumber).try(:first)\n self.first_name ||= result.try(:givenName).try(:first)\n self.last_name ||= result.try(:sn).try(:first)\n self.display_name ||= result.try(:displayName).try(:first)\n self.status ||= result.try(:employeeType).try(:first) || \"potential\"\n self.email ||= result.try(:mail).try(:first) || \"#{username}@fake.me\"\n end\n end\n end", "def read_info(uid)\n grid_info = files_collection.find(filename: uid).first or raise Tus::NotFound\n grid_info[:metadata]\n end", "def show\n @ldap_entry = LdapEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ldap_entry }\n end\n end", "def probe_configured_ldap_identity_source_probe(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = probe_configured_ldap_identity_source_probe_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def show\n ldap = Net::LDAP.new\n @user = @server.users.all#(user_params)\n \n end", "def find_user\n results = @ldap.search( :base => options[:ldap][:base], :filter => user_filter)\n return results.first\n end", "def get_info_source(field_prefix)\n info_source = nil\n return nil if self.fields.keys.find{|k| !k.nil? && k.starts_with?(\"#{field_prefix}.info_source\")}.nil?\n begin\n info_source_id = self.fields.delete(\"#{field_prefix}.info_source.id\")\n if info_source_id.blank?\n info_source_code = self.fields.delete(\"#{field_prefix}.info_source.code\")\n if info_source_code.blank?\n source_name = self.fields.delete(\"#{field_prefix}.info_source.oral.fullname\")\n if !source_name.blank?\n info_source = OralSource.find_by_name(source_name)\n self.say \"Oral source with name #{source_name} was not found.\" if info_source.nil?\n end\n else\n info_source = OralSource.get_by_code(info_source_code)\n self.say \"Info source with code #{info_source_code} was not found.\" if info_source.nil?\n end\n else\n info_source = ShantiIntegration::Source.find(info_source_id)\n self.say \"Info source with Shanti Source ID #{info_source_id} was not found.\" if info_source.nil?\n end \n rescue Exception => e\n self.say e.to_s\n end\n return info_source\n end", "def extract_identity\n @identity = Identity.find_omniauth(omniauth) if omniauth\n end", "def ldap_username_field\n @attributes[:ldap_username_field]\n end", "def ldap\n conf['dashboard']['ldap']\n end", "def populateLDAP\n \n #quit if no email or netid to work with\n return if !self.netid\n \n ldap = Net::LDAP.new(host: 'directory.yale.edu', port: 389)\n b = 'ou=People,o=yale.edu'\n f = Net::LDAP::Filter.eq('uid', self.netid)\n a = %w(givenname sn mail knownAs class college)\n\n p = ldap.search(base: b, filter: f, attributes: a).first\n \n\n\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n if self.fname.blank?\n self.fname = ( p['givenname'] ? p['givenname'][0] : '' )\n end\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n self.save!\n end", "def user_info_by_cid( id )\n\n print \"Looking up user details for #{id}...\"\n\n # lookup the user by computing id\n user_info = Helpers.lookup_user( id )\n if user_info.nil?\n puts \"not found\"\n return nil\n end\n\n puts \"done\"\n return user_info\n end", "def get_metadata_source_info(ns)\n METADATA_FIELDS[ns][:info]\n end", "def get_dn(domain,dn,return_attrs = [])\n scope = Net::LDAP::SearchScope_BaseObject\n ldap = ldap_connect(domain)\n results = ldap.search(:base => dn, :scope => scope, :attributes => return_attrs)\n if (results.nil? || results.length == 0)\n return nil\n else\n results.each do |entry|\n return entry\n end\n end\n end", "def ldap_base_dn\n @attributes[:ldap_base_dn]\n end", "def source_id\n return @source_id\n end", "def provider_identity\n [self.source.name, self.uid].compact.join('_')\n end", "def probe_unconfigured_ldap_identity_source_probe_identity_source(ldap_identity_source, opts = {})\n data, _status_code, _headers = probe_unconfigured_ldap_identity_source_probe_identity_source_with_http_info(ldap_identity_source, opts)\n data\n end", "def get_authentication_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_authentication_sources ...'\n end\n # resource path\n local_var_path = '/api/3/authentication_sources'\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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = 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 => 'ResourcesAuthenticationSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_authentication_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find_source_entry\n @source_entry = SourceGlossaryEntry.find params[:source_id]\n end", "def authentication provider=:identity\n Authentication.where(user_id: id, provider: provider).all.first\n end", "def read_ldif(io)\n ds = Net::LDAP::Dataset.new\n io = ChompedIO.new(io)\n\n line = io.gets\n dn = nil\n\n while line\n new_line = io.gets\n\n if new_line =~ /^ /\n line << $'\n else\n nextline = new_line\n\n if line =~ /^#/\n ds.comments << line\n yield :comment, line if block_given?\n elsif line =~ /^version:[\\s]*([0-9]+)$/i\n ds.version = $1\n yield :version, line if block_given?\n elsif line =~ /^dn:([\\:]?)[\\s]*/i\n # $1 is a colon if the dn-value is base-64 encoded\n # $' is the dn-value\n # Avoid the Base64 class because not all Ruby versions have it.\n dn = ($1 == \":\") ? $'.unpack('m').shift : $'\n ds[dn] = Hash.new { |k,v| k[v] = [] }\n yield :dn, dn if block_given?\n elsif line.empty?\n dn = nil\n yield :end, nil if block_given?\n elsif line =~ /^([^:]+):([\\:]?)[\\s]*/\n # $1 is the attribute name\n # $2 is a colon iff the attr-value is base-64 encoded\n # $' is the attr-value\n # Avoid the Base64 class because not all Ruby versions have it.\n attrvalue = ($2 == \":\") ? $'.unpack('m').shift : $'\n ds[dn][$1.downcase.to_sym] << attrvalue\n yield :attr, [$1.downcase.to_sym, attrvalue] if block_given?\n end\n\n line = nextline\n end\n end\n\n ds\n end", "def raw\n Origen.ldap.display(self)\n nil\n end", "def read_replica_source_db_instance_identifier\n @dbi.read_replica_source_db_instance_identifier\n end", "def read_replica_source_db_instance_identifier\n @dbi.read_replica_source_db_instance_identifier\n end", "def slapd_db_config_file\n Dir[\"#{node['ca_openldap']['config_dir']}/cn=config/olcDatabase=\\{*\\}{#{ node['ca_openldap']['db_backend'] }}.ldif\"].first\n end", "def load_ldap ldap_result\n self.reset\n self.from = :ldap\n\n if ldap_result.nil?\n self.errors.add(:query, 'No results were found')\n return\n end\n \n [:cn, :mail, :displayName].each do |key|\n if ldap_result[key].nil?\n self.errors.add key, 'Search result was missing information'\n return\n end\n\n if ldap_result[key].size == 0\n self.errors.add key, 'Search result was missing data'\n return\n end\n \n if ldap_result[key].size != 1\n self.errors.add :query, 'There were too many matches to your search'\n return\n end\n\n if ldap_result[key][0].nil?\n self.errors.add key, 'There were no results for search'\n return\n end\n end\n\n unless ldap_result[:mail].first =~ /\\A[^@]+@[^@]+\\Z/ \n errors.add :email, 'An invalid email address was found in search result'\n end\n \n self.sn = ldap_result[:cn][0].to_s\n self.cn = ldap_result[:cn][0].to_s\n self.email = ldap_result[:mail][0].to_s\n self.displayname = ldap_result[:displayName][0].to_s\n end", "def ldap_person\n @person ||= UCB::LDAP::Person.find_by_uid(self.login) if self.login\n end", "def get_data(login,from)\n ### USER ###\n # acces to user fields\n user_data = User.find_by_login(login)\n # cas_id field of user table\n # cas_id = user_data.cas_id\ncas_id = 1 \n ### CAS ###\n # acces to cas fields\n cas_data = Cas.find_by_id(cas_id)\n # field field of cas table\n ldap_name = cas_data.ldap\n \n ## LDAP ##\n # acces to ldap field\n ldap_data = AuthSourceLdap.find_by_name(ldap_name)\n \n \n # Composition de requête\n auth = {\n :method => :simple,\n :username => ldap_data.account,\n :password => ldap_data.account_password\n }\n \n ldap_req = Net::LDAP::new :host => ldap_data.host, :port => ldap_data.port , :auth => auth\n filter = Net::LDAP::Filter.eq(ldap_data.attr_login, login)\n # Teacher\n labo = Net::LDAP::Filter.construct(ldap_data.filter)\n real_filter = filter & labo\n \n # Informatin to gather from\n attributes = ['givenName', 'sn', 'mail', 'auaStatut', 'eduPersonAffiliation','auaEtapeMillesime', 'supannAffectation']\n \n # CASE\n entry = case from \n when \"staff\" then ldap_req.search(:base => ldap_data.base_dn, :filter => real_filter)\n when \"onthefly\" then ldap_req.search( :base => ldap_data.base_dn, :filter => filter, :attributes => attributes ).first\n end\n # Return\n return entry\n end", "def ldap_host_2\n @attributes[:ldap_host_2]\n end", "def search(basedn, scope, deref, filter)\n #raise LDAP::ResultError::UnwillingToPerform, \"Bad base DN\" unless basedn == BASEDN\n #raise LDAP::ResultError::UnwillingToPerform, \"Bad filter\" unless filter[0..1] == [:eq, \"uid\"]\n uid = filter[3]\n @@pool.borrow do |sql|\n q = \"select login_id,passwd from #{TABLE} where login='#{sql.quote(uid)}'\"\n puts \"SQL Query #{sql.object_id}: #{q}\" if $debug\n res = sql.query(q)\n res.each do |login_id,passwd|\n @@cache.add(login_id, passwd)\n send_SearchResultEntry(\"id=#{login_id},#{BASEDN}\", {\n \"maildir\"=>[\"/netapp/#{uid}/\"],\n })\n end\n end\n end", "def ldap_attr(attr_name)\n Devise::LDAP::Adapter.get_ldap_param(login, attr_name).first\n rescue NoMethodError\n # return blank when ldap does not have the desired attribute.\n logger.warn \"LDAP attribute '#{attr_name}' not found for '#{login}'\"\n ''\n end", "def probe_identity_source_ldap_server_probe_ldap_server_with_http_info(identity_source_ldap_server, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_identity_source_ldap_server_probe_ldap_server ...'\n end\n # verify the required parameter 'identity_source_ldap_server' is set\n if @api_client.config.client_side_validation && identity_source_ldap_server.nil?\n fail ArgumentError, \"Missing the required parameter 'identity_source_ldap_server' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_identity_source_ldap_server_probe_ldap_server\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=probe_ldap_server'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(identity_source_ldap_server)\n auth_names = ['BasicAuth']\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 => 'IdentitySourceLdapServerProbeResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_identity_source_ldap_server_probe_ldap_server\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def fetch_identity_source_ldap_server_certificate_fetch_certificate_with_http_info(identity_source_ldap_server_endpoint, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.fetch_identity_source_ldap_server_certificate_fetch_certificate ...'\n end\n # verify the required parameter 'identity_source_ldap_server_endpoint' is set\n if @api_client.config.client_side_validation && identity_source_ldap_server_endpoint.nil?\n fail ArgumentError, \"Missing the required parameter 'identity_source_ldap_server_endpoint' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.fetch_identity_source_ldap_server_certificate_fetch_certificate\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=fetch_certificate'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(identity_source_ldap_server_endpoint)\n auth_names = ['BasicAuth']\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 => 'PeerCertificateChain')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#fetch_identity_source_ldap_server_certificate_fetch_certificate\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def read(syntax = Net::LDAP::AsnSyntax)\n ber_object =\n instrument \"read.net_ldap_connection\", :syntax => syntax do |payload|\n @conn.read_ber(syntax) do |id, content_length|\n payload[:object_type_id] = id\n payload[:content_length] = content_length\n end\n end\n\n return unless ber_object\n\n instrument \"parse_pdu.net_ldap_connection\" do |payload|\n pdu = payload[:pdu] = Net::LDAP::PDU.new(ber_object)\n\n payload[:message_id] = pdu.message_id\n payload[:app_tag] = pdu.app_tag\n\n pdu\n end\n end", "def get_account(domain,samaccountname,attrs = [])\n ldap = ldap_connect(domain)\n treebase = domain.gsub(/\\./, ',dc=')\n treebase = treebase.insert(0, 'dc=')\n filter = Net::LDAP::Filter.eq(\"samaccountname\", samaccountname)\n attrs = [ \"dn\", \"cn\", \"samaccountname\", \"mail\" ] if attrs.length == 0\n results = ldap.search(:base => treebase, :filter => filter, :attributes => attrs)\n if results.length == 0\n return nil\n else\n results.each do |entry|\n return entry\n end\n end\n end", "def login_from_other_sources\n result = nil\n # Takes the first entry that doesn't return false\n sorcery_config.login_sources.find do |source|\n result = send(source)\n end\n return result if result\n\n nil\n end", "def get_source_and_collection\n source_uri = N::URI.from_encoded(params[:source])\n collection_uri = N::URI.from_encoded(params[:collection])\n source = TaliaCore::ActiveSource.find(source_uri)\n collection = TaliaCollection.find(collection_uri)\n @source_id = params[:source]\n @source = TaliaSource.find(source.id)\n [ source, collection ]\n end", "def get_identification_type\n if user_signed_in?\n @identification_type = current_user.cvs.find_by(params[:identification_type])\n end\n end", "def get_all_sources_info\n source_info = {}\n METADATA_FIELDS.keys.each { |ns|\n source_info[ns] = get_metadata_source_info(ns)\n }\n source_info\n end", "def get_mapping(cid)\n dir = ASF::SVN['ldap-map']\n filename = File.join(dir, MAPPING_FILE).untaint\n maps = JSON.parse(File.read(filename))\n if maps.has_key?(cid)\n return maps[cid]\n else\n return { COMMITTERID => cid }\n end\nend", "def source\n @attributes[:source]\n end", "def source\n @attributes[:source]\n end", "def identify( source=nil, **options )\n\t\tresponse = self.server.run_with_json_template( :identify, source, **options )\n\n\t\tdata = response.first\n\t\treturn Hglib::Repo::Id.new( **data )\n\tend", "def show\n @nome_completo = Devise::LDAP::Adapter.get_ldap_param(current_user.username,\"cn\").first.force_encoding(\"utf-8\")\n end", "def show\n @datasource = Datasource.find(params[:id])\n end", "def sid\n open['sid']\n end", "def read_replica_source_db_instance_identifier\n data[:read_replica_source_db_instance_identifier]\n end", "def get(identity)\n data = service.describe_db_security_groups(identity).body['DescribeDBSecurityGroupsResult']['DBSecurityGroups'].first\n new(data) # data is an attribute hash\n rescue Fog::AWS::RDS::NotFound\n nil\n end", "def get_source_info(ns:DEFAULT_NAMESPACE)\n emsg = \"#{ns} should be one of these values: #{allowed_values_for_ns}\"\n raise ArgumentError.new(emsg) unless allowed_values_for_ns.include?(ns)\n chk_key = ns.to_sym\n if METADATA_FIELDS.has_key?(chk_key)\n get_metadata_source_info(chk_key)\n elsif ns == NAMESPACE_ALL\n get_all_sources_info\n end\n\n end", "def get_datasource()\n # was an input file arg provided?\n if ($input_file)\n # yes -- use local xml file as source\n source_xml = get_local_datasource($input_file)\n else\n # no -- get sourcex xml from account\n source_xml = get_remote_datasource($account, $userid, $passwd, $instance_id)\n end\n\n dsobj = Nokogiri::XML(source_xml)\n\n return dsobj\n end", "def set_cla_source\n @cla_source = ClaSource.find(params[:id])\n end", "def source\n @source ||= PublicEarth::Db::Source.for_user(self)\n end", "def locate_from_identity(identity)\n query(email: identity.email).union(query(id: identity.user_id)).first\n end", "def ad_query_by_username(username)\n \n user = nil\n search_filter = Net::LDAP::Filter.eq( \"sAMAccountName\", username ) \n ad_connection = ADMapper::Connection.current_connection\n ad_connection.search(:base => ADMapper::Connection.treebase,\n :filter => search_filter, \n :attributes => ['dn','sAMAccountName','displayname','SN','givenName']) do |ad_user| \n user = ad_user\n end\n user\n end", "def datasource_by_id(datasource_id)\n datasource = @datasources.select { |_name, ds| ds.id == datasource_id.to_i }.values.first\n raise DatasourceDoesNotExistError.new('id', datasource_id) unless datasource\n\n datasource\n end", "def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n skip_accounts = ['CORP$']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n if skip_accounts.include? entry.sAMAccountName.first.to_s\n next\n end\n\n begin\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :mail => entry.mail.first.to_s,\n :pwdays => 0,\n :notify => false,\n }\n rescue\n puts \"Caught exception: #{entry.inspect}\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n acct[:pwdays] = numDays\n $accounts.push acct\n end\n\n end\nend", "def credential_get(nuid)\n self.class.get(\"/credential/#{nuid}\")\n end", "def source_id source\n source.is_a?(NewsApi::Source) ? source.id : source\n end", "def slapd_db_config_index\n ::File.basename(slapd_db_config_file).match(/{(\\d+)}#{ node['ca_openldap']['db_backend'] }\\.ldif/)[1]\n end", "def get_entry( branch )\n\t\tself.log.debug \"Looking up entry for %p\" % [ branch.dn ]\n\t\treturn self.conn.search_ext2( branch.dn, SCOPE[:base], '(objectClass=*)' ).first\n\trescue LDAP::ResultError => err\n\t\tself.log.info \" search for %p failed: %s\" % [ branch.dn, err.message ]\n\t\treturn nil\n\tend", "def ldap_secure\n @attributes[:ldap_secure]\n end", "def probe_identity_source_ldap_server_probe_ldap_server(identity_source_ldap_server, opts = {})\n data, _status_code, _headers = probe_identity_source_ldap_server_probe_ldap_server_with_http_info(identity_source_ldap_server, opts)\n data\n end", "def displayName\n dn = @params['dn']\n if dn\n dn.first\n else\n nil\n end\n end", "def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :pwdays => 0,\n :notify => false,\n }\n\n if entry.respond_to? :mail\n acct[:mail] = entry.mail.first.to_s\n else\n acct[:mail] = \"im-bigdata-pgh-sysadmins@wwpdl.vnet.ibm.com\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n next # These passwords have already expired.\n end\n\n # Send a notice 14, 7, 3, 2 and 1 days before expiration\n if [14, 7, 3, 2, 1].include? numDays\n acct[:notify] = true\n acct[:pwDays] = numDays\n end\n\n $accounts.push acct\n end\nend", "def campus_solutions_id\n @net_ldap_entry[:berkeleyeducsid].first\n end", "def account_sources(source)\n get('account/sources', {'source' => source})\n end" ]
[ "0.6929651", "0.6626802", "0.61915314", "0.59994817", "0.599063", "0.588267", "0.585672", "0.58158505", "0.56406635", "0.5612808", "0.5599504", "0.5595735", "0.55811137", "0.5580492", "0.55786854", "0.5471295", "0.5376232", "0.53758705", "0.53758705", "0.53758705", "0.53758705", "0.53615284", "0.53409415", "0.53404504", "0.5328555", "0.5290846", "0.52881944", "0.5280302", "0.5269072", "0.52557224", "0.5247587", "0.52400994", "0.5233018", "0.52328324", "0.52036816", "0.5200239", "0.5173769", "0.5163879", "0.51549953", "0.5142465", "0.51285857", "0.51147395", "0.50862753", "0.5066682", "0.5064944", "0.50597054", "0.50594664", "0.5050349", "0.50440663", "0.5030127", "0.5024295", "0.5024184", "0.49929252", "0.49928883", "0.4992141", "0.49899292", "0.49678183", "0.49678183", "0.49635705", "0.49552497", "0.49547338", "0.495033", "0.4932099", "0.4924479", "0.49096856", "0.49067336", "0.48877564", "0.48853898", "0.48853296", "0.4878941", "0.4870612", "0.486105", "0.4838869", "0.4837578", "0.48258495", "0.48258495", "0.48145324", "0.480897", "0.4807025", "0.48005417", "0.4796632", "0.4778563", "0.47777826", "0.47750723", "0.4771472", "0.47702238", "0.47680286", "0.4760399", "0.47535247", "0.47463697", "0.47339424", "0.4729987", "0.47195378", "0.47191447", "0.47112876", "0.47065794", "0.4705888", "0.46992898", "0.46982592", "0.469071" ]
0.6827542
1
Read a single LDAP identity source Return details about one LDAP identity source
def read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source ...' end # verify the required parameter 'ldap_identity_source_id' is set if @api_client.config.client_side_validation && ldap_identity_source_id.nil? fail ArgumentError, "Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source" end # resource path local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'LdapIdentitySource') if @api_client.config.debugging @api_client.config.logger.debug "API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#read_ldap_identity_source\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_ldap_identity_source(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def show\n @ldap_auth_header = Irm::LdapAuthHeader.list_all.find(params[:id])\n puts @ldap_auth_header.ldap_source.name\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ldap_auth_header }\n end\n end", "def search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}/search'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'filter_value'] = opts[:'filter_value'] if !opts[:'filter_value'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceSearchResultList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#search_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_ldap_details(username)\n search_filter = Net::LDAP::Filter.eq(\"uid\", username)\n result = LDAP_CONNECTION.search(:filter => search_filter)\n puts result.inspect\nend", "def search_ldap_identity_source(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def get_ldap_id\n\t\tself.id = Devise::LDAP::Adapter.get_ldap_param(self.username,\"uidnumber\").first\n end", "def get_user_details_from_ldap(username)\n\tresult_attrs = [\"uid\", \"displayName\", \"mail\"]\n\tsearch_filter = Net::LDAP::Filter.eq(\"uid\", username)\n\tLDAP_CONNECTION.search(:filter => search_filter, :attributes => result_attrs) { |item| \n\t puts \"#{item.uid.first}: #{item.displayName.first} (#{item.mail.first})\" \n\t}\n\t\nend", "def ldap\n @attributes[:ldap]\n end", "def student_id\n @net_ldap_entry[:berkeleyedustuid].first\n end", "def get_source_data(source_name:, catalog_id:)\n response = HTTParty.get(\"#{@host}/api/sources/#{source_name}\", query: {\n catalog_id: catalog_id,\n api_key: @api_key\n })\n \n return response[\"source\"]\n end", "def find(source = @source)\n scope = 0\n filter = \"(objectClass=*)\"\n if source.respond_to?(:search2_ext)\n source.search2(\n to_s,\n scope,\n filter\n )\n elsif source.respond_to?(:search)\n Array(source.search(\n :base => to_s,\n :scope => scope,\n :filter => filter,\n :limit => 1\n ))\n else\n raise RuntimeError, \"missing or invalid source for LDAP search\", caller\n end.first\n end", "def read_server_role(srcn)\n\n filter1 = Net::LDAP::Filter.eq( \"objectclass\", \"serverRole\" )\n filter2 = Net::LDAP::Filter.eq( \"cn\", srcn )\n filter = Net::LDAP::Filter.join(filter1, filter2)\n attrs = [ ]\n\n $conn.search(:base => $basedomainsr,\n :filter => filter) do |entry|\n serverrole = entry\n\n return serverrole\n end\nend", "def ldap_username\n @attributes[:ldap_username]\n end", "def ldap_server\n get_attribute_from_auth_source('host')\n end", "def probe_unconfigured_ldap_identity_source_probe_identity_source_with_http_info(ldap_identity_source, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source' is set\n if @api_client.config.client_side_validation && ldap_identity_source.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=probe_identity_source'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(ldap_identity_source)\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceProbeResults')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_unconfigured_ldap_identity_source_probe_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def source\n @source ||= ::Incident.includes(current_user: :contacts).find_by(uuid: payload[\"source\"][\"id\"])\n end", "def all_info\n LdapUser.retrieve_all_information self.login \n end", "def source_id\n @ole.sourceID\n end", "def source_id\n @ole.sourceID\n end", "def source_id\n @ole.sourceID\n end", "def source_id\n @ole.sourceID\n end", "def source_account_id\n data[:source_account_id]\n end", "def source_get\n db_select 'source'\n end", "def get_entry( c, dn ) # :yields: connection_info, distinguished_name\n \n self.bind( c.host, c.port, c.credentials, c.databag_name, c.use_tls ) unless @ldap\n \n entry = @ldap.search( \n base: dn, \n filter: Net::LDAP::Filter.eq( 'objectClass', '*' ),\n scope: Net::LDAP::SearchScope_BaseObject,\n attributes: [ '*' ]\n )\n \n raise \"Error while searching: #{@ldap.get_operation_result.message}\" unless @ldap.get_operation_result.message =~ /(Success|No Such Object)/\n return entry ? entry.first : entry\n end", "def ldap_domain\n @attributes[:ldap_domain]\n end", "def get_authentication_source_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_authentication_source ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling UserApi.get_authentication_source\"\n end\n # resource path\n local_var_path = '/api/3/authentication_sources/{id}'.sub('{' + 'id' + '}', id.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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = 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 => 'AuthenticationSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_authentication_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_authentication_source(id, opts = {})\n data, _status_code, _headers = get_authentication_source_with_http_info(id, opts)\n data\n end", "def probe_configured_ldap_identity_source_probe_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_configured_ldap_identity_source_probe ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_configured_ldap_identity_source_probe\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}?action=probe'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceProbeResults')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_configured_ldap_identity_source_probe\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_ldap_identity_sources(opts = {})\n data, _status_code, _headers = list_ldap_identity_sources_with_http_info(opts)\n data\n end", "def list_ldap_identity_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/aaa/ldap-identity-sources'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#list_ldap_identity_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def given_name\n @net_ldap_entry[:givenname].first\n end", "def group_get_info(attribs, dir_info)\n attribs = group_record_name_alternatives(attribs)\n\n check_critical_attribute( attribs, :record_name )\n\n command = {action: 'read', scope: 'Groups', value: nil}\n user_attrs = attribs.merge(command)\n\n dscl( user_attrs, dir_info )\n end", "def find_by_external_authentication_uid(external_authentication_uid)\n finder = table.where(:external_authentication_uid => external_authentication_uid)\n if user_data = execute_sql(:read, :user) { finder.first }\n inflate_model(user_data)\n else\n nil\n end\n end", "def get_ldap_data\n if Rails.env.production?\n result = LdapHelper::find_user(self.username)\n\n if result\n self.legacy_id ||= result.try(:employeeNumber).try(:first)\n self.first_name ||= result.try(:givenName).try(:first)\n self.last_name ||= result.try(:sn).try(:first)\n self.display_name ||= result.try(:displayName).try(:first)\n self.status ||= result.try(:employeeType).try(:first) || \"potential\"\n self.email ||= result.try(:mail).try(:first) || \"#{username}@fake.me\"\n end\n end\n end", "def read_info(uid)\n grid_info = files_collection.find(filename: uid).first or raise Tus::NotFound\n grid_info[:metadata]\n end", "def show\n @ldap_entry = LdapEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ldap_entry }\n end\n end", "def probe_configured_ldap_identity_source_probe(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = probe_configured_ldap_identity_source_probe_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def show\n ldap = Net::LDAP.new\n @user = @server.users.all#(user_params)\n \n end", "def find_user\n results = @ldap.search( :base => options[:ldap][:base], :filter => user_filter)\n return results.first\n end", "def get_info_source(field_prefix)\n info_source = nil\n return nil if self.fields.keys.find{|k| !k.nil? && k.starts_with?(\"#{field_prefix}.info_source\")}.nil?\n begin\n info_source_id = self.fields.delete(\"#{field_prefix}.info_source.id\")\n if info_source_id.blank?\n info_source_code = self.fields.delete(\"#{field_prefix}.info_source.code\")\n if info_source_code.blank?\n source_name = self.fields.delete(\"#{field_prefix}.info_source.oral.fullname\")\n if !source_name.blank?\n info_source = OralSource.find_by_name(source_name)\n self.say \"Oral source with name #{source_name} was not found.\" if info_source.nil?\n end\n else\n info_source = OralSource.get_by_code(info_source_code)\n self.say \"Info source with code #{info_source_code} was not found.\" if info_source.nil?\n end\n else\n info_source = ShantiIntegration::Source.find(info_source_id)\n self.say \"Info source with Shanti Source ID #{info_source_id} was not found.\" if info_source.nil?\n end \n rescue Exception => e\n self.say e.to_s\n end\n return info_source\n end", "def extract_identity\n @identity = Identity.find_omniauth(omniauth) if omniauth\n end", "def ldap_username_field\n @attributes[:ldap_username_field]\n end", "def ldap\n conf['dashboard']['ldap']\n end", "def populateLDAP\n \n #quit if no email or netid to work with\n return if !self.netid\n \n ldap = Net::LDAP.new(host: 'directory.yale.edu', port: 389)\n b = 'ou=People,o=yale.edu'\n f = Net::LDAP::Filter.eq('uid', self.netid)\n a = %w(givenname sn mail knownAs class college)\n\n p = ldap.search(base: b, filter: f, attributes: a).first\n \n\n\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n if self.fname.blank?\n self.fname = ( p['givenname'] ? p['givenname'][0] : '' )\n end\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n self.save!\n end", "def user_info_by_cid( id )\n\n print \"Looking up user details for #{id}...\"\n\n # lookup the user by computing id\n user_info = Helpers.lookup_user( id )\n if user_info.nil?\n puts \"not found\"\n return nil\n end\n\n puts \"done\"\n return user_info\n end", "def get_metadata_source_info(ns)\n METADATA_FIELDS[ns][:info]\n end", "def get_dn(domain,dn,return_attrs = [])\n scope = Net::LDAP::SearchScope_BaseObject\n ldap = ldap_connect(domain)\n results = ldap.search(:base => dn, :scope => scope, :attributes => return_attrs)\n if (results.nil? || results.length == 0)\n return nil\n else\n results.each do |entry|\n return entry\n end\n end\n end", "def ldap_base_dn\n @attributes[:ldap_base_dn]\n end", "def source_id\n return @source_id\n end", "def provider_identity\n [self.source.name, self.uid].compact.join('_')\n end", "def probe_unconfigured_ldap_identity_source_probe_identity_source(ldap_identity_source, opts = {})\n data, _status_code, _headers = probe_unconfigured_ldap_identity_source_probe_identity_source_with_http_info(ldap_identity_source, opts)\n data\n end", "def get_authentication_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_authentication_sources ...'\n end\n # resource path\n local_var_path = '/api/3/authentication_sources'\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;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = 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 => 'ResourcesAuthenticationSource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_authentication_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find_source_entry\n @source_entry = SourceGlossaryEntry.find params[:source_id]\n end", "def authentication provider=:identity\n Authentication.where(user_id: id, provider: provider).all.first\n end", "def read_ldif(io)\n ds = Net::LDAP::Dataset.new\n io = ChompedIO.new(io)\n\n line = io.gets\n dn = nil\n\n while line\n new_line = io.gets\n\n if new_line =~ /^ /\n line << $'\n else\n nextline = new_line\n\n if line =~ /^#/\n ds.comments << line\n yield :comment, line if block_given?\n elsif line =~ /^version:[\\s]*([0-9]+)$/i\n ds.version = $1\n yield :version, line if block_given?\n elsif line =~ /^dn:([\\:]?)[\\s]*/i\n # $1 is a colon if the dn-value is base-64 encoded\n # $' is the dn-value\n # Avoid the Base64 class because not all Ruby versions have it.\n dn = ($1 == \":\") ? $'.unpack('m').shift : $'\n ds[dn] = Hash.new { |k,v| k[v] = [] }\n yield :dn, dn if block_given?\n elsif line.empty?\n dn = nil\n yield :end, nil if block_given?\n elsif line =~ /^([^:]+):([\\:]?)[\\s]*/\n # $1 is the attribute name\n # $2 is a colon iff the attr-value is base-64 encoded\n # $' is the attr-value\n # Avoid the Base64 class because not all Ruby versions have it.\n attrvalue = ($2 == \":\") ? $'.unpack('m').shift : $'\n ds[dn][$1.downcase.to_sym] << attrvalue\n yield :attr, [$1.downcase.to_sym, attrvalue] if block_given?\n end\n\n line = nextline\n end\n end\n\n ds\n end", "def raw\n Origen.ldap.display(self)\n nil\n end", "def read_replica_source_db_instance_identifier\n @dbi.read_replica_source_db_instance_identifier\n end", "def read_replica_source_db_instance_identifier\n @dbi.read_replica_source_db_instance_identifier\n end", "def slapd_db_config_file\n Dir[\"#{node['ca_openldap']['config_dir']}/cn=config/olcDatabase=\\{*\\}{#{ node['ca_openldap']['db_backend'] }}.ldif\"].first\n end", "def load_ldap ldap_result\n self.reset\n self.from = :ldap\n\n if ldap_result.nil?\n self.errors.add(:query, 'No results were found')\n return\n end\n \n [:cn, :mail, :displayName].each do |key|\n if ldap_result[key].nil?\n self.errors.add key, 'Search result was missing information'\n return\n end\n\n if ldap_result[key].size == 0\n self.errors.add key, 'Search result was missing data'\n return\n end\n \n if ldap_result[key].size != 1\n self.errors.add :query, 'There were too many matches to your search'\n return\n end\n\n if ldap_result[key][0].nil?\n self.errors.add key, 'There were no results for search'\n return\n end\n end\n\n unless ldap_result[:mail].first =~ /\\A[^@]+@[^@]+\\Z/ \n errors.add :email, 'An invalid email address was found in search result'\n end\n \n self.sn = ldap_result[:cn][0].to_s\n self.cn = ldap_result[:cn][0].to_s\n self.email = ldap_result[:mail][0].to_s\n self.displayname = ldap_result[:displayName][0].to_s\n end", "def ldap_person\n @person ||= UCB::LDAP::Person.find_by_uid(self.login) if self.login\n end", "def get_data(login,from)\n ### USER ###\n # acces to user fields\n user_data = User.find_by_login(login)\n # cas_id field of user table\n # cas_id = user_data.cas_id\ncas_id = 1 \n ### CAS ###\n # acces to cas fields\n cas_data = Cas.find_by_id(cas_id)\n # field field of cas table\n ldap_name = cas_data.ldap\n \n ## LDAP ##\n # acces to ldap field\n ldap_data = AuthSourceLdap.find_by_name(ldap_name)\n \n \n # Composition de requête\n auth = {\n :method => :simple,\n :username => ldap_data.account,\n :password => ldap_data.account_password\n }\n \n ldap_req = Net::LDAP::new :host => ldap_data.host, :port => ldap_data.port , :auth => auth\n filter = Net::LDAP::Filter.eq(ldap_data.attr_login, login)\n # Teacher\n labo = Net::LDAP::Filter.construct(ldap_data.filter)\n real_filter = filter & labo\n \n # Informatin to gather from\n attributes = ['givenName', 'sn', 'mail', 'auaStatut', 'eduPersonAffiliation','auaEtapeMillesime', 'supannAffectation']\n \n # CASE\n entry = case from \n when \"staff\" then ldap_req.search(:base => ldap_data.base_dn, :filter => real_filter)\n when \"onthefly\" then ldap_req.search( :base => ldap_data.base_dn, :filter => filter, :attributes => attributes ).first\n end\n # Return\n return entry\n end", "def ldap_host_2\n @attributes[:ldap_host_2]\n end", "def search(basedn, scope, deref, filter)\n #raise LDAP::ResultError::UnwillingToPerform, \"Bad base DN\" unless basedn == BASEDN\n #raise LDAP::ResultError::UnwillingToPerform, \"Bad filter\" unless filter[0..1] == [:eq, \"uid\"]\n uid = filter[3]\n @@pool.borrow do |sql|\n q = \"select login_id,passwd from #{TABLE} where login='#{sql.quote(uid)}'\"\n puts \"SQL Query #{sql.object_id}: #{q}\" if $debug\n res = sql.query(q)\n res.each do |login_id,passwd|\n @@cache.add(login_id, passwd)\n send_SearchResultEntry(\"id=#{login_id},#{BASEDN}\", {\n \"maildir\"=>[\"/netapp/#{uid}/\"],\n })\n end\n end\n end", "def ldap_attr(attr_name)\n Devise::LDAP::Adapter.get_ldap_param(login, attr_name).first\n rescue NoMethodError\n # return blank when ldap does not have the desired attribute.\n logger.warn \"LDAP attribute '#{attr_name}' not found for '#{login}'\"\n ''\n end", "def probe_identity_source_ldap_server_probe_ldap_server_with_http_info(identity_source_ldap_server, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_identity_source_ldap_server_probe_ldap_server ...'\n end\n # verify the required parameter 'identity_source_ldap_server' is set\n if @api_client.config.client_side_validation && identity_source_ldap_server.nil?\n fail ArgumentError, \"Missing the required parameter 'identity_source_ldap_server' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_identity_source_ldap_server_probe_ldap_server\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=probe_ldap_server'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(identity_source_ldap_server)\n auth_names = ['BasicAuth']\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 => 'IdentitySourceLdapServerProbeResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#probe_identity_source_ldap_server_probe_ldap_server\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def fetch_identity_source_ldap_server_certificate_fetch_certificate_with_http_info(identity_source_ldap_server_endpoint, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.fetch_identity_source_ldap_server_certificate_fetch_certificate ...'\n end\n # verify the required parameter 'identity_source_ldap_server_endpoint' is set\n if @api_client.config.client_side_validation && identity_source_ldap_server_endpoint.nil?\n fail ArgumentError, \"Missing the required parameter 'identity_source_ldap_server_endpoint' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.fetch_identity_source_ldap_server_certificate_fetch_certificate\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources?action=fetch_certificate'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(identity_source_ldap_server_endpoint)\n auth_names = ['BasicAuth']\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 => 'PeerCertificateChain')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#fetch_identity_source_ldap_server_certificate_fetch_certificate\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def read(syntax = Net::LDAP::AsnSyntax)\n ber_object =\n instrument \"read.net_ldap_connection\", :syntax => syntax do |payload|\n @conn.read_ber(syntax) do |id, content_length|\n payload[:object_type_id] = id\n payload[:content_length] = content_length\n end\n end\n\n return unless ber_object\n\n instrument \"parse_pdu.net_ldap_connection\" do |payload|\n pdu = payload[:pdu] = Net::LDAP::PDU.new(ber_object)\n\n payload[:message_id] = pdu.message_id\n payload[:app_tag] = pdu.app_tag\n\n pdu\n end\n end", "def get_account(domain,samaccountname,attrs = [])\n ldap = ldap_connect(domain)\n treebase = domain.gsub(/\\./, ',dc=')\n treebase = treebase.insert(0, 'dc=')\n filter = Net::LDAP::Filter.eq(\"samaccountname\", samaccountname)\n attrs = [ \"dn\", \"cn\", \"samaccountname\", \"mail\" ] if attrs.length == 0\n results = ldap.search(:base => treebase, :filter => filter, :attributes => attrs)\n if results.length == 0\n return nil\n else\n results.each do |entry|\n return entry\n end\n end\n end", "def login_from_other_sources\n result = nil\n # Takes the first entry that doesn't return false\n sorcery_config.login_sources.find do |source|\n result = send(source)\n end\n return result if result\n\n nil\n end", "def get_source_and_collection\n source_uri = N::URI.from_encoded(params[:source])\n collection_uri = N::URI.from_encoded(params[:collection])\n source = TaliaCore::ActiveSource.find(source_uri)\n collection = TaliaCollection.find(collection_uri)\n @source_id = params[:source]\n @source = TaliaSource.find(source.id)\n [ source, collection ]\n end", "def get_identification_type\n if user_signed_in?\n @identification_type = current_user.cvs.find_by(params[:identification_type])\n end\n end", "def get_all_sources_info\n source_info = {}\n METADATA_FIELDS.keys.each { |ns|\n source_info[ns] = get_metadata_source_info(ns)\n }\n source_info\n end", "def get_mapping(cid)\n dir = ASF::SVN['ldap-map']\n filename = File.join(dir, MAPPING_FILE).untaint\n maps = JSON.parse(File.read(filename))\n if maps.has_key?(cid)\n return maps[cid]\n else\n return { COMMITTERID => cid }\n end\nend", "def source\n @attributes[:source]\n end", "def source\n @attributes[:source]\n end", "def identify( source=nil, **options )\n\t\tresponse = self.server.run_with_json_template( :identify, source, **options )\n\n\t\tdata = response.first\n\t\treturn Hglib::Repo::Id.new( **data )\n\tend", "def show\n @nome_completo = Devise::LDAP::Adapter.get_ldap_param(current_user.username,\"cn\").first.force_encoding(\"utf-8\")\n end", "def show\n @datasource = Datasource.find(params[:id])\n end", "def sid\n open['sid']\n end", "def read_replica_source_db_instance_identifier\n data[:read_replica_source_db_instance_identifier]\n end", "def get(identity)\n data = service.describe_db_security_groups(identity).body['DescribeDBSecurityGroupsResult']['DBSecurityGroups'].first\n new(data) # data is an attribute hash\n rescue Fog::AWS::RDS::NotFound\n nil\n end", "def get_source_info(ns:DEFAULT_NAMESPACE)\n emsg = \"#{ns} should be one of these values: #{allowed_values_for_ns}\"\n raise ArgumentError.new(emsg) unless allowed_values_for_ns.include?(ns)\n chk_key = ns.to_sym\n if METADATA_FIELDS.has_key?(chk_key)\n get_metadata_source_info(chk_key)\n elsif ns == NAMESPACE_ALL\n get_all_sources_info\n end\n\n end", "def get_datasource()\n # was an input file arg provided?\n if ($input_file)\n # yes -- use local xml file as source\n source_xml = get_local_datasource($input_file)\n else\n # no -- get sourcex xml from account\n source_xml = get_remote_datasource($account, $userid, $passwd, $instance_id)\n end\n\n dsobj = Nokogiri::XML(source_xml)\n\n return dsobj\n end", "def set_cla_source\n @cla_source = ClaSource.find(params[:id])\n end", "def source\n @source ||= PublicEarth::Db::Source.for_user(self)\n end", "def locate_from_identity(identity)\n query(email: identity.email).union(query(id: identity.user_id)).first\n end", "def ad_query_by_username(username)\n \n user = nil\n search_filter = Net::LDAP::Filter.eq( \"sAMAccountName\", username ) \n ad_connection = ADMapper::Connection.current_connection\n ad_connection.search(:base => ADMapper::Connection.treebase,\n :filter => search_filter, \n :attributes => ['dn','sAMAccountName','displayname','SN','givenName']) do |ad_user| \n user = ad_user\n end\n user\n end", "def datasource_by_id(datasource_id)\n datasource = @datasources.select { |_name, ds| ds.id == datasource_id.to_i }.values.first\n raise DatasourceDoesNotExistError.new('id', datasource_id) unless datasource\n\n datasource\n end", "def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n skip_accounts = ['CORP$']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n if skip_accounts.include? entry.sAMAccountName.first.to_s\n next\n end\n\n begin\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :mail => entry.mail.first.to_s,\n :pwdays => 0,\n :notify => false,\n }\n rescue\n puts \"Caught exception: #{entry.inspect}\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n acct[:pwdays] = numDays\n $accounts.push acct\n end\n\n end\nend", "def credential_get(nuid)\n self.class.get(\"/credential/#{nuid}\")\n end", "def source_id source\n source.is_a?(NewsApi::Source) ? source.id : source\n end", "def slapd_db_config_index\n ::File.basename(slapd_db_config_file).match(/{(\\d+)}#{ node['ca_openldap']['db_backend'] }\\.ldif/)[1]\n end", "def get_entry( branch )\n\t\tself.log.debug \"Looking up entry for %p\" % [ branch.dn ]\n\t\treturn self.conn.search_ext2( branch.dn, SCOPE[:base], '(objectClass=*)' ).first\n\trescue LDAP::ResultError => err\n\t\tself.log.info \" search for %p failed: %s\" % [ branch.dn, err.message ]\n\t\treturn nil\n\tend", "def ldap_secure\n @attributes[:ldap_secure]\n end", "def probe_identity_source_ldap_server_probe_ldap_server(identity_source_ldap_server, opts = {})\n data, _status_code, _headers = probe_identity_source_ldap_server_probe_ldap_server_with_http_info(identity_source_ldap_server, opts)\n data\n end", "def displayName\n dn = @params['dn']\n if dn\n dn.first\n else\n nil\n end\n end", "def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :pwdays => 0,\n :notify => false,\n }\n\n if entry.respond_to? :mail\n acct[:mail] = entry.mail.first.to_s\n else\n acct[:mail] = \"im-bigdata-pgh-sysadmins@wwpdl.vnet.ibm.com\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n next # These passwords have already expired.\n end\n\n # Send a notice 14, 7, 3, 2 and 1 days before expiration\n if [14, 7, 3, 2, 1].include? numDays\n acct[:notify] = true\n acct[:pwDays] = numDays\n end\n\n $accounts.push acct\n end\nend", "def campus_solutions_id\n @net_ldap_entry[:berkeleyeducsid].first\n end", "def account_sources(source)\n get('account/sources', {'source' => source})\n end" ]
[ "0.6827542", "0.6626802", "0.61915314", "0.59994817", "0.599063", "0.588267", "0.585672", "0.58158505", "0.56406635", "0.5612808", "0.5599504", "0.5595735", "0.55811137", "0.5580492", "0.55786854", "0.5471295", "0.5376232", "0.53758705", "0.53758705", "0.53758705", "0.53758705", "0.53615284", "0.53409415", "0.53404504", "0.5328555", "0.5290846", "0.52881944", "0.5280302", "0.5269072", "0.52557224", "0.5247587", "0.52400994", "0.5233018", "0.52328324", "0.52036816", "0.5200239", "0.5173769", "0.5163879", "0.51549953", "0.5142465", "0.51285857", "0.51147395", "0.50862753", "0.5066682", "0.5064944", "0.50597054", "0.50594664", "0.5050349", "0.50440663", "0.5030127", "0.5024295", "0.5024184", "0.49929252", "0.49928883", "0.4992141", "0.49899292", "0.49678183", "0.49678183", "0.49635705", "0.49552497", "0.49547338", "0.495033", "0.4932099", "0.4924479", "0.49096856", "0.49067336", "0.48877564", "0.48853898", "0.48853296", "0.4878941", "0.4870612", "0.486105", "0.4838869", "0.4837578", "0.48258495", "0.48258495", "0.48145324", "0.480897", "0.4807025", "0.48005417", "0.4796632", "0.4778563", "0.47777826", "0.47750723", "0.4771472", "0.47702238", "0.47680286", "0.4760399", "0.47535247", "0.47463697", "0.47339424", "0.4729987", "0.47195378", "0.47191447", "0.47112876", "0.47065794", "0.4705888", "0.46992898", "0.46982592", "0.469071" ]
0.6929651
0
Search the LDAP identity source Search the LDAP identity source for users and groups that match the given filter_value. In most cases, the LDAP source performs a caseinsensitive search.
def search_ldap_identity_source(ldap_identity_source_id, opts = {}) data, _status_code, _headers = search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(basedn, scope, deref, filter)\n #raise LDAP::ResultError::UnwillingToPerform, \"Bad base DN\" unless basedn == BASEDN\n #raise LDAP::ResultError::UnwillingToPerform, \"Bad filter\" unless filter[0..1] == [:eq, \"uid\"]\n uid = filter[3]\n @@pool.borrow do |sql|\n q = \"select login_id,passwd from #{TABLE} where login='#{sql.quote(uid)}'\"\n puts \"SQL Query #{sql.object_id}: #{q}\" if $debug\n res = sql.query(q)\n res.each do |login_id,passwd|\n @@cache.add(login_id, passwd)\n send_SearchResultEntry(\"id=#{login_id},#{BASEDN}\", {\n \"maildir\"=>[\"/netapp/#{uid}/\"],\n })\n end\n end\n end", "def get_ldap_details(username)\n search_filter = Net::LDAP::Filter.eq(\"uid\", username)\n result = LDAP_CONNECTION.search(:filter => search_filter)\n puts result.inspect\nend", "def user_filter\n username_attribute = options[:ldap][:username_attribute] || default_username_attribute\n\n filter = Net::LDAP::Filter.eq(username_attribute, @username)\n unless @options[:ldap][:filter].blank?\n filter &= Net::LDAP::Filter.construct(@options[:ldap][:filter])\n end\n\n filter\n end", "def filter(uid: '*')\n Net::LDAP::Filter.eq('uid', uid)\n end", "def ldapsearch(filter)\n raise ArgumentError.new(\"You must pass a block to ldapsearch\") unless block_given?\n\n found = false\n count = 0\n\n begin\n connection.search(search_base, 2, filter, search_attributes) do |entry|\n found = true\n yield entry\n end\n rescue SystemExit,NoMemoryError\n raise\n rescue Exception => detail\n if count == 0\n # Try reconnecting to ldap if we get an exception and we haven't yet retried.\n count += 1\n @connection = nil\n Puppet.warning \"Retrying LDAP connection\"\n retry\n else\n error = Puppet::Error.new(\"LDAP Search failed\")\n error.set_backtrace(detail.backtrace)\n raise error\n end\n end\n\n found\n end", "def find(search_value)\r\n cases = [search_value.downcase, search_value.capitalize, search_value.upcase]\r\n users = Array.new\r\n\r\n cases.each do |value|\r\n users.concat(Array.new(User.all(:login.like => \"%#{value}%\") |\r\n User.all(:firstname.like => \"%#{value}%\") |\r\n User.all(:lastname.like => \"%#{value}%\")))\r\n end\r\n\r\n # Delete user which searching for other users\r\n users.delete(self)\r\n\r\n return false if users.empty?\r\n\r\n users.map! { |user| { login: user.login,\r\n firstname: user.firstname,\r\n lastname: user.lastname }}\r\n users = users.uniq\r\n end", "def filter(username)\n clas = Net::LDAP::Filter.eq('objectClass', @config[:object_class])\n uid = Net::LDAP::Filter.eq(@config[:user_attr], username)\n filter = clas & uid\n if group = @config[:groupdn]\n memberOf = Net::LDAP::Filter.eq('memberOf', group)\n isMemberOf = Net::LDAP::Filter.eq('isMemberOf', group)\n filter = filter & (memberOf | isMemberOf)\n end\n filter\n end", "def do_search_for(key, value)\n search_term = self.send(\"filter_by_#{key}\", value)\n prepare_search_term_for(key, search_term)\n end", "def search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source ...'\n end\n # verify the required parameter 'ldap_identity_source_id' is set\n if @api_client.config.client_side_validation && ldap_identity_source_id.nil?\n fail ArgumentError, \"Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source\"\n end\n # resource path\n local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}/search'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'filter_value'] = opts[:'filter_value'] if !opts[:'filter_value'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 => 'LdapIdentitySourceSearchResultList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#search_ldap_identity_source\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def uid_search(*args)\n search_internal([\"UID\", \"SEARCH\"], *args)\n end", "def search_filter(name)\n raise Puppet::DevError, \"No search string set for LDAP terminus for #{self.name}\"\n end", "def search_by_user(user, additional_filters={})\n additional_filters[:user] = user\n return search(additional_filters)\n end", "def find(source = @source)\n scope = 0\n filter = \"(objectClass=*)\"\n if source.respond_to?(:search2_ext)\n source.search2(\n to_s,\n scope,\n filter\n )\n elsif source.respond_to?(:search)\n Array(source.search(\n :base => to_s,\n :scope => scope,\n :filter => filter,\n :limit => 1\n ))\n else\n raise RuntimeError, \"missing or invalid source for LDAP search\", caller\n end.first\n end", "def filter=(value)\n # nil and false disable the filter\n return @filter = false unless value # rubocop:disable Lint/ReturnInVoidContext\n\n @filter = value.to_s.downcase\n end", "def search(sfilter = nil)\n sfilter ||= filter\n\n result = []\n connect do |conn|\n conn.search2(base, 1, sfilter) do |entry|\n result << entry2provider(entry)\n end\n end\n return(result.empty? ? nil : result)\n end", "def do_search_for(key, value)\n join_by = join_for(value)\n search_elements = parse_into_search_elements(key, value)\n filter = \"\"\n num_elements = search_elements.size\n search_elements.each_with_index do |term, x|\n search_term = self.send(\"filter_by_#{key}\", term)\n filter += (prepare_search_term_for(key, search_term) + join_if_more(x, num_elements, join_by))\n end\n filter\n end", "def do_search_for(key, value)\n join_by = join_for(value)\n search_elements = parse_into_search_elements(key, value)\n filter = \"\"\n num_elements = search_elements.size\n search_elements.each_with_index do |term, x|\n search_term = self.send(\"filter_by_#{key}\", term)\n filter += (prepare_search_term_for(key, search_term) + join_if_more(x, num_elements, join_by))\n end\n filter\n end", "def search_ldap_by_username(str, credentials = {}, wildcard: false, limit: 20)\n credentials = determine_credentials(credentials)\n LdapQuery::Query.perform(credentials, attr: :cn, val: str, wildcard: wildcard, limit: limit)\n end", "def search_users(wildcard_email_address)\n filter = Net::LDAP::Filter.eq(ENTITY_ATTR_MAPPING[:email].to_s, wildcard_email_address)\n return search_map_user_fields(filter)\n end", "def search_for_login\n @login_ldap_entry ||= begin\n DeviseLdapNorm::Logger.send(\"LDAP search for login: #{@attribute}=#{@login}\")\n filter = Net::LDAP::Filter.eq(@attribute.to_s, @login.to_s)\n ldap_entry = nil\n match_count = 0\n @ldap.search(:filter => filter) {|entry| ldap_entry = entry; match_count+=1}\n DeviseLdapNorm::Logger.send(\"LDAP search yielded #{match_count} matches\")\n ldap_entry\n end\n end", "def activedirectory_users(opts, accountname_expr = 'jturner')\n\n ldap = Net::LDAP.new :host => opts[:ldaphost],\n\t:port => opts[:ldapport],\n\t:auth => {\n\t:method => :simple,\n\t:username => opts[:binddn],\n\t:password => opts[:bindpassword]\n \n }\n\n filter = Net::LDAP::Filter.construct(\"(&(objectCategory=Person)(sAMAccountName=#{accountname_expr}))\")\n\n ldap.search(\n\t:base => opts[:basedn],\n\t:filter => filter,\n\t:attributes => [:samaccountname, :displayname, :mail, :telephonenumber, :description, :department, :company, :physicaldeliveryofficename, :streetaddress, :l, :st, :postalcode, :co, :thumbnailPhoto]\n ) \nend", "def addGroupsToSearchContext(key, value)\n begin\n owner = User.find_by_username(key)\n if owner == nil\n puts \"Couldn't find owner of the group\"\n return\n end\n # Split the value, if multiple values\n values = value.split(' ')\n values.each do |x|\n \n # Find the group and users in it\n group = Group.find_by_name(x)\n if group != nil\n group.users.each do |u|\n addUsersToSearchContext(u.username)\n end\n addUsersToSearchContext(owner.username)\n end \n end\n rescue => e\n puts \"Problem adding group to search context. E: #{e}\"\n end\n end", "def case_sensitive_matching=(value)\n @case_sensitive_matching = value\n end", "def query_ldap(session_handle, base, scope, filter, fields)\n vprint_status(\"Searching LDAP directory\")\n search = wldap32.ldap_search_sA(session_handle, base, scope, filter, nil, 0, 4)\n vprint_status(\"search: #{search}\")\n\n if search['return'] == LDAP_SIZELIMIT_EXCEEDED\n print_error(\"LDAP_SIZELIMIT_EXCEEDED, parsing what we retrieved, try increasing the MAX_SEARCH value [0:LDAP_NO_LIMIT]\")\n elsif search['return'] != Error::SUCCESS\n print_error(\"No results\")\n wldap32.ldap_msgfree(search['res'])\n return\n end\n\n search_count = wldap32.ldap_count_entries(session_handle, search['res'])['return']\n\n if search_count == 0\n print_error(\"No entries retrieved\")\n wldap32.ldap_msgfree(search['res'])\n return\n end\n\n print_status(\"Entries retrieved: #{search_count}\")\n\n pEntries = []\n entry_results = []\n\n if datastore['MAX_SEARCH'] == 0\n max_search = search_count\n else\n max_search = [datastore['MAX_SEARCH'], search_count].min\n end\n\n 0.upto(max_search - 1) do |i|\n\n if(i==0)\n pEntries[0] = wldap32.ldap_first_entry(session_handle, search['res'])['return']\n end\n\n if(pEntries[i] == 0)\n print_error(\"Failed to get entry\")\n wldap32.ldap_msgfree(search['res'])\n return\n end\n\n vprint_status(\"Entry #{i}: 0x#{pEntries[i].to_s(16)}\")\n\n entry = get_entry(pEntries[i])\n\n # Entries are a linked list...\n if client.arch == ARCH_X64\n pEntries[i+1] = entry[4]\n else\n pEntries[i+1] = entry[3]\n end\n\n ber = get_ber(entry)\n\n field_results = []\n fields.each do |field|\n vprint_status(\"Field: #{field}\")\n\n values = get_values_from_ber(ber, field)\n\n values_result = \"\"\n values_result = values.join(',') if values\n vprint_status(\"Values #{values}\")\n\n field_results << {:type => 'unknown', :value => values_result}\n end\n\n entry_results << field_results\n end\n\n return {\n :fields => fields,\n :results => entry_results\n }\n end", "def search_query_for(group)\n { q: \"uid:(#{group.map { |e| \"\\\"#{e.uid}\\\"\" }.join(' OR ')})\",\n def_type: 'lucene',\n facet: false,\n fl: @options[:fl] ? @options[:fl] :\n (@options[:fulltext] ?\n RLetters::Solr::Connection::DEFAULT_FIELDS_FULLTEXT :\n RLetters::Solr::Connection::DEFAULT_FIELDS),\n tv: @options[:term_vectors] || false,\n rows: group.size }\n end", "def ldap_authenticate \n filter = Net::LDAP::Filter.eq(\"uid\",\"#{username}\")\n \n ldap_connection.search(:base => ldap_treebase, :filter => filter, :attributes => ldap_attrs, :return_result => false) do |entry|\n return true\n end\n \n self.errors.add(:username, \" is invalid\")\n return false\n end", "def addUsersToSearchContext(value)\n begin\n values = value.split(' ')\n values.each do |x|\n \n # Find each user and add its information to the search context\n user = User.find_by_username(x)\n if user != nil\n @context.merge!({:user=> user})\n puts \"Added user: #{user.username} to the search context\"\n user.devices.each do |d|\n @device_ids.push(d.id)\n end\n end\n end\n rescue => e\n puts \"Problem adding user to search context. E: #{e}\"\n end\n end", "def find_user\n results = @ldap.search( :base => options[:ldap][:base], :filter => user_filter)\n return results.first\n end", "def ldap_search(attr,query)\n\t\tload \"#{$pwd}/plugins/config/ldap_config.rb\"\n\t\n\t\t# ldap_return auth (below) is a function from auth_ldap.rb that returns a\n\t\t# hash with the username and password to bind to LDAP with.\n\t\tldap_config = return_ldap_config\n\n\t\thost = 'ldap.oit.pdx.edu'\n\t\tport = 636\n \t\tauth = { :method => :simple, :username => ldap_config['username'], :password => ldap_config['pass'] }\n\t\tbase = 'dc=pdx,dc=edu'\n\t\n\t\tresult = Hash.new(Array.new)\n\t\tNet::LDAP.open(:host => host, :port => port, :auth => auth, :encryption => :simple_tls, :base => base) do |ldap|\n\t\t\t\n\t\t\t# Perform the search, then return a hash with LDAP attributes corresponding\n\t\t\t# to hash keys, and LDAP values corresponding to hash values.\n\t\t\tfilter = Net::LDAP::Filter.eq(attr,query)\n\t\t\tif (ldap.bind)\n\t\t\t\tldap.search(:filter => filter) do |entry|\n\t\t\t\t\tentry.each do |attribute, values|\n\t\t\t\t\t\tvalues.each do |value|\n\t\t\t\t\t\t\tresult[\"#{attribute}\"] += [\"#{value}\"]\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tresult = false\n\t\t\tend\n\t\tend\n\n\t\treturn result\n\tend", "def find_filter_word_matches(filter_value, filter_list: :filters)\n sanitized_value = filter_value.downcase\n flatten_filters(filter_list).select do |filter|\n filter.downcase == sanitized_value || filter.split.map(&:downcase).include?(sanitized_value)\n end\n end", "def search(search)\n query = if Rails.env.development?\n 'name like ?'\n else\n 'name ilike ?'\n end\n User.where(query, \"%#{search}%\")\n end", "def find_filter_matches(filter_value, filter_list: :filters)\n flatten_filters(filter_list).select { |filter| filter.match(/#{Regexp.escape(filter_value)}/i) }.map(&:to_s)\n end", "def filter(value)\n @filter_rx = value\n end", "def search(field, value)\n @rows.select {|row| get_variable(row, field).downcase == value.downcase}\n end", "def search filter\n if filter && is_searchable?\n filter = [filter, Chronic.parse(filter).strftime(\"%Y-%m-%d\")] rescue filter\n handle_joins(self.fields, scoped.select(\"DISTINCT(`#{self.table_name}`.`id`), `#{self.table_name}`.*\"))\n .where(build_filter(filter, self.fields))\n else\n scoped\n end\n end", "def search\n # params[:query] populated by query text input field\n # here we search for users that match input email\n @users = User.where(email: params[:query])\n end", "def membership(user_dn, group_names)\n search(filter: group_filter(group_names, user_dn))\n end", "def search( c, basedn, *constraints ) # :yields: connection_info, basedn, filter, scope\n\n self.bind( c.host, c.port, c.credentials, c.databag_name, c.use_tls ) unless @ldap\n\n raise \"Must specify base dn for search\" unless basedn\n\n ( filter, scope, attributes ) = constraints\n filter = filter.nil? ? Net::LDAP::Filter.eq( 'objectClass', '*' ) : filter\n\n case scope\n when 'base'\n scope = Net::LDAP::SearchScope_BaseObject\n when 'one'\n scope = Net::LDAP::SearchScope_SingleLevel\n else\n scope = Net::LDAP::SearchScope_WholeSubtree\n end\n\n scope = scope.nil? ? Net::LDAP::SearchScope_BaseObject : scope\n attributes = attributes.nil? ? [ '*' ] : attributes\n\n entries = @ldap.search( \n base: basedn, \n filter: filter,\n scope: scope,\n attributes: attributes\n )\n\n raise \"Error while searching: #{@ldap.get_operation_result.message}\" unless @ldap.get_operation_result.message =~ /(Success|No Such Object)/\n return entries\n end", "def projects_matching_filter\n # rubocop: disable CodeReuse/Finder\n projects_nested_in_group = Project.where(namespace_id: hierarchy_for_parent.base_and_descendants.select(:id))\n params_with_search = params.merge(search: params[:filter])\n\n ProjectsFinder.new(params: params_with_search,\n current_user: current_user,\n project_ids_relation: projects_nested_in_group).execute\n # rubocop: enable CodeReuse/Finder\n end", "def set_SearchForUser(value)\n set_input(\"SearchForUser\", value)\n end", "def get_users(host, base='dc=griddynamics,dc=net', scope=LDAP::LDAP_SCOPE_SUBTREE, filter='(objectclass=person)')\n\n puts \"Getting users from #{host} with base #{base} with filter #{filter}\"\n\n attrs = ['uid', 'mail', 'sn', 'givenName' ,'cn', 'sshPublicKey']\n\n conn = LDAP::Conn.new(host)\n\n puts \"Connection received: #{conn.inspect}\"\n\n conn.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n\n puts conn.bind('','')\n\n conn.perror(\"bind\")\n\n begin\n users = Hash.new\n\n conn.search(base, scope, filter, attrs) { |entry|\n groups = []\n entry.dn.split(',').each { |dn|\n tmp = dn.split('=')\n if tmp[0] == 'ou'\n groups << tmp[1]\n end\n }\n\n if groups.include?('people') and groups.include?('griddynamics') and not groups.include?('deleted')\n users[entry.vals('uid')[0].dup] = {\n :email => entry.vals('mail')[0].dup,\n :name => entry.vals('givenName')[0].dup,\n :last_name => entry.vals('sn')[0].dup,\n :full_name => entry.vals('cn')[0].dup,\n :ssh_public_key => entry.vals('sshPublicKey').nil? ? nil : entry.vals('sshPublicKey')[0].dup,\n :groups => groups.dup\n }\n end\n }\n return users\n rescue LDAP::ResultError\n conn.perror(\"search\")\n exit\n end\n conn.perror(\"search\")\n conn.unbind\nend", "def filter(val)\n raise \"filter requires a String.\" unless val.is_a? String\n @filter = val\n self\n end", "def usernamesearch(field_hash)\n usersearch(field_hash)\n end", "def search_ldap_by_group(str, credentials = {}, wildcard: false, limit: 20)\n credentials = determine_credentials(credentials)\n LdapQuery::Query.perform(credentials, attr: :memberof, val: str, wildcard: wildcard, limit: limit)\n end", "def apply_filter(query, filter, value)\n return [query] if query.blank? || filter.blank? || value.blank?\n return [query] if filter.noop?\n\n klass = filter.klass || query.klass\n column = filter.column\n value = filter.values.call(value) if filter.values.present?\n\n queries = []\n\n if column.present?\n target_column = \"#{klass.table_name}.#{column}\"\n\n if filter.data_type == DateTime\n target_column = \"date_trunc('second', #{target_column})\"\n end\n\n vals = Array(value)\n value = []\n q = []\n\n vals.each do |val|\n if klass.columns_hash[column.to_s] && klass.columns_hash[column.to_s].type == :integer && !(val.to_s.strip =~ /\\A\\d+\\Z/)\n q << '0 = 1'\n else\n q << \"LOWER(#{target_column}::varchar) LIKE LOWER(?)\"\n value << \"%#{val}%\"\n end\n end\n\n queries << \"(#{q.join(' OR ')})\" if q.any?\n elsif filter.query.present?\n query, query_list, value_list = filter.query.call(query, value)\n queries = Array(query_list)\n value = Array(value_list)\n elsif filter.having.present?\n query = query.having(\"LOWER((#{filter.having})::varchar) LIKE ?\", \"%#{Array(value).first}%\")\n end\n\n [query, queries, value]\n end", "def search(base, filter = nil, attributes = nil)\n rows = []\n \n timeout_status = nil\n search_status = nil\n begin\n timeout_status = Timeout::timeout(60) do\n @ds.search(:base => base, :filter => filter, :attributes => attributes) do |entry|\n if ((!entry.nil?) && (entry[:cn] != []))\n rows << entry\n end \n end\n \n search_status = @ds.get_operation_result\n end\n rescue Timeout::Error => te\n ret = {\n :status => 0,\n :message => \"Connection to LDAP timed out\",\n :values => nil\n }\n return ret\n rescue Exception => e\n pp [\"exception\", e]\n end\n \n if (search_status.code == 0)\n ret = {\n :status => 1,\n :message => \"Success\",\n :values => rows\n }\n else\n ret = {\n :status => 0,\n :message => \"Net-LDAP Error #{search_status.code}: #{search_status.message}\",\n :values => nil\n }\n end\n \n return ret\n end", "def search_map_user_fields(filter, max_recs=nil, raw=false)\n # search for all fields plus the description field\n Net::LDAP.open(@ldap_conf) do |ldap|\n attributes = COMBINED_LDAP_ATTR_MAPPING.keys + [LDAP_DESCRIPTION_FIELD] + (raw ? LDAP_WO_CONSTANTS.keys : [])\n arr = ldap.search(:filter => filter, :attributes => attributes).to_a()\n if !max_recs\n max_recs = arr.length\n end\n\n # if the raw ldap records were requested then return them\n return arr if raw\n\n # process them into records\n return arr[0..(max_recs-1)].map do |entry|\n user_rec = {}\n COMBINED_LDAP_ATTR_MAPPING.each do |ldap_k, rec_k|\n attr_val = entry[ldap_k].is_a?(Array) ? entry[ldap_k][0] : entry[ldap_k]\n user_rec[rec_k] = LDAP_DATETIME_FIELDS.include?(ldap_k) ? DateTime.iso8601(attr_val) : attr_val\n end\n\n # unpack the fields that are stored in the description field\n desc = (entry[LDAP_DESCRIPTION_FIELD] ? entry[LDAP_DESCRIPTION_FIELD] : [])[0]\n # handle packed fields deliminated by carriage return, newline, comma, or space\n desc = desc.gsub(/tenant=([^\\s,]+)[,\\s]+/, \"tenant=\\\\1\\n\") unless desc == nil\n unpacked_fields = if desc && (desc.strip != \"\")\n mapping = desc.strip().split(\"\\n\").map {|x| x.strip}\n mapping = mapping.map do |x|\n x.split(\"=\").map {|y| y.strip }\n end\n mapping = Hash[mapping]\n else\n {}\n end\n PACKED_ENTITY_FIELD_MAPPING.each do |rec_k, packed_k|\n if unpacked_fields.include?(packed_k)\n user_rec[rec_k] = unpacked_fields[packed_k]\n end\n end\n\n user_rec\n end\n end\n end", "def set_filter(val)\n @filter = val\n build_path_query\n @filter\n end", "def search_by_customer_id(value)\n if session[:customer_id]\n if session[:customer_id] == \"All\"\n value\n else\n value.where('customer_id=?', session[:customer_id])\n end\n else\n value\n end\n end", "def parse_group filter\n /^\\(cn=(.*)\\)$/.match(filter)[1]\n end", "def uhook_filtered_search filters = {}\n create_scopes(filters) do |filter, value|\n case filter\n when :locale\n {:conditions => {:locale => value}}\n end\n end\n end", "def search_by_username(search_username)\n #will return all values except the current user\n User.find(:all, :conditions => [\"username LIKE ? AND username <> ?\", \"%#{search_username}%\", \"#{self.username}\"])\n end", "def search(records, field, criteria)\n records.where(\"#{field} = ?\", encrypt(criteria))\n end", "def user_search(search_criteria)\n found_user = nil\n as_manager do | conn |\n conn.search(user_root_dn,\n LDAP::LDAP_SCOPE_SUBTREE,\n ldap_user_search_criteria(search_criteria),\n SEARCH_RETURN_ATTRS) do | entry |\n found_user = entry.to_hash\n end\n end\n found_user\n end", "def search(args = nil)\n args ||= {}\n\n # filtering, scoping, search base\n # filter: https://tools.ietf.org/html/rfc4511#section-4.5.1.7\n # base: https://tools.ietf.org/html/rfc4511#section-4.5.1.1\n # scope: https://tools.ietf.org/html/rfc4511#section-4.5.1.2\n filter = args[:filter] || Net::LDAP::Filter.eq(\"objectClass\", \"*\")\n base = args[:base]\n scope = args[:scope] || Net::LDAP::SearchScope_WholeSubtree\n\n # attr handling\n # attrs: https://tools.ietf.org/html/rfc4511#section-4.5.1.8\n # attrs_only: https://tools.ietf.org/html/rfc4511#section-4.5.1.6\n attrs = Array(args[:attributes])\n attrs_only = args[:attributes_only] == true\n\n # references\n # refs: https://tools.ietf.org/html/rfc4511#section-4.5.3\n # deref: https://tools.ietf.org/html/rfc4511#section-4.5.1.3\n refs = args[:return_referrals] == true\n deref = args[:deref] || Net::LDAP::DerefAliases_Never\n\n # limiting, paging, sorting\n # size: https://tools.ietf.org/html/rfc4511#section-4.5.1.4\n # time: https://tools.ietf.org/html/rfc4511#section-4.5.1.5\n size = args[:size].to_i\n time = args[:time].to_i\n paged = args[:paged_searches_supported]\n sort = args.fetch(:sort_controls, false)\n\n # arg validation\n raise ArgumentError, \"search base is required\" unless base\n raise ArgumentError, \"invalid search-size\" unless size >= 0\n raise ArgumentError, \"invalid search scope\" unless Net::LDAP::SearchScopes.include?(scope)\n raise ArgumentError, \"invalid alias dereferencing value\" unless Net::LDAP::DerefAliasesArray.include?(deref)\n\n # arg transforms\n filter = Net::LDAP::Filter.construct(filter) if filter.is_a?(String)\n ber_attrs = attrs.map { |attr| attr.to_s.to_ber }\n ber_sort = encode_sort_controls(sort)\n\n # An interesting value for the size limit would be close to A/D's\n # built-in page limit of 1000 records, but openLDAP newer than version\n # 2.2.0 chokes on anything bigger than 126. You get a silent error that\n # is easily visible by running slapd in debug mode. Go figure.\n #\n # Changed this around 06Sep06 to support a caller-specified search-size\n # limit. Because we ALWAYS do paged searches, we have to work around the\n # problem that it's not legal to specify a \"normal\" sizelimit (in the\n # body of the search request) that is larger than the page size we're\n # requesting. Unfortunately, I have the feeling that this will break\n # with LDAP servers that don't support paged searches!!!\n #\n # (Because we pass zero as the sizelimit on search rounds when the\n # remaining limit is larger than our max page size of 126. In these\n # cases, I think the caller's search limit will be ignored!)\n #\n # CONFIRMED: This code doesn't work on LDAPs that don't support paged\n # searches when the size limit is larger than 126. We're going to have\n # to do a root-DSE record search and not do a paged search if the LDAP\n # doesn't support it. Yuck.\n rfc2696_cookie = [126, \"\"]\n result_pdu = nil\n n_results = 0\n\n message_id = next_msgid\n\n instrument \"search.net_ldap_connection\",\n message_id: message_id,\n filter: filter,\n base: base,\n scope: scope,\n size: size,\n time: time,\n sort: sort,\n referrals: refs,\n deref: deref,\n attributes: attrs do |payload|\n loop do\n # should collect this into a private helper to clarify the structure\n query_limit = 0\n if size > 0\n if paged\n query_limit = (((size - n_results) < 126) ? (size -\n n_results) : 0)\n else\n query_limit = size\n end\n end\n\n request = [\n base.to_ber,\n scope.to_ber_enumerated,\n deref.to_ber_enumerated,\n query_limit.to_ber, # size limit\n time.to_ber,\n attrs_only.to_ber,\n filter.to_ber,\n ber_attrs.to_ber_sequence\n ].to_ber_appsequence(Net::LDAP::PDU::SearchRequest)\n\n # rfc2696_cookie sometimes contains binary data from Microsoft Active Directory\n # this breaks when calling to_ber. (Can't force binary data to UTF-8)\n # we have to disable paging (even though server supports it) to get around this...\n\n controls = []\n controls <<\n [\n Net::LDAP::LDAPControls::PAGED_RESULTS.to_ber,\n # Criticality MUST be false to interoperate with normal LDAPs.\n false.to_ber,\n rfc2696_cookie.map{ |v| v.to_ber}.to_ber_sequence.to_s.to_ber\n ].to_ber_sequence if paged\n controls << ber_sort if ber_sort\n controls = controls.empty? ? nil : controls.to_ber_contextspecific(0)\n\n write(request, controls, message_id)\n\n result_pdu = nil\n controls = []\n\n while pdu = queued_read(message_id)\n case pdu.app_tag\n when Net::LDAP::PDU::SearchReturnedData\n n_results += 1\n yield pdu.search_entry if block_given?\n when Net::LDAP::PDU::SearchResultReferral\n if refs\n if block_given?\n se = Net::LDAP::Entry.new\n se[:search_referrals] = (pdu.search_referrals || [])\n yield se\n end\n end\n when Net::LDAP::PDU::SearchResult\n result_pdu = pdu\n controls = pdu.result_controls\n if refs && pdu.result_code == Net::LDAP::ResultCodeReferral\n if block_given?\n se = Net::LDAP::Entry.new\n se[:search_referrals] = (pdu.search_referrals || [])\n yield se\n end\n end\n break\n else\n raise Net::LDAP::ResponseTypeInvalidError, \"invalid response-type in search: #{pdu.app_tag}\"\n end\n end\n\n # count number of pages of results\n payload[:page_count] ||= 0\n payload[:page_count] += 1\n\n # When we get here, we have seen a type-5 response. If there is no\n # error AND there is an RFC-2696 cookie, then query again for the next\n # page of results. If not, we're done. Don't screw this up or we'll\n # break every search we do.\n #\n # Noticed 02Sep06, look at the read_ber call in this loop, shouldn't\n # that have a parameter of AsnSyntax? Does this just accidentally\n # work? According to RFC-2696, the value expected in this position is\n # of type OCTET STRING, covered in the default syntax supported by\n # read_ber, so I guess we're ok.\n more_pages = false\n if result_pdu.result_code == Net::LDAP::ResultCodeSuccess and controls\n controls.each do |c|\n if c.oid == Net::LDAP::LDAPControls::PAGED_RESULTS\n # just in case some bogus server sends us more than 1 of these.\n more_pages = false\n if c.value and c.value.length > 0\n cookie = c.value.read_ber[1]\n if cookie and cookie.length > 0\n rfc2696_cookie[1] = cookie\n more_pages = true\n end\n end\n end\n end\n end\n\n break unless more_pages\n end # loop\n\n # track total result count\n payload[:result_count] = n_results\n\n result_pdu || OpenStruct.new(:status => :failure, :result_code => Net::LDAP::ResultCodeOperationsError, :message => \"Invalid search\")\n end # instrument\n ensure\n\n # clean up message queue for this search\n messages = message_queue.delete(message_id)\n\n # in the exceptional case some messages were *not* consumed from the queue,\n # instrument the event but do not fail.\n if !messages.nil? && !messages.empty?\n instrument \"search_messages_unread.net_ldap_connection\",\n message_id: message_id, messages: messages\n end\n end", "def search_ldap_by_other(credentials = {}, attr: nil, val: nil, wildcard: false, limit: 20)\n raise(AttributeError, 'a valid attribute name and value must be supplied to query against') if attr.nil? || val.nil?\n\n credentials = determine_credentials(credentials)\n LdapQuery::Query.perform(credentials, attr: attr, val: val, wildcard: wildcard, limit: limit)\n end", "def index\n\t\t\n\t\t# @admins=User.where(admin: true)\n\t #Only show users that aren't admin(only the community are shown)\n\t @users = User.where(admin: false).order(\"first_name ASC\")\n\n\t if params[:search_user].present?\t\n\t \t#Storing user with capital letter on first letter of name and rest downcase.\n\n user_search= params[:search_user].downcase.split(\" \")\n \t\n @users= @users.where(\"first_name ILIKE ? OR last_name ILIKE ? OR last_name ILIKE ?\", \"#{user_search[0]}\", \"#{user_search[1]}\",\"#{user_search[0]}\")\n \n end\n end", "def filter=(val)\n set_filter(val)\n val\n end", "def users(filter = {})\n handler[:people].filter(filter)\n end", "def search\n @users = User.where('full_name ilike ?', \"%#{params[:query].strip}%\")\n if @users.length.zero?\n flash[:notice] = \"#{params[:query]} not found\"\n redirect_to users_path\n else\n render 'index'\n end\n end", "def search_ldap_by_name(str, credentials = {}, wildcard: false, limit: 20)\n credentials = determine_credentials(credentials)\n LdapQuery::Query.perform(credentials, attr: :displayname, val: str, wildcard: wildcard, limit: limit)\n end", "def search_for_login(connection=nil)\n connection ||= self\n @login_ldap_entry ||= begin\n DeviseLdapAuthenticatable::Logger.send(\"LDAP search for login: #{@attribute}=#{@login}\")\n filter = Net::LDAP::Filter.eq(@attribute.to_s, @login.to_s)\n ldap_entry = nil\n match_count = 0\n connection.open do |ldap|\n ldap.search(:filter => filter) {|entry| ldap_entry = entry; match_count+=1}\n end\n DeviseLdapAuthenticatable::Logger.send(\"LDAP search yielded #{match_count} matches\")\n ldap_entry\n end\n end", "def index\n\n @organization_id = params[:organization_id].to_i\n @search_text = params[:search_text]\n @role = params[:role].split(\",\") if params[:role]\n @id_filter_list = params[:ids]\n\n # Start to set up the query\n conditions = []\n values = []\n\n if @organization_id.to_i > 0\n conditions << 'users_organizations.organization_id = ?'\n values << @organization_id\n else\n conditions << 'users_organizations.organization_id IN (?)'\n values << @organization_list\n end\n\n\n unless @search_text.blank?\n # get the list of searchable fields from the asset class\n searchable_fields = User.new.searchable_fields\n # create an OR query for each field\n query_str = []\n first = true\n # parameterize the search based on the selected search parameter\n search_value = get_search_value(@search_text, @search_param)\n # Construct the query based on the searchable fields for the model\n searchable_fields.each do |field|\n if first\n first = false\n query_str << '('\n else\n query_str << ' OR '\n end\n\n query_str << \"UPPER(users.#{field})\"\n query_str << ' LIKE ? '\n # add the value in for this sub clause\n values << search_value.upcase\n end\n query_str << ')' unless searchable_fields.empty?\n\n conditions << [query_str.join]\n end\n\n unless @id_filter_list.blank?\n conditions << 'object_key in (?)'\n values << @id_filter_list\n end\n\n if params[:show_active_only].nil?\n @show_active_only = 'active'\n else\n @show_active_only = params[:show_active_only]\n end\n\n if @show_active_only == 'active'\n conditions << 'users.active = ?'\n values << true\n elsif @show_active_only == 'inactive'\n conditions << 'users.active = ?'\n values << false\n end\n\n # Get the Users but check to see if a role was selected\n @users = User.unscoped.distinct.joins(:organization).order('organizations.organization_type_id', 'organizations.short_name', :last_name).joins(:organizations).includes(:organization,:roles).where(conditions.join(' AND '), *values)\n\n unless @role.blank?\n all_users = @users\n @users = @users.with_role(@role[0])\n @role[1..-1].each do |r|\n @users = @users.or(all_users.with_role(r))\n end\n end\n\n if params[:sort] && params[:order]\n case params[:sort]\n when 'organization'\n @users = @users.reorder(\"organizations.short_name #{params[:order]}\")\n # figure out sorting by role + privilege some other way\n # when 'role_name'\n # @users = @users.joins(:roles).merge(Role.unscoped.order(name: params[:order]))\n # when 'privilege_names'\n # @users = @users.joins(:roles).merge(Role.order(privilege: params[:order]))\n else\n @users = @users.reorder(params[:sort] => params[:order])\n end\n end\n\n # Set the breadcrumbs\n if @organization_list.count == 1\n org = Organization.find(@organization_list.first)\n add_breadcrumb org.short_name, users_path(:organization_id => org.id)\n end\n if @role.present?\n role_string = @role.kind_of?(Array) ? Role.find_by(name: @role).try(:label).try(:parameterize).try(:underscore) : @role\n add_breadcrumb role_string.titleize, users_path(:role => role_string) if role_string\n end\n\n # remember the view type\n @view_type = get_view_type(SESSION_VIEW_TYPE_VAR)\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json {\n # render :json => {\n # :total => @users.count,\n # :rows => @users.limit(params[:limit]).offset(params[:offset]).collect{ |u|\n # u.as_json.merge!({\n # organization_short_name: u.organization.short_name,\n # organization_name: u.organization.name,\n # role_name: !@role.blank? && (@role.kind_of?(Array) ? !Role.find_by(name:@role.first).privilege : !Role.find_by(name: @role).privilege) ? (@role.kind_of?(Array) ? u.roles.roles.where(name: @role).last.label : u.roles.roles.find_by(name: @role).label) : u.roles.roles.last.label,\n # privilege_names: u.roles.privileges.collect{|x| x.label}.join(', '),\n # all_orgs: u.organizations.map{ |o| o.to_s }.join(', ')\n # })\n # }\n # }\n # }\n\n end\n end", "def search_users(term, value)\n results = @users_indice.search(term: term, value: value)\n if perform_search_by_id?(term)\n results.each do |user|\n # Get related organizations\n user['organizations'] =\n @organizations_indice.search_by_primary_key(value: user['organization_id'])\n\n # Get submitted tickets related to user\n user['submitted_tickets'] =\n @tickets_indice.search(term: 'submitter_id', value: user['_id'])\n\n # Get assigned tickets related to user\n user['assigned_tickets'] =\n @tickets_indice.search(term: 'assignee_id', value: user['_id'])\n end\n end\n results\n end", "def search(*args)\n search_provider.search(*args)\n end", "def index\n if params[:search]\n @groups = Group.search((params[:search]).to_s.downcase)\n end\n end", "def search(value)\n return @searchMethods.searchAtTree(value, @root)\n end", "def search( base, scope=:subtree, filter='(objectClass=*)', options={} )\n\t\tcollectclass = nil\n\n\t\t# If the base argument is an object whose class knows how to create instances of itself\n\t\t# from an LDAP::Entry, use it instead of Treequel::Branch to wrap results\n\t\tif options.key?( :results_class )\n\t\t\tcollectclass = options.delete( :results_class )\n\t\telse\n\t\t\tcollectclass = base.class.respond_to?( :new_from_entry ) ?\n\t\t\t\tbase.class :\n\t\t\t\tself.results_class\n\t\tend\n\n\t\t# Format the arguments in the way #search_ext2 expects them\n\t\tbase_dn, scope, filter, searchopts =\n\t\t\tself.normalize_search_parameters( base, scope, filter, options )\n\n\t\t# Unwrap the search options from the hash in the correct order\n\t\tself.log.debug do\n\t\t\tattrlist = SEARCH_PARAMETER_ORDER.inject([]) do |list, param|\n\t\t\t\tlist << \"%s: %p\" % [ param, searchopts[param] ]\n\t\t\tend\n\t\t\t\"searching with base: %p, scope: %p, filter: %p, %s\" %\n\t\t\t\t[ base_dn, scope, filter, attrlist.join(', ') ]\n\t\tend\n\t\tparameters = searchopts.values_at( *SEARCH_PARAMETER_ORDER )\n\n\t\t# Wrap each result in the class derived from the 'base' argument\n\t\tself.log.debug \"Searching via search_ext2 with arguments: %p\" % [[\n\t\t\tbase_dn, scope, filter, *parameters\n\t\t]]\n\n\t\tresults = []\n\t\tself.conn.search_ext2( base_dn, scope, filter, *parameters ).each do |entry|\n\t\t\tbranch = collectclass.new_from_entry( entry, self )\n\t\t\tbranch.include_operational_attrs = true if\n\t\t\t\tbase.respond_to?( :include_operational_attrs? ) &&\n\t\t\t\tbase.include_operational_attrs?\n\n\t\t\tif block_given?\n\t\t\t\tresults << yield( branch )\n\t\t\telse\n\t\t\t\tresults << branch\n\t\t\tend\n\t\tend\n\n\t\treturn results\n\trescue RuntimeError => err\n\t\tconn = self.conn\n\n\t\t# The LDAP library raises a plain RuntimeError with an incorrect message if the\n\t\t# connection goes away, so it's caught here to rewrap it\n\t\tcase err.message\n\t\twhen /no result returned by search/i\n\t\t\traise LDAP::ResultError.new( LDAP.err2string(conn.err) )\n\t\telse\n\t\t\traise\n\t\tend\n\tend", "def index\n @filter = params[:filter] if params.has_key? :filter and %w{unapproved invited}.include? params[:filter]\n\n if params[:search]\n @search = User.search { fulltext params[:search] }\n @users = user_query.where(id: @search.results.map(&:id))\n else\n @users = user_query.order(updated_at: :desc)\n end\n end", "def return_exact_results\n\t# make empty array that will contain all users whose first_name, last_name, or email exactly matches a given string\n\texact_search_results = []\n\n\tUser.all.each do |user|\n\t\tif user.first_name == user.search_term || user.last_name == search_term || user.email == search_term\n\t\t\texact_search_results.push user.id\n\t\telse\n\t\t\t# do nothing if search term is not exactly\n\t\tend\n\tend\n\texact_search_results\nend", "def searchUsing(filter)\n @zqlQuery = filter\n end", "def group_invitable_users\n group = Group.find(params[:group_id])\n @users = User.where(\"LOWER(name) LIKE ?\", \"%#{@query}%\")\n .where.not(id: group.members).limit(10)\n .sort_by { |user| SearchScore.name(user.name, @query) }\n\n render \"users\"\n end", "def search\n @users ||= User.search_user(params[:search])\n authorize! :read, @user\n end", "def filters_include?(filter_value, filter_list: :filters)\n flatten_filters(filter_list).map(&:downcase).include? filter_value.downcase\n end", "def user_search\n @users = User.admin_search(params[:query])\n end", "def bind_by_username\n username_attribute = options[:ldap][:username_attribute] || default_username_attribute\n\n @ldap.bind_as(:base => @options[:ldap][:base], :password => @password, :filter => user_filter)\n end", "def ldapSearchLookup(key) \n answer = []\n filter = Net::LDAP::Filter.from_rfc4515(key)\n conf = Config[:ldap] \n treebase = conf[:base]\n Hiera.debug(\"Searching #{key} in LDAP backend, base #{treebase}.\")\n searchresult = @connection.search(:filter => filter)\n\n for i in 0..searchresult.length-1 do\n answer[i] = {}\n searchresult[i].each do |attribute, values|\n Hiera.debug( \" #{attribute}:\")\n answer[i][attribute.to_s] = values\n values.each do |value|\n Hiera.debug( \" ---->#{value}:\")\n end\n end\n end\n return answer\n end", "def search_filter(search_term)\n @items = @items.where('client_name like ? OR client_ssn like ? OR case_id like ?', \"%#{search_term}%\", \"%#{search_term}%\", \"%#{search_term}%\")\n @old_items = @items.where('client_name like ? OR client_ssn like ? OR case_id like ?', \"%#{search_term}%\", \"%#{search_term}%\", \"%#{search_term}%\")\n session[:search] = search_term\n end", "def get_user_details_from_ldap(username)\n\tresult_attrs = [\"uid\", \"displayName\", \"mail\"]\n\tsearch_filter = Net::LDAP::Filter.eq(\"uid\", username)\n\tLDAP_CONNECTION.search(:filter => search_filter, :attributes => result_attrs) { |item| \n\t puts \"#{item.uid.first}: #{item.displayName.first} (#{item.mail.first})\" \n\t}\n\t\nend", "def search\n @lawyer = User.first\n expertise = Expertise.find_by_id(params[:id])\n @users = UserExpertise.where(expertise_id: expertise)\n end", "def search(user, query, collection, wiki)\n end", "def user_search # :nologin: :norobots:\n pattern = params[:pattern].to_s\n if pattern.match(/^\\d+$/) &&\n (user = User.safe_find(pattern))\n redirect_to(action: \"show_user\", id: user.id)\n else\n query = create_query(:User, :pattern_search, pattern: pattern)\n show_selected_users(query)\n end\n end", "def updateFilter(sender)\n CanastoLog.debug @searchField.stringValue\n end", "def user_search\n pattern = params[:pattern].to_s\n if pattern.match(/^\\d+$/) &&\n (user = User.safe_find(pattern))\n redirect_to(action: \"show_user\", id: user.id)\n else\n query = create_query(:User, :pattern_search, pattern: pattern)\n show_selected_users(query)\n end\n end", "def user_collaboration_search(q, limit=10)\n if q.present? and q.length > 1\n already_exists_ids = []\n already_exists_emails = []\n # add owner\n # already_exists_ids << self.user_id\n # add colaborators\n if self.users.present?\n already_exists_ids << self.users.map{|x| x.id}\n end\n # add invitations\n pending = Invitation.pending_by_story(self.id)\n if pending.present?\n already_exists_emails << pending.map{|x| x.to_email}\n end\n\n already_exists_ids.flatten!\n already_exists_emails.flatten!\n\n sql = \"\"\n if already_exists_ids.present? && already_exists_emails.present?\n sql = \"!(id in (:ids) or email in (:emails)) and \"\n elsif already_exists_ids.present?\n sql = \"!(id in (:ids)) and \"\n elsif already_exists_emails.present?\n sql = \"!(email in (:emails)) and \"\n end\n sql << \"(nickname like :search or email_no_domain like :search)\"\n users = User.where([sql,\n :ids => already_exists_ids.uniq,\n :emails => already_exists_emails.uniq,\n :search => \"%#{q}%\"])\n .limit(limit)\n return users\n end\n end", "def search (query_string)\n\n OpenWFE::Extras::Workitem.search(query_string, store_names).find_all do |wi|\n\n @user.admin? or (\n wi.store_name != 'users' || wi.participant_name == @user.name)\n end\n end", "def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end", "def search(value)\n record_ids = []\n\n hash(value).each do |tri|\n if ids = index[tri]\n record_ids += ids\n end\n end\n record_ids.uniq!\n\n record_ids.collect { |id| records[id] }\n end", "def construct_ilike_search(table, field, value, concat = \"AND\")\n \"#{concat} #{table}.#{field} ILIKE '#{sanitize(value)}'\" if value.present?\n end", "def search(query, case_type: :smart)\n WWID.new.fuzzy_filter_items(self, query, case_type: case_type)\n end", "def search_options_for(filter:, attributes:)\n {}.tap do |opts|\n group_base = APP_CONFIG[\"ldap\"][\"group_base\"]\n opts[:base] = group_base if group_base.present?\n opts[:filter] = Net::LDAP::Filter.construct(filter)\n opts[:attributes] = attributes\n end\n end", "def search(value)\n # YOUR WORK HERE\n end", "def invitation_search(q, limit=10)\n if q.present? and q.length > 1\n already_exists_ids = []\n already_exists_emails = []\n # add owner\n already_exists_ids << self.id\n # add colaborators\n if self.members.present?\n already_exists_ids << self.members.map{|x| x.member_id}\n end\n # add invitations\n pending = Invitation.pending_from_user(self.id)\n if pending.present?\n already_exists_emails << pending.map{|x| x.to_email}\n end\n\n already_exists_ids.flatten!\n already_exists_emails.flatten!\n\n users = User.any_of({first_name: /#{q}/i}, {last_name: /#{q}/i}, {email_no_domain: /#{q}/i}).limit(limit)\n if already_exists_ids.present? && already_exists_emails.present?\n users = users.not_in({id: already_exists_ids.uniq, email: already_exists_emails.uniq})\n elsif already_exists_ids.present?\n users = users.not_in({id: already_exists_ids.uniq})\n elsif already_exists_emails.present?\n users = users.not_in({email: already_exists_emails.uniq})\n end\n\n return users\n end\n end", "def filterredir(value)\n _filterredir(value) or fail ArgumentError, \"Unknown value for filterredir: #{value}\"\n end", "def find_resource(_field, value)\n query = <<-SQL.squish\n LOWER(username) = :value OR LOWER(email) = :value\n SQL\n\n @resource = resource_class.where(query, value: value).first\n end", "def search(options)\n options[:base] = @base_name\n options[:attributes] ||= %w{ou cn dn sAMAccountName member}\n options[:ignore_server_caps] ||= true\n\n @connection.search(options)\n end", "def search(term)\n # TODO: Select the Contact instances from the 'contacts.csv' file whose name or email attributes contain the search term.\n Contact.all.select do |contact|\n contact.name.downcase.match(term) || contact.email.downcase.match(term)\n end\n end", "def filter(field, value)\n @filters << [field, value]\n @loaded = false\n self\n end", "def filter(value)\n true\n end", "def apply_attribute_filter(filter, value)\n self.scope = scope.where(filter => value)\n end" ]
[ "0.6211908", "0.5757533", "0.5701406", "0.5689939", "0.5651422", "0.5638755", "0.5631808", "0.55178046", "0.5498491", "0.5498253", "0.5439008", "0.5393417", "0.53746533", "0.5328625", "0.52728313", "0.5264735", "0.5264735", "0.52619094", "0.52588075", "0.5253779", "0.5244372", "0.5232043", "0.5222137", "0.5206224", "0.51648605", "0.51511794", "0.5144575", "0.51068455", "0.5103735", "0.5099979", "0.50806874", "0.50366455", "0.5036377", "0.5012913", "0.50077426", "0.4983913", "0.4976933", "0.4967557", "0.49546203", "0.49404663", "0.49298152", "0.49249744", "0.48942384", "0.48904717", "0.4889331", "0.48678535", "0.48667946", "0.4857641", "0.48397073", "0.4823245", "0.47827652", "0.47747594", "0.47730353", "0.47701117", "0.47647414", "0.47545603", "0.4752132", "0.47476768", "0.47280604", "0.4726813", "0.47197202", "0.47139162", "0.4707282", "0.47053835", "0.4703769", "0.470122", "0.46995926", "0.4698111", "0.46968982", "0.46856287", "0.46745583", "0.4667396", "0.46654254", "0.46650365", "0.4658767", "0.46535084", "0.46456543", "0.46301186", "0.46165577", "0.46144846", "0.46084931", "0.46057177", "0.4598127", "0.45969954", "0.45962316", "0.45923173", "0.45799285", "0.457414", "0.45714927", "0.45701393", "0.45579106", "0.4542977", "0.4541295", "0.45366845", "0.45355383", "0.4524299", "0.45215014", "0.45206147", "0.4514747", "0.4506416" ]
0.5224638
22
Search the LDAP identity source Search the LDAP identity source for users and groups that match the given filter_value. In most cases, the LDAP source performs a caseinsensitive search.
def search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source ...' end # verify the required parameter 'ldap_identity_source_id' is set if @api_client.config.client_side_validation && ldap_identity_source_id.nil? fail ArgumentError, "Missing the required parameter 'ldap_identity_source_id' when calling SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.search_ldap_identity_source" end # resource path local_var_path = '/aaa/ldap-identity-sources/{ldap-identity-source-id}/search'.sub('{' + 'ldap-identity-source-id' + '}', ldap_identity_source_id.to_s) # query parameters query_params = {} query_params[:'filter_value'] = opts[:'filter_value'] if !opts[:'filter_value'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'LdapIdentitySourceSearchResultList') if @api_client.config.debugging @api_client.config.logger.debug "API called: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi#search_ldap_identity_source\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(basedn, scope, deref, filter)\n #raise LDAP::ResultError::UnwillingToPerform, \"Bad base DN\" unless basedn == BASEDN\n #raise LDAP::ResultError::UnwillingToPerform, \"Bad filter\" unless filter[0..1] == [:eq, \"uid\"]\n uid = filter[3]\n @@pool.borrow do |sql|\n q = \"select login_id,passwd from #{TABLE} where login='#{sql.quote(uid)}'\"\n puts \"SQL Query #{sql.object_id}: #{q}\" if $debug\n res = sql.query(q)\n res.each do |login_id,passwd|\n @@cache.add(login_id, passwd)\n send_SearchResultEntry(\"id=#{login_id},#{BASEDN}\", {\n \"maildir\"=>[\"/netapp/#{uid}/\"],\n })\n end\n end\n end", "def get_ldap_details(username)\n search_filter = Net::LDAP::Filter.eq(\"uid\", username)\n result = LDAP_CONNECTION.search(:filter => search_filter)\n puts result.inspect\nend", "def user_filter\n username_attribute = options[:ldap][:username_attribute] || default_username_attribute\n\n filter = Net::LDAP::Filter.eq(username_attribute, @username)\n unless @options[:ldap][:filter].blank?\n filter &= Net::LDAP::Filter.construct(@options[:ldap][:filter])\n end\n\n filter\n end", "def filter(uid: '*')\n Net::LDAP::Filter.eq('uid', uid)\n end", "def ldapsearch(filter)\n raise ArgumentError.new(\"You must pass a block to ldapsearch\") unless block_given?\n\n found = false\n count = 0\n\n begin\n connection.search(search_base, 2, filter, search_attributes) do |entry|\n found = true\n yield entry\n end\n rescue SystemExit,NoMemoryError\n raise\n rescue Exception => detail\n if count == 0\n # Try reconnecting to ldap if we get an exception and we haven't yet retried.\n count += 1\n @connection = nil\n Puppet.warning \"Retrying LDAP connection\"\n retry\n else\n error = Puppet::Error.new(\"LDAP Search failed\")\n error.set_backtrace(detail.backtrace)\n raise error\n end\n end\n\n found\n end", "def find(search_value)\r\n cases = [search_value.downcase, search_value.capitalize, search_value.upcase]\r\n users = Array.new\r\n\r\n cases.each do |value|\r\n users.concat(Array.new(User.all(:login.like => \"%#{value}%\") |\r\n User.all(:firstname.like => \"%#{value}%\") |\r\n User.all(:lastname.like => \"%#{value}%\")))\r\n end\r\n\r\n # Delete user which searching for other users\r\n users.delete(self)\r\n\r\n return false if users.empty?\r\n\r\n users.map! { |user| { login: user.login,\r\n firstname: user.firstname,\r\n lastname: user.lastname }}\r\n users = users.uniq\r\n end", "def filter(username)\n clas = Net::LDAP::Filter.eq('objectClass', @config[:object_class])\n uid = Net::LDAP::Filter.eq(@config[:user_attr], username)\n filter = clas & uid\n if group = @config[:groupdn]\n memberOf = Net::LDAP::Filter.eq('memberOf', group)\n isMemberOf = Net::LDAP::Filter.eq('isMemberOf', group)\n filter = filter & (memberOf | isMemberOf)\n end\n filter\n end", "def do_search_for(key, value)\n search_term = self.send(\"filter_by_#{key}\", value)\n prepare_search_term_for(key, search_term)\n end", "def uid_search(*args)\n search_internal([\"UID\", \"SEARCH\"], *args)\n end", "def search_filter(name)\n raise Puppet::DevError, \"No search string set for LDAP terminus for #{self.name}\"\n end", "def search_by_user(user, additional_filters={})\n additional_filters[:user] = user\n return search(additional_filters)\n end", "def find(source = @source)\n scope = 0\n filter = \"(objectClass=*)\"\n if source.respond_to?(:search2_ext)\n source.search2(\n to_s,\n scope,\n filter\n )\n elsif source.respond_to?(:search)\n Array(source.search(\n :base => to_s,\n :scope => scope,\n :filter => filter,\n :limit => 1\n ))\n else\n raise RuntimeError, \"missing or invalid source for LDAP search\", caller\n end.first\n end", "def filter=(value)\n # nil and false disable the filter\n return @filter = false unless value # rubocop:disable Lint/ReturnInVoidContext\n\n @filter = value.to_s.downcase\n end", "def search(sfilter = nil)\n sfilter ||= filter\n\n result = []\n connect do |conn|\n conn.search2(base, 1, sfilter) do |entry|\n result << entry2provider(entry)\n end\n end\n return(result.empty? ? nil : result)\n end", "def do_search_for(key, value)\n join_by = join_for(value)\n search_elements = parse_into_search_elements(key, value)\n filter = \"\"\n num_elements = search_elements.size\n search_elements.each_with_index do |term, x|\n search_term = self.send(\"filter_by_#{key}\", term)\n filter += (prepare_search_term_for(key, search_term) + join_if_more(x, num_elements, join_by))\n end\n filter\n end", "def do_search_for(key, value)\n join_by = join_for(value)\n search_elements = parse_into_search_elements(key, value)\n filter = \"\"\n num_elements = search_elements.size\n search_elements.each_with_index do |term, x|\n search_term = self.send(\"filter_by_#{key}\", term)\n filter += (prepare_search_term_for(key, search_term) + join_if_more(x, num_elements, join_by))\n end\n filter\n end", "def search_ldap_by_username(str, credentials = {}, wildcard: false, limit: 20)\n credentials = determine_credentials(credentials)\n LdapQuery::Query.perform(credentials, attr: :cn, val: str, wildcard: wildcard, limit: limit)\n end", "def search_users(wildcard_email_address)\n filter = Net::LDAP::Filter.eq(ENTITY_ATTR_MAPPING[:email].to_s, wildcard_email_address)\n return search_map_user_fields(filter)\n end", "def search_for_login\n @login_ldap_entry ||= begin\n DeviseLdapNorm::Logger.send(\"LDAP search for login: #{@attribute}=#{@login}\")\n filter = Net::LDAP::Filter.eq(@attribute.to_s, @login.to_s)\n ldap_entry = nil\n match_count = 0\n @ldap.search(:filter => filter) {|entry| ldap_entry = entry; match_count+=1}\n DeviseLdapNorm::Logger.send(\"LDAP search yielded #{match_count} matches\")\n ldap_entry\n end\n end", "def activedirectory_users(opts, accountname_expr = 'jturner')\n\n ldap = Net::LDAP.new :host => opts[:ldaphost],\n\t:port => opts[:ldapport],\n\t:auth => {\n\t:method => :simple,\n\t:username => opts[:binddn],\n\t:password => opts[:bindpassword]\n \n }\n\n filter = Net::LDAP::Filter.construct(\"(&(objectCategory=Person)(sAMAccountName=#{accountname_expr}))\")\n\n ldap.search(\n\t:base => opts[:basedn],\n\t:filter => filter,\n\t:attributes => [:samaccountname, :displayname, :mail, :telephonenumber, :description, :department, :company, :physicaldeliveryofficename, :streetaddress, :l, :st, :postalcode, :co, :thumbnailPhoto]\n ) \nend", "def addGroupsToSearchContext(key, value)\n begin\n owner = User.find_by_username(key)\n if owner == nil\n puts \"Couldn't find owner of the group\"\n return\n end\n # Split the value, if multiple values\n values = value.split(' ')\n values.each do |x|\n \n # Find the group and users in it\n group = Group.find_by_name(x)\n if group != nil\n group.users.each do |u|\n addUsersToSearchContext(u.username)\n end\n addUsersToSearchContext(owner.username)\n end \n end\n rescue => e\n puts \"Problem adding group to search context. E: #{e}\"\n end\n end", "def search_ldap_identity_source(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = search_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n data\n end", "def case_sensitive_matching=(value)\n @case_sensitive_matching = value\n end", "def query_ldap(session_handle, base, scope, filter, fields)\n vprint_status(\"Searching LDAP directory\")\n search = wldap32.ldap_search_sA(session_handle, base, scope, filter, nil, 0, 4)\n vprint_status(\"search: #{search}\")\n\n if search['return'] == LDAP_SIZELIMIT_EXCEEDED\n print_error(\"LDAP_SIZELIMIT_EXCEEDED, parsing what we retrieved, try increasing the MAX_SEARCH value [0:LDAP_NO_LIMIT]\")\n elsif search['return'] != Error::SUCCESS\n print_error(\"No results\")\n wldap32.ldap_msgfree(search['res'])\n return\n end\n\n search_count = wldap32.ldap_count_entries(session_handle, search['res'])['return']\n\n if search_count == 0\n print_error(\"No entries retrieved\")\n wldap32.ldap_msgfree(search['res'])\n return\n end\n\n print_status(\"Entries retrieved: #{search_count}\")\n\n pEntries = []\n entry_results = []\n\n if datastore['MAX_SEARCH'] == 0\n max_search = search_count\n else\n max_search = [datastore['MAX_SEARCH'], search_count].min\n end\n\n 0.upto(max_search - 1) do |i|\n\n if(i==0)\n pEntries[0] = wldap32.ldap_first_entry(session_handle, search['res'])['return']\n end\n\n if(pEntries[i] == 0)\n print_error(\"Failed to get entry\")\n wldap32.ldap_msgfree(search['res'])\n return\n end\n\n vprint_status(\"Entry #{i}: 0x#{pEntries[i].to_s(16)}\")\n\n entry = get_entry(pEntries[i])\n\n # Entries are a linked list...\n if client.arch == ARCH_X64\n pEntries[i+1] = entry[4]\n else\n pEntries[i+1] = entry[3]\n end\n\n ber = get_ber(entry)\n\n field_results = []\n fields.each do |field|\n vprint_status(\"Field: #{field}\")\n\n values = get_values_from_ber(ber, field)\n\n values_result = \"\"\n values_result = values.join(',') if values\n vprint_status(\"Values #{values}\")\n\n field_results << {:type => 'unknown', :value => values_result}\n end\n\n entry_results << field_results\n end\n\n return {\n :fields => fields,\n :results => entry_results\n }\n end", "def search_query_for(group)\n { q: \"uid:(#{group.map { |e| \"\\\"#{e.uid}\\\"\" }.join(' OR ')})\",\n def_type: 'lucene',\n facet: false,\n fl: @options[:fl] ? @options[:fl] :\n (@options[:fulltext] ?\n RLetters::Solr::Connection::DEFAULT_FIELDS_FULLTEXT :\n RLetters::Solr::Connection::DEFAULT_FIELDS),\n tv: @options[:term_vectors] || false,\n rows: group.size }\n end", "def ldap_authenticate \n filter = Net::LDAP::Filter.eq(\"uid\",\"#{username}\")\n \n ldap_connection.search(:base => ldap_treebase, :filter => filter, :attributes => ldap_attrs, :return_result => false) do |entry|\n return true\n end\n \n self.errors.add(:username, \" is invalid\")\n return false\n end", "def addUsersToSearchContext(value)\n begin\n values = value.split(' ')\n values.each do |x|\n \n # Find each user and add its information to the search context\n user = User.find_by_username(x)\n if user != nil\n @context.merge!({:user=> user})\n puts \"Added user: #{user.username} to the search context\"\n user.devices.each do |d|\n @device_ids.push(d.id)\n end\n end\n end\n rescue => e\n puts \"Problem adding user to search context. E: #{e}\"\n end\n end", "def find_user\n results = @ldap.search( :base => options[:ldap][:base], :filter => user_filter)\n return results.first\n end", "def ldap_search(attr,query)\n\t\tload \"#{$pwd}/plugins/config/ldap_config.rb\"\n\t\n\t\t# ldap_return auth (below) is a function from auth_ldap.rb that returns a\n\t\t# hash with the username and password to bind to LDAP with.\n\t\tldap_config = return_ldap_config\n\n\t\thost = 'ldap.oit.pdx.edu'\n\t\tport = 636\n \t\tauth = { :method => :simple, :username => ldap_config['username'], :password => ldap_config['pass'] }\n\t\tbase = 'dc=pdx,dc=edu'\n\t\n\t\tresult = Hash.new(Array.new)\n\t\tNet::LDAP.open(:host => host, :port => port, :auth => auth, :encryption => :simple_tls, :base => base) do |ldap|\n\t\t\t\n\t\t\t# Perform the search, then return a hash with LDAP attributes corresponding\n\t\t\t# to hash keys, and LDAP values corresponding to hash values.\n\t\t\tfilter = Net::LDAP::Filter.eq(attr,query)\n\t\t\tif (ldap.bind)\n\t\t\t\tldap.search(:filter => filter) do |entry|\n\t\t\t\t\tentry.each do |attribute, values|\n\t\t\t\t\t\tvalues.each do |value|\n\t\t\t\t\t\t\tresult[\"#{attribute}\"] += [\"#{value}\"]\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tresult = false\n\t\t\tend\n\t\tend\n\n\t\treturn result\n\tend", "def find_filter_word_matches(filter_value, filter_list: :filters)\n sanitized_value = filter_value.downcase\n flatten_filters(filter_list).select do |filter|\n filter.downcase == sanitized_value || filter.split.map(&:downcase).include?(sanitized_value)\n end\n end", "def search(search)\n query = if Rails.env.development?\n 'name like ?'\n else\n 'name ilike ?'\n end\n User.where(query, \"%#{search}%\")\n end", "def find_filter_matches(filter_value, filter_list: :filters)\n flatten_filters(filter_list).select { |filter| filter.match(/#{Regexp.escape(filter_value)}/i) }.map(&:to_s)\n end", "def filter(value)\n @filter_rx = value\n end", "def search(field, value)\n @rows.select {|row| get_variable(row, field).downcase == value.downcase}\n end", "def search filter\n if filter && is_searchable?\n filter = [filter, Chronic.parse(filter).strftime(\"%Y-%m-%d\")] rescue filter\n handle_joins(self.fields, scoped.select(\"DISTINCT(`#{self.table_name}`.`id`), `#{self.table_name}`.*\"))\n .where(build_filter(filter, self.fields))\n else\n scoped\n end\n end", "def search\n # params[:query] populated by query text input field\n # here we search for users that match input email\n @users = User.where(email: params[:query])\n end", "def membership(user_dn, group_names)\n search(filter: group_filter(group_names, user_dn))\n end", "def search( c, basedn, *constraints ) # :yields: connection_info, basedn, filter, scope\n\n self.bind( c.host, c.port, c.credentials, c.databag_name, c.use_tls ) unless @ldap\n\n raise \"Must specify base dn for search\" unless basedn\n\n ( filter, scope, attributes ) = constraints\n filter = filter.nil? ? Net::LDAP::Filter.eq( 'objectClass', '*' ) : filter\n\n case scope\n when 'base'\n scope = Net::LDAP::SearchScope_BaseObject\n when 'one'\n scope = Net::LDAP::SearchScope_SingleLevel\n else\n scope = Net::LDAP::SearchScope_WholeSubtree\n end\n\n scope = scope.nil? ? Net::LDAP::SearchScope_BaseObject : scope\n attributes = attributes.nil? ? [ '*' ] : attributes\n\n entries = @ldap.search( \n base: basedn, \n filter: filter,\n scope: scope,\n attributes: attributes\n )\n\n raise \"Error while searching: #{@ldap.get_operation_result.message}\" unless @ldap.get_operation_result.message =~ /(Success|No Such Object)/\n return entries\n end", "def projects_matching_filter\n # rubocop: disable CodeReuse/Finder\n projects_nested_in_group = Project.where(namespace_id: hierarchy_for_parent.base_and_descendants.select(:id))\n params_with_search = params.merge(search: params[:filter])\n\n ProjectsFinder.new(params: params_with_search,\n current_user: current_user,\n project_ids_relation: projects_nested_in_group).execute\n # rubocop: enable CodeReuse/Finder\n end", "def set_SearchForUser(value)\n set_input(\"SearchForUser\", value)\n end", "def get_users(host, base='dc=griddynamics,dc=net', scope=LDAP::LDAP_SCOPE_SUBTREE, filter='(objectclass=person)')\n\n puts \"Getting users from #{host} with base #{base} with filter #{filter}\"\n\n attrs = ['uid', 'mail', 'sn', 'givenName' ,'cn', 'sshPublicKey']\n\n conn = LDAP::Conn.new(host)\n\n puts \"Connection received: #{conn.inspect}\"\n\n conn.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\n\n puts conn.bind('','')\n\n conn.perror(\"bind\")\n\n begin\n users = Hash.new\n\n conn.search(base, scope, filter, attrs) { |entry|\n groups = []\n entry.dn.split(',').each { |dn|\n tmp = dn.split('=')\n if tmp[0] == 'ou'\n groups << tmp[1]\n end\n }\n\n if groups.include?('people') and groups.include?('griddynamics') and not groups.include?('deleted')\n users[entry.vals('uid')[0].dup] = {\n :email => entry.vals('mail')[0].dup,\n :name => entry.vals('givenName')[0].dup,\n :last_name => entry.vals('sn')[0].dup,\n :full_name => entry.vals('cn')[0].dup,\n :ssh_public_key => entry.vals('sshPublicKey').nil? ? nil : entry.vals('sshPublicKey')[0].dup,\n :groups => groups.dup\n }\n end\n }\n return users\n rescue LDAP::ResultError\n conn.perror(\"search\")\n exit\n end\n conn.perror(\"search\")\n conn.unbind\nend", "def filter(val)\n raise \"filter requires a String.\" unless val.is_a? String\n @filter = val\n self\n end", "def usernamesearch(field_hash)\n usersearch(field_hash)\n end", "def search_ldap_by_group(str, credentials = {}, wildcard: false, limit: 20)\n credentials = determine_credentials(credentials)\n LdapQuery::Query.perform(credentials, attr: :memberof, val: str, wildcard: wildcard, limit: limit)\n end", "def apply_filter(query, filter, value)\n return [query] if query.blank? || filter.blank? || value.blank?\n return [query] if filter.noop?\n\n klass = filter.klass || query.klass\n column = filter.column\n value = filter.values.call(value) if filter.values.present?\n\n queries = []\n\n if column.present?\n target_column = \"#{klass.table_name}.#{column}\"\n\n if filter.data_type == DateTime\n target_column = \"date_trunc('second', #{target_column})\"\n end\n\n vals = Array(value)\n value = []\n q = []\n\n vals.each do |val|\n if klass.columns_hash[column.to_s] && klass.columns_hash[column.to_s].type == :integer && !(val.to_s.strip =~ /\\A\\d+\\Z/)\n q << '0 = 1'\n else\n q << \"LOWER(#{target_column}::varchar) LIKE LOWER(?)\"\n value << \"%#{val}%\"\n end\n end\n\n queries << \"(#{q.join(' OR ')})\" if q.any?\n elsif filter.query.present?\n query, query_list, value_list = filter.query.call(query, value)\n queries = Array(query_list)\n value = Array(value_list)\n elsif filter.having.present?\n query = query.having(\"LOWER((#{filter.having})::varchar) LIKE ?\", \"%#{Array(value).first}%\")\n end\n\n [query, queries, value]\n end", "def search(base, filter = nil, attributes = nil)\n rows = []\n \n timeout_status = nil\n search_status = nil\n begin\n timeout_status = Timeout::timeout(60) do\n @ds.search(:base => base, :filter => filter, :attributes => attributes) do |entry|\n if ((!entry.nil?) && (entry[:cn] != []))\n rows << entry\n end \n end\n \n search_status = @ds.get_operation_result\n end\n rescue Timeout::Error => te\n ret = {\n :status => 0,\n :message => \"Connection to LDAP timed out\",\n :values => nil\n }\n return ret\n rescue Exception => e\n pp [\"exception\", e]\n end\n \n if (search_status.code == 0)\n ret = {\n :status => 1,\n :message => \"Success\",\n :values => rows\n }\n else\n ret = {\n :status => 0,\n :message => \"Net-LDAP Error #{search_status.code}: #{search_status.message}\",\n :values => nil\n }\n end\n \n return ret\n end", "def search_map_user_fields(filter, max_recs=nil, raw=false)\n # search for all fields plus the description field\n Net::LDAP.open(@ldap_conf) do |ldap|\n attributes = COMBINED_LDAP_ATTR_MAPPING.keys + [LDAP_DESCRIPTION_FIELD] + (raw ? LDAP_WO_CONSTANTS.keys : [])\n arr = ldap.search(:filter => filter, :attributes => attributes).to_a()\n if !max_recs\n max_recs = arr.length\n end\n\n # if the raw ldap records were requested then return them\n return arr if raw\n\n # process them into records\n return arr[0..(max_recs-1)].map do |entry|\n user_rec = {}\n COMBINED_LDAP_ATTR_MAPPING.each do |ldap_k, rec_k|\n attr_val = entry[ldap_k].is_a?(Array) ? entry[ldap_k][0] : entry[ldap_k]\n user_rec[rec_k] = LDAP_DATETIME_FIELDS.include?(ldap_k) ? DateTime.iso8601(attr_val) : attr_val\n end\n\n # unpack the fields that are stored in the description field\n desc = (entry[LDAP_DESCRIPTION_FIELD] ? entry[LDAP_DESCRIPTION_FIELD] : [])[0]\n # handle packed fields deliminated by carriage return, newline, comma, or space\n desc = desc.gsub(/tenant=([^\\s,]+)[,\\s]+/, \"tenant=\\\\1\\n\") unless desc == nil\n unpacked_fields = if desc && (desc.strip != \"\")\n mapping = desc.strip().split(\"\\n\").map {|x| x.strip}\n mapping = mapping.map do |x|\n x.split(\"=\").map {|y| y.strip }\n end\n mapping = Hash[mapping]\n else\n {}\n end\n PACKED_ENTITY_FIELD_MAPPING.each do |rec_k, packed_k|\n if unpacked_fields.include?(packed_k)\n user_rec[rec_k] = unpacked_fields[packed_k]\n end\n end\n\n user_rec\n end\n end\n end", "def set_filter(val)\n @filter = val\n build_path_query\n @filter\n end", "def search_by_customer_id(value)\n if session[:customer_id]\n if session[:customer_id] == \"All\"\n value\n else\n value.where('customer_id=?', session[:customer_id])\n end\n else\n value\n end\n end", "def parse_group filter\n /^\\(cn=(.*)\\)$/.match(filter)[1]\n end", "def uhook_filtered_search filters = {}\n create_scopes(filters) do |filter, value|\n case filter\n when :locale\n {:conditions => {:locale => value}}\n end\n end\n end", "def search_by_username(search_username)\n #will return all values except the current user\n User.find(:all, :conditions => [\"username LIKE ? AND username <> ?\", \"%#{search_username}%\", \"#{self.username}\"])\n end", "def search(records, field, criteria)\n records.where(\"#{field} = ?\", encrypt(criteria))\n end", "def user_search(search_criteria)\n found_user = nil\n as_manager do | conn |\n conn.search(user_root_dn,\n LDAP::LDAP_SCOPE_SUBTREE,\n ldap_user_search_criteria(search_criteria),\n SEARCH_RETURN_ATTRS) do | entry |\n found_user = entry.to_hash\n end\n end\n found_user\n end", "def search(args = nil)\n args ||= {}\n\n # filtering, scoping, search base\n # filter: https://tools.ietf.org/html/rfc4511#section-4.5.1.7\n # base: https://tools.ietf.org/html/rfc4511#section-4.5.1.1\n # scope: https://tools.ietf.org/html/rfc4511#section-4.5.1.2\n filter = args[:filter] || Net::LDAP::Filter.eq(\"objectClass\", \"*\")\n base = args[:base]\n scope = args[:scope] || Net::LDAP::SearchScope_WholeSubtree\n\n # attr handling\n # attrs: https://tools.ietf.org/html/rfc4511#section-4.5.1.8\n # attrs_only: https://tools.ietf.org/html/rfc4511#section-4.5.1.6\n attrs = Array(args[:attributes])\n attrs_only = args[:attributes_only] == true\n\n # references\n # refs: https://tools.ietf.org/html/rfc4511#section-4.5.3\n # deref: https://tools.ietf.org/html/rfc4511#section-4.5.1.3\n refs = args[:return_referrals] == true\n deref = args[:deref] || Net::LDAP::DerefAliases_Never\n\n # limiting, paging, sorting\n # size: https://tools.ietf.org/html/rfc4511#section-4.5.1.4\n # time: https://tools.ietf.org/html/rfc4511#section-4.5.1.5\n size = args[:size].to_i\n time = args[:time].to_i\n paged = args[:paged_searches_supported]\n sort = args.fetch(:sort_controls, false)\n\n # arg validation\n raise ArgumentError, \"search base is required\" unless base\n raise ArgumentError, \"invalid search-size\" unless size >= 0\n raise ArgumentError, \"invalid search scope\" unless Net::LDAP::SearchScopes.include?(scope)\n raise ArgumentError, \"invalid alias dereferencing value\" unless Net::LDAP::DerefAliasesArray.include?(deref)\n\n # arg transforms\n filter = Net::LDAP::Filter.construct(filter) if filter.is_a?(String)\n ber_attrs = attrs.map { |attr| attr.to_s.to_ber }\n ber_sort = encode_sort_controls(sort)\n\n # An interesting value for the size limit would be close to A/D's\n # built-in page limit of 1000 records, but openLDAP newer than version\n # 2.2.0 chokes on anything bigger than 126. You get a silent error that\n # is easily visible by running slapd in debug mode. Go figure.\n #\n # Changed this around 06Sep06 to support a caller-specified search-size\n # limit. Because we ALWAYS do paged searches, we have to work around the\n # problem that it's not legal to specify a \"normal\" sizelimit (in the\n # body of the search request) that is larger than the page size we're\n # requesting. Unfortunately, I have the feeling that this will break\n # with LDAP servers that don't support paged searches!!!\n #\n # (Because we pass zero as the sizelimit on search rounds when the\n # remaining limit is larger than our max page size of 126. In these\n # cases, I think the caller's search limit will be ignored!)\n #\n # CONFIRMED: This code doesn't work on LDAPs that don't support paged\n # searches when the size limit is larger than 126. We're going to have\n # to do a root-DSE record search and not do a paged search if the LDAP\n # doesn't support it. Yuck.\n rfc2696_cookie = [126, \"\"]\n result_pdu = nil\n n_results = 0\n\n message_id = next_msgid\n\n instrument \"search.net_ldap_connection\",\n message_id: message_id,\n filter: filter,\n base: base,\n scope: scope,\n size: size,\n time: time,\n sort: sort,\n referrals: refs,\n deref: deref,\n attributes: attrs do |payload|\n loop do\n # should collect this into a private helper to clarify the structure\n query_limit = 0\n if size > 0\n if paged\n query_limit = (((size - n_results) < 126) ? (size -\n n_results) : 0)\n else\n query_limit = size\n end\n end\n\n request = [\n base.to_ber,\n scope.to_ber_enumerated,\n deref.to_ber_enumerated,\n query_limit.to_ber, # size limit\n time.to_ber,\n attrs_only.to_ber,\n filter.to_ber,\n ber_attrs.to_ber_sequence\n ].to_ber_appsequence(Net::LDAP::PDU::SearchRequest)\n\n # rfc2696_cookie sometimes contains binary data from Microsoft Active Directory\n # this breaks when calling to_ber. (Can't force binary data to UTF-8)\n # we have to disable paging (even though server supports it) to get around this...\n\n controls = []\n controls <<\n [\n Net::LDAP::LDAPControls::PAGED_RESULTS.to_ber,\n # Criticality MUST be false to interoperate with normal LDAPs.\n false.to_ber,\n rfc2696_cookie.map{ |v| v.to_ber}.to_ber_sequence.to_s.to_ber\n ].to_ber_sequence if paged\n controls << ber_sort if ber_sort\n controls = controls.empty? ? nil : controls.to_ber_contextspecific(0)\n\n write(request, controls, message_id)\n\n result_pdu = nil\n controls = []\n\n while pdu = queued_read(message_id)\n case pdu.app_tag\n when Net::LDAP::PDU::SearchReturnedData\n n_results += 1\n yield pdu.search_entry if block_given?\n when Net::LDAP::PDU::SearchResultReferral\n if refs\n if block_given?\n se = Net::LDAP::Entry.new\n se[:search_referrals] = (pdu.search_referrals || [])\n yield se\n end\n end\n when Net::LDAP::PDU::SearchResult\n result_pdu = pdu\n controls = pdu.result_controls\n if refs && pdu.result_code == Net::LDAP::ResultCodeReferral\n if block_given?\n se = Net::LDAP::Entry.new\n se[:search_referrals] = (pdu.search_referrals || [])\n yield se\n end\n end\n break\n else\n raise Net::LDAP::ResponseTypeInvalidError, \"invalid response-type in search: #{pdu.app_tag}\"\n end\n end\n\n # count number of pages of results\n payload[:page_count] ||= 0\n payload[:page_count] += 1\n\n # When we get here, we have seen a type-5 response. If there is no\n # error AND there is an RFC-2696 cookie, then query again for the next\n # page of results. If not, we're done. Don't screw this up or we'll\n # break every search we do.\n #\n # Noticed 02Sep06, look at the read_ber call in this loop, shouldn't\n # that have a parameter of AsnSyntax? Does this just accidentally\n # work? According to RFC-2696, the value expected in this position is\n # of type OCTET STRING, covered in the default syntax supported by\n # read_ber, so I guess we're ok.\n more_pages = false\n if result_pdu.result_code == Net::LDAP::ResultCodeSuccess and controls\n controls.each do |c|\n if c.oid == Net::LDAP::LDAPControls::PAGED_RESULTS\n # just in case some bogus server sends us more than 1 of these.\n more_pages = false\n if c.value and c.value.length > 0\n cookie = c.value.read_ber[1]\n if cookie and cookie.length > 0\n rfc2696_cookie[1] = cookie\n more_pages = true\n end\n end\n end\n end\n end\n\n break unless more_pages\n end # loop\n\n # track total result count\n payload[:result_count] = n_results\n\n result_pdu || OpenStruct.new(:status => :failure, :result_code => Net::LDAP::ResultCodeOperationsError, :message => \"Invalid search\")\n end # instrument\n ensure\n\n # clean up message queue for this search\n messages = message_queue.delete(message_id)\n\n # in the exceptional case some messages were *not* consumed from the queue,\n # instrument the event but do not fail.\n if !messages.nil? && !messages.empty?\n instrument \"search_messages_unread.net_ldap_connection\",\n message_id: message_id, messages: messages\n end\n end", "def search_ldap_by_other(credentials = {}, attr: nil, val: nil, wildcard: false, limit: 20)\n raise(AttributeError, 'a valid attribute name and value must be supplied to query against') if attr.nil? || val.nil?\n\n credentials = determine_credentials(credentials)\n LdapQuery::Query.perform(credentials, attr: attr, val: val, wildcard: wildcard, limit: limit)\n end", "def index\n\t\t\n\t\t# @admins=User.where(admin: true)\n\t #Only show users that aren't admin(only the community are shown)\n\t @users = User.where(admin: false).order(\"first_name ASC\")\n\n\t if params[:search_user].present?\t\n\t \t#Storing user with capital letter on first letter of name and rest downcase.\n\n user_search= params[:search_user].downcase.split(\" \")\n \t\n @users= @users.where(\"first_name ILIKE ? OR last_name ILIKE ? OR last_name ILIKE ?\", \"#{user_search[0]}\", \"#{user_search[1]}\",\"#{user_search[0]}\")\n \n end\n end", "def filter=(val)\n set_filter(val)\n val\n end", "def users(filter = {})\n handler[:people].filter(filter)\n end", "def search\n @users = User.where('full_name ilike ?', \"%#{params[:query].strip}%\")\n if @users.length.zero?\n flash[:notice] = \"#{params[:query]} not found\"\n redirect_to users_path\n else\n render 'index'\n end\n end", "def search_ldap_by_name(str, credentials = {}, wildcard: false, limit: 20)\n credentials = determine_credentials(credentials)\n LdapQuery::Query.perform(credentials, attr: :displayname, val: str, wildcard: wildcard, limit: limit)\n end", "def search_for_login(connection=nil)\n connection ||= self\n @login_ldap_entry ||= begin\n DeviseLdapAuthenticatable::Logger.send(\"LDAP search for login: #{@attribute}=#{@login}\")\n filter = Net::LDAP::Filter.eq(@attribute.to_s, @login.to_s)\n ldap_entry = nil\n match_count = 0\n connection.open do |ldap|\n ldap.search(:filter => filter) {|entry| ldap_entry = entry; match_count+=1}\n end\n DeviseLdapAuthenticatable::Logger.send(\"LDAP search yielded #{match_count} matches\")\n ldap_entry\n end\n end", "def index\n\n @organization_id = params[:organization_id].to_i\n @search_text = params[:search_text]\n @role = params[:role].split(\",\") if params[:role]\n @id_filter_list = params[:ids]\n\n # Start to set up the query\n conditions = []\n values = []\n\n if @organization_id.to_i > 0\n conditions << 'users_organizations.organization_id = ?'\n values << @organization_id\n else\n conditions << 'users_organizations.organization_id IN (?)'\n values << @organization_list\n end\n\n\n unless @search_text.blank?\n # get the list of searchable fields from the asset class\n searchable_fields = User.new.searchable_fields\n # create an OR query for each field\n query_str = []\n first = true\n # parameterize the search based on the selected search parameter\n search_value = get_search_value(@search_text, @search_param)\n # Construct the query based on the searchable fields for the model\n searchable_fields.each do |field|\n if first\n first = false\n query_str << '('\n else\n query_str << ' OR '\n end\n\n query_str << \"UPPER(users.#{field})\"\n query_str << ' LIKE ? '\n # add the value in for this sub clause\n values << search_value.upcase\n end\n query_str << ')' unless searchable_fields.empty?\n\n conditions << [query_str.join]\n end\n\n unless @id_filter_list.blank?\n conditions << 'object_key in (?)'\n values << @id_filter_list\n end\n\n if params[:show_active_only].nil?\n @show_active_only = 'active'\n else\n @show_active_only = params[:show_active_only]\n end\n\n if @show_active_only == 'active'\n conditions << 'users.active = ?'\n values << true\n elsif @show_active_only == 'inactive'\n conditions << 'users.active = ?'\n values << false\n end\n\n # Get the Users but check to see if a role was selected\n @users = User.unscoped.distinct.joins(:organization).order('organizations.organization_type_id', 'organizations.short_name', :last_name).joins(:organizations).includes(:organization,:roles).where(conditions.join(' AND '), *values)\n\n unless @role.blank?\n all_users = @users\n @users = @users.with_role(@role[0])\n @role[1..-1].each do |r|\n @users = @users.or(all_users.with_role(r))\n end\n end\n\n if params[:sort] && params[:order]\n case params[:sort]\n when 'organization'\n @users = @users.reorder(\"organizations.short_name #{params[:order]}\")\n # figure out sorting by role + privilege some other way\n # when 'role_name'\n # @users = @users.joins(:roles).merge(Role.unscoped.order(name: params[:order]))\n # when 'privilege_names'\n # @users = @users.joins(:roles).merge(Role.order(privilege: params[:order]))\n else\n @users = @users.reorder(params[:sort] => params[:order])\n end\n end\n\n # Set the breadcrumbs\n if @organization_list.count == 1\n org = Organization.find(@organization_list.first)\n add_breadcrumb org.short_name, users_path(:organization_id => org.id)\n end\n if @role.present?\n role_string = @role.kind_of?(Array) ? Role.find_by(name: @role).try(:label).try(:parameterize).try(:underscore) : @role\n add_breadcrumb role_string.titleize, users_path(:role => role_string) if role_string\n end\n\n # remember the view type\n @view_type = get_view_type(SESSION_VIEW_TYPE_VAR)\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json {\n # render :json => {\n # :total => @users.count,\n # :rows => @users.limit(params[:limit]).offset(params[:offset]).collect{ |u|\n # u.as_json.merge!({\n # organization_short_name: u.organization.short_name,\n # organization_name: u.organization.name,\n # role_name: !@role.blank? && (@role.kind_of?(Array) ? !Role.find_by(name:@role.first).privilege : !Role.find_by(name: @role).privilege) ? (@role.kind_of?(Array) ? u.roles.roles.where(name: @role).last.label : u.roles.roles.find_by(name: @role).label) : u.roles.roles.last.label,\n # privilege_names: u.roles.privileges.collect{|x| x.label}.join(', '),\n # all_orgs: u.organizations.map{ |o| o.to_s }.join(', ')\n # })\n # }\n # }\n # }\n\n end\n end", "def search_users(term, value)\n results = @users_indice.search(term: term, value: value)\n if perform_search_by_id?(term)\n results.each do |user|\n # Get related organizations\n user['organizations'] =\n @organizations_indice.search_by_primary_key(value: user['organization_id'])\n\n # Get submitted tickets related to user\n user['submitted_tickets'] =\n @tickets_indice.search(term: 'submitter_id', value: user['_id'])\n\n # Get assigned tickets related to user\n user['assigned_tickets'] =\n @tickets_indice.search(term: 'assignee_id', value: user['_id'])\n end\n end\n results\n end", "def search(*args)\n search_provider.search(*args)\n end", "def index\n if params[:search]\n @groups = Group.search((params[:search]).to_s.downcase)\n end\n end", "def search(value)\n return @searchMethods.searchAtTree(value, @root)\n end", "def search( base, scope=:subtree, filter='(objectClass=*)', options={} )\n\t\tcollectclass = nil\n\n\t\t# If the base argument is an object whose class knows how to create instances of itself\n\t\t# from an LDAP::Entry, use it instead of Treequel::Branch to wrap results\n\t\tif options.key?( :results_class )\n\t\t\tcollectclass = options.delete( :results_class )\n\t\telse\n\t\t\tcollectclass = base.class.respond_to?( :new_from_entry ) ?\n\t\t\t\tbase.class :\n\t\t\t\tself.results_class\n\t\tend\n\n\t\t# Format the arguments in the way #search_ext2 expects them\n\t\tbase_dn, scope, filter, searchopts =\n\t\t\tself.normalize_search_parameters( base, scope, filter, options )\n\n\t\t# Unwrap the search options from the hash in the correct order\n\t\tself.log.debug do\n\t\t\tattrlist = SEARCH_PARAMETER_ORDER.inject([]) do |list, param|\n\t\t\t\tlist << \"%s: %p\" % [ param, searchopts[param] ]\n\t\t\tend\n\t\t\t\"searching with base: %p, scope: %p, filter: %p, %s\" %\n\t\t\t\t[ base_dn, scope, filter, attrlist.join(', ') ]\n\t\tend\n\t\tparameters = searchopts.values_at( *SEARCH_PARAMETER_ORDER )\n\n\t\t# Wrap each result in the class derived from the 'base' argument\n\t\tself.log.debug \"Searching via search_ext2 with arguments: %p\" % [[\n\t\t\tbase_dn, scope, filter, *parameters\n\t\t]]\n\n\t\tresults = []\n\t\tself.conn.search_ext2( base_dn, scope, filter, *parameters ).each do |entry|\n\t\t\tbranch = collectclass.new_from_entry( entry, self )\n\t\t\tbranch.include_operational_attrs = true if\n\t\t\t\tbase.respond_to?( :include_operational_attrs? ) &&\n\t\t\t\tbase.include_operational_attrs?\n\n\t\t\tif block_given?\n\t\t\t\tresults << yield( branch )\n\t\t\telse\n\t\t\t\tresults << branch\n\t\t\tend\n\t\tend\n\n\t\treturn results\n\trescue RuntimeError => err\n\t\tconn = self.conn\n\n\t\t# The LDAP library raises a plain RuntimeError with an incorrect message if the\n\t\t# connection goes away, so it's caught here to rewrap it\n\t\tcase err.message\n\t\twhen /no result returned by search/i\n\t\t\traise LDAP::ResultError.new( LDAP.err2string(conn.err) )\n\t\telse\n\t\t\traise\n\t\tend\n\tend", "def index\n @filter = params[:filter] if params.has_key? :filter and %w{unapproved invited}.include? params[:filter]\n\n if params[:search]\n @search = User.search { fulltext params[:search] }\n @users = user_query.where(id: @search.results.map(&:id))\n else\n @users = user_query.order(updated_at: :desc)\n end\n end", "def return_exact_results\n\t# make empty array that will contain all users whose first_name, last_name, or email exactly matches a given string\n\texact_search_results = []\n\n\tUser.all.each do |user|\n\t\tif user.first_name == user.search_term || user.last_name == search_term || user.email == search_term\n\t\t\texact_search_results.push user.id\n\t\telse\n\t\t\t# do nothing if search term is not exactly\n\t\tend\n\tend\n\texact_search_results\nend", "def searchUsing(filter)\n @zqlQuery = filter\n end", "def group_invitable_users\n group = Group.find(params[:group_id])\n @users = User.where(\"LOWER(name) LIKE ?\", \"%#{@query}%\")\n .where.not(id: group.members).limit(10)\n .sort_by { |user| SearchScore.name(user.name, @query) }\n\n render \"users\"\n end", "def search\n @users ||= User.search_user(params[:search])\n authorize! :read, @user\n end", "def filters_include?(filter_value, filter_list: :filters)\n flatten_filters(filter_list).map(&:downcase).include? filter_value.downcase\n end", "def user_search\n @users = User.admin_search(params[:query])\n end", "def bind_by_username\n username_attribute = options[:ldap][:username_attribute] || default_username_attribute\n\n @ldap.bind_as(:base => @options[:ldap][:base], :password => @password, :filter => user_filter)\n end", "def ldapSearchLookup(key) \n answer = []\n filter = Net::LDAP::Filter.from_rfc4515(key)\n conf = Config[:ldap] \n treebase = conf[:base]\n Hiera.debug(\"Searching #{key} in LDAP backend, base #{treebase}.\")\n searchresult = @connection.search(:filter => filter)\n\n for i in 0..searchresult.length-1 do\n answer[i] = {}\n searchresult[i].each do |attribute, values|\n Hiera.debug( \" #{attribute}:\")\n answer[i][attribute.to_s] = values\n values.each do |value|\n Hiera.debug( \" ---->#{value}:\")\n end\n end\n end\n return answer\n end", "def search_filter(search_term)\n @items = @items.where('client_name like ? OR client_ssn like ? OR case_id like ?', \"%#{search_term}%\", \"%#{search_term}%\", \"%#{search_term}%\")\n @old_items = @items.where('client_name like ? OR client_ssn like ? OR case_id like ?', \"%#{search_term}%\", \"%#{search_term}%\", \"%#{search_term}%\")\n session[:search] = search_term\n end", "def get_user_details_from_ldap(username)\n\tresult_attrs = [\"uid\", \"displayName\", \"mail\"]\n\tsearch_filter = Net::LDAP::Filter.eq(\"uid\", username)\n\tLDAP_CONNECTION.search(:filter => search_filter, :attributes => result_attrs) { |item| \n\t puts \"#{item.uid.first}: #{item.displayName.first} (#{item.mail.first})\" \n\t}\n\t\nend", "def search\n @lawyer = User.first\n expertise = Expertise.find_by_id(params[:id])\n @users = UserExpertise.where(expertise_id: expertise)\n end", "def search(user, query, collection, wiki)\n end", "def user_search # :nologin: :norobots:\n pattern = params[:pattern].to_s\n if pattern.match(/^\\d+$/) &&\n (user = User.safe_find(pattern))\n redirect_to(action: \"show_user\", id: user.id)\n else\n query = create_query(:User, :pattern_search, pattern: pattern)\n show_selected_users(query)\n end\n end", "def updateFilter(sender)\n CanastoLog.debug @searchField.stringValue\n end", "def user_search\n pattern = params[:pattern].to_s\n if pattern.match(/^\\d+$/) &&\n (user = User.safe_find(pattern))\n redirect_to(action: \"show_user\", id: user.id)\n else\n query = create_query(:User, :pattern_search, pattern: pattern)\n show_selected_users(query)\n end\n end", "def user_collaboration_search(q, limit=10)\n if q.present? and q.length > 1\n already_exists_ids = []\n already_exists_emails = []\n # add owner\n # already_exists_ids << self.user_id\n # add colaborators\n if self.users.present?\n already_exists_ids << self.users.map{|x| x.id}\n end\n # add invitations\n pending = Invitation.pending_by_story(self.id)\n if pending.present?\n already_exists_emails << pending.map{|x| x.to_email}\n end\n\n already_exists_ids.flatten!\n already_exists_emails.flatten!\n\n sql = \"\"\n if already_exists_ids.present? && already_exists_emails.present?\n sql = \"!(id in (:ids) or email in (:emails)) and \"\n elsif already_exists_ids.present?\n sql = \"!(id in (:ids)) and \"\n elsif already_exists_emails.present?\n sql = \"!(email in (:emails)) and \"\n end\n sql << \"(nickname like :search or email_no_domain like :search)\"\n users = User.where([sql,\n :ids => already_exists_ids.uniq,\n :emails => already_exists_emails.uniq,\n :search => \"%#{q}%\"])\n .limit(limit)\n return users\n end\n end", "def search (query_string)\n\n OpenWFE::Extras::Workitem.search(query_string, store_names).find_all do |wi|\n\n @user.admin? or (\n wi.store_name != 'users' || wi.participant_name == @user.name)\n end\n end", "def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end", "def search(value)\n record_ids = []\n\n hash(value).each do |tri|\n if ids = index[tri]\n record_ids += ids\n end\n end\n record_ids.uniq!\n\n record_ids.collect { |id| records[id] }\n end", "def construct_ilike_search(table, field, value, concat = \"AND\")\n \"#{concat} #{table}.#{field} ILIKE '#{sanitize(value)}'\" if value.present?\n end", "def search(query, case_type: :smart)\n WWID.new.fuzzy_filter_items(self, query, case_type: case_type)\n end", "def search_options_for(filter:, attributes:)\n {}.tap do |opts|\n group_base = APP_CONFIG[\"ldap\"][\"group_base\"]\n opts[:base] = group_base if group_base.present?\n opts[:filter] = Net::LDAP::Filter.construct(filter)\n opts[:attributes] = attributes\n end\n end", "def search(value)\n # YOUR WORK HERE\n end", "def invitation_search(q, limit=10)\n if q.present? and q.length > 1\n already_exists_ids = []\n already_exists_emails = []\n # add owner\n already_exists_ids << self.id\n # add colaborators\n if self.members.present?\n already_exists_ids << self.members.map{|x| x.member_id}\n end\n # add invitations\n pending = Invitation.pending_from_user(self.id)\n if pending.present?\n already_exists_emails << pending.map{|x| x.to_email}\n end\n\n already_exists_ids.flatten!\n already_exists_emails.flatten!\n\n users = User.any_of({first_name: /#{q}/i}, {last_name: /#{q}/i}, {email_no_domain: /#{q}/i}).limit(limit)\n if already_exists_ids.present? && already_exists_emails.present?\n users = users.not_in({id: already_exists_ids.uniq, email: already_exists_emails.uniq})\n elsif already_exists_ids.present?\n users = users.not_in({id: already_exists_ids.uniq})\n elsif already_exists_emails.present?\n users = users.not_in({email: already_exists_emails.uniq})\n end\n\n return users\n end\n end", "def filterredir(value)\n _filterredir(value) or fail ArgumentError, \"Unknown value for filterredir: #{value}\"\n end", "def find_resource(_field, value)\n query = <<-SQL.squish\n LOWER(username) = :value OR LOWER(email) = :value\n SQL\n\n @resource = resource_class.where(query, value: value).first\n end", "def search(options)\n options[:base] = @base_name\n options[:attributes] ||= %w{ou cn dn sAMAccountName member}\n options[:ignore_server_caps] ||= true\n\n @connection.search(options)\n end", "def search(term)\n # TODO: Select the Contact instances from the 'contacts.csv' file whose name or email attributes contain the search term.\n Contact.all.select do |contact|\n contact.name.downcase.match(term) || contact.email.downcase.match(term)\n end\n end", "def filter(field, value)\n @filters << [field, value]\n @loaded = false\n self\n end", "def filter(value)\n true\n end", "def apply_attribute_filter(filter, value)\n self.scope = scope.where(filter => value)\n end" ]
[ "0.6211908", "0.5757533", "0.5701406", "0.5689939", "0.5651422", "0.5638755", "0.5631808", "0.55178046", "0.5498253", "0.5439008", "0.5393417", "0.53746533", "0.5328625", "0.52728313", "0.5264735", "0.5264735", "0.52619094", "0.52588075", "0.5253779", "0.5244372", "0.5232043", "0.5224638", "0.5222137", "0.5206224", "0.51648605", "0.51511794", "0.5144575", "0.51068455", "0.5103735", "0.5099979", "0.50806874", "0.50366455", "0.5036377", "0.5012913", "0.50077426", "0.4983913", "0.4976933", "0.4967557", "0.49546203", "0.49404663", "0.49298152", "0.49249744", "0.48942384", "0.48904717", "0.4889331", "0.48678535", "0.48667946", "0.4857641", "0.48397073", "0.4823245", "0.47827652", "0.47747594", "0.47730353", "0.47701117", "0.47647414", "0.47545603", "0.4752132", "0.47476768", "0.47280604", "0.4726813", "0.47197202", "0.47139162", "0.4707282", "0.47053835", "0.4703769", "0.470122", "0.46995926", "0.4698111", "0.46968982", "0.46856287", "0.46745583", "0.4667396", "0.46654254", "0.46650365", "0.4658767", "0.46535084", "0.46456543", "0.46301186", "0.46165577", "0.46144846", "0.46084931", "0.46057177", "0.4598127", "0.45969954", "0.45962316", "0.45923173", "0.45799285", "0.457414", "0.45714927", "0.45701393", "0.45579106", "0.4542977", "0.4541295", "0.45366845", "0.45355383", "0.4524299", "0.45215014", "0.45206147", "0.4514747", "0.4506416" ]
0.5498491
8
Gets recommended topics for the user based on the topics he have visited
def recommended_topics(limit = 10) visited_topics.joins(:topic).where('topics.language = ?', I18n.locale).group('topic_id').order("visits DESC, updated_at DESC").limit(limit).map(&:topic).map { |t| t.find_related_tags.limit(2) }.flatten.uniq[0...limit] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_suggested_topics(assignment_id)\n team_id = TeamsUser.team_id(assignment_id, session[:user].id)\n teams_users = TeamsUser.where(team_id: team_id)\n teams_users_array = Array.new\n teams_users.each do |teams_user|\n teams_users_array << teams_user.user_id\n end\n @suggested_topics = SignUpTopic.where(assignment_id: assignment_id, private_to: teams_users_array)\n end", "def topics\n topics = [\"News\", \"A.I.\", \"V.R.\", \"RMIT\", \"Game\", \"Rails\", \"Go\", \"Web\", \"M.L\", \"Joke\", \"React\", \"Vue\", \"Node\", \"iOS\", \"AWS\"]\n end", "def topics\n _topics\n end", "def suggest\r\n if current_user and !(current_user.followed_topic_ids.blank? and current_user.following_ids.blank?)\r\n elim = current_user.is_expert ? 3 : 2\r\n ulim = current_user.is_expert ? 0 : 1\r\n tlim = 2\r\n e,u,t = UserSuggestItem.find_by_user(current_user)\r\n @suggested_experts = e.blank? ? [] : User.any_in(:_id=>e.random(elim)).not_in(:_id=>current_user.following_ids)\r\n @suggested_users = u.blank? ? [] : User.any_in(:_id=>u.random(ulim)).not_in(:_id=>current_user.following_ids)\r\n @suggested_topics = t.blank? ? [] : Topic.any_in(:name=>t.random(tlim))\r\n end\r\n end", "def topics\n optional! :order, type: String, default: \"recent\", values: %w[recent likes replies]\n optional! :offset, type: Integer, default: 0\n optional! :limit, type: Integer, default: 20, values: 1..150\n\n @topics = @user.topics.fields_for_list\n @topics =\n if params[:order] == \"likes\"\n @topics.high_likes\n elsif params[:order] == \"replies\"\n @topics.high_replies\n else\n @topics.recent\n end\n @topics = @topics.includes(:user).offset(params[:offset]).limit(params[:limit])\n end", "def my_topic\n @published_topics = current_user.topics.published\n @unpublished_topics = current_user.topics.unpublished\n end", "def coarse_topics\n _coarse_topics\n end", "def index\n @topics = current_user.topics\n end", "def topics\n respond_to?(:topic) ? topic : []\n end", "def unread_topics user\r\n topics.find_all{|topic| topic.unread_comment?(user) }\r\n end", "def view\n get_topic(@current_id, :resolve => false)\n get_complete_topic(@current_id, :resolve => false)\n get_related_for_current\n end", "def get_topics\n @topics = Topic.all\n end", "def get_topics\n @topics = Topic.all\n end", "def get(*topics)\n # FIXME: implement this\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 top_topics\n topics_with_views = Hash.new\n topics.each do |topic|\n topics_with_views[topic] = getViews(topic)\n end\n topics_with_views = topics_with_views.sort_by { |k, v| v }.reverse\n return topics_with_views\n end", "def topic_search\n @topic_search ||= begin\n vals = []\n vals.concat(subject_topics) if subject_topics\n vals.empty? ? nil : vals\n end\n end", "def topics(usernames)\n get(\"/1/users/topics.json\", :users => [usernames].flatten).users\n end", "def index\n @published_topics = current_user.topics.published\n @unpublished_topics = current_user.topics.unpublished\n end", "def recommended_articles\n @user = User.find(params[:user_id])\n @articles = @user.articles.accessibles(current_user).recommended.order_by_recommendations_count_desc.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::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 get_topics\n @chapter = Chapter.find(params[:id]) unless params[:id].blank?\n if current_user.is?(\"EA\") or current_user.is?(\"IA\")\n list = @chapter.topics.map {|u| Hash[value: u.id, name: u.name]}\n else\n topic_ids = ContentUserLayout.get_unlocked_topics(@chapter,current_user)\n if !topic_ids.nil?\n list = @chapter.topics.where(:id=>topic_ids).map {|u| Hash[value: u.id, name: u.name]}\n else\n list = @chapter.topics.map {|u| Hash[value: u.id, name: u.name]}\n end\n end\n render json: list\n end", "def list_topics\n outputter.print_topics(guides.keys)\n 0\n end", "def topics\n @topics ||= [cloudenvoy_options_hash[:topic], cloudenvoy_options_hash[:topics]].flatten.compact.map do |t|\n t.is_a?(String) ? { name: t } : t\n end\n end", "def topics_for_course\n redirect_guest\n @course = Course.find(params[:id])\n @topics = @course.topics\n end", "def index\n @questions = Question.includes(:user, :topics, answers: [:user]).all\n @questions = @questions.topic(params[:topic_id]) if params[:topic_id]\n end", "def topics\n\t\t\t# Magically make arrays from string Wooooo!\n\t\t\tuid = params[\"uid\"].split(\",\")\n\t\t\ttid = params[\"tid\"].split(\",\")\n\n\t\t\t#request post from usrs AND specific topics ahhhhhhh!\n\t\t\tposts = Post.where('user_id IN (?) OR topic_id IN (?) OR raw LIKE (?)', uid, tid, '%@everyone%' )\n\t\t\t \t\t\t\t\t\t\t\t\t.order(created_at: :desc)\n\t\t\t \t.limit(params[\"total\"])\n\t\t\t\t\t\t\t\t\t\t\t\t.offset(params[\"start\"])\n\n\t\t\t# that cleaned that up\n\t\t\trender_json_dump(serialize_data(posts, PostSerializer))\n\t\t\t#K shows over\n\t\tend", "def trending_topics\n result = http_get(\"/services/data/v#{self.version}/chatter/topics/trending\")\n result = JSON.parse(result.body)\n result[\"topics\"].collect { |topic| topic[\"name\"] }\n end", "def index\n @user_topics = UserTopic.all\n end", "def topics(path = nil)\n # NOTE: root url\n platform.topics_at url_for(path: path.to_s)\n end", "def define_topics\n @topics = {\n 'uk' => 'UK',\n 'world' => 'World',\n 'education' => 'Education',\n 'politics' => 'Politics',\n 'health' => 'Health',\n 'science_and_environment' => 'Science and Environment',\n 'business' => 'Business',\n 'technology' => 'Technology',\n 'entertainment_and_arts' => 'Entertainment and Arts'\n }\n end", "def recommended_by_current_user\n if current_user\n extract = Csvarchive.find(params[:id])\n e_rec = extract.recommendations\n u_rec = current_user.recommendations\n all_rec = e_rec & u_rec\n if !all_rec.empty?\n @recommended = true\n else\n @recommended = false\n end\n else\n @recommended = false\n end\n end", "def topics\n begin\n case params[:filter].to_i\n when 0: #everyone. unfiltered.\n @topics = @owner.topics.unfiltered\n when 1: #my topics\n @topics = @owner.topics.by_userlist(logged_in_user.id)\n when 2: #my friend's topics\n @topics = @owner.topics.by_userlist(logged_in_user.friends)\n when 3: #topics by classmates\n #@topics = @owner.topics.by_userlist(@logged_in_user.classmates)\n @topics = @owner.topics.unfiltered\n else\n params[:filter] = 0\n @topics = @owner.topics.unfiltered\n end\n case params[:sorter].to_i\n when 0: #latest replies\n @topics.sort! { |x,y| y.latest_post.created_on <=> x.latest_post.created_on}\n when 1: #newest posts\n @topics.sort! { |x,y| y.created_on <=> x.created_on }\n when 2: #most people\n @topics.sort! { |x,y| y.people_count <=> x.people_count }\n when 3: #most posts\n @topics.sort! { |x,y| y.posts.count <=> x.posts.count }\n else\n params[:sorter] = 0\n @topics.sort! { |x,y| y.latest_post.created_on <=> x.latest_post.created_on}\n end\n rescue Exception => e #render_return\n puts e.inspect\n end\n end", "def popular_topics\n topics = []\n results = repository.adapter.select('SELECT t.id, t.name, COUNT(*) count FROM topics t INNER JOIN messages m ON t.id = m.topic_id GROUP BY t.id ORDER BY COUNT(*) DESC')\n \n # Loop over aggregate results\n results.each do |result|\n topic = Topic.get(result.id)\n \n # Skip topic if it has been notified within the window\n notification = *topic.notifications(:source => name, :order => :created_at.desc)\n next if notification && Time.now-Time.parse(notification.created_at.to_s) < window\n\n # Skip topic if it doesn't contain any of the filtered tags\n if tags && tags.length > 0\n found = false\n tags.each do |tag|\n m, tag_type, tag_value = *tag.match(/^(\\w+):(.+)$/)\n \n if topic.tags(:type => tag_type, :value => tag_value).length > 0\n found = true\n break\n end\n end\n next unless found\n end\n \n # If validations have all passed, add the topic to the list\n topics << topic\n end\n\n return topics\n end", "def favorites\n optional! :offset, type: Integer, default: 0\n optional! :limit, type: Integer, default: 20, values: 1..150\n\n @topics = @user.favorite_topics.includes(:user).order(\"actions.id desc\").offset(params[:offset]).limit(params[:limit])\n render \"topics\"\n end", "def topics\n @topics ||= import.map { |topic| Topic.parse(topic) }\n end", "def index\n @topics = Topic.includes(:user).includes(:responses).subscribed_by(@user).order('id DESC').page(params[:page])\n end", "def answered_topics_by_user\n user_answers = Answer.where(uuid: params[:uuid])\n topic_ids = user_answers.map{ |a| a.statement.topic.id }\n render json: topic_ids.uniq, status:200\n end", "def topics\n r = bills_grouped_by_topic.map do |slug, bills|\n {\n :id => bills.first['id-categoria'],\n :slug => slug,\n :title => ActiveSupport::Inflector.transliterate(bills.first['categoria']),\n :views => bills.map { |b| b['value'] }.inject(:+)\n }\n end\n\n # Sort by views, descending\n r.sort_by! { |b| -b[:views] }\n\n # Set the relative view percentage for each of the topics\n views_total = r.map { |b| b[:views] }.inject(:+)\n\n r.each do |b|\n b[:perc] = b[:views].fdiv(views_total)\n end\n\n # Get the requested topic (if any)\n if params[:topic]\n if params[:topic] =~ /^\\d+$/\n r = r.map { |i| i if i[:id] == params[:topic].to_i }.compact.first\n else\n r = r.map { |i| i if i[:slug] == params[:topic] }.compact.first\n end\n elsif params[:ordered_index]\n # XXX Hack for the Arduino display which shouldn't show the\n # \"other topics\" entry\n r = r.map { |i| i if i[:slug] != 'outros-temas' }.compact\n r = r[params[:ordered_index].to_i]\n\n # They also dont like big jsons\n r.delete(:slug) if r\n end\n\n respond_with r\n end", "def topic\n team_topic = nil\n\n participants.each do |participant|\n team_topic = participant.topic\n break if team_topic\n end\n\n team_topic\n end", "def topic\n team_topic = nil\n\n participants.each do |participant|\n team_topic = participant.topic\n break if team_topic\n end\n\n team_topic\n end", "def topic\n team_topic = nil\n\n participants.each do |participant|\n team_topic = participant.topic\n break if team_topic\n end\n\n team_topic\n end", "def get_topics_cohort\n # If affect is all, that means all matching tickets should be bulk updated\n if params[:affect].present? && params[:affect] == \"all\"\n if params[:status].present?\n @topics = Topic.where(current_status: params[:status]).all\n elsif params[:q].present?\n @topics = Topic.admin_search(params[:q])\n end\n\n # Select topics from params\n else\n @topics = Topic.where(id: params[:topic_ids]).all\n end\n \n end", "def topic_names\n if topic.blank?\n {}\n else\n @topic_names ||= topic.sub_topics.collect { |t| t.name }.join(' ')\n end\n end", "def find_topic\n @topic = current_user.topics.find(params[:topic_id])\n end", "def find_topic\n @topic = current_user.topics.find(params[:topic_id])\n end", "def topics_with_cache\n if new_record?\n @associated_topics_cache || []\n else\n self.topics_without_cache\n end\n end", "def get_topics_values\n @chapter = Chapter.find(params[:id]) unless params[:id].blank?\n if current_user.is?(\"EA\") or current_user.is?(\"IA\")\n list = @chapter.topics.map {|u| Hash[value: (u.id.to_s+'|'+get_params(u.params.to_s)), name: u.name]}\n else\n topic_ids = ContentUserLayout.get_unlocked_topics(@chapter,current_user)\n if !topic_ids.nil?\n list = @chapter.topics.where(:id=>topic_ids).map {|u| Hash[value: (u.id.to_s+'|'+get_params(u.params.to_s)), name: u.name]}\n else\n list = @chapter.topics.map {|u| Hash[value: (u.id.to_s+'|'+get_params(u.params.to_s)), name: u.name]}\n end\n end\n render json: list\n end", "def list_topics\n\tputs \"1. Social Media\"\n\tputs \"2. Tech\"\n\tputs \"3. Business\"\n\tputs \"4. Entertainment\"\n\tputs \"5. World\"\n\tputs \"6. Watercooler\"\n\tputs \" \"\n\tputs \"Which topic interests you most?\"\n\tprint \"Please enter a number 1 through 6 or press any other # to quit: \"\nend", "def show\n if current_user.role == 'Student'\n subject_ids = current_user.proficiencies.where(\"marks_in_perc < ?\", 65).pluck(:subject_id)\n keywords = current_user.search_histories.order(\"hits DESC\").limit(5).pluck(:keywords)\n @recommended_resources = Resource.includes([:subject, :tags]).where(\"subject_id IN (?)\", subject_ids) + Resource.includes([:subject, :tags]).ransack(title_or_description_or_subject_title_or_tags_name_cont_any: keywords).result.limit(5)\n end\n end", "def related_topics\n Topic.where(:language => language).tagged_with(tags.map(&:name), :any => true).reject { |t| t == self }\n end", "def get_recommendations\n result = []\n DIST[@pain_severity].each do |element|\n unique = false\n while !unique\n recommendation = weighted_sample(Recommendation.send(element).suggestable)\n if result.include? recommendation\n recommendation = weighted_sample(Recommendation.send(element).suggestable)\n else\n result << recommendation\n unique = true\n end\n end\n end\n result\n end", "def all_following_topics\n topics = User.find(params[:user_id]).following_topics\n render :json => topics\n end", "def find_reviewers(topic)\n User.all.collect{|u| u if u.reviews.count > 0}.compact\n end", "def help_topics\n (@help_topics || {}).inject({}) do |topics, (k,v)|\n url = CartridgeType.normalize_url(v)\n topics[k] = url if url\n topics\n end\n end", "def find_user_data\n if @guardian.current_user && @all_topics.present?\n topic_lookup = TopicUser.lookup_for(@guardian.current_user, @all_topics)\n @all_topics.each { |ft| ft.user_data = topic_lookup[ft.id] }\n end\n end", "def get_most_recently_visited_topics(org_unit_id) # GET\n query_string = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/content/recent\"\n _get(query_string)\n # Returns: a JSON array of Topic ToC entries.\nend", "def topics\n client = Comments.discourse\n @topics = client.latest_topics\n respond_to do |fmt|\n fmt.js { }\n end\n end", "def get_threaded_discussion_topic_user_view_responses(user_id, course_id,\r\n thread_id, topic_id,\r\n depth = nil)\r\n if depth.nil?\r\n relative_url = PATH_USERS_COURSES_THREADEDDISCUSSIONS_TOPICS_USERVIEWRESPONSES % [user_id,\r\n course_id,\r\n thread_id,\r\n topic_id]\r\n else\r\n relative_url = PATH_USERS_COURSES_THREADEDDISCUSSIONS_TOPICS_USERVIEWRESPONSES_DEPTH % [user_id,\r\n course_id,\r\n thread_id,\r\n topic_id,\r\n depth]\r\n end\r\n get(relative_url)\r\n end", "def otherConfirmedTopicforUser(assignment_id, creator_id)\n # Return other signups for this user\n SignedUpUser.find_user_signup_topics(assignment_id, creator_id)\n end", "def find_frequently_reviewed_restaurants(topic, reviewer)\n restaurants = reviewer.subscribed_restaurants.by_topic(topic.id)\n frequency_with_restaurants = {}\n restaurants.each do |restaurant|\n frequency_with_restaurants[restaurant] ||= 0\n frequency_with_restaurants[restaurant] += 1\n end\n\n sorted = frequency_with_restaurants.sort{|v1, v2| v2.last <=> v1.last}\n\n # Take top 5 restaurants\n sorted[0..5]\n end", "def hsdq_authorized_topics(*topics)\n if topics.any?\n @hsdq_authorized_topics = [topics].flatten\n else\n @hsdq_authorized_topics ||= [hsdq_opts[:topics]].flatten\n end\n end", "def pending\n @topics = if current_course_user&.student?\n unread_topics_for_student\n else\n all_topics.pending_staff_reply\n end\n\n render_topics_list_data\n end", "def list_topics\n output = []\n output.push(\"\\e[1;32mTopics:\\e[0m\\n\")\n topics.each_key do |title|\n output.push(\"- \\e[1;37m#{title}\\e[0m\")\n end\n output.join(\"\\n\")\n end", "def subject_topics\n @subject_topics ||= term_values([:subject, :topic])\n end", "def show\n redirect_to '/unauthorized' if current_user.blocked_by? User.find(params[:user_id])\n @user = User.find(params[:user_id])\n @dm_profile = @user.dm_profile\n unless @dm_profile.nil?\n @similar_profiles = User.recommender(@dm_profile, \"dm\")\n @similar_profiles = recommend_set(@similar_profiles, @user) & User.location(current_user, \"1\")\n else\n @similar_profiles = nil\n end\n if !@dm_profile\n redirect_to new_user_dm_profiles_path(@user, tutorial: params[:tutorial])\n else\n render 'show'\n end\n end", "def including_topics_list\n names_string(self.includes_topics)\n end", "def show\n\t resource = User.find_by_authentication_token(params[:auth_token])\n\t return invalid_user unless resource\n\n\t @topic = Topic.where(:id => \"#{params[:topic_id]}\").first\n\t return invalid_topic unless @topic.present?\n\n\t unless resource.has_admin_previlages?\n\t\t\tlog_topic_activity resource , @topic.name, \"#{resource.first_name} clicked this topic, #{@topic.name}\" \n\t\tend\n\n\t\t@questions = @topic.questions.page(params[:page]).per_page(10)\n\n\t end", "def help_topics\n self.class.instance_variable_get(:@__help_topics) || {}\n end", "def recommend_articles\n @user = User.find(params[:user_id])\n @articles = @user.recommend_articles.accessibles(current_user).order_by_recommendations_count_desc.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::RECOMMEND)\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 get_bookmarked_topics(org_unit_id) # GET\n query_string = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/content/bookmarks\"\n _get(query_string)\n # Returns: a JSON array of Topic ToC entries.\nend", "def followings\n @hot_topics = Topic.hot_topics(5)\n @interviewee = User.where(:nickname => params[:id]).first\n @is_same_user = @interviewee.is_same_user?(@current_user)\n \n @followings = @interviewee.followings\n end", "def set_topics \n # Below - All city topics for filter panel obj pass. \n @ossembly = @city.topics\n # Below - Lets Talk topic and all corresponding subtopics.\n @lets_talk = @city.topics.find_by_name(\"Let's Talk\")\n @general_talk = @city.subtopics.find_by_name(\"General Talk\")\n @help_out = @city.subtopics.find_by_name(\"Help Me Out\")\n @sports = @city.subtopics.find_by_name(\"Sports\")\n @business_buzz = @city.subtopics.find_by_name(\"Business Buzz\")\n @grinds_gears = @city.subtopics.find_by_name(\"Grinds My Gears\")\n # Below - Good Vibes topic and all corresponding subtopics.\n @good_vibes = @city.topics.find_by_name(\"Good Vibes\")\n @general_good = @city.subtopics.find_by_name(\"General Good\")\n @good_news = @city.subtopics.find_by_name(\"Good News\")\n @furry_friends = @city.subtopics.find_by_name(\"Furry Friends\")\n @city_snaps = @city.subtopics.find_by_name(\"City Snaps\")\n @local_historian = @city.subtopics.find_by_name(\"Local Historian\")\n # Below - City Affairs topic and all corresponding subtopics.\n @city_affairs = @city.topics.find_by_name(\"City Affairs\")\n @general_affairs = @city.subtopics.find_by_name(\"General Affairs\")\n @ballots = @city.subtopics.find_by_name(\"Ballots\")\n @schools = @city.subtopics.find_by_name(\"Schools\")\n @city_improvements = @city.subtopics.find_by_name(\"City Improvements\")\n @events = @city.subtopics.find_by_name(\"Events\")\n end", "def topics=(value)\n @topics = value.is_a?(Array) ? value : [value]\n end", "def index\n @topics = @ip.topics\n end", "def get_threaded_discussion_topics(course_id, thread_id, use_source_domain = false)\r\n if !use_source_domain\r\n relative_url = PATH_COURSES_THREADEDDISCUSSIONS_TOPICS % [course_id, thread_id]\r\n else\r\n relative_url = PATH_COURSES_THREADEDDISCUSSIONS_TOPICS_USESOURCEDOMAIN % [course_id, thread_id]\r\n end\r\n get(relative_url)\r\n end", "def get_tutorials\n Story.published.commoners_voice.select do |s|\n %w(tutorial howto).all? {|t| s.tags.pluck(:name).include?(t)}\n end.first(3)\n end", "def topic\n SignedUpTeam.find_by(team_id: id, is_waitlisted: 0).try(:topic_id)\n end", "def topics(preload: Kazoo::Topic::DEFAULT_PRELOAD_METHODS)\n @topics_mutex.synchronize do\n @topics ||= begin\n topics = zk.get_children(path: \"/brokers/topics\")\n raise Kazoo::Error, \"Failed to list topics. Error code: #{topics.fetch(:rc)}\" unless topics.fetch(:rc) == Zookeeper::Constants::ZOK\n preload_topics_from_names(topics.fetch(:children), preload: preload)\n end\n end\n end", "def get_user_recommendations\n recommendations = []\n csv = open( CONFIG['SPREADSHEET_URL'] ).read\n CSV.parse( csv ).each_with_index do |line,i|\n next if i == 0 # Skip header\n date, title, category, url, note, person = *line\n next if category.match(/^Other/) # Looking at specific categories - Other is too broad\n if matches = url.match(%r{/(?:dp|product|ASIN)/([^/]*)})\n recommendations << {\n :id => matches[1],\n :category => category\n }\n end\n end\n recommendations\n end", "def all\n data = service.list_topics.to_h[:topics] || []\n load(data)\n end", "def get_topic_relationships(topic)\n query = \"\n START n=node:topics(uuid = '#{topic.id}')\n MATCH (n)-[r]->(x)\n WHERE has(r.connection_id)\n RETURN r,x\n \"\n outgoing = Neo4j.neo.execute_query(query)\n\n query = \"\n START n=node:topics(uuid = '#{topic.id}')\n MATCH (n)<-[r]-(x)\n WHERE has(r.connection_id)\n RETURN r,x\n \"\n incoming = Neo4j.neo.execute_query(query)\n\n query = \"\n START n=node:topics(uuid = '#{topic.id}')\n MATCH (n)-[r:pull]->(x)\n RETURN r,x\n \"\n pulls = Neo4j.neo.execute_query(query)\n\n query = \"\n START n=node:topics(uuid = '#{topic.id}')\n MATCH (n)<-[r:pull]-(x)\n RETURN r,x\n \"\n pushes = Neo4j.neo.execute_query(query)\n\n organized = {}\n\n if outgoing\n outgoing['data'].each do |c|\n type = c[0]['type']\n organized[type] ||= c[0]['data'].select{|key,value|['connection_id','reverse_name','inline'].include?(key)}.merge({'connections' => []})\n organized[type]['connections'] << c[0]['data'].select{|key,value|['user_id'].include?(key)}.merge(c[1]['data'])\n end\n end\n\n if incoming\n incoming['data'].each do |c|\n type = c[0]['data']['reverse_name'].blank? ? c[0]['type'] : c[0]['data']['reverse_name']\n organized[type] ||= c[0]['data'].select{|key,value|['connection_id','reverse_name','inline'].include?(key)}.merge({'connections' => []})\n data = c[0]['data'].select{|key,value|['user_id'].include?(key)}.merge(c[1]['data'])\n organized[type]['connections'] << data\n end\n end\n\n if pulls\n pulls['data'].each do |c|\n\n found = nil\n\n organized.each do |k,o|\n found = o['connections'].detect{|con| con['uuid'] == c[1]['data']['uuid'] }\n break if found\n end\n\n if found\n found['pull'] = true\n next\n end\n\n type = 'Pull'\n organized[type] ||= {\n 'connection_id' => 'pull',\n 'reverse_name' => 'pull',\n 'inline' => 'pull',\n 'connections' => []\n }\n organized[type]['connections'] << { 'pull' => true }.merge(c[1]['data'])\n end\n end\n\n if pushes\n pushes['data'].each do |c|\n\n found = nil\n\n organized.each do |k,o|\n found = o['connections'].detect{|con| con['uuid'] == c[1]['data']['uuid'] }\n break if found\n end\n\n if found\n found['reverse_pull'] = true\n next\n end\n\n type = 'Push'\n organized[type] ||= {\n 'connection_id' => 'push',\n 'reverse_name' => 'push',\n 'inline' => 'push',\n 'connections' => []\n }\n organized[type]['connections'] << { 'reverse_pull' => true }.merge(c[1]['data'])\n end\n end\n\n returnable = []\n organized.each do |type, data|\n returnable << {:name => type}.merge(data)\n end\n\n returnable\n end", "def recommended\n @users = popular_users\n\n all_plucked_tags_photo_ids = []\n @tags = popular_tags.map do |tag|\n current_tag_photo_ids = tag.photo_ids\n all_plucked_tags_photo_ids += current_tag_photo_ids[0..7]\n [tag.name, current_tag_photo_ids[0..7]]\n end\n\n @photos = Photo\n .includes(:tags, :likers, :author)\n .where(id: all_plucked_tags_photo_ids)\n\n render :recommended\n end", "def forum_get_topics(args={})\n JSON.parse(HelpSpot.api_request('forums.getTopics', 'GET', {:xForumId => args[:forum_id]}.merge(args)))['topic'] rescue []\n end", "def all\n data = service.list_topics.body[\"topics\"] || []\n load(data)\n end", "def scrape_resources(topic)\n \n #The query parameters: (update according to your search query)\n q = \"#{topic.name}\"; #the search query\n pageNumber = 1 #the number of requested page\n pageSize = WebScraperOptions[:numSearchResults] #the size of a page\n autoCorrect = false #autoCorrectspelling\n safeSearch = true #filter results for adult content\n \n response = Unirest.get \"https://contextualwebsearch-websearch-v1.p.rapidapi.com/api/Search/WebSearchAPI?q=#{q}&pageNumber=#{pageNumber}&pageSize=#{pageSize}&autoCorrect=#{autoCorrect}&safeSearch=#{safeSearch}\",\n headers:{\n \"X-RapidAPI-Key\" => Contextual_Web_Search_Key\n }\n \n resources = []\n \n #Go over each resulting item\n response.body[\"value\"].each do |webPage|\n \n #Get the web page metadata \n url = webPage[\"url\"]\n \n # Removes html tags from title and titleizes the string.\n title = ActionView::Base.full_sanitizer.sanitize(webPage[\"title\"])\n title = title.titleize\n \n # Removes html tags from excerpt\n excerpt = ActionView::Base.full_sanitizer.sanitize(webPage[\"description\"]).truncate(200)\n \n # User with id of 2 is the web scraper.\n content = { link: url, video: \"\", text: \"\", excerpt: excerpt }\n res = Resource.new(name: title, content: content.to_json, topic_id: topic.id, user_id: 2) \n if res.save \n resources << res \n else \n raise 'Resource could not be saved!'\n end \n end \n resources \n end", "def show\n @courses = current_user.courses\n @topics = current_user.topics.where(course_id: params[:course_id])\n @lessons = current_user.lessons.where(topic_id: params[:topic_id])\n @user_course = current_user.courses.each{|f| f}.first.id\n @user_topics = current_user.topics.each{|f| f}.first.id\n @lesson = Lesson.find(params[:id])\n end", "def all_topics\n topics = Feed.find(params[:feed_id]).topics\n render :json => topics\n end", "def get_topic(org_unit_id, topic_id) # GET\n query_string = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/content/topics/#{topic_id}\"\n _get(query_string)\nend", "def list_topics\n req_hash = generate_request('ListTopics')\n request_info(req_hash, SnsListTopicsParser.new(:logger => @logger))\n rescue\n on_exception\n end", "def recommended_subreddits(subreddits)\n names = subreddits.join(',')\n parameters = { :srnames => names }\n\n response = get('api/subreddit_recommendations.json', parameters)\n body = response[:body]\n\n body.map { |subreddit| subreddit[:sr_name] }\n end", "def show\n\n @user = User.includes([:votes =>\n [:topic_link =>\n [:link, :topic => [:category => :channel]]\n ]\n ],\n [:topic_links =>\n [:link,\n :topic =>\n [:category=>\n [:channel]\n ]\n ]\n ],\n [:topics =>\n [:category=>[:channel], :best_link => [:link]]\n ],\n [:twitter_auth]).find(params[:id])\n\n @friends_upvoted_links = TopicLink.includes(:link, :voters, :topic => [:category => [:channel]], :votes => [:user]).where(votes: {user_id: @user.friends.collect{|u|u.id}, status:1}).limit(5).flatten\n @friends_downvoted_links = TopicLink.includes(:link, :voters, :topic => [:category => [:channel]], :votes => [:user]).order().where(votes: {user_id: @user.friends.collect{|u|u.id}, status:-1}).limit(5).flatten\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def user\n recommendations 'user'\n end", "def recommend_artists(current_user, recommended_user)\n recommended_artists = Array.new\n artists = retrieve_favourite_artists(recommended_user)\n artists.each do |artist|\n unless current_user.artists.to_a.include?(artist[0]) || recommended_artists.length >= 10\n recommended_artists << artist[0]\n end\n end\n recommended_artists\n end", "def load_topics(address)\n\n\t# uses JSON via a RestClient GET command to load the top post Mashable API \n\t# into an array usable by ruby; sets article count to 1 for first article\n\tposts = JSON.load(RestClient.get address)\n\tnum = 1\n\n\t# iterates through each post within the [\"hot\"] key displaying the post's\n\t# title and url for quick access for the user\n\tposts[\"hot\"].each do |array|\n\t\tputs \"#{num}\" + array[\"title\"]\n\t\tputs \"\t\t\" + array[\"short_url\"]\n\t\tputs \" \"\n\t\tnum += 1\n\tend\n\n\t# once method has outputted the top 10 articles within a given category\n\t# it then asks for user input regarding which article they'd like to read\n\tputs \"Which topic would you like to read?\"\n\tprint \"Please enter a number from 1 to 10 or any other # to exit. \"\n\n\tarticle = gets.to_i\n\n\t# as long as the article choice is between 1 and 10, the below conditional\n\t# will clear the previous screen, display the title of chosen article as \n\t# well as the content in plain text; once user is done reading they are\n\t# prompted to press enter to return to menu of categories for furthe reading \n\tif article > 0 && article <= 10\n\t\tarticle -= 1\n\t\tsystem \"clear\"\n\t\tputs posts[\"hot\"][article][\"title\"]\n\t\tputs \" \"\n\t\tputs posts[\"hot\"][article][\"content\"][\"plain\"]\n\t\tputs \" \"\n\t\tputs \"Press enter when done reading.\"\n\n\t\tgets\n\t\tsystem \"clear\"\n\telse\n\t\tputs \"I'm sorry, you didn't enter a correct article #.\"\n\t\tputs \" \"\n\tend\nend", "def list(options = {})\n body = options.has_key?(:query) ? options[:query] : {}\n\n response = @client.get \"/api/topics\", body, options\n\n return response\n end", "def topic\n @topic.join('/')\n end", "def search_item_topic(search_item)\n search_item_topic = begin\n SearchItem.find(search_item).topic\n rescue\n \"\"\n end\n end", "def list_topic_titles\n topics.keys.join(\"\\n\")\n end", "def get_match(curr_user)\n political_diff = 0\n chosen_user = nil\n topic_chosen = nil\n data = {}\n curr_user.topics.each do |topic|\n topic.users.each do |user|\n curr_political_diff = (curr_user.political_leaning - user.political_leaning).abs\n if chosen_user.nil? and user.id != curr_user.id\n chosen_user = user\n political_diff = curr_political_diff\n topic_chosen = topic\n elsif curr_political_diff > political_diff and user.id != curr_user.id\n chosen_user = user\n political_diff = curr_political_diff\n topic_chosen = topic\n end\n end\n end\n data[:match] = chosen_user\n data[:topic_chosen] = topic_chosen\n return data\n end", "def show\n @topic = Topic.includes(:posts => {:user => :setting}).find(params[:id])\n end" ]
[ "0.69905466", "0.69010246", "0.6765958", "0.67455447", "0.66843027", "0.6620959", "0.65781856", "0.65252274", "0.6485533", "0.645811", "0.6428915", "0.6315805", "0.6315805", "0.6312051", "0.63070834", "0.62557745", "0.62521315", "0.62454796", "0.62250453", "0.6214372", "0.62134063", "0.6211428", "0.6209867", "0.6178117", "0.61642665", "0.6149527", "0.6134003", "0.60701233", "0.6065506", "0.60582465", "0.60550857", "0.6054661", "0.6028601", "0.6006365", "0.5965114", "0.5953677", "0.593507", "0.5927507", "0.5903688", "0.5903688", "0.5903688", "0.58983976", "0.5876096", "0.5869493", "0.5869493", "0.58317596", "0.581721", "0.5814966", "0.58107364", "0.5774289", "0.576979", "0.57688415", "0.5743284", "0.5727644", "0.57184696", "0.5711991", "0.56680185", "0.56609005", "0.5628821", "0.56250244", "0.5619451", "0.5611626", "0.559979", "0.55946714", "0.5587549", "0.55850387", "0.55613047", "0.5552657", "0.5546759", "0.5503186", "0.5493813", "0.54774827", "0.54629517", "0.54627323", "0.5451353", "0.5450756", "0.54420054", "0.5432644", "0.5418431", "0.5411527", "0.54040724", "0.5398804", "0.53912175", "0.53816855", "0.5373486", "0.5371873", "0.5370604", "0.5367571", "0.5362384", "0.53573036", "0.53556246", "0.5340542", "0.53320545", "0.5331125", "0.5327464", "0.53183913", "0.5302545", "0.52996737", "0.5297143", "0.5296418" ]
0.72970647
0
Get if is a new user or not
def new_user? self.created_at > 1.month.ago end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new?\n @user\n end", "def new?(user)\n not read? and user != sender\n end", "def create?\n @user != nil\n end", "def create?\n user.present?\n end", "def create?\n user.present?\n end", "def create?\n user.present?\n end", "def create?\n\t\t!@user.nil?\n\tend", "def create?\n @user.expert\n end", "def isAllowUser(request) \n return httpRequest('check_newuser',request)\n end", "def isnew?\n if Admin.new\n return false \n else\n return true \n end \n end", "def user_is_old? user\n return user.logins_number > 1\n end", "def current_user_has_create?(uri, options=nil)\n opts = options || current_user.try(:user_options) || nil\n current_user.present? and current_user.has_create?(uri, opts)\n end", "def new?\n profile\n @new\n end", "def create?\n #everyone who is loggedin can do this action\n true\n end", "def create?\n !@user.nil?\n end", "def creatable_by?(user)\n true\n end", "def new?\n if is_super_admin?\n true\n elsif is_admin? && !has_company?\n true\n else\n false\n end\n end", "def create?\n user.present? && user.admin?\n end", "def new?\n super && !user.admin? && not_a_visitor && !user_has_other_application?\n end", "def create?\n !user.nil?\n end", "def create?\n !user.nil?\n end", "def newUser\n end", "def new_user_handler\n nil\n end", "def new?\n\t\treturn true if sign_in_count < 2 && Time.now-created_at < 2*60\n\t\tfalse\n\tend", "def creator?(object)\n current_user == object.user ? true : false\n \n end", "def creator?\n if session[:user_id] == @event.id\n @creator = true\n else\n @creator = false\n end\n end", "def new_unique_user\n puts '>>> params:'\n puts params.inspect\n user = User.find_or_initialize_by_email(params[:user][:email])\n puts '>>> created?'\n puts user.new_record?\n\n if user.new_record?\n created = true\n \n #use_password default to false\n user.use_password = false\n \n if user.save\n success = true\n else\n success = false\n end\n else\n created = false\n success = true\n end\n \n response = { :success => success, :created => created }\n \n puts '>>> User:'\n puts user.inspect\n puts '>>> response'\n puts response.inspect\n \n render json: response\n end", "def new?\n @user&.admin?\n end", "def is_user?\n user ? true : false\n end", "def call\n context.user = User.find_by_telegram_id(context.telegram_user.id)\n return if context.user\n\n context.is_new_user = true\n context.user = User.create(\n telegram_id: context.telegram_user.id,\n )\n end", "def new_user\n \n end", "def ensure_user_created\n if User.find_by_ldap_uid(ldap_user.uid)\n Rails.logger.debug(\"User in user table.\")\n true\n else\n Rails.logger.debug(\"User not in user table, redirecting to new user form.\")\n redirect_to(new_users_url) and return\n end\n end", "def set_new_user\n @new_user = NewUser.find(params[:id])\n end", "def new\n @user_signup = User.new\n @is_signup = true\n end", "def new\n @user = User.new\n @is_signup = true\n end", "def create?\n # false # no access\n user.present? # minimum requirement for creating records \n # like posts or comments is that a user exist and be logged in. \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 is_new?(last_updated=nil)\n last = last_updated || @user.last_updated\n Time.parse(@created_at) > last\n end", "def is_user?\ncurrent_user.username == @userl.username\n end", "def one_user_registered?\n if User.count == 1\n if user_signed_in?\n redirect_to root_path\n else\n redirect_to new_user_session_path\n end\n end \n end", "def created_by?(user)\n unless user.nil?\n userid = user.send(BigbluebuttonRails.configuration.user_attr_id)\n self.creator_id == userid\n else\n false\n end\n end", "def new_user?(seminar,user)\n user = $app_ids[seminar][user].to_s\n user[0] == 48\nend", "def canCreate?(user=current_user)\n return false if user.nil?\n true\n end", "def create?\n !@current_user.admin?\n end", "def new_record?\n new?\n end", "def new?\n @is_new\n end", "def find_or_create(uid)\n is_new = false\n @user = User.where(\"uid =?\",uid).first\n is_new = true if @user.nil?\n @user = User.new() if @user.nil?\n @user.uid = uid\n @user.is_new = is_new\n @user\n end", "def status_getuser?()\n return true if (@status == TAC_PLUS_AUTHEN_STATUS_GETUSER)\n return false\n end", "def new?\n status == STATUS_NEW\n end", "def create?\n user.role == \"Envio\" || user.role == \"Cadastro\" || user.admin?\n end", "def new\n\n if User.find_by_id(session[:user_id])\n redirect_to users_url, :notice => \"You are already signed in\"\n else\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end\n\n end", "def has_new_activity?(user)\n found_notification?(user) || found_comment_notifications?(user)\n end", "def saved?\n user_id?\n end", "def isnew?\n if Client.new\n return false \n else\n return true \n end \n end", "def new?\n profile.empty?\n end", "def new\n if logged_in? && !is_api_request?\n flash[:error] = \"You cannot sign up for a new account because you are already logged in.\"\n redirect_to home_url\n else\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end\n end", "def new?\n @type == 'NEW'\n end", "def is_potential_user?\n\t\ttrue\n\tend", "def self_signup?\n user_id == author_id\n end", "def new_record?() true end", "def user?\n type == :user_id\n end", "def user?\n type == :user_id\n end", "def new_record?\n @new_record == true\n end", "def user?\n get_mode == :user\n end", "def login_required\n if params[:create_user] # hidden field in posted form. Create the user.\n user = User.new\n user.last_login = request.remote_ip\n if user.save && user.errors.empty?\n self.current_user = user # !! now logged in\n else\n flash[:error] = \"I am sorry. the system could not create a new account for you.\"\n access_denied\n end\n elsif authorized?\n return true\n else\n access_denied\n end\n end", "def get_or_create_user\n @user||=use_url_session? ? get_or_create_url_session_user : current_user_with_guest\n end", "def fill_up_user_create\n # if self.class.column_names.include? 'updated_by_id'\n # if UserInfo.current_user_id\n # # if updated_by_id && updated_by_id != UserInfo.current_user_id\n # # logger.info \"NOTICE create - self.updated_by_id is different: #{updated_by_id}/#{UserInfo.current_user_id}\"\n # # end\n # # self.updated_by_id = UserInfo.current_user_id\n # end\n # end\n\n # return true if !self.class.column_names.include? 'created_by_id'\n\n return true if !UserInfo.current_user_id\n\n # if created_by_id && created_by_id != UserInfo.current_user_id\n # logger.info \"NOTICE create - self.created_by_id is different: #{created_by_id}/#{UserInfo.current_user_id}\"\n # end\n # self.created_by_id = UserInfo.current_user_id\n true\n end", "def new?\n @new\n end", "def logged_in_normal_user?\n normal_user.present?\n end", "def guest?\n new_record?\n end", "def new_record?\n @new_record\n end", "def new_record?\n @new_record\n end", "def new_record?\n @new_record\n end", "def new_guest_user\n if object.user && object.user.guest? && object.user.trips.count == 1\n {email: object.user.email, authentication_token: object.user.authentication_token}\n else\n nil\n end\n end", "def create?\n @current_user.permission('Fdp', :clerk)\n end", "def user?\n @user = User.find_by(email: @email) if @userinfo\n\n # No user with that email so create the user with auth0_id.\n create_user_and_login @userinfo if @user.nil?\n end", "def new?\n\t\tcreate?\n\tend", "def new_record? \n new? \n end", "def dummy_user?\n (user_id.split('/').first == 'gofreerev')\n end", "def dummy_user?\n (user_id.split('/').first == 'gofreerev')\n end", "def new_record?\n new?\n end", "def new_record?\n new?\n end", "def new_record?\n new?\n end", "def new_record?\n new?\n end", "def create?\n return false unless @user\n\n @user.try(:admin?) || @record.user == @user ||\n @record.group&.users&.include?(@user) ||\n NodePolicy.new(@user, @record.node).create?\n end", "def new_session?\n new_session != false\n end", "def check_for_user\n if User.count == 0\n User.create({:login => \"admin\", :password => \"password\", :password_confirmation => \"password\", :name => 'blog owner', :email => \"none@none\", :time_zone => \"Europe/London\"})\n # Display the newly created users details\n notify \"No users found, so default user created: authenticate with login \\\"admin\\\", password \\\"password\\\", and then change your password.\"\n end\n login_required\n end", "def new_session?\n new_session != false\n end", "def new_record?\n @new_record\n end", "def new_record?\n @new_record\n end", "def create_user(field_hash)\n field_hash[:id] = \"user/new\"\n payload = compose(field_hash)\n resp = @site['user/new/edit'].post payload\n new_id = resp.match(/User\\s*(\\d+)/)\n if new_id.class == MatchData\n new_user = new_id[1]\n else\n new_user = resp\n end\n new_user # return the new user id or the full REST response\n end", "def logged_in?\n #Dependiendo de lo que regrese current_user\n if current_user\n #Regresa true si el usuario existe\n true\n else\n #Si no existe regresa false\n false\n end\n end", "def user_exists?\n \t\tself.errors.add(:name, \"does not exist!\") unless self.user_id.present?\n \tend", "def new_user_available(useremail)\n result = @connection.exec(\"SELECT * FROM Users WHERE useremail='#{useremail}';\")\n if result.num_tuples.zero?\n true\n else\n false\n end\n end", "def new_user\n\t @user = User.new\t \n\tend", "def new?\n @new\n end", "def new_profile?\n @profile = Profile.new(params[:profile])\n @profile.user = current_user\n @profile.email = current_user.email\n end", "def new?\n create?\n end", "def new?\n create?\n end", "def new?\n create?\n end" ]
[ "0.76083463", "0.7112065", "0.710109", "0.7097605", "0.7097605", "0.7097605", "0.70500624", "0.69911754", "0.6977029", "0.693427", "0.686162", "0.68191147", "0.68150294", "0.67663866", "0.67612106", "0.6751757", "0.670841", "0.6693662", "0.668555", "0.667204", "0.667204", "0.66540956", "0.6624256", "0.65736276", "0.6563907", "0.6549156", "0.654865", "0.6534873", "0.65187967", "0.6514982", "0.65143466", "0.6506634", "0.6485234", "0.6481288", "0.64643073", "0.64519215", "0.64253134", "0.64246666", "0.64200425", "0.64169806", "0.6414476", "0.6412401", "0.64096504", "0.63976914", "0.6396027", "0.6392833", "0.6389171", "0.63876706", "0.6373215", "0.63721234", "0.63669187", "0.63662887", "0.63466585", "0.634208", "0.6338576", "0.63334125", "0.6330106", "0.6318148", "0.6315692", "0.6312609", "0.63012606", "0.63012606", "0.62982523", "0.6296936", "0.629661", "0.6295636", "0.6288631", "0.62776953", "0.62769365", "0.6273854", "0.6267917", "0.6267917", "0.6267917", "0.6266974", "0.6261374", "0.6255709", "0.6255562", "0.62473816", "0.62397903", "0.62397903", "0.6238605", "0.6238605", "0.6238605", "0.6238605", "0.6229804", "0.62295276", "0.6229129", "0.6228615", "0.6217226", "0.6217226", "0.6215604", "0.6211549", "0.6209349", "0.62085027", "0.62069696", "0.6206168", "0.6205545", "0.62005204", "0.62005204", "0.62005204" ]
0.7170557
1
Get if the user already thanked the topic specified
def already_thanked?(topic) notification = Notification.thanked_by(self.id, topic.id) !notification.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def own_topic?(topic)\n topic.read_attribute(:user_id) == self.id\n end", "def thanked_by?(user)\n result = self.notifications.where(:sender_id => user.id)\n !result.empty?\n end", "def owned_topic\n unless current_user.id == @topic.user_id\n flash[:alert] = \"Opps! You don't have permission to do that.\"\n end\n end", "def has_topic?\n ! (topic.nil? || topic_name.nil?)\n end", "def has_topic\n !@topic.nil?\n end", "def has_topic\n !@topic.nil?\n end", "def can_reply_to?(topic) false end", "def can_reply_to_forem_topic? topic\n true\n end", "def subscribing?(other_user)\n subscribing.include?(other_user)\n end", "def following?(tw_user)\n following.include?(tw_user)\n end", "def liked_by?(user)\n likes_by_user(user).any?\n end", "def topics_creatable_by?(user=:false)\n (user != :false && topics_created_by_id <= user.user_level.position) || (user == :false && topics_created_by == UserLevel.find_by_name(\"Anonymous\"))\n end", "def has_topics?\n !self.topics.empty?\n end", "def liked_by?(user)\n likers.exists?(user.id)\n end", "def liked_by?(user)\n likes.find_by_user_id(user.id).present?\n end", "def already_welcomed?(user)\n notification = Notification.welcomed_by(self.id, user.id)\n !notification.empty?\n end", "def likes?(tweet)\n \ttweet.likes.where(user_id: id).any?\n end", "def food_upvote?(topic)\n\ttopic == \"food\"\nend", "def check_if_reply_and_not_already_read(tweet)\n\n puts tweet.text\n if tweet.text.match(/^@partyprinter.*/) && tweet.user.id != 1678701920 && Tweet.exists?(tweet.id.to_i) == nil\n puts \"new\"\n return true\n end\n\n end", "def kbHasTopic _obj, _args\n \"_obj kbHasTopic _args;\" \n end", "def bacon_upvote?(topic)\n\ttopic == \"bacon\"\nend", "def already_liked?\n Like.where(user_id: current_user.id, gosssip_id: params[:gosssip_id]).exists?\n end", "def allot_topic_to_user_if_possible(assignment_id, signed_up_user_entry,topic,current_max_slots)\n high_prio_topics = is_other_topic_of_higher_priority(assignment_id,signed_up_user_entry.creator_id,signed_up_user_entry.preference_priority_number,current_max_slots)\n if(high_prio_topics == false)\n current_max_slots[topic.id] = current_max_slots[topic.id] -1\n signed_up_user_entry.update_attribute('is_waitlisted',0)\n participant = Participant.find_by_user_id_and_parent_id(Team.find(signed_up_user_entry.creator_id).users[0].id, assignment_id)\n participant.update_topic_id(topic.id)\n delete_other_bids(assignment_id, signed_up_user_entry.creator_id)\n return true\n end\n return false\nend", "def liked?(user_id)\n !StoryLike.where(story_id: self.id, user_id: user_id).empty?\n end", "def following? subject\n has_event? 'follow', subject\n end", "def answered_by?(user)\n replies.exists?(:user_id => user)\n end", "def mentioning?\n # Skip send notification if Doc not in publishing\n if instance_of?(Doc)\n publishing?\n else\n true\n end\n end", "def favorited_tweet?(tweet)\n favorite_tweets.include? tweet\n end", "def can_read_forem_topic? topic\n true\n end", "def like(topic)\n likes.where(topic: topic).first\n end", "def mentioned?(user)\n @mentions.include?(user)\n end", "def retweeted?\n retweeted_ids = h.current_user.retweeted_replies.pluck(:id)\n retweeted_ids.include?(self.id)\n end", "def slotAvailable?(topic_id)\n SignUpTopic.slotAvailable?(topic_id)\n end", "def slotAvailable?(topic_id)\n SignUpTopic.slotAvailable?(topic_id)\n end", "def slotAvailable?(topic_id)\n SignUpTopic.slotAvailable?(topic_id)\n end", "def respondent_already_answered?\n sibling_responses.exists?(user_id: user_id)\n end", "def subscribed_by?(user)\n subscriptions.where(user: user).any?\n end", "def subscribed_by?(user)\n subscriptions.where(user: user).any?\n end", "def can_give_kudos?\n if self.kudos_given_by_user_in_past_week < MAX_WEEKLY_KUDOS\n return true\n end\n return false\n end", "def following?(user)\n following.include?(user)\n end", "def already_liked?\n Like.where(user_id: current_user.id, post_id: params[:post_id]).exists?\n end", "def recommended?(user_id)\n return self.article_recommendations.exists?(user_id: user_id)\n end", "def participates?(user)\n author == user || receiver == user\n end", "def share_to_twitter?\n self.tweet_id == TWSharing::Underway\n end", "def already_liked_by?(current_user)\n return false unless current_user\n self.likes.where(:user_id => current_user.id).count > 0\n end", "def following?(other_user)\n following.include?(other_user) \n end", "def liked_by_user?\n\t\tLike.where(user_id: current_user.id, post_id:\n\t \tparams[:post_id]).exists?\n\tend", "def needs_followup?\n followup_note_count && followup_note_count > 0\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def has_swimmer_confirmations?\n user_swimmer_confirmations ? user_swimmer_confirmations.count > 0 : false\n end", "def request_sent?(_user_id)\n pending_user_relationships.where(user_id: _user_id).any?\n end", "def someone_won?\n !!winnning_marker\n end", "def following?(other_user)\n following.include?(other_user)\nend", "def subscribed?(user)\n user.subscription.subscribed==true\n end", "def sent_by?(user)\n from_user_id == user&.id\n end", "def following?(other_user)\n followeds.include?(other_user)\n end", "def can_modify_scrap_topic?\n return (admin? or @scrap_topic.scraps.length == 0 or (logged_in? and @scrap_topic.user_id == current_user.id))\n end", "def any_unread? usr\n @conv.posts.each do |post| \n if post.unread?(usr) && post.recipient_id == usr.id\n return true\n end\n end\n return false\n end", "def answered_questionnaire?(user)\n answered_users.include?(user)\n end", "def following_user?(other_user)\n following.include?(other_user)\n end", "def topic\n SignedUpTeam.find_by(team_id: id, is_waitlisted: 0).try(:topic_id)\n end", "def following?(user)\n following.include? user\n end", "def following? other_user\n following.include? other_user # check array are there include other_user?\n end", "def following?(other_author)\n following.include?(other_author)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following? other_user\n following.include?(other_user)\n end", "def subscribed?\n self.friendship_status > 0\n end", "def following_profile?(profile)\n return favorites.streams.where(favable_id: profile.stream_ids).count > 0\n end", "def invitable_to?(user)\n return false unless pending?\n return false if authors.include?(user)\n end", "def following?(other_user)\nfollowing.include?(other_user)\nend", "def following?(tribute)\n following.include?(tribute)\n end", "def following? (other_user)\n following.include?(other_user)\n end", "def should_notify?\n (article.recommendations_count > 0 and\n article.recommendations_count.modulo(5) == 0)\n end", "def following?(post)\n posts.include?(post)\n end", "def check_tweet_for_user\n if @tweet.user_id != current_user.id\n flash[:notice] = \"Not allowed!\"\n redirect_to tweets_url\n return\n end\n end", "def any_unread? usr\n ConversationProcessor.new(self).any_unread? usr\n end", "def has_liked_userpost(feed_item)\n @like = Like.where(user_id: current_user.id, userpost_id: feed_item.id).first\n !@like.nil?\n end", "def save_tweet?(tweet)\n if (tweet.user.followers_count + tweet.retweet_count) > MegaUltraTweet::Application::TWEET_RELEVANCE_MINIMUM\n return true\n end\n return false\n end", "def user_wants_to_join?\n @data['event']['text'].downcase != 'no'\n end", "def check_education_message\n return if @topic&.private_message?\n\n if creating_topic?\n count = @user.created_topic_count\n education_key = 'education.new-topic'\n else\n count = @user.post_count\n education_key = 'education.new-reply'\n end\n\n if count < SiteSetting.educate_until_posts\n return {\n id: 'education',\n templateName: 'education',\n wait_for_typing: true,\n body: PrettyText.cook(\n I18n.t(\n education_key,\n education_posts_text: I18n.t('education.until_posts', count: SiteSetting.educate_until_posts),\n site_name: SiteSetting.title,\n base_path: Discourse.base_path\n )\n )\n }\n end\n\n nil\n end", "def someone_did_change_topic(stem, person, channel, topic)\n end", "def liked_by? user\n not likes.reject { |like| like.created_by != user }.blank?\n end", "def subscribed_newsletter(user)\n NewsletterEmail.all.each do |newsletter|\n if newsletter.email == user.email\n return true\n end\n end\n return false\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end" ]
[ "0.7276717", "0.70956945", "0.6707058", "0.644437", "0.64084655", "0.64084655", "0.63783264", "0.63043135", "0.6234976", "0.62336546", "0.62186545", "0.62170166", "0.61582786", "0.611688", "0.60926855", "0.6092574", "0.6067959", "0.60553133", "0.60386765", "0.6030413", "0.60214067", "0.6015908", "0.601139", "0.59878784", "0.59863317", "0.5937312", "0.5934484", "0.59140015", "0.59132373", "0.5898593", "0.58948505", "0.58943236", "0.5891815", "0.5891815", "0.5891815", "0.5878177", "0.58716226", "0.58716226", "0.5863519", "0.5857204", "0.58536005", "0.584941", "0.58325374", "0.5824756", "0.5822479", "0.5807903", "0.5806571", "0.5806166", "0.57990134", "0.5796431", "0.57880247", "0.5778707", "0.57783306", "0.5777635", "0.5765344", "0.5761378", "0.57599497", "0.5758745", "0.5757142", "0.5741842", "0.57390636", "0.57203895", "0.57201403", "0.57101816", "0.56993806", "0.5692243", "0.5691691", "0.56860846", "0.568251", "0.5681908", "0.56786615", "0.56756043", "0.56755453", "0.56738484", "0.5673241", "0.56720054", "0.56710774", "0.5664331", "0.5661157", "0.56583107", "0.5657803", "0.5655845", "0.565004", "0.564982", "0.564982", "0.564982", "0.564982", "0.564982", "0.564982", "0.564982", "0.564982", "0.564982", "0.564982", "0.564982", "0.564982", "0.564982", "0.564982", "0.564982", "0.564982", "0.564982" ]
0.8361982
0
Get if the user already welcomed the user specified
def already_welcomed?(user) notification = Notification.welcomed_by(self.id, user.id) !notification.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thanked_by?(user)\n result = self.notifications.where(:sender_id => user.id)\n !result.empty?\n end", "def participates?(user)\n author == user || receiver == user\n end", "def mentioned?(user)\n @mentions.include?(user)\n end", "def invite?\r\n admin? or (user.id != user_record.id and streamer?)\r\n end", "def sent_by?(user)\n from_user_id == user&.id\n end", "def participates?(user)\n \tsender == user || recipient == user\n\tend", "def invited? user\n users.include?(user)\n end", "def applies_to?(user); false end", "def subscribing?(other_user)\n subscribing.include?(other_user)\n end", "def made_request?(user)\n all_users.include?(user)\n end", "def invitable_to?(user)\n return false unless pending?\n return false if authors.include?(user)\n end", "def enrolled?(user)\n return false if user == owner\n users.include?(user)\n end", "def user_joined?(user)\n not ContentUser.first(:user => user, :content => self).nil?\n end", "def has_swimmer_confirmations?\n user_swimmer_confirmations ? user_swimmer_confirmations.count > 0 : false\n end", "def sender? usr\n usr.id == user_id\n end", "def owned_by? a_user\n a_user == program.moderator\n end", "def allow_easy_notifiaction?\n this_and_closer_members_count <= self.user.max_easy_notification_count\n end", "def can_be_replied_by?(attempting_user)\n if attempting_user\n published? && (is_public? || is_protected? || member?(attempting_user) || attempting_user.is_admin? ||\n (is_subscription_only? && attempting_user.is_paid_subscriber?))\n else\n false # must be logged in to make a reply\n end\n end", "def invited_by?(user)\n user.friend_ids.include?(self.id) or user.pending_friend_ids.include?(self.id)\n end", "def can_notify? user\n return false if self.id == user.id\n not notification_exists? user\n end", "def answered_by?(user)\n replies.exists?(:user_id => user)\n end", "def replied_conv? usr\n ConversationProcessor.new(self).replied_conv? usr\n end", "def any_unread? usr\n ConversationProcessor.new(self).any_unread? usr\n end", "def user_meets_criteria?(user)\n user.credits > 0\n end", "def request_sent?(other_user)\n\t\tif requested_friends.include?(other_user)\n\t\t\treturn true\n\t\telse \n\t\t\treturn false\n\t\tend\n\tend", "def mine?\n user && user.username == Codeplane.username\n end", "def is_potential_user?\n\t\ttrue\n\tend", "def lastfm_user?(user)\n lastfm_users.any? { |lastfm| lastfm.user_id == user.try(:id) }\n end", "def usr_msg? convo, usr\n (usr.id == convo.user_id && convo.status == 'active') || (usr.id == convo.recipient_id && convo.recipient_status == 'active')\n end", "def is_invitable_by(another_user)\n !!(\n is_associated_to_somebody_else_than(another_user) &&\n @swimmer.associated_user.find_any_friendship_with(another_user).nil?\n )\n end", "def managed_by? a_user\n owned_by? a_user || program.moderator == a_user\n end", "def request_sent?(_user_id)\n pending_user_relationships.where(user_id: _user_id).any?\n end", "def game_available_for? (user)\n user_state[user] == :invited\n end", "def respondent_already_answered?\n sibling_responses.exists?(user_id: user_id)\n end", "def already_thanked?(topic)\n notification = Notification.thanked_by(self.id, topic.id)\n !notification.empty?\n end", "def invitee?(user)\n return user.id == invitee_user_id\n end", "def owned?\n user.present?\n end", "def bot_user?\n !@email.nil?\n end", "def attended?(user)\n self.attendees.include?(user)\n # self.users.map{|user| user.id }.include?(user_id)\n end", "def invited?(user)\n self.friend_ids.include?(user.id) or self.pending_friend_ids.include?(user.id)\n end", "def new?(user)\n not read? and user != sender\n end", "def is_owned_by_user?(user)\n self.user == user\n end", "def can_give_kudos?\n if self.kudos_given_by_user_in_past_week < MAX_WEEKLY_KUDOS\n return true\n end\n return false\n end", "def can_mail? user\n can_send_messages? && profile.is_active?\n end", "def following?(tw_user)\n following.include?(tw_user)\n end", "def liked_by?(user)\n likes_by_user(user).any?\n end", "def unread_by?(user)\n received_message.try(:unread?) || replies.map { |r|\n r.received_message if r.recipient == user\n }.compact.any?(&:unread?)\n end", "def subscribed?(user)\n user.subscription.subscribed==true\n end", "def answered_questionnaire?(user)\n answered_users.include?(user)\n end", "def user_wants_to_join?\n @data['event']['text'].downcase != 'no'\n end", "def users_joined?\n true\n end", "def has_subscriber?(user)\n has_text? user.email\n end", "def users_messaged_by\r\n self.users_who_messaged_me\r\n end", "def users_messaged_by\r\n self.users_who_messaged_me\r\n end", "def requested?\n !invited?\n end", "def checkIfAlreadyOnline\n # check the presence chat channel to see if the current users is subscribed to the channel\n # if the user is then render return true, else return false\n allUsers = Pusher.get('/channels/presence-chat/users')\n allUsers[:users].each do |userHash|\n return true if userHash.first.last == current_user.id.to_s\n end\n return false\n end", "def following?\n user.present?\n end", "def someone_won?\n !!winnning_marker\n end", "def user?(user)\n users.include? user\n end", "def announcer?(user_asking)\n employee? user_asking or owner? user_asking\n end", "def respondent_already_answered?\n sibling_responses.where('user_id = ?', self.user_id).exists?\n end", "def subscribed_by?(user)\n subscriptions.where(user: user).any?\n end", "def subscribed_by?(user)\n subscriptions.where(user: user).any?\n end", "def current_user_hasmsg?\n response = get_current_user_meta('hasmsg')\n return false unless response\n\n response['query']['userinfo']['messages'] == ''\n end", "def sent_already?\n @user = User.find_by_email(self.rcvr_email)\n return false if @user.blank?\n @sent_invitation = Invitation.where(\"user_id = ? AND project_id = ?\", @user.id, self.project_id)\n if @sent_invitation.present?\n return true\n else\n return false\n end\n end", "def mentioning?\n # Skip send notification if Doc not in publishing\n if instance_of?(Doc)\n publishing?\n else\n true\n end\n end", "def blue_magic_learn_by_allies?(user)\n if user.actor?\n return Bubs::BlueMagic::LEARN_BY_ALLIES\n else\n return true\n end\n end", "def readable?(user)\n confirmed? || self == user\n end", "def following?(user)\n following.include?(user)\n end", "def user_responded?(email:)\n @responses.any? { |r| r.email == email }\n end", "def following?(other_user)\n followeds.include?(other_user)\n end", "def following_user?(other_user)\n following.include?(other_user)\n end", "def is_there_notification\n current_user.notifications\n end", "def subscribed_newsletter(user)\n NewsletterEmail.all.each do |newsletter|\n if newsletter.email == user.email\n return true\n end\n end\n return false\n end", "def users_favorite?(naming, user)\n lookup_naming(naming).users_favorite?(user)\n end", "def any_unread? usr\n @conv.posts.each do |post| \n if post.unread?(usr) && post.recipient_id == usr.id\n return true\n end\n end\n return false\n end", "def me?\n @msg.me?\n end", "def moderation_state_visible_to_user?(user)\n moderation_state_visible_to_all? || (!user.thredded_anonymous? && user_id == user.id)\n end", "def has_user(user_id)\n if self.user_id == user_id\n puts 'You are the mod!'\n return false\n end\n last_registered_player_id = self.last_registered_player_id.to_i\n if last_registered_player_id == -1\n puts \"No user are signed up for this game.\"\n return false\n end\n while last_registered_player_id != -1\n curr_player = Player.find(last_registered_player_id)\n if curr_player.user_id == user_id\n return true\n end\n last_registered_player_id = curr_player.prev_player_id\n end\n return false\n end", "def advising?(other_user)\n advisees.include?(other_user)\n end", "def admited?\n return true unless admited_on.nil?\n end", "def employs?(user)\n employees.include?(user) or (affiliate == user) or user.admin?\n end", "def thread_member?(user)\n user == self.user || (messagable_type == \"User\" && messagable_id == user.id) || self.replies.map(&:user).include?(user)\n end", "def owners_favorite?(naming)\n lookup_naming(naming).users_favorite?(user)\n end", "def unread? user_id\n !unread_messages(user_id).blank?\n end", "def is_editable_by(another_user)\n !!(\n is_associated_to_somebody_else_than(another_user) &&\n !@swimmer.associated_user.find_any_friendship_with(another_user).nil?\n )\n end", "def is_wish?(venue_id, user_id)\n Wish.exists?(venue_id:venue_id, user_id: user_id)\n end", "def has_user?(user)\n self.users.include?(user)\n end", "def owner_only_offers_reward?\n self.rewards_count == 1 && self.rewards.visible[0].sender == self.person\n end", "def following?(other_user)\n following.include?(other_user) \n end", "def verify_notification\n wait_for_css(input_elements[:entries])\n entries = get_entries\n entries.each do |entry|\n if entry[\"data-mention-id\"].eql?(@stream_post_id)\n user_icon = entry.all(input_elements[:notification_icon]).first\n return true if user_icon[\"data-original-title\"].include?(\"Assigned to \")\n return false\n end\n end\n return false\n end", "def inviter?(user)\n return user.id == inviter_user_id\n end", "def replied_conv? usr\n if @conv.posts.count > 1 && @conv.posts.last.user_id != usr.id\n @conv.posts.each do |post|\n return true if post.user_id == usr.id\n end\n end\n false\n end", "def modifiable?(user)\n RetroCM[:ticketing][:author_modifiable][:tickets] == true && self.user == user\n end", "def owned_by?(u)\n self.user == u\n end", "def managed_by? a_user\n program.owned_by? a_user\n end", "def is_user_moderator?(user)\n result = false\n if(user)\n if user.has_system_role('moderator')\n result = true\n end\n\n\n if(created_by==user.id)\n result = true\n end\n\n self.publishers.each do |organism|\n if organism.is_user_moderator?(user)\n result = true\n end\n end\n end\n return result\n\t\n end", "def liked_by?(user)\n likers.exists?(user.id)\n end", "def follow?(user)\n followings_users.include?(user)\n end", "def followed_by?(user)\n extension_followers.where(user: user).any?\n end" ]
[ "0.69823694", "0.68208206", "0.66220576", "0.6607415", "0.6586578", "0.6553506", "0.6491558", "0.645393", "0.64099234", "0.640093", "0.63703245", "0.63408333", "0.6307273", "0.6306157", "0.6305431", "0.62882847", "0.6269986", "0.6244351", "0.62284493", "0.62214047", "0.62173194", "0.6198502", "0.6196358", "0.6184599", "0.6175378", "0.61608094", "0.6158631", "0.615518", "0.615168", "0.6143358", "0.61419034", "0.6133916", "0.6129462", "0.6121049", "0.6116715", "0.6110555", "0.6107555", "0.60841614", "0.60789037", "0.6075326", "0.60723597", "0.6071091", "0.60623497", "0.6056174", "0.6054199", "0.60400045", "0.6027204", "0.6018565", "0.60184604", "0.60154635", "0.6014558", "0.60141367", "0.60092705", "0.60092705", "0.60055405", "0.6003316", "0.59915054", "0.5989966", "0.5985165", "0.5982826", "0.5971353", "0.5964596", "0.5964596", "0.596259", "0.5961559", "0.5948007", "0.5947603", "0.5947582", "0.5941841", "0.5926642", "0.5922646", "0.5920704", "0.59103066", "0.5909945", "0.59077615", "0.5903146", "0.59024787", "0.58954895", "0.58942276", "0.58941036", "0.58903384", "0.5890022", "0.5889562", "0.58883864", "0.5887795", "0.5882688", "0.586695", "0.5865742", "0.58595556", "0.5856089", "0.5854794", "0.5853974", "0.584937", "0.58470416", "0.58450913", "0.5844947", "0.5841134", "0.58366066", "0.58356965", "0.58239216" ]
0.7975654
0
Adds a subscription for the user to the given topic
def subscribe_to(topic) StreamUser.create(:user => self, :stream_message => topic.stream_messages.last, :source => 'followed') if topic.stream_messages.last subscriptions << Subscription.new(:topic => topic) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe!(topic)\n subscriptions.create!( :topic_id => topic.id )\n end", "def subscribe_to_topic(tokens, topic)\n make_topic_mgmt_request(tokens, topic, \"batchAdd\")\n end", "def subscribe_author\n self.subscriptions.create user_id: self.user.id\n end", "def subscribe(_topic, **)\n raise 'not implemented'\n end", "def create_subscription topic, subscription_name, options = {}\n updated_option = construct_create_subscription_options topic, subscription_name, options\n subscriber.create_subscription(**updated_option)\n end", "def create\n @topic = Topic.create(topic_params)\n current_user.topics.push(@topic)\n \n respond_with @topic\n end", "def subscribe!\n Subscription.transaction do\n subscription = create_stripe_subscription!\n store.subscriptions.create!(\n customer: user,\n stripe_plan_id: stripe_plan_id,\n stripe_id: subscription.id,\n first_date: Date.today,\n status: :active\n )\n end\n end", "def subscription(topic_name, subscription_name)\n pubsub.subscription(subscription_name) ||\n create_subscription(topic_name, subscription_name)\n end", "def add_topic(description)\n topic = Topic.new\n topic.title = description\n topic.user = self\n topic.save\n end", "def create\n @topic = current_user.topics.new(topic_params)\n @topic.subscriber = @user\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to [@user, @topic], notice: '成功新增' }\n format.json { render :show, status: :created, location: @topic }\n else\n format.html { render :new }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_user_topic\n @user_topic = UserTopic.find(params[:id])\n end", "def associate_topic(topic)\n self.synchronize do\n @topic = topic\n end\n end", "def subscribe\n return unless self.hub.nil?\n\n # Discover hubs if none exist\n @hubs = discover_hubs_for_topic(self.topic_url) if self.hubs.empty?\n @hub = self.hubs.first\n change_subscription(:subscribe, token)\n\n # TODO: Check response, if failed, try a different hub\n end", "def subscription_for(topic)\n subscriptions.where(:topic_id => topic.id).first\n end", "def subscribe! (user_id)\n check_auth :subscribe\n \n response = connection.post do |req|\n req.url \"/user/subscribe/#{user_id}\"\n req.body = { :format => @format }\n end\n response\n end", "def subscribe(user_id, channel_id, unsubscribe = false)\n data = {\n user_id: user_id,\n channel_id: channel_id,\n unsubscribe: unsubscribe ? 1 : 0\n }\n\n response = rest_client.post(signature_url('/subscription/'), body: data)\n process_response(response)\n end", "def create_topic\n t = Topic.create(title: new_topic) if new_topic.present?\n t.update_column(:user_id, self.user_id)\n t.save\n self.topic = t\n end", "def subscribe(*topics)\n # Defer subscribing until we are connected\n callback do\n send_packet(\n MQTT::Packet::Subscribe.new(\n :topics => topics,\n :message_id => @message_id.next\n )\n )\n end\n end", "def create_pubsub_topic topic_id\n pubsub = Google::Cloud::Pubsub.new project: @project_id\n topic = pubsub.create_topic topic_id\n policy = topic.policy do |p|\n p.add \"roles/pubsub.publisher\",\n \"serviceAccount:cloud-iot@system.gserviceaccount.com\"\n end\n @topics << topic\n topic\n end", "def subscribe!\n @repository.callback_url = pubsubhubbub_callback_url\n\n if @repository.valid?\n begin\n client.subscribe(\n topic,\n @repository.callback_url,\n ENV['PUBSUBHUBBUB_SECRET']\n )\n\n @repository.save\n rescue Octokit::Error => e\n @repository.errors.add(:base, e.message)\n\n false\n end\n end\n end", "def associate_topic(topic)\n @topic = topic\n self.__log_messages\n end", "def subscribe!(params)\n raise Errors::AlreadySubscribedError if subscribed?\n raise Errors::StripeCustomerExistsError if stripe_customer_id\n\n customer = ::Stripe::Customer.create(\n source: params[:stripe_token],\n plan: params[:subscription_plan_id] || SlackRubyBotServer::Stripe.config.subscription_plan_id,\n email: params[:stripe_email],\n metadata: {\n id: id,\n team_id: team_id,\n name: name,\n domain: domain\n }\n )\n\n update_attributes!(\n subscribed: true,\n subscribed_at: Time.now.utc,\n stripe_customer_id: customer['id'],\n subscription_expired_at: nil,\n subscription_past_due_at: nil,\n subscription_past_due_informed_at: nil\n )\n\n customer\n end", "def subscribe_to_topic_courses(course_id,topic_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"course_id is required\" if course_id.nil?\n raise \"topic_id is required\" if topic_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :course_id => course_id,\n :topic_id => topic_id\n )\n\n # resource path\n path = path_replace(\"/v1/courses/{course_id}/discussion_topics/{topic_id}/subscribed\",\n :course_id => course_id,\n :topic_id => topic_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n response\n \n end", "def subscribe(*topics)\n # FIXME: make sure @connection isn't nil\n @connection.subscribe(*topics)\n end", "def subscribe\n @board.subscribers << current_user\n redirect_to board_path(@board), notice: \"Boarda abone oldunuz.\"\n end", "def create\n @topic = current_user.topics.build(params[:topic])\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "def addSubscription(subscr)\n subscriptions = Hash.new\n if @subscriptionLists.hasKey(\"subscriptions\")\n subscriptions = @subscriptionLists.getRepositoryObject(\"subscriptions\").getObject\n end\n subscriptions[subscr] = Subscription.new(subscr)\n @subscriptionLists.commitObject(\"subscriptions\", subscriptions, false)\n end", "def subscribe_to_topic_groups(group_id,topic_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"group_id is required\" if group_id.nil?\n raise \"topic_id is required\" if topic_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :group_id => group_id,\n :topic_id => topic_id\n )\n\n # resource path\n path = path_replace(\"/v1/groups/{group_id}/discussion_topics/{topic_id}/subscribed\",\n :group_id => group_id,\n :topic_id => topic_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n response\n \n end", "def subscribe\n \n @conversation.subscriptions << @user unless @conversation.subscriptions.exists?(@user.id)\n @notice = \"You will now receive email notifications about new replies in this conversation.\"\n \n respond_to do |format|\n format.html {\n redirect_to(@conversation, notice: @notice) and return\n return \n }\n format.js\n end\n\n end", "def subscribe_to_topic(topic, device)\n raise NotImplementedError.new\n end", "def create\n @topic = current_user.topics.build(params[:topic])\n\n respond_to do |format|\n if @topic.save\n flash[:notice] = 'Topic was successfully created.'\n format.html { redirect_to(@topic) }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @topic = current_user.topics.build(topic_params)\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render :show, status: :created, location: @topic }\n else\n format.html { render :new }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "def subscribe\n\t\t@subject = Subject.find_by_name(params[:name])\n\t\t@customer = current_user.customer\n\t\t@customer.subjects << @subject\n\t\tflash[:success] = \"You have subscribed to #{@subject.name}.\"\n\t\tredirect_to root_url\n\tend", "def invite_user_to_topic(params = {})\n deprecated(__method__, \"invite_to_topic\")\n invite_to_topic(params[:topic_id], params)\n end", "def subscribe(magazine, price)\n Subscription.create(price: price, magazine_id: magazine.id, reader_id: self.id)\n end", "def new_subscription(user, subscribable)\n @user = user \n @subscribable = subscribable \n\n mail to: user.email, subject: \"Subscribed to #{subscribable.name} Updates\"\n end", "def add_subscription(entity)\r\n subscriptions << entity\r\n end", "def create\n @user_topic = UserTopic.new(user_topic_params)\n\n respond_to do |format|\n if @user_topic.save\n format.html { redirect_to @user_topic, notice: 'User topic was successfully created.' }\n format.json { render :show, status: :created, location: @user_topic }\n else\n format.html { render :new }\n format.json { render json: @user_topic.errors, status: :unprocessable_entity }\n end\n end\n end", "def subscribe(user)\n return false if user == self\n if subscription = find_any_subscription_with(user)\n subscription.update_attributes(status: Subscription.statuses[:allowed])\n else\n Subscription.new(subscriber_id: user.id, user_id: self.id).save\n end\n end", "def to_topic id, options={}, headers={}\n @connection.get \"subscriptions/to_topic/#{id}.json\", options, headers\n end", "def create\n @topic = Topic.new(params[:topic])\n @topic.user_id = current_user.id\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_sub_topic\n @sub_topic = SubTopic.find(params[:id])\n end", "def subscribe( publication )\n subscriptions.create(publication: publication) unless has_subscribed?(publication)\n rescue ActiveRecord::RecordNotUnique\n end", "def create\n @topic = Topic.new(params[:topic])\n @topic.user = existing_user\n @topic.course = @course\n\n respond_to do |format|\n if @topic.user and @topic.save\n format.html { redirect_to @course, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "def addplayer_general topic_id, user_id\n topic = Topic.find(topic_id)\n topic.create_player(user_id)\n topic.save\n end", "def set_subtopic\n @subtopic = Subtopic.find(params[:id])\n end", "def create\n @topic = Topic.new(topic_params)\n @topic.user = current_user\n if @topic.save\n redirect_to @topic, notice: 'Topic was successfully created.'\n else\n render :new \n end\n end", "def subscribe(event)\n has_subscriptions.create(subscribed_id: event.id)\n end", "def ensure_subscribed_by(user)\n return true if self.subscribed_by?(user)\n subscriptions.build(user: user).save!\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique => e\n return true if e.is_a?(ActiveRecord::RecordInvalid) &&\n e.record.errors[:topic_id].any? && e.record.errors[:user_id].any?\n raise e\n end", "def create\n @topic = Topic.new(topic_params)\n @topic.user_id = current_user.id\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render action: 'show', status: :created, location: @topic }\n else\n format.html { render action: 'new' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "def authenticate_subscribe(message)\n subscription = PrivatePub.subscription(:channel => message[\"subscription\"], :timestamp => message[\"ext\"][\"private_pub_timestamp\"])\n end", "def subscribe(subreddit)\n full_name = extract_full_name subreddit\n parameters = { :action => 'sub', :sr => full_name }\n\n post('api/subscribe', parameters)\n end", "def create\n topic = Topic.find(sub_topic_params[:topic_id])\n @sub_topic = topic.sub_topics.build(sub_topic_params)\n\n respond_to do |format|\n if @sub_topic.save\n format.html { redirect_to @sub_topic, notice: 'Sub topic was successfully created.' }\n format.json { render :show, status: :created, location: @sub_topic }\n else\n format.html { render :new }\n format.json { render json: @sub_topic.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n parameters = topic_params\n parameters[:user_id] = current_user.id\n @topic = Topic.new(parameters)\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render :show, status: :created, location: @topic }\n else\n format.html { render :new }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "def subscribe_to_topic(topic_arn, protocol, end_point)\n # TODO handle different SubscriptionArn results? Let's\n # just return the raw subscription arn for now\n req_hash = generate_request('Subscribe', 'TopicArn' => topic_arn, 'Protocol' => protocol, 'Endpoint' => end_point)\n request_info(req_hash, SnsSubscribeParser.new(:logger => @logger))\n end", "def subscribe(mirror, collection, user_token, verify_token, callback_url, operation)\n subscription = mirror.subscriptions.insert.request_schema.new({\n 'collection' => collection,\n 'userToken' => user_token,\n 'verifyToken' => verify_token,\n 'callbackUrl' => callback_url,\n 'operation' => operation})\n result = client.execute(\n :api_method => mirror.subscriptions.insert,\n :body_object => subscription)\n if result.error?\n puts \"An error occurred: #{result.data['error']['message']}\"\n end\n end", "def subscribe(user)\n @clients[user.signature] = user\n end", "def topic_create(topic)\n @topic = topic\n @board = topic.board\n @user = topic.author\n @mail = @user.email\n @link = board_topic_url(@board, @topic)\n @greeting = \"Hi\"\n\n @subject = \"您已成功在Board: #{@board.name}內新增了一篇Topic~\"\n\n mail to: @mail, subject: @subject\n end", "def create\n #@topic = Topic.new(topic_params)\n @topic = current_user.topics.build(topic_params)\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render action: 'show', status: :created, location: @topic }\n else\n format.html { render action: 'new' }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_if_necessary!\n if topic.blank?\n @topic = pubsub.create_topic(topic_name).tap do |topic|\n raise error, \"Unable to create topic #{topic_name}\" if topic.nil?\n end\n end\n\n @subscription = @topic.find_subscription(subscription_name) || @topic.create_subscription(subscription_name)\n @subscription.tap do |subscription|\n raise Error, \"Unable to create subscription #{subscription_name}\" if subscription.nil?\n\n # Default subscription expiry is 31 days. We want none of that.\n subscription.expires_in = nil unless pubsub.project_id == EMULATOR.fetch(:project_id)\n end\n end", "def set_subscription_user\n @subscription_user = SubscriptionUser.find(params[:id])\n end", "def topic!(topic)\n @session.chanserv.topic(self.name, topic)\n end", "def subscribe(queue_resource_name:, topic_resource_name:)\n topic = topics[topic_resource_name]\n queue = queues[queue_resource_name]\n queue_arn = queue.attributes[\"QueueArn\"]\n\n resp = sns_client.subscribe(\n topic_arn: topic.arn,\n protocol: \"sqs\",\n endpoint: queue_arn,\n attributes: { \"RawMessageDelivery\" => \"true\" }\n )\n\n subscriptions[resp.subscription_arn] =\n Aws::SNS::Subscription.new(resp.subscription_arn, client: sns_client)\n\n queue.set_attributes(\n attributes: {\n \"Policy\" => sqs_policy(\n queue_arn: queue_arn,\n topic_arn: topic.arn\n )\n }\n )\n end", "def set_user_to_channel_subscription\n @user_to_channel_subscription = UserToChannelSubscription.find(params[:id])\n end", "def signup\n this_topic_id = params[:id]\n this_user_id = params[:user_id]\n topic = Topic.find(this_topic_id)\n topic.create_player(this_user_id)\n redirect_to '/t/' + this_topic_id\n end", "def create\n if session[:user_id] \n user = User.find(session[:user_id])\n s = Subscription.new\n s.url = params[:subscription][:url]\n s.title = params[:subscription][:title]\n s.user = user\n @subscription = s\n \n respond_to do |format|\n if @subscription.save\n format.html { redirect_to(@subscription, :notice => 'Subscription was successfully created.') }\n format.xml { render :xml => @subscription, :status => :created, :location => @subscription }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def set_subscribe\n pa = params[:subscribe]\n @subscribe = params[:id].to_i.zero? ? Subscribe.where(user_id: pa[:user_id], target_id: pa[:target_id]).take : Subscribe.find(params[:id])\n end", "def add_topics(note, topics)\n logger.info \"Adding topics #{topics.map &:name} to note ID '#{note.id}'\"\n show_adv_note_options unless topic_input?\n topics.each do |topic|\n logger.debug \"Adding topic '#{topic.name}'\"\n wait_for_element_and_select_js(add_topic_select_element, topic.name)\n wait_for_update_and_click add_topic_button_element\n topic_pill(note, topic).when_visible Utils.short_wait\n note.topics << topic\n end\n end", "def create\n @topics_user = TopicsUser.new(:topic_id=>params[:topic_id], :user_id=>params[:user_id])\n respond_to do |format|\n if @topics_user.save\n format.html { redirect_to find_topics_url, notice: 'Topic successfully added.' }\n format.json { render json: @topics_user, status: :created, location: @topics_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topics_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def ensure_subscribed_by(user)\n ActiveRecord::Base.transaction(requires_new: true) do\n subscribed_by?(user) || subscriptions.create!(user: user)\n end\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique => e\n errors = e.record.errors\n return true if e.is_a?(ActiveRecord::RecordInvalid) &&\n !errors[:topic_id].empty? && !errors[:user_id].empty?\n raise e\n end", "def subscribe\n subscribee = connection.jid.bare\n\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'set'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('subscribe','node' => node_id, 'jid'=>subscribee)\n )\n )\n\n send_iq_stanza_fibered iq\n end", "def create\n @topic = Topic.new(params[:topic])\n @topic.author = current_user\n\n respond_to do |format|\n if @topic.save\n flash[:notice] = \"Topic was successfully created.\"\n format.html { redirect_to(@topic) }\n format.xml { render :xml => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(topic, options = {})\n body = options.has_key?(:body) ? options[:body] : {}\n body[:topic] = topic\n\n response = @client.post \"/api/topics\", body, options\n\n return response\n end", "def prepend_topic!(topic)\n @session.chanserv.topicprepend(self.name, topic)\n end", "def subscribe!(subscriber, **args)\n caffeinate_campaign_subscriptions.find_or_create_by!(subscriber: subscriber, **args)\n end", "def publish(topic, payload, retain=false, qos=0)\n # FIXME: make sure @connection isn't nil\n @connection.publish(topic, payload, retain, qos=0)\n end", "def fAddSubscribedEventTo(email, eventID)\n @users.addSubscribedEventTo(email, eventID)\n end", "def create_auto_subscription(user, target, namespace = nil)\n if namespace\n if user.can?(:\"read_#{namespace.class.name.underscore}\", namespace)\n user.auto_subscriptions.create(target: target, namespace_id: namespace.id, namespace_type: namespace.class.name)\n end\n else\n user.auto_subscriptions.create(target: target)\n end\n end", "def create\n @topic = Topic.new(params[:topic])\n if logged_in?\n @topic.user_id = current_user.id\n if @topic.save\n flash[:notice] = 'Topic was successfully created.'\n redirect_to(@topic)\n else\n render :action => \"new\"\n end\n else\n flash[:alert] = \"You need to login to create a new topic.\"\n render :action => \"new\"\n end\n end", "def create\n @topic = current_user.topics.build()\n @topic.title = params[:title]\n @topic.user_id = current_user.id\n @topic.user_email = current_user.email\n\n respond_to do |format|\n if @topic.save!\n format.html { redirect_to topics_url, :notice => 'topic was successfully created.' }\n format.json { render :json => @topic, :status => :created, :location => @topic }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @topic.errors, :status => :unprocessable_entity }\n end\n end\n end", "def subscribe\n if User.exists?(email: params[:user][:email])\n render json: { status: 'The email is already taken' }, status: :bad_request\n else\n subscribed_user = SubscribedUser.create!(user_params)\n render json: { status: 'Created' }, status: :created if subscribed_user\n render json: { status: 'Something wrong happened' }, status: :bad_request unless subscribed_user\n end\n rescue\n render json: { status: 'Something wrong happened' }, status: :bad_request\n end", "def create\n @subtopic = Subtopic.new(subtopic_params)\n\n respond_to do |format|\n if @subtopic.save\n format.html { redirect_to @subtopic, notice: 'Subtopic was successfully created.' }\n format.json { render :show, status: :created, location: @subtopic }\n else\n format.html { render :new }\n format.json { render json: @subtopic.errors, status: :unprocessable_entity }\n end\n end\n end", "def auto_subscribe_topic\n fail NotImplementedError, 'To be implemented by the concrete topic posts controller.'\n end", "def create\n @subtopic = Subtopic.new(params[:subtopic])\n\n respond_to do |format|\n if @subtopic.save\n format.html { redirect_to @subtopic, notice: 'Subtopic was successfully created.' }\n format.json { render json: @subtopic, status: :created, location: @subtopic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subtopic.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_subtopic\n @subtopic = Subtopic.friendly.find(params[:id])\n end", "def subscribe(user, device_id, subscription)\n if @subscriptionLists.hasKey device_id\n device = @subscriptionLists.getRepositoryObject(device_id).getObject\n subscriptions = Hash.new\n subscriptions = @subscriptionLists.getRepositoryObject(\"subscriptions\").getObject if @subscriptionLists.hasKey(\"subscriptions\")\n\n #puts \"\\n\\n_____________________Sub Queues_______________________\\n#{subscriptions}\\n\\nLooking for #{subscription}\\n__________________________________\"\n\n if subscriptions.key? subscription\n sub = subscriptions[subscription]\n #sub.addDevice(device_id)\n if(sub != nil && sub.hasDevice?(device_id)) # Device Already subscribed so let the user know\n return \"{\\\"subscribe\\\": \\\"Device already subscribed to #{subscription}\\\"}\"\n else #Lets subscribe the user(only implemented locally, not on the firebase server)\n device.addSubscription(sub)\n sub.addDevice(device)\n @subscriptionLists.commitObject(\"subscriptions\", subscriptions, false) #List of all subscription lists with device ids\n @subscriptionLists.commitObject(device_id, device, false) #We also keep a list of subscriptions with the particular device id... do we need this??\n\n return \"{\\\"subscribe\\\": \\\"Device subscribed to #{subscription}\\\"}\"\n end\n else\n return '{\"subscribe\": \"Subscription queue('+subscription+') does not exist.\"}'\n end\n else\n return '{\"subscribe\": \"Device not registered\"}'\n end\n end", "def create\n @topic = current_user.topics.build(topic_params)\n @topic.user_id = current_user.id\n @topic.forum_id = @forum.id\n \n if @topic.save\n redirect_to forum_topic_path(@forum, @topic)\n else\n render 'new'\n end\n end", "def user_topic_params\n params.require(:user_topic).permit(:user_id, :topic_id)\n end", "def create\n @service = Service.find(params[:service_id])\n \n @service_subscription = current_user.subscribe(@service, params[:service_subscription])\n \n if @service_subscription && @service_subscription.errors.empty?\n redirect_to service_subscriptions_path, :success => \"You have subscribed to the service!\"\n else\n render :action => :new\n end\n \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 subscribe(course)\n subscribeds << course\n end", "def subscribe(options, &block)\n subscriptions.create(options, &block)\n end", "def create\n @message = current_user.messages.build(message_params)\n @message.topic_id = params[:topic_id]\n if !user_signed_in?\n redirect_to new_user_session_path\n end\n if current_user\n @message.save\n flash[:success] = 'Your message is sent'\nredirect_to topic_path(@message.topic)\n end\nend", "def subscription(topic)\n settings = { start_from_beginning: topic.start_from_beginning }\n\n kafka_configs.each do |setting_name, setting_value|\n next unless AttributesMap.config_adapter[:subscription].include?(setting_name)\n next if settings.keys.include?(setting_name)\n settings[setting_name] = setting_value\n end\n\n [topic.name, sanitize(settings)]\n end", "def subscribe(subscriber, **args)\n caffeinate_campaign_subscriptions.find_or_create_by(subscriber: subscriber, **args)\n end", "def create\n @topic = current_user.topics.new(topic_params)\n if @topic.save\n redirect_to @topic, notice: params[:is_draft]? 'Topic successfully save as draft.': 'Topic successfully published.'\n else\n render 'new'\n end\n end", "def add_event_subscriber\n\t\tevent = Event.find(params[:id])\n\t\tuser = User.find(params[:user_id])\n\t\tif !event.users.exists?(user.id)\n\t\t\tevent.users << user\n\t\t\t@del = true\n\t\telse\n\t\t\tevent.users.delete(user)\n\t\t\t@del = false\n\t\tend\n\tend", "def publish(topic, payload, retain=false, qos=0)\n # Defer publishing until we are connected\n callback do\n send_packet(\n MQTT::Packet::Publish.new(\n :qos => qos,\n :retain => retain,\n :topic => topic,\n :payload => payload,\n :message_id => @message_id.next\n )\n )\n end\n end", "def create\n @topic.student = current_user\n\n respond_to do |format|\n if @topic.save\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render :show, status: :created, location: @topic }\n else\n format.html { render :new }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "def publish(topic, *args, **kwargs)\n raise 'The topic can not be nil' unless url != nil\n\n params = {\n topic: topic,\n args: args,\n kwargs: kwargs\n }\n\n self._make_api_call(params)\n end" ]
[ "0.81512696", "0.7070888", "0.7040874", "0.70373267", "0.67486745", "0.66825444", "0.663919", "0.6626898", "0.6621064", "0.66059786", "0.6599181", "0.6571987", "0.65571517", "0.6556943", "0.65291584", "0.64855635", "0.6478466", "0.645491", "0.64543647", "0.6447197", "0.63841385", "0.6372571", "0.63689816", "0.6324908", "0.63159645", "0.6304565", "0.6301988", "0.62802494", "0.627446", "0.6265142", "0.6258169", "0.6257227", "0.62526", "0.6249425", "0.62449884", "0.6221029", "0.6217956", "0.62124604", "0.62036216", "0.62015295", "0.61278075", "0.61277944", "0.6098308", "0.60669583", "0.60587543", "0.6056263", "0.60449636", "0.60329634", "0.6030337", "0.60158443", "0.6006457", "0.6001849", "0.6000299", "0.59998596", "0.59794754", "0.59764534", "0.5975832", "0.59751165", "0.596836", "0.59535253", "0.5953199", "0.5951753", "0.5948451", "0.5948068", "0.59366006", "0.5929618", "0.5925714", "0.59215", "0.59120965", "0.5891296", "0.5888425", "0.5887571", "0.58765185", "0.5873539", "0.58732796", "0.5871949", "0.58703893", "0.58529717", "0.5852872", "0.58489233", "0.5848258", "0.5846188", "0.5845947", "0.58296597", "0.5828037", "0.58259726", "0.5825771", "0.58181334", "0.5811168", "0.5799985", "0.57903254", "0.57886493", "0.5783258", "0.5774429", "0.5773697", "0.5769583", "0.5768787", "0.5768022", "0.57637507", "0.5756487" ]
0.8117725
1
Removes subscriptions for this user to the given topic
def unsubscribe_from(topic) subscriptions.find_by_topic_id(topic.id).try(:destroy) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubscribe_from_topic(tokens, topic)\n make_topic_mgmt_request(tokens, topic, \"batchRemove\")\n end", "def destroy\n topic = Topic.find params[:id]\n user_topic = current_user.user_topics.find_by!(topic_id: topic.id)\n user_topic.destroy\n\n respond_to do |format|\n flash[:notice] = 'You have successfully unsubscribed from the thread.'\n\n format.html { redirect_back(fallback_location: root_path) }\n end\n end", "def unsubscribe(*topics)\n # FIXME: make sure @connection isn't nil\n @connection.unsubscribe(*topics)\n end", "def unsubscribe(*topics)\n # Defer unsubscribing until we are connected\n callback do\n send_packet(\n MQTT::Packet::Unsubscribe.new(\n :topics => topics,\n :message_id => @message_id.next\n )\n )\n end\n end", "def unsubscribe_from_topic_courses(course_id,topic_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"course_id is required\" if course_id.nil?\n raise \"topic_id is required\" if topic_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :course_id => course_id,\n :topic_id => topic_id\n )\n\n # resource path\n path = path_replace(\"/v1/courses/{course_id}/discussion_topics/{topic_id}/subscribed\",\n :course_id => course_id,\n :topic_id => topic_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:delete, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:delete, path, query_params, form_params, headers)\n page_params_store(:delete, path)\n response\n \n end", "def unsubscribe_from_topic_groups(group_id,topic_id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"group_id is required\" if group_id.nil?\n raise \"topic_id is required\" if topic_id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :group_id => group_id,\n :topic_id => topic_id\n )\n\n # resource path\n path = path_replace(\"/v1/groups/{group_id}/discussion_topics/{topic_id}/subscribed\",\n :group_id => group_id,\n :topic_id => topic_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:delete, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:delete, path, query_params, form_params, headers)\n page_params_store(:delete, path)\n response\n \n end", "def unsubscribe\n @entry.subscribers.delete(current_user)\n end", "def unsubscribe\n subscriptions.values.each(&:unsubscribe)\n @on_unsubscribe.call(self) if @on_unsubscribe\n end", "def destroy!(this_is_not_accidental:)\n @topic.delete\n @subscription.delete\n end", "def unsubscribe\n check_subscribed!\n subscription.unsubscribe_from_channel\n end", "def unsubscribe\n @subscription_reference.unsubscribe\n end", "def unsubscribe( publication )\n subscriptions.by_publication( publication ).delete_all\n end", "def unsubscribe(user, target)\n user.personal_subscriptions.where(target_id: target.id, target_type: target.class).destroy_all\n end", "def delete_topic topic_name\n publisher.delete_topic topic: topic_path(topic_name)\n end", "def destroy\n subscribers.each do |name, subscriber|\n subscriber.destroy\n end\n end", "def delete_subscription(subscription_id)\n query = @subscriptions.delete(subscription_id)\n # In case this came from the server, tell the client to unsubscribe:\n @action_cable.server.broadcast(stream_subscription_name(subscription_id), { more: false })\n # This can be `nil` when `.trigger` happens inside an unsubscribed ActionCable channel,\n # see https://github.com/rmosolgo/graphql-ruby/issues/2478\n if query\n events = query.context.namespace(:subscriptions)[:events]\n events.each do |event|\n ev_by_fingerprint = @events[event.topic]\n ev_for_fingerprint = ev_by_fingerprint[event.fingerprint]\n ev_for_fingerprint.delete(event)\n if ev_for_fingerprint.empty?\n ev_by_fingerprint.delete(event.fingerprint)\n end\n end\n end\n end", "def destroy\n transaction do\n clean\n connection.delete \"DELETE FROM user_subscriptions WHERE subscription_id = #{id}\"\n connection.delete \"DELETE FROM subscriptions WHERE id = #{id}\"\n end\n end", "def remove_topics(note, topics)\n logger.info \"Removing topics #{topics.map &:name} from note ID '#{note.id}'\"\n topics.each do |topic|\n logger.debug \"Removing topic '#{topic.name}'\"\n wait_for_update_and_click topic_remove_button(note, topic)\n topic_pill(note, topic).when_not_visible Utils.short_wait\n note.topics.delete topic\n end\n end", "def unsubscribe(event)\n has_subscriptions.find_by(subscribed_id: event.id).destroy\n end", "def unsubscribed\n @chatroom = Chatroom.find(params[:id])\n @chatroom.unsubscribe()\n end", "def unsubscribe\n email = Base64.decode64(params[:token])\n Subscription.where(email: email).destroy_all\n end", "def remove_subscription\n buyer = @current_user\n customer_id = buyer.stripe_customer_id\n customer = Stripe::Customer.retrieve(customer_id)\n subscription.delete\n render json: { message: 'Unsubscribed succesfully' }, status: 200\n end", "def destroy\n @topics_user = TopicsUser.find(params[:id])\n @topics_user.destroy\n\n respond_to do |format|\n format.html { redirect_to my_topics_url, notice: 'Remove topic succeed!' }\n format.json { head :no_content }\n end\n end", "def unsubscribe\n\t\t@subject = Subject.find(params[:id])\n\t\t@customer = current_user.customer\n\t\t@customer.subjects.delete(@subject)\n\t\tflash[:success] = \"You have unsubscribed from #{@subject.name}.\"\n\t\tredirect_to root_url\n\tend", "def delete_subscription subscription\n subscriber.delete_subscription subscription: subscription_path(subscription)\n end", "def unsubscribe(topic, callback)\n options = {\n :\"hub.mode\" => \"unsubscribe\",\n :\"hub.topic\" => topic,\n :\"hub.callback\" => callback,\n }\n post(\"/hub\", options, 3, true, true, true)\n true\n end", "def delete_subscription(id)\n delete(\"/subscriptions/#{id}\")\n end", "def destroy\n subscription = current_user.subscriptions.find(params[:id])\n subscription.destroy!\n\n render json: { status: 'success'}\n end", "def unsubscribe\n return true if @subscription_id.nil?\n\n resp = ews.unsubscribe(@subscription_id)\n rmsg = resp.response_messages.first\n if rmsg.success?\n @subscription_id, @watermark = nil, nil\n true\n else\n raise EwsSubscriptionError, \"Could not unsubscribe: #{rmsg.code}: #{rmsg.message_text}\"\n end\n end", "def destroy\n # Удаляем подписки\n @subscriptions = Subscription.where(email: current_user.email)\n @subscriptions.each do |subscription|\n subscription.destroy\n end\n\n super\n end", "def delete_subscription(account_id, subscription_id)\n delete(url_(\"subscription\", subscription_id))\n end", "def destroy\n @user_topic.destroy\n respond_to do |format|\n format.html { redirect_to user_topics_url, notice: 'User topic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def unsubscribe\n if @subscriber\n @subscriber.stream.close\n @subscriber = nil\n end\n end", "def remove(address_or_id)\n delete(\"#{domain}/unsubscribes/#{address_or_id}\")\n end", "def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end", "def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end", "def unsubscribe\n synchronize do\n stan.nats.unsubscribe(self.sid)\n end\n\n # Make client stop tracking the subscription inbox\n # and grab unsub request subject under the lock.\n unsub_subject = nil\n stan.synchronize do\n stan.sub_map.delete(self.ack_inbox)\n unsub_subject = stan.unsub_req_subject\n end\n\n unsub_req = STAN::Protocol::UnsubscribeRequest.new({\n clientID: stan.client_id,\n subject: self.subject,\n inbox: self.ack_inbox\n })\n\n if self.durable_name\n unsub_req.durableName = self.durable_name\n end\n\n raw = stan.nats.request(unsub_subject, unsub_req.to_proto, {\n timeout: stan.options[:connect_timeout]\n })\n response = STAN::Protocol::SubscriptionResponse.decode(raw.data)\n unless response.error.empty?\n # FIXME: Error handling on unsubscribe\n raise Error.new(response.error)\n end\n end", "def close_topic\n puts \"#{self.class} #{@my_hostname} unsubscribing #{self.topic}\"\n self.conn.unsubscribe self.topic if self.conn!=nil\n end", "def unsubscribed\n @room.remove_user(current_user)\n\n # Inform the other players that this player has left.\n broadcast_users_changed\n end", "def destroy\n if session[:user_id] \n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n \n respond_to do |format|\n format.html { redirect_to(subscriptions_url) }\n format.xml { head :ok }\n end\n end\n end", "def unsubscribe(topic, channel)\n name = \"#{topic}:#{channel}\"\n @subscriber_mutex.synchronize do\n subscriber = @subscribers[name]\n return unless subscriber\n subscriber.stop\n @subscribers.delete(name)\n end\n end", "def unsubscribe(feed)\n SubscriptionsManager.remove_subscription feed, self\n end", "def unsubscribe_from(id)\n post(ROOT_URI + '/a/unsubscribe', 'stream' => id)\n end", "def unsubscribe_from(id)\n post(ROOT_URI + '/a/unsubscribe', 'stream' => id)\n end", "def unsubscribe\n redis.unsubscribe\n end", "def unsubscribe(aSubscriber)\n subscribers.delete_if { |entry| entry == aSubscriber }\n end", "def destroy\n if super_user?\n @topic = Topic.find(params[:id])\n @topic.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to(topics_url) }\n format.xml { head :ok }\n end\n end", "def remove_subscriptions(subscriptions)\n lightstreamer_subscriptions = Array(subscriptions).compact.map(&:lightstreamer_subscription)\n\n return if lightstreamer_subscriptions.empty?\n\n @lightstreamer.remove_subscriptions lightstreamer_subscriptions\n end", "def unsubscribe(user)\n @clients.delete(user.signature)\n self.class.remove_channel(self) if empty?\n end", "def unsubscribe\n raise UnsubscribedError\n end", "def unsubscribe\n user = User.where(email: params[:md_email]).first\n user.unsubscribe!\n\n redirect_to root_path, notice: t(\"unsubscribed\")\n end", "def unsubscribe\n \n @conversation.subscriptions.delete(@user) if @conversation.subscriptions.exists?(@user.id)\n @notice = \"You will now no longer receive email notifications about new replies in this conversation.\"\n \n respond_to do |format|\n format.html {\n redirect_to(@conversation, notice: @notice) and return\n return \n }\n format.js\n end\n \n end", "def unsubscribe(source)\n Log.debug(\"Unsubscribing from #{source}\")\n @connection.unsubscribe(source)\n @subscriptions.delete(source)\n end", "def unsubscribe(object)\n subscriptions.delete(remote_object(object))\n end", "def unsubscribe(*channels)\n raise SubscriptionError, \"Can't unsubscribe if not subscribed.\" unless subscribed?\n\n @subscribed_node.unsubscribe(*channels)\n end", "def unsubscribe(cls)\n @subscribers.delete(name)\n end", "def destroy\n @subscriptions = []\n\n # query parameter with the ids of all the necessarily deleted subscriptions\n subscription_id_string = params[:subscription][:subscriptions]\n\n # converts the query parameter string into an array. Query parameter gets sent like this \"[1,2,3]\"\n all_ids = subscription_id_string[subscription_id_string.index(\"[\") + 1, subscription_id_string.index(\"]\") - 1].split(\",\")\n\n # for each id in the array of ids, find the Subscription with that id, add it to the array of deleted subscriptions\n # for the view, and then destroy the subscription\n all_ids.each do |id|\n this_subscription = Subscription.find(id)\n @subscriptions << this_subscription\n\n # decrement subscription count of corresponding dept/club/team\n if this_subscription.category == \"department\"\n dept = Department.find(this_subscription.subscribed_to)\n dept.subscriber_count -= 1\n dept.save\n elsif this_subscription.category == \"club\"\n club = Club.find(this_subscription.subscribed_to)\n club.subscriber_count -= 1\n club.save\n else\n team = AthleticTeam.find(this_subscription.subscribed_to)\n team.subscriber_count -= 1\n team.save\n end\n\n this_subscription.destroy\n end\n end", "def clear_subs\n instagram_client.subscriptions.each do |sub|\n instagram_client.delete_subscription(id: sub.id)\n end\n\n redirect_to list_subs_path\n end", "def destroy\n if @topic.user_id != current_user.id\n redirect_to controller: 'topics', action: 'index'\n else\n @topic.destroy\n respond_to do |format|\n format.html { redirect_to topics_url}\n format.json { head :no_content }\n end\n end\n end", "def unsubscribe!\n message_class = whoami\n\n debug_me{[ :message_class ]}\n\n broker.unsubscribe!(message_class) if broker_configured?\n end", "def unsubscribe\n unless unsubscribe = pubsub.find_first('ns:unsubscribe', :ns => self.class.registered_ns)\n self.pubsub << (unsubscribe = XMPPNode.new('unsubscribe', self.document))\n unsubscribe.namespace = self.pubsub.namespace\n end\n unsubscribe\n end", "def unsubscribe\n subscription = nil\n @gate.synchronize do\n if @subscription\n unless @primary_unsubscribed\n @primary_unsubscribed = true\n\n if @count == 0\n subscription = @subscription\n @subscription = nil\n end\n end\n end\n end\n\n subscription.unsubscribe if subscription\n end", "def unsubscribe(device_id, subscription)\n #puts \"\\n\\n------------------------------\\nUnsubscribe from: #{subscription}\\n--------------------------------------\"\n if @subscriptionLists.hasKey device_id\n device = @subscriptionLists.getRepositoryObject(device_id).getObject\n device.removeSubscription(subscription)\n @subscriptionLists.commitObject(device_id, device, false)\n end\n if @subscriptionLists.hasKey(\"subscriptions\")\n subscriptions = @subscriptionLists.getRepositoryObject(\"subscriptions\").getObject\n if(subscriptions.key? subscription)\n subs = subscriptions[subscription]\n subs.removeDevice(device_id)\n @subscriptionLists.commitObject(\"subscriptions\", subscriptions, false)\n return \"{\\\"unsubscribe\\\": \\\"Device unsubscribed from #{subscription}\\\"}\"\n end\n else\n return '{\"unsubscribe\": \"No subscriptions available\"}'\n end\n end", "def destroy\n @newsletter_topic.destroy\n end", "def destroy\n @subscription = current_user.subscriptions.find(params[:id])\n #TODO move to model Subscription\n if not current_user.fitbit.nil?\n path = ['/1/user/-', @subscription.collection_path, 'apiSubscriptions', @subscription.subscription_id + '-' + @subscription.collection_path]\n current_user.fitbit.client.delete(path.join('/') + '.json')\n flash[:success] = 'Subscription successfully removed from Fitbit.'\n else\n flash[:error] = 'Can not remove subscription from Fitbit, because you are not connected.'\n end\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :ok }\n end\n end", "def unsubscribe(course)\n subscribeds.delete(course)\n end", "def unsubscribe(ident)\n @subscribers.delete(ident)\n end", "def unsubscribe_notifications\n authorize resource\n redirect_to user_path(current_user, anchor: 'unsubscribes')\n end", "def unsubscribe! (user_id)\n check_auth :unsubscribe\n \n response = connection.post do |req|\n req.url \"/user/unsubscribe/#{user_id}\"\n req.body = { :format => @format }\n end\n response\n end", "def revoke(topic, partition)\n ktopic = find_topic(topic)\n\n @buffer[ktopic][partition].clear\n end", "def unsubscribe(host)\n pubsub.subscriptions(host) do |m|\n m[:subscribed] && m[:subscribed].each do |s|\n pubsub.unsubscribe(s[:node], nil, s[:subid], host, &callback_logging(__method__, s[:node], s[:subid]))\n end\n end\n end", "def unsubscribe_from_channel # :nodoc:\n run_callbacks :unsubscribe do\n unsubscribed\n end\n end", "def unsubscribe_webhook\n if @redis\n @redis.pubsub.unsubscribe(subscribed_channel)\n @redis.close_connection\n end\n end", "def unsubscribe(subscriber)\n name_or_subscriber = subscriber.is_a?(String) ? name_with_suffix(subscriber) : subscriber\n adapter.unsubscribe(name_or_subscriber)\n end", "def unsubscribe\n @conn.send_data :opcode => UNSUBSCRIBE, :channel => @name\n end", "def delete_subscription(subscription_id)\n @subscriptions.delete(subscription_id)\n @connections.delete(subscription_id).close\n end", "def delete_subscriptions\n end", "def unsubscribe\n CampaignMonitorWrapper.unsubscribe(user.email)\n end", "def destroy\n @admin_topic = Admin::Topic.find(params[:id])\n @admin_topic.destroy\n \n respond_to do |format|\n format.html { redirect_to admin_topics_url }\n format.json { head :no_content }\n end\n end", "def unsubscribe(*channels)\n _subscription(:unsubscribe, 0, channels, nil)\n end", "def unsubscribe(subscription_id=nil)\n params = {}\n params['subid'] = subscription_id if subscription_id\n subscribee = connection.jid.bare\n\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'set'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('unsubscribe',{'node' => node_id, 'jid'=>subscribee}.merge(params))\n )\n )\n\n send_iq_stanza_fibered iq\n end", "def destroy\n event = Subscription.find(params[:id]).event\n current_user.unsubscribe(event)\n redirect_to event\n end", "def unsubscribe_from_list(user, list)\n delete(\"/#{user}/#{list}/subscribers.json\")\n end", "def unsubscribe_sms\n if current_user\n current_user.update_notification_preference(:push) \n render :text => \"ok\"\n else\n render :text => \"unknown user\"\n end\n end", "def unsubscrive_from_the_topic(topic, device)\n raise NotImplementedError.new\n end", "def unsubscribe(params)\n web_id = params[\"web_id\"]\n\n subscriber = nil\n enabled_models.each { |model| subscriber ||= model.constantize.find_by_mail_chimp_id(web_id) }\n\n subscriber.subscribed_to_list = false\n subscriber.save_without_update_list_member(:validate => false)\n end", "def cancel_subscription(magazine)\n self.subscriptions.find {|subscription| subscription.magazine === magazine}.delete\n end", "def delete_topic(org_unit_id, topic_id) # DELETE\n query_string = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/content/topics/#{topic_id}\"\n _delete(query_string)\nend", "def unsubscribe!\n self.type = :unsubscribe\n reply_if_needed!\n end", "def delete_subscription(entity)\r\n subscriptions.delete(entity)\r\n end", "def unsubscribe(opts = {})\n\t\t\t# Default consumer_tag from subscription if not passed in\n\t\t\tconsumer_tag = subscription ? subscription.consumer_tag : opts[:consumer_tag]\n\t\t\t\n\t\t\t# Must have consumer tag to tell server what to unsubscribe\n\t\t\traise Bunny::UnsubscribeError,\n\t\t\t\t\"No consumer tag received\" if !consumer_tag\n\t\t\t\n # Cancel consumer\n client.send_frame( Qrack::Protocol09::Basic::Cancel.new(:consumer_tag => consumer_tag,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:nowait => false))\n\n\t\t\tmethod = client.next_method\n\n\t\t\tclient.check_response(method,\tQrack::Protocol09::Basic::CancelOk,\n\t\t\t\t\"Error unsubscribing from queue #{name}\")\n\n\t\t\t# Reset subscription\n\t\t\t@subscription = nil\n\t\t\t\t\n\t\t\t# Return confirmation\n\t\t\t:unsubscribe_ok\n\t\t\t\n end", "def destroy\n @subtopic = Subtopic.find(params[:id])\n @subtopic.destroy\n\n respond_to do |format|\n format.html { redirect_to subtopics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @topic = Topic.find(params[:id])\n \n authorize @topic\n \n if @topic.destroy\n flash[:notice] = \"\\\"#{@topic.name}\\\" was deleted successfully.\"\n redirect_to topics_path\n else\n flash[:error] = \"There was an error deleting this topic.\"\n render :show\n end\n end", "def do_unsubscribe(subid)\n unsubscribe(@nodename,subid)\n end", "def unsubscribe(subreddit)\n full_name = extract_full_name subreddit\n parameters = { :action => 'unsub', :sr => full_name }\n\n post('api/subscribe', parameters)\n end", "def delete options={}, headers={}\n @connection.delete \"subscriptions.json\", options, headers\n end", "def destroy\n @subsubtopic = Subsubtopic.find(params[:id])\n @subsubtopic.destroy\n\n respond_to do |format|\n format.html { redirect_to(subsubtopics_url) }\n format.xml { head :ok }\n end\n end", "def unsubscribe(*args)\n (@client ||= connect).unsubscribe(*args)\n end", "def unsubscribe!\n @consumer.try(:cancel)\n @consumer = nil\n end", "def destroy\n if @user.stripe_id.present?\n user = Stripe::Customer.retrieve(@user.stripe_id)\n if user.subscriptions.present?\n subscription = Stripe::Subscription.retrieve(user.subscriptions.data[0].id)\n subscription.delete\n end\n end\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.78070605", "0.7528983", "0.7261029", "0.69946027", "0.6703463", "0.66892874", "0.65922135", "0.6569172", "0.65643096", "0.6481982", "0.641013", "0.6405847", "0.6399709", "0.63749194", "0.6328091", "0.6282876", "0.6281427", "0.62758833", "0.62713367", "0.6254413", "0.6233438", "0.6232369", "0.62255925", "0.6225569", "0.62249845", "0.6186736", "0.6177672", "0.61743194", "0.6162754", "0.61475426", "0.6123118", "0.61148685", "0.6104966", "0.6098462", "0.60759366", "0.60759366", "0.6073269", "0.60483766", "0.6043549", "0.6041387", "0.6024596", "0.6023422", "0.6016062", "0.6016062", "0.6008962", "0.60072476", "0.60064965", "0.60052603", "0.60000265", "0.598893", "0.59832776", "0.59806144", "0.5973537", "0.5972442", "0.59617954", "0.5956484", "0.5952846", "0.59491915", "0.592788", "0.5925336", "0.5912679", "0.5905269", "0.5902592", "0.58746916", "0.58630407", "0.5847538", "0.58442914", "0.5840892", "0.5830704", "0.5823596", "0.5805511", "0.5798056", "0.579225", "0.579116", "0.5789753", "0.5782994", "0.57788324", "0.5762694", "0.57496184", "0.5747823", "0.5720415", "0.5714228", "0.5713358", "0.57128036", "0.5710485", "0.57095903", "0.5706528", "0.5705354", "0.5703176", "0.569804", "0.56951374", "0.56918555", "0.56901896", "0.56891704", "0.5688516", "0.56815207", "0.5679702", "0.5673751", "0.567191", "0.5668574" ]
0.82400113
0
Finds subscription to the given topic
def subscription_for(topic) subscriptions.where(:topic_id => topic.id).first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_topic(topic)\n @subscription_group.topics.find(topic) || raise(Errors::TopicNotFoundError, topic)\n end", "def find_topic\n @topic = current_user.topics.find(params[:topic_id])\n end", "def find_topic\n @topic = current_user.topics.find(params[:topic_id])\n end", "def subscribe!(topic)\n subscriptions.create!( :topic_id => topic.id )\n end", "def subscription(topic)\n settings = { start_from_beginning: topic.start_from_beginning }\n\n kafka_configs.each do |setting_name, setting_value|\n next unless AttributesMap.config_adapter[:subscription].include?(setting_name)\n next if settings.keys.include?(setting_name)\n settings[setting_name] = setting_value\n end\n\n [topic.name, sanitize(settings)]\n end", "def find_topic\n @topic = Topic.find(params[:topic_id]) if params[:topic_id]\n end", "def subscribe_to(topic)\n StreamUser.create(:user => self, :stream_message => topic.stream_messages.last, :source => 'followed') if topic.stream_messages.last\n subscriptions << Subscription.new(:topic => topic)\n end", "def subscribe(_topic, **)\n raise 'not implemented'\n end", "def by_subtopic(id)\n where(:subtopic_id=>id)\n end", "def subscription(topic_name, subscription_name)\n pubsub.subscription(subscription_name) ||\n create_subscription(topic_name, subscription_name)\n end", "def list_subscriptions_by_topic(arn, options = {})\n request({\n 'Action' => 'ListSubscriptionsByTopic',\n 'TopicArn' => arn,\n :parser => Fog::Parsers::AWS::SNS::ListSubscriptions.new\n }.merge!(options))\n end", "def get_topic\n Topic.find(params[:id])\n end", "def get_topic\n Topic.find(params[:id])\n end", "def subreddits_by_topic(topic)\n parameters = { :query => topic }\n\n response = get('api/subreddits_by_topic.json', parameters)\n body = response[:body]\n\n body.map { |subreddit| subreddit[:name] }\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 subscribe_to_topic(topic, device)\n raise NotImplementedError.new\n end", "def set_sub_topic\n @sub_topic = SubTopic.find(params[:id])\n end", "def get_topic(org_unit_id, topic_id) # GET\n query_string = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/content/topics/#{topic_id}\"\n _get(query_string)\nend", "def list_topics_subscriptions topic, options = {}\n publisher.list_topic_subscriptions topic: topic_path(topic, options),\n page_size: options[:max],\n page_token: options[:token]\n end", "def [](topic_or_event)\n topic, head, tail, parts = process_routing_key(topic_or_event)\n\n items = parts.length == 1 ? my_subscriptions(head, original_lookup: topic) : child_subscriptions(head, tail)\n\n Result.new(root, topic, items)\n end", "def get_topic topic_name, options = {}\n publisher.get_topic topic: topic_path(topic_name, options)\n end", "def find\n @subscription = @target.find_subscription(params[:key])\n @subscription ? redirect_to_subscription_path : render_resource_not_found(\"Couldn't find subscription with this target and 'key'=#{params[:key]}\")\n end", "def list_subscriptions_by_topic(topic_arn, next_token = nil)\n params = { 'TopicArn' => topic_arn }\n params.merge!({ 'NextToken' => next_token }) unless !next_token\n req_hash = generate_request('ListSubscriptionsByTopic', params)\n request_info(req_hash, SnsListSubscriptionsByTopicParser.new(:logger => @logger))\n rescue\n on_exception\n end", "def lookup_subscription\n @subscription = if params.has_key?(:id)\n UserSubscription.find(params[:id])\n else\n current_user.user_subscriptions.where(artist: @user).first\n end\n end", "def set_subtopic\n @subtopic = Subtopic.find(params[:id])\n end", "def find(options = {})\n body = options.has_key?(:query) ? options[:query] : {}\n\n response = @client.get \"/api/topics/:id\", body, options\n\n return response\n end", "def set_document_topic_sub_topic\n @document_topic_sub_topic = DocumentTopicSubTopic.find(params[:id])\n end", "def select_note_topic(topic)\n expand_search_options_notes_subpanel\n wait_for_element_and_select_js(note_topics_select_element, topic.name)\n end", "def unsubscribe_from(topic)\n subscriptions.find_by_topic_id(topic.id).try(:destroy)\n end", "def to_topic id, options={}, headers={}\n @connection.get \"subscriptions/to_topic/#{id}.json\", options, headers\n end", "def set_subtopic\n @subtopic = Subtopic.friendly.find(params[:id])\n end", "def get_topic id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get TOPICS, id )\n\t\t\t\tend", "def subscribe(*topics)\n # FIXME: make sure @connection isn't nil\n @connection.subscribe(*topics)\n end", "def subscribe\n return unless self.hub.nil?\n\n # Discover hubs if none exist\n @hubs = discover_hubs_for_topic(self.topic_url) if self.hubs.empty?\n @hub = self.hubs.first\n change_subscription(:subscribe, token)\n\n # TODO: Check response, if failed, try a different hub\n end", "def topic\n begin\n @topic = @owner.topics.find(params[:id])\n rescue render_return\n end\n end", "def find_subscribable\n params.each do |name, value|\n return Regex.last_match(1).classify.constantize.find(value) if name =~ /(.+)_id$/\n end\n nil\n end", "def topic\n @topic ||= client.topic config.topic\n end", "def subscription\n ensure_connection\n @consumers.find(&:subscription)\n end", "def get_by_guid(guid)\n HttpClient::Preconditions.assert_class('guid', guid, String)\n @client.request(\"/subscriptions/#{guid}\").get { |hash| Apidoc::Models::Subscription.new(hash) }\n end", "def find_by_slug_id(id)\n if Moped::BSON::ObjectId.legal?(id)\n Topic.find(id)\n else\n Topic.where(:slug_pretty => id.parameterize).first\n end\n end", "def subscribe(*topics)\n # Defer subscribing until we are connected\n callback do\n send_packet(\n MQTT::Packet::Subscribe.new(\n :topics => topics,\n :message_id => @message_id.next\n )\n )\n end\n end", "def find_any_subscription_with(user)\n Subscription.where(:user_id => self.id, :subscriber_id => user.id).first\n end", "def topic\n SignedUpTeam.find_by(team_id: id, is_waitlisted: 0).try(:topic_id)\n end", "def subscription\n ret = nil\n if type == 'S'\n ret = @mc2p.subscription('id' => @json_body['id'])\n ret.retrieve\n end\n ret\n end", "def subscribe_to_topic(tokens, topic)\n make_topic_mgmt_request(tokens, topic, \"batchAdd\")\n end", "def topic\n load\n @topic\n end", "def set_topic\n @topic = Admin::Topic.find(params[:id])\n end", "def set_rel_topic_sub_topic\n @rel_topic_sub_topic = RelTopicSubTopic.find(params[:id])\n end", "def GetTopic id\n\n APICall(path: \"topics/#{id}.json\")\n\n end", "def topic(name)\n pubsub.topic(name) || create_topic(name)\n end", "def subscriber(record, **args)\n caffeinate_campaign_subscriptions.find_by(subscriber: record, **args)\n end", "def get_subscription(subscription_id)\n get(url_(\"subscription\", subscription_id))\n end", "def get(topic_name)\n topic = service.get_topic(topic_name).to_h\n new(topic)\n rescue ::Google::Apis::ClientError => e\n raise e unless e.status_code == 404\n nil\n end", "def set_subtopic\n\t @subtopic = Subtopic.includes(:questions).find(params[:id])\n\t end", "def subscription subscription_name, skip_lookup: nil\n ensure_connection!\n if skip_lookup\n return Subscription.new_lazy(subscription_name, connection)\n end\n resp = connection.get_subscription subscription_name\n return Subscription.from_gapi(resp.data, connection) if resp.success?\n return nil if resp.status == 404\n fail ApiError.from_response(resp)\n end", "def topic\n return @topic\n end", "def find_topic(category_name, forum_name, topic_title, options = {})\n forum = self.find_forum(category_name, forum_name, options)\n if forum\n self.topics(forum['id'], options).detect {|t| t['title'] == topic_title}\n end\n end", "def get(topic_name)\n topic = service.get_topic(topic_name).body\n new(topic)\n rescue Fog::Errors::NotFound\n nil\n end", "def topic()\n Sensit::Api::Topic.new @http_client\n end", "def fetch_subscription(_params) \n subscription_id = _params['subscription_id']\n if subscription_id.blank? == true \n return false\n end \n begin\n result = ChargeBee::Subscription.retrieve(subscription_id)\n session[:subscription_id] = result.subscription.id\n session[:customer_id] = result.customer.id\n return true\n rescue ChargeBee::APIError => e\n if e.api_error_code == \"resource_not_found\"\n return false\n end\n throw e\n end\n end", "def topic(chan, topic)\n sep = $config['plugins/topic/separator', '|']\n chan.server.cmd('TOPIC', chan.name, topic.join(\" #{sep} \"))\n end", "def topic\n return @topic\n end", "def topic\n return @topic\n end", "def get_topic\n\t\treturn Topic.find(Debate.find(self.debate_id).topic_id)\n\tend", "def get_topic(path, directory_name)\n topic_path = path.gsub(/#{directory_name}/, \"\")\n path_array = topic_path.split(\"/\")\n path_array.each do |topic|\n @topics.push(topic)\n end\n end", "def set_topic\n @topic = Topic.find(params[:topic_id])\n end", "def subscription_to(subscriber, subscription_level = nil)\n matches = self.subscriptions_to.where(:\"#{Sable.subscriber_relation_name.to_sym}_id\" => subscriber.id)\n matches = matches.where('level >= ?', subscription_level) unless subscription_level == nil\n (matches.length > 0) ? matches.first : nil\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def search_item_topic(search_item)\n search_item_topic = begin\n SearchItem.find(search_item).topic\n rescue\n \"\"\n end\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n @topic = Topic.find(params[:id])\n end", "def set_topic\n if params[:id].nil?\n @topic = Topic.find_by(:permalink => params[:permalink])\n else\n @topic = Topic.find(params[:id])\n end\n end", "def subscribe_to_topic(topic_arn, protocol, end_point)\n # TODO handle different SubscriptionArn results? Let's\n # just return the raw subscription arn for now\n req_hash = generate_request('Subscribe', 'TopicArn' => topic_arn, 'Protocol' => protocol, 'Endpoint' => end_point)\n request_info(req_hash, SnsSubscribeParser.new(:logger => @logger))\n end", "def topic\n team_topic = nil\n\n participants.each do |participant|\n team_topic = participant.topic\n break if team_topic\n end\n\n team_topic\n end" ]
[ "0.7928342", "0.7137102", "0.7137102", "0.70296943", "0.7007277", "0.6946221", "0.69441426", "0.68553925", "0.67524695", "0.6596232", "0.6556846", "0.65511703", "0.6510501", "0.6493501", "0.64616305", "0.6346345", "0.6336999", "0.6325711", "0.63208884", "0.63087606", "0.62803215", "0.62716055", "0.6266263", "0.625732", "0.62037253", "0.6162855", "0.61608267", "0.61470014", "0.6143015", "0.61157876", "0.61068505", "0.6069309", "0.6054834", "0.60529935", "0.59988594", "0.5995565", "0.59948885", "0.5952013", "0.5950189", "0.59479576", "0.5947817", "0.59236646", "0.591733", "0.5915437", "0.5915434", "0.5890782", "0.5874647", "0.58725727", "0.58560157", "0.5847686", "0.58473295", "0.58147895", "0.5811377", "0.5801132", "0.5797878", "0.57898426", "0.57734334", "0.57690287", "0.5768503", "0.5767669", "0.57479465", "0.57390994", "0.57390994", "0.57269627", "0.5726866", "0.57254016", "0.5720397", "0.57158816", "0.57158816", "0.56909215", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5683404", "0.5678015", "0.5673362", "0.5666862" ]
0.83120275
0
if a user is destroyed change the ownership of its topics to admin
def change_topics_owner self.topics.each do |topic| topic.user = User.where(:is_admin => true).first topic.save! end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n# @topic = current_user.topics.find(params[:id])\n @topic = Topic.find(params[:id])\n\n if @topic.owner != current_user\n flash[:notice] = \"You are not OWNER. No Permission!\"\n redirect_to topics_path\n else\n @topic.destroy\n respond_to do |format|\n format.html { redirect_to topics_url }\n format.json { head :no_content }\n end\n end\n\n\n\n\n end", "def owned_topic\n unless current_user.id == @topic.user_id\n flash[:alert] = \"Opps! You don't have permission to do that.\"\n end\n end", "def destroy\n unless @user.level >= 8 or @topic.creator == @user.id.to_s\n redirect_to \"/\" and return\n end\n @topic.destroy\n respond_to do |format|\n format.html { redirect_to \"/list\" }\n format.json { head :no_content }\n end\n end", "def destroy\n if (user_signed_in? && ([2].include?(current_user.role)))\n @cultural_heritage_topic = CulturalHeritage::Topic.find(params[:id])\n mensaje = @cultural_heritage_topic.erasable\n if mensaje.blank?\n @cultural_heritage_topic.deleted = 1\n @cultural_heritage_topic.save\n end\n respond_to do |format|\n format.html { redirect_to(cultural_heritage_topics_url, :notice => mensaje) }\n format.xml { head :ok }\n end\n else\n respond_to do |format|\n format.html { redirect_to(new_user_session_path) }\n end\n end\n end", "def destroy\n if @topic.user_id != current_user.id\n redirect_to controller: 'topics', action: 'index'\n else\n @topic.destroy\n respond_to do |format|\n format.html { redirect_to topics_url}\n format.json { head :no_content }\n end\n end\n end", "def delete_topic\n begin\n if logged_in_user.is_admin? then\n topic = Topic.find(params[:id])\n else\n topic = logged_in_user.topics.find(params[:id])\n end\n topic.posts.each do |post|\n post.destroy\n end\n topic.destroy\n \n if @owner.topics.count > 0 then \n fb_redirect_to :controller => 'discussion', :action => 'topics', :cn => @owner.class, :cid => @owner.id\n else\n fb_redirect_to @owner.back_url\n end\n rescue render_return\n end\n end", "def destroy\n @topics_user = TopicsUser.find(params[:id])\n @topics_user.destroy\n\n respond_to do |format|\n format.html { redirect_to my_topics_url, notice: 'Remove topic succeed!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_topic.destroy\n respond_to do |format|\n format.html { redirect_to user_topics_url, notice: 'User topic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def authorize_user_to_delete\n post = Post.find(params[:id])\n unless current_user == post.user || current_user.admin?\n flash[:alert] = \"You must be an admin to do that.\"\n redirect_to [post.topic, post]\n end\n end", "def authorize_destroy\n if forum?\n redirect_to home_url unless current_person.admin?\n elsif blog?\n authorize_change\n end\n end", "def destroy\n user = User.find(params[:id])\n # Works\n if (current_user == user) && (!current_user.admin?)\n user.destroy\n flash[:success] = \"Your profile and related stories are gone.\"\n # Works\n elsif (current_user == user) && (current_user.admin?)\n flash[:error] = \"Cannot delete own admin account\"\n elsif (current_user != user) && (!current_user.admin?)\n flash[:error] = \"You cannot delete other users.\"\n elsif (current_user != user) && (current_user.admin?)\n user.destroy\n flash[:success] = \"User and related posts destroyed.\"\n end\n redirect_to root_path\n end", "def destroy?\n user_is_owner_or_admin?\n end", "def destroy\n if super_user?\n @topic = Topic.find(params[:id])\n @topic.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to(topics_url) }\n format.xml { head :ok }\n end\n end", "def destroy_user(id)\n #TODO:\n # ADD SOME USER LEVEL TO AVOID THESE\n end", "def destroy?\n user.admin_or_owner?\n end", "def destroy?\n user_is_owner_or_admin?\n end", "def beforeDestroy\n UserPermission.where(user:self).each {|up| up.destroy}\n end", "def destroy!(this_is_not_accidental:)\n @topic.delete\n @subscription.delete\n end", "def destroy\n @user = User.find(params[:id])\n if @user.tasks.present?\n Task.where(user_id: params[:id]).destroy_all\n end\n if @user.id == current_user.id\n redirect_to admin_users_url, notice: \"You can not delete signed in user\"\n @admin = User.admin\n elsif @admin == 1\n redirect_to admin_users_url, notice: \"Atleast one admin must remain!\"\n else\n @user.destroy\n redirect_to admin_users_url, notice: 'User was successfully destroyed.'\n end\n end", "def destroy\n if @user.authority == '2'\n flash[:danger] = 'Pre-configured Admin Cannot Be Deleted'\n redirect_to users_path\n elsif @user.email == current_user.email\n flash[:danger] = 'Oops. Don\\'t Delete Yourself'\n redirect_to users_path\n else\n sql = \"delete from histories where email = '#{@user.email}' and (date > '#{Time.now.to_date}' or (date = '#{Time.now.to_date}' and begintime > '#{Time.now.hour}' ))\"\n h = History.find_by_sql(sql)\n @user.destroy\n redirect_to users_path\n flash[:success] = 'User Was Successfully Deleted'\n end\n end", "def destroy\n # allows admin to destroy users w/o being logged out themselves\n if @user.id == current_user.id\n reset_session\n @user.destroy\n flash[:notice] = \"You've successfully deleted your account.\"\n redirect_to preview_path\n else\n @user.destroy\n flash[:notice] = \"User successfully destroyed.\"\n redirect_to last_delete_url\n end\n end", "def destroy\n @user = User.find(params[:id])\n\tif @user.name == session[:name]\t\n\t\treset_session\n\tend\n\tadminCount = User.count(:conditions => [\"admin = ?\", true])\n\tif @user.admin && adminCount == 1\n\t\tflash[:notice] = \"Can't delete last admin\"\n\telse\n\t\t@user.destroy\t\n\tend\n\n respond_to do |format|\n format.html { redirect_to members_url }\n format.json { head :no_content }\n end\n end", "def destroy?\n user.admin?\n end", "def destroy\n #authorize_admin or return\n @topic = Topic.find(params[:id])\n\n authorize! :delete, @topic\n\n @topic.destroy\n\n respond_to do |format|\n format.html { redirect_to(topics_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n authorize! :destroy, @user, :message => 'You are not authorized to perform this operation.'\n user = User.find(params[:id])\n unless user == current_user\n user.destroy\n redirect_to users_path, :notice => \"User deleted. #{undo_link}\"\n else\n redirect_to users_path, :notice => \"Can't delete yourself.\"\n end\n\n end", "def destroy\n if @user.admin == true\n flash[:danger] = \"You cannot delete an admin\"\n redirect_to users_path\n else\n flash[:success] = \"Delete success\"\n Antenna.where(user_id: @user.id).delete_all\n OwnBox.where(user_id: @user.id).delete_all\n OwnDevice.where(user_id: @user.id).delete_all\n @user.destroy\n redirect_to users_path\n end\n end", "def destroy?\n user.present? && (record.user == user || user.admin? || user.moderator?)\n end", "def destroy\n if current_user != nil && !current_user.try(:banned?)\n discussion = Discussion.where(:id => @post.discussion_id).first\n if author_exists = User.where(:id => @post.user_id).first\n if current_user == author_exists || current_user.try(:admin?)\n @post.destroy\n redirect_to discussion_path(discussion), notice: 'Post was successfully destroyed.'\n else\n redirect_to discussion_path(@post.discussion_id)\n end\n else\n if current_user.try(:admin?)\n @post.destroy\n redirect_to discussion_path(discussion), notice: 'Post was successfully destroyed.'\n else\n redirect_to discussion_path(@post.discussion_id)\n end\n end\n else\n redirect_to discussion_path(@post.discussion_id)\n end\n end", "def destroy\n find_user\n # check if logged in & if user exists\n @user.destroy\n # also destorys all attending events that contains the user_id\n end", "def destroy?\n owner? || user.is?(:admin)\n end", "def destroy\n # Making sure only signed in users can access\n # if user_signed_in?\n topic = Topic.find(params[:id])\n if topic.destroy\n render json: topic\n else\n render json: topic.errors\n end\n # else\n # render status: 403, plain: 'Please Sign In to Access'\n # end\n end", "def before_destroy\n if public?\n errors.add_to_base _('Public user cannot be deleted.')\n end\n if last_admin?\n errors.add_to_base _(\"Cannot delete. User '{{username}}' is the last available admin.\", :username => username)\n end\n if current?\n errors.add_to_base _('You cannot delete your own account.')\n end\n errors.empty?\n end", "def destroy\n unless current_user.admin?\n redirect_to '/', :alert => \"Acceso denegado.\" #por ahora solo un adminsitrador puede ver esto\n end\n\n if @subject.destroy\n redirect_to request.referrer\n flash[:noticep]='Asignatura borrada exitosamente'\n else\n flash[:noticen]='Error al borrar'\n end\n end", "def destroy\n @topic.destroy\n redirect_to admin_topics_url, notice: \"#{t('notice.deleted',{model: \"#{t('activerecord.models.admin/topic')}\"})}\"\n end", "def destroy\n if (current_user.id == @post_reply.user_id) or (current_user.is_admin)\n @post_reply.flag_delete = true\n @post_reply.save\n if @post_reply.save\n flash[:notice] = \"Reply was succefully deleted\"\n redirect_to post_path(@post_reply.post_id)\n else\n flash[:alert] = \"Uppss....\"\n redirect_to post_path(@post_reply.post_id)\n end\n else\n flash[:notice] = 'Access Denied'\n redirect_to post_path(@post_reply.post_id)\n end\n end", "def destroy \n if !current_user.isScrumMasterOrProductOwner?\n if !current_user.isAdmin?\n if current_user.id == @user.id\n borrar\n else\n redirect_to(root_path, notice: \"You can not delete other users\")\n end\n else\n if User.where(:role => \"admin\").count > 1 or @user.role == \"user\"\n borrar\n else\n redirect_to(users_path, notice: \"It is not allowed to delete the admin\")\n end\n end\n else\n redirect_to(root_path, notice: \"It is not allowed to delete users while being a Scrum Master or Product Owner\")\n end\n end", "def destroy?\n user.present? && user.admin?\n end", "def destroy\n\n logger.tagged(\"destroy\",\"beginning\") {logger.debug \"I'M HERE!\"}\n @user = User.find(params[:id])\n can_destroy_hash = Permissions.hasMorePermissions(@current_user,@user)\n @can_destroy = can_destroy_hash[:has_permission]\n if @can_destroy\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_path }\n format.json { head :no_content }\n end\n else\n flash[:warning] = can_destroy_hash[:permission_message]\n redirect_to user_path(@user)\n end\n\n end", "def destroy?\n user.admin?\n end", "def destroy?\n user.admin?\n end", "def destroy\n if !@user.is_admin && @user.destroy\n flash[:notice] = \"User deleted successfully\"\n else\n flash[:alert] = \"Unable to delete user\"\n end\n redirect_to users_path\n end", "def destroy\n authorize(@user, :update?)\n\n @user.destroy\n\n redirect_to users_path, notice: t('user.deleted')\n end", "def revoke_admin\n authorize! @user\n @user.roles = @user.roles - ['admin']\n @user.save\n redirect_to @user, notice: t('user.revoked_admin', name: @user.username)\n end", "def destroy\n # destroy not implemented - only admins may \"purge\" or \"delete\" users\n raise \"This action is not implemented\"\n end", "def change_owner!(user_changing, user_to_be_changed)\n if(!user_changing.persisted? || super_admin != user_changing)\n raise SecurityError.new \"No Permissions\"\n end \n exist_user?(user_to_be_changed)\n if(super_admin != user_changing)\n ActiveRecord::Base.transaction do\n remove_user!(user_changing, user_to_be_changed)\n participants.create(user_id: user_changing.id, member_type: Course.roles[\"admin\"])\n update(super_admin: user_to_be_changed)\n end\n end\n\nend", "def destroy\n if User.find(params[:id]).admin?\n redirect_to users_url\n else\n User.find(params[:id]).delete\n flash[:sucess] = \"User deleted\"\n redirect_to users_url\n end\n end", "def destroy\n topic = Topic.find params[:id]\n user_topic = current_user.user_topics.find_by!(topic_id: topic.id)\n user_topic.destroy\n\n respond_to do |format|\n flash[:notice] = 'You have successfully unsubscribed from the thread.'\n\n format.html { redirect_back(fallback_location: root_path) }\n end\n end", "def destroy?\n raise Pundit::NotAuthorizedError, \"must be logged in\" unless @user\n @user.admin? || @repository.namespace.team.owners.exists?(user.id)\n end", "def destroy\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n @user = User.find(params[:id])\n if (@user)\n @user.destroy\n end\n redirect_to :action => 'index'\n else\n redirect_to '/'\n end \n end", "def destroy?\n record.sender == user || user.admin?\n end", "def destroy\n @user.destroy\n respond_to do |format|\n if current_user.isAdmin?\n format.html { redirect_to home_admin_path, notice: 'Successfully destroyed.' }\n elsif current_user.isSuperadmin?\n format.html { redirect_to home_superadmin_path, notice: 'Successfully destroyed.' }\n end\n end\n end", "def destroy?\n user&.admin?\n end", "def destroy?\n record.user_id == user.id || user.admin?\n end", "def destroy\n if check_user_write_access\n user.destroy\n\n respond_to do |format|\n format.html { redirect_to :root }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n #any suggested changes assigned to this user will be set to assigned_to_id = null automatically by the foreign key constraint.\n respond_to do |format|\n if @user.application_admin? && User.where(application_admin?: true).count == 1\n flash[:error] = \"The last application admin user cannot be deleted.\"\n format.html { redirect_to users_path }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n elsif ChangeLogEntry.where(user: @user).count > 0\n flash[:error] = \"This user can't be deleted, because there are one or more change log entries for actions they took. If this user no longer uses the application, try setting them to inactive instead.\"\n format.html { redirect_to users_path }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n else\n @user.destroy\n format.html { redirect_to users_url, notice: 'User was successfully deleted. Any suggested changes assigned to this user are now assigned to no one.' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n user = User.find(params[:id])\n # if admin tries to delete himself\n if current_user?(user)\n flash[:error] = \"Admins are not allowed to self destruct\"\n redirect_to users_path\n else\n user.destroy\n flash[:success] = \"User #{user.name} was successfully deleted.\"\n redirect_to users_path\n end\n end", "def destroy?\n raise Pundit::NotAuthorizedError, \"must be logged in\" unless @user\n @user.admin? || @tag.repository.namespace.team.owners.exists?(user.id)\n end", "def destroy\n @user = User.find_by_username(params[:id])\n authorize! :manage, @user\n \n if !current_user.has_role?(:admin)\n redirect_to root_url, alert: \"Only admins allowed.\"\n else\n \n\n respond_to do |format|\n if @user.destroy\n format.html { redirect_to root_url, notice: \"User deleted.\" } \n else\n format.html { redirect_to user_path(@user.username), notice: \"User deactivated.\" } \n end\n end\n end\n end", "def ensure_if_admin_remains\n raise \"Can't delete last admin user.\" if User.count.zero?\n end", "def ensure_if_admin_remains\n raise \"Can't delete last admin user.\" if User.count.zero?\n end", "def destroy?\n @user&.admin?\n end", "def destroy\n unless current_user.admin? or current_user.coordinador?\n redirect_to '/', :alert => \"Acceso denegado.\" #por ahora solo un adminsitrador puede ver esto\n end\n @tutor = Tutor.find(params[:id]) \n if current_user.admin? or current_user.coordinador?\n if @tutor.update(status:false) \n flash[:noticep] = 'Tutor borrado con éxito' \n redirect_to request.referrer \n else \n flash[:noticen] = 'Error al eliminar tutor' \n redirect_to request.referrer\n end\n else\n flash[:noticen] = 'Usted no tiene permisos para eliminar este tutor' \n redirect_to request.referrer \n end \n \n end", "def destroy\n unless current_user.admin? or current_user.coordinador? or current_user.tutor?\n redirect_to '/', :alert => \"Acceso denegado.\" #por ahora solo un adminsitrador puede ver esto\n end\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n redirect_to tutorials_path\n \n end", "def destroy\n @thred = Thred.find(params[:id])\n\tif @thred.user_id == current_user.id\n @thred.destroy\nend\n\n respond_to do |format|\n format.html { redirect_to(:controller => \"topics\", :action => \"topicsList\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n if is_admin?\n\n if @user.role == \"Super Administrator\"\n flash[:notice] = \"The Super Administrator cannot be deleted\"\n redirect_to @user\n return\n end\n if @user.role == \"Administrator\"\n if !@superadmin_user\n if !(@current_user == @user)\n flash[:notice] = \"Only the super administrator can delete other administrators\"\n redirect_to @user\n return\n end\n end\n end\n else\n if !(@current_user == @user)\n flash[:notice] = \"You do not have permission to delete this user!\"\n redirect_to @current_user\n return\n end\n end\n @posts = Post.where(:user_id => @user.id).all\n #@replies = Reply.where(:user_id => @user.id).all\n @anonymous = User.where(:username => 'Anonymous').first\n @posts.each do |p|\n p.update_attributes(:user_id => @anonymous.id)\n end\n #@replies.each do |r|\n # r.update_attributes(:user_id => @anonymous.id)\n #end\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @tenant_of.property.user.id != @user.id\n redirect_to properties_path, notice: \"Not Authorized\"\n else\n @tenant_of.destroy\n redirect_to :back, notice: 'Tenant was removed.' \n end \n end", "def destroy\n @topic = Topic.find(params[:id])\n \n authorize @topic\n \n if @topic.destroy\n flash[:notice] = \"\\\"#{@topic.name}\\\" was deleted successfully.\"\n redirect_to topics_path\n else\n flash[:error] = \"There was an error deleting this topic.\"\n render :show\n end\n end", "def destroy\n\t\tif(is_admin?)\n\t @user = User.find(params[:id])\n \t \t@user.destroy\n\t respond_to do |format|\n \t \tformat.html { redirect_to(users_url) }\n \t \tformat.xml { head :ok }\n\t\t\tend\n\t\telse\n\t\t\tredirect_to user_path, notice: 'Access Denied'\n end\n end", "def destroy\n deleted = false\n # Não é possível deletar o último super admin\n if @user.can_delete?(current_user)\n @user.destroy\n deleted = true\n end\n\n respond_to do |format|\n if deleted\n format.html { redirect_to admin_users_url, notice: \"Usuário deletado com sucesso!\" }\n else\n format.html { redirect_to admin_users_url, alert: \"Impossível deletar o último SuperAdmin do sistema ou usuário de um aluno!\" }\n end\n format.json { head :no_content }\n end\n end", "def destroy\n if @user.account.present? && @user.account.accountable.is_a?(Npo)\n @user.npo.npo_events.create(npo_event_status: NpoEventStatus.user_deleted, user: current_user, description: \"Deleting User: #{@user.email}\")\n end\n sso_user_setting = @user.user_settings.where(setting_type: 'sisense_sso').first\n if sso_user_setting.present?\n Rails.logger.info(\"sso_user_setting for user id: #{@user.id} - #{sso_user_setting.inspect}\")\n Producer.publish({ :message_type => Fox::QueueTypes::ANALYTICS_QUEUE, :analytics_type => SisenseUserService::DELETE_SSO_USER, :sisense_user_id => sso_user_setting.setting_value })\n end\n\n @user.destroy\n redirect_path = current_user.account.is_channel_partner? ? edit_account_settings_path : account_path\n\n respond_to do |format|\n format.html { redirect_to redirect_path }\n format.json { head :ok }\n end\n end", "def destroy\n restrict('allow only admins') or begin\n @user = User.find_by_id(params[:id])\n if @user.destroy\n respond_to do |format|\n format.html { redirect_to manage_users_url }\n format.xml { head :ok }\n end\n else\n \n end\n end\n end", "def delete_admin(id)\n @m = Member.find_by_society_id_and_user_id(self.id, id)\n if @m == nil then return end\n \n if @m.admin \n @m.admin = false\n @m.save\n\t\t\tadd_post(id, \"Administrator status revoked\")\n end\n end", "def destroy\n @admin_topic = Admin::Topic.find(params[:id])\n @admin_topic.destroy\n \n respond_to do |format|\n format.html { redirect_to admin_topics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @topic = Topic.find(params[:id])\n authorize @topic\n @topic.destroy\n\n head :no_content\n end", "def destroy\n # check signed in user is the creator of post\n if @post.user == current_user \n if @post.destroy\n flash[:notice] = \"Post deleted!\"\n else\n flash[:alert] = \"Something went wrong ...\"\n end\n else\n flash[:notice] = \"You don't have permission to do that!\"\n end\n redirect_to root_path\n end", "def destroy\n UserService.deleteUser(params[:id],current_admin[:id])\n redirect_to users_path\n end", "def delete_user\n end", "def destroy\n user_to_delete = User.find(params[:id])\n if (current_user?(user_to_delete))\n flash[:error] = \"You cannot delete yourself!\"\n else\n user_to_delete.destroy\n flash[:success] = \"User deleted.\"\n end\n redirect_to users_url \n end", "def destroy\n if @user != current_user && !current_user.admin?\n render json: ['Not authorized for that action'], status: :unauthorized\n else\n if @user.destroy\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end\n end", "def destroy\n if current_user.has_role?(:admin)\n \n @asunto = Asunto.find(params[:id])\n @asunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(asuntos_url) }\n format.xml { head :ok }\n end\n else\n redirect_to(root_path,:notice => 'No se tienen permisos.')\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.delete\n flash[:notice] = t('users.destroyed')\n redirect_to admin_users_url\n end", "def destroy\n if @user != current_user\n @user.destroy\n else\n flash[:error] = \"Vous ne pouvez pas supprimer votre compte utilisateur\"\n end\n redirect_to users_path\n end", "def destroy?\n @current_user.permission('Fdp', :admin)\n end", "def admin_deny_user\n @user.destroy\n redirect_to admin_path, notice: \"User Denied and Account Deleted\"\n end", "def destroy_user\n self.own_children.each do |child|\n unless child.admins.where([\"relations.user_id != ?\", self.id]).any?\n child.destroy_child\n end\n end\n self.destroy\n end", "def before_destory\n if User.count(:all, :conditions => [\"is_superuser = 1 and active = 1\"]) <= 1\n errors.add_to_base \"Cannot delete #{self.username.upcase} because it is the last admin user\"\n return false\n else\n return true\n end\n end", "def destroy\n if @post.user.nick != current_user.nick and !current_user.has_role? :admin\n redirect_to timeline_path, :alert => \"You can't delete another user’s post!\"\n else\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @topic.destroy\n redirect_to root_url\n end", "def destroy\n user = User.first(:username => params[:username])\n if user\n auth = Authorization.first(:provider => params[:provider], :user_id => user.id)\n auth.destroy if auth\n end\n redirect_to \"/users/#{params[:username]}/edit\"\n end", "def destroy?\n return false if user.nil?\n user.admin? && user != record\n end", "def destroy\n unless current_user.admin?\n redirect_back fallback_location: root_path, alert: '削除権限がありません。'\n return\n end\n\n name = @user.dispname(User::FULLNAME)\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to relation_members_url, notice: \"#{name}を削除しました.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n #only user can modify \n unless current_user.has_role?(:admin) || current_user.has_role?(:user)\n redirect_to admin_channels_path, alert: \"没有权限\"\n return\n end\n @admin_channel.destroy\n respond_to do |format|\n format.html { redirect_to admin_channels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #TODO update hyku user.destroy to do roles.destroy_all instead\n if @user.present? && @user.destroy\n redirect_to main_app.persona_users_path, notice: t('.success', user: @user)\n else\n redirect_to main_app.persona_users_path flash: { error: t('.failure', user: @user) }\n end\n end", "def destroy\n if session[:admin_user]\n old_user = session[:user]\n session[:user] = session[:admin_user]\n session.delete(:admin_user)\n flash[:success] = \"Logged out <b>#{old_user.username}</b>, returned to <b>#{session[:user].username}</b>\".html_safe\n else\n session[:user] = nil\n flash[:success] = \"You have successfully logged out\"\n end\n redirect_to request.referer || \"/\"\n end", "def can_destroy?(user)\n !!user&.admin\n end", "def notify_users_before_destroy\n notify_users(:destroy)\n end", "def destroy\n if current_user.is_an_admin?\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n else\n flash[:error] = \"That action is not permitted.\"\n redirect_back_or_default('/')\n end \n end", "def destroy\n get_master_context\n authenticate_muni_admin!\n @muni_admin = MuniAdmin.find(params[:id])\n\n if (current_muni_admin == @muni_admin)\n flash[:error] = \"You cannot delete yourself.\"\n @error = true\n return\n end\n\n authorize_muni_admin!(:delete, @muni_admin)\n\n if @muni_admin\n if !@muni_admin.deployments.empty?\n @redirect = destroy_confirm_master_muni_admin_path(@master, @muni_admin)\n else\n flash[:notice] = \"Administrator #{@muni_admin.email} has been removed.\"\n @muni_admin.destroy\n end\n end\n end", "def destroy\n if current_user && current_user.admin? \n @user = User.find(params[:id])\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n else\n flash[:notice] = 'You do not have Admin rights to delete a user'\n redirect_to home_index_path\n end\n end", "def destroy\n if session[:admin]\n @current_user = User.find(session[:admin])\n set_user\n else\n reset_session\n flash[:notice] = t(\"signed_out\")\n if params[:redirect_to]\n redirect_to params[:redirect_to]\n else\n redirect_to action: \"new\"\n end\n end\n end" ]
[ "0.7436648", "0.6806079", "0.6798248", "0.6742251", "0.66281784", "0.6439939", "0.6408619", "0.6371251", "0.63659513", "0.6353874", "0.6349523", "0.6303384", "0.62920004", "0.628072", "0.62624013", "0.6248637", "0.6245208", "0.6244804", "0.6215825", "0.6210043", "0.6186702", "0.6162211", "0.61544305", "0.61532974", "0.6150829", "0.6150515", "0.6148464", "0.6141623", "0.61349005", "0.6125073", "0.61078495", "0.6104386", "0.6089964", "0.6071915", "0.60686404", "0.6059309", "0.6041459", "0.6038149", "0.60375494", "0.60375494", "0.6024056", "0.60099524", "0.6009011", "0.59992945", "0.59979004", "0.59902114", "0.59700614", "0.5960329", "0.5958732", "0.59486204", "0.59458137", "0.594567", "0.5943121", "0.594235", "0.5941705", "0.59391963", "0.5938574", "0.59251297", "0.59192216", "0.59192216", "0.5912271", "0.5909441", "0.59089416", "0.59062123", "0.59056634", "0.5902006", "0.5899196", "0.5898258", "0.5897451", "0.589526", "0.58937204", "0.5893604", "0.5890969", "0.58819914", "0.58723986", "0.58688766", "0.5865106", "0.5863673", "0.5858674", "0.58550656", "0.5851659", "0.5849274", "0.58359087", "0.58349496", "0.5830279", "0.5830154", "0.58251506", "0.58234733", "0.5817493", "0.58154815", "0.58061135", "0.5804518", "0.5804353", "0.5803115", "0.58016765", "0.57997906", "0.5799431", "0.5797482", "0.57927287", "0.5788482" ]
0.71738094
1
send notification to participate in a topic
def notify_about_topic!(topic) with_user_locale do UserMailer.topic_match_notification(self, topic).deliver! end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topic(channel, str)\n sendmsg \"TOPIC #{channel} :#{str}\"\n end", "def topic(chan, topic)\n sep = $config['plugins/topic/separator', '|']\n chan.server.cmd('TOPIC', chan.name, topic.join(\" #{sep} \"))\n end", "def topic(channel, topic = nil)\n topic = \":#{topic}\" if topic\n send_msg(\"TOPIC #{channel} #{topic}\")\n end", "def notify(msg)\n @room_queue.push(msg)\n end", "def notify(msg, subject)\n end", "def notify_user user_id, message\n\n\t\tmsg = \"Hello PubNub, love the Ruby SDK\"\n\t\tchannel = \"demo\"\n\n\t \tpubnub.publish(:message => msg, :channel => channel) do |envelope|\n\t\t\tputs envelope.message\n\t\t\tputs envelope.channel\n\t\t\tputs envelope.status_code\n\t\t\tputs envelope.timetoken\n\t\tend\n\n\t\tputs \"#{channel_prefix + user_id}\"\n\tend", "def sendMsg(msg)\r\n @pubNub.publish(:message => msg, :channel => @channel, :http_sync => true)\r\n end", "def onMessage(topic, message)\n puts \"Topic: #{topic}, Message: #{message}\"\nend", "def topic(c, t)\n @socket << \"TOPIC #{c} :#{t}\"\n end", "def send_notification\n\n\n end", "def associate_topic(topic)\n @topic = topic\n self.__log_messages\n end", "def send_notification(msg)\n EM.next_tick do\n @do_notify.call(msg)\n end\n end", "def notify_topic(message, options: nil, &block)\n command = make_simple_command(:post, 'messages:send', options)\n command.request_representation = Google::Apis::Messages::Message::Representation\n command.request_object = message\n\n if !ENV['FIREBASE_DEBUG'].nil?\n log_json(command)\n end\n\n execute_or_queue_command(command, &block)\n end", "def send_notification2(msg)\n raise \"please start server first before notify !!\" unless @x_notify\n puts \"[AmqpServer] notify: message=#{msg}\" if $DEBUG\n MQ.fanout(@x_notify).publish(Blix.to_binary_data(msg))\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 topic(message)\n puts \"-----> #{message}\"\nend", "def send_message_notification\n message = MessageBlueprint.render_as_json(self)\n ActionCable.server.broadcast \"conversation_#{ self.conversation_id }_notification_channel\", message\n # receiver = self.conversation.user_one_id == self.user_id ? self.conversation.user_two_id : self.conversation.user_one_id\n # response = self.attributes.merge(user: self.user&.name)\n # ActionCable.server.broadcast \"user_#{ receiver }_notification_channel\", response.as_json.to_s\n end", "def send_notification(params)\n room_id = self.room_id || params.delete(:room_id)\n raise ArgumentError.new(\"room_id required\") unless room_id\n call_api(:method => :post, :uri => @api_base.merge(\"room/#{room_id}/notification\"), :body_params => params)\n end", "def someone_did_change_topic(stem, person, channel, topic)\n end", "def publish msg\n @conn.send_data :opcode => PUBLISH, :channel => @name, :data => msg.to_s\n end", "def say(msg)\n self.signed_request '/api/v1/chat.postMessage', 'POST', {roomId: @channel_id, text: '>' + msg}\n end", "def subscribe(_topic, **)\n raise 'not implemented'\n end", "def topic(session, message, options={})\n json_request \"topic\", {:session => session,\n :message => message}, options\n end", "def subscribe_to_topic(tokens, topic)\n make_topic_mgmt_request(tokens, topic, \"batchAdd\")\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 topic!(topic)\n @session.chanserv.topic(self.name, topic)\n end", "def send_message(email, text)\n @notification_server.send_message email, text\n end", "def do_publish(params)\n content_type 'text/plain', :charset => 'utf-8'\n unless params['hub.url'] and not params['hub.url'].empty?\n throw :halt, [400, \"Bad request: Empty or missing 'hub.url' parameter\"]\n end\n begin\n # TODO: move the subscribers notifications to some background job (worker?)\n hash = Topic.to_hash(params['hub.url'])\n topic = DB[:topics].filter(:url => hash)\n if topic.first # already registered\n # minimum 5 min interval between pings\n #time_diff = (Time.now - topic.first[:updated]).to_i\n #throw :halt, [204, \"204 Try after #{(300-time_diff)/60 +1} min\"] if time_diff < 300\n topic.update(:updated => Time.now, :dirty => 1)\n # only verified subscribers, subscribed to that topic\n subscribers = DB[:subscriptions].filter(:topic_id => topic.first[:id], :state => 0)\n atom_diff = Topic.diff(params['hub.url'], true)\n postman(subscribers, atom_diff) if (subscribers.count > 0 and atom_diff)\n topic.update(:dirty => 0)\n else \n DB[:topics] << { :url => hash, :created => Time.now, :updated => Time.now }\n end\n throw :halt, [204, \"204 No Content\"]\n rescue Exception => e\n throw :halt, [404, e.to_s]\n end\n end", "def subscribe!(topic)\n subscriptions.create!( :topic_id => topic.id )\n end", "def will_notify\n #Resque.safe_enqueue Notification, to_user_id, id, APP::NOTIFICATIONS::MESSAGE\n end", "def send_notifications\n end", "def notify(mid, *args, **kwargs)\n @notification_name = mid\n do_notify(*args, **kwargs)\n end", "def send_notification\n\t\tSingleCellMailer.share_notification(self.study.user, self).deliver_now\n\tend", "def associate_topic(topic)\n self.synchronize do\n @topic = topic\n end\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 send_message(msg, *args)\n speakers = get_speakers(@resource[:name])\n Puppet.debug(\"#{resource[:name]} => #{msg} => #{args}\")\n speakers.each { |s| s.send msg, *args }\n end", "def send_other_kafka_message\n Rimless.message(data: { 'id' => 'id' }, topic: :test, schema: :include)\nend", "def msg_send(type)\n\n input_message = {\n \"type\" => \"record-alarm\", # Sensor reading\n \"alarm\" => \"smoke\", # Current time (reading time)\n }.to_json\n\n if type == \"co\"\n input_message = {\n \"type\" => \"record-alarm\", # Sensor reading\n \"alarm\" => \"co\", # Current time (reading time)\n }.to_json\n end\n\n @pubnub.publish(\n :channel => @channel_name,\n :message => input_message,\n :callback => lambda {|message| puts \"Sent Message: message\" +input_message.inspect + \"\\nResponse:\" + message.inspect}\n )\n end", "def notify(type,subject,target=nil)\n self.notices.create :type => type, :subject => subject, :target => target\n end", "def publish_message(args)\n room_id = args.shift\n if room_id.nil? or room_id.empty?\n puts \"Please enter room id\"\n exit(0)\n end\n\n message = (args.shift || \"\").dup\n target_topic = \"worker/rooms/#{room_id}\"\n payload = {name: 'Tarou', message: message}.to_json\n client.publish(target_topic, payload)\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 publish(topic, payload, retain=false, qos=0)\n # Defer publishing until we are connected\n callback do\n send_packet(\n MQTT::Packet::Publish.new(\n :qos => qos,\n :retain => retain,\n :topic => topic,\n :payload => payload,\n :message_id => @message_id.next\n )\n )\n end\n end", "def deliver_message(json_message, topic:)\n producer.produce json_message.to_json, topic: topic, partition_key: Teamwork::Utils.mac\n Teamwork.logger.info \"deliver kafka message success #{json_message} , topic #{topic}\"\n end", "def test_update_topic_for_individual_assignment\n participant = participants(:par19)\n topic = sign_up_topics(:Topic5)\n participant.update_topic_id topic.id\n assert_equal \"Research Communication\", participant.get_topic_string\n end", "def send_ta_notification(user, msg)\n\t\t@user = user\n\t\t@msg = msg\n\t\tmail( :to => @user.email, :subject => 'You have just been assigned to a course!')\n\tend", "def create_notification\n subject = \"#{student_request.name} \"\n body = \"#{student_request.name} (#{student_request.email}) needs tutorial.\"\n tutor_request.notify(subject, body, self)\n end", "def receive_topic name\n @topic = sanitize_location_name name\n end", "def can_reply_to_forem_topic? topic\n true\n end", "def topic(channel, topic = nil)\n if topic.nil?\n raw \"TOPIC #{channel}\\r\\n\"\n else\n raw \"TOPIC #{channel} :#{topic}\\r\\n\"\n end\n end", "def topic_create(topic)\n @topic = topic\n @board = topic.board\n @user = topic.author\n @mail = @user.email\n @link = board_topic_url(@board, @topic)\n @greeting = \"Hi\"\n\n @subject = \"您已成功在Board: #{@board.name}內新增了一篇Topic~\"\n\n mail to: @mail, subject: @subject\n end", "def owned_topic\n unless current_user.id == @topic.user_id\n flash[:alert] = \"Opps! You don't have permission to do that.\"\n end\n end", "def push(notif)\n\n end", "def create_topic!\n fora.post_new_topic\n end", "def send_message(data)\n current_user.messages.create!(body: data[\"message\"], chat_room_id: data[\"chat_room_id\"])\n # the next line broadcasts the message without a job. BUT: that is only the message.\n # We want do more :)\n # ActionCable.server.broadcast(\"chat_rooms_channel\", message: data[\"message\"])\n end", "def notify(params)\n client.post('/notify', params)\n end", "def notify(interests, data = {})\n Request.new(\n @eventflit_client,\n :post,\n url(\"/publishes\"),\n {},\n payload(interests, data)\n ).send_sync\n end", "def say_hi(medium)\n @medium = medium\n\n mail(to: '446146366@qq.com' , subject: \"视频#{@medium.subject}更新通知\")\n mail(to: 'mwang@jingqi100.com' , subject: \"视频#{@medium.subject}更新通知\")\n mail(to: 'hhuang@jingqi100.com' , subject: \"视频#{@medium.subject}更新通知\")\n mail(to: 'mwu@jingqi100.com' , subject: \"视频#{@medium.subject}更新通知\").deliver\n end", "def groups_set_topic(params = {})\n fail ArgumentError, \"Required arguments 'channel' missing\" if params['channel'].nil?\n fail ArgumentError, \"Required arguments 'topic' missing\" if params['topic'].nil?\n response = @session.do_post \"#{SCOPE}.setTopic\", params\n Slack.parse_response(response)\n end", "def publish(topic, key, data)\n key = topic+'.'+key\n gamex_publish(key, data)\n end", "def topic=(topic)\n raise 'Tried to set topic on voice channel' if voice?\n\n update_channel_data(topic: topic)\n end", "def publish(channel, message); end", "def publish(channel, message); end", "def topic( name, &block )\n destination( name, :topic, @topics, &block )\n end", "def invite_user_to_topic(params = {})\n deprecated(__method__, \"invite_to_topic\")\n invite_to_topic(params[:topic_id], params)\n end", "def publish(topic, args=nil, kwargs=nil, options={}, &callback)\n\n # Create the params\n params = { topic: topic , args: args, kwargs: kwargs, options: options }\n\n # Execute the command\n request_response :publish, params, options[:acknowledge], &callback\n end", "def topic(name)\n pubsub.topic(name) || create_topic(name)\n end", "def broadcast message\n @clients.keys.each do |key|\n notify key, message\n end\n end", "def speak(data)\n sender = current_user\n message = data['message']\n\n # Save message in database as historical data\n msg = Message.new\n msg.user_id = current_user.id \n msg.recipient_id = data[\"target_user\"]\n msg.content = data['message']\n puts msg\n msg.save!\n\n # Sends back the data in realtime using websockets\n ActionCable.server.broadcast \"RoomChannel\", {message: message, sender: current_user, recipient: User.find(msg.recipient_id)}\n\n end", "def create_pubsub_topic topic_id\n pubsub = Google::Cloud::Pubsub.new project: @project_id\n topic = pubsub.create_topic topic_id\n policy = topic.policy do |p|\n p.add \"roles/pubsub.publisher\",\n \"serviceAccount:cloud-iot@system.gserviceaccount.com\"\n end\n @topics << topic\n topic\n end", "def publish_action(f)\n send_as :notification\n from f\n story_size SHORT # or ONE_LINE or FULL\n data :friend=>\"Mike\"\n end", "def notify sender_id:, referent:, instance:, users:, params: {}\n notify_push(sender_id: sender_id, referent: referent, instance: instance, users: users, params: params)\n notify_inapp(sender_id: sender_id, referent: referent, instance: instance, users: users, params: params)\n end", "def auto_subscribe_topic\n fail NotImplementedError, 'To be implemented by the concrete topic posts controller.'\n end", "def send_notification(msg)\n $BLIX_NOTIFY.push(msg)\n puts \"[DummyServer] notify: message=#{msg}\" if $DEBUG\n end", "def subscribe\n subscribee = connection.jid.bare\n\n iq = connection.iq_stanza({'to'=>jid.bare,'type'=>'set'},\n x('pubsub',{:xmlns => EM::Xmpp::Namespaces::PubSub},\n x('subscribe','node' => node_id, 'jid'=>subscribee)\n )\n )\n\n send_iq_stanza_fibered iq\n end", "def create\n @topic = Topic.find(params[:topic_id])\n @forum = Forum.find(params[:forum_id])\n\n @message.topic = @topic\n @message.user = current_user\n\n @messages = @topic.messages.order('created_at DESC').limit(5)\n\n respond_to do |format|\n if @message.save\n\n # Notify users who want to be\n @message.notify_users_topic_update!(current_user)\n\n format.html { redirect_to forum_topic_path(@forum, @topic, :anchor => \"msg_id_#{@message.id}\"), notice: 'Message was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def notify_acknowledgement\n # message = sender_activity.decorate.activity_message\n # logger.info \"Preparing to send acknowledgment push notification of #{ message } to sender: #{ sender.id }\"\n #\n # sender.devices.each do |device|\n # device.notify message\n # end\n end", "def notfiy_subscribers(params)\n subject = params[:subscribable]\n\n subject.subscribers.each do |subscriber|\n subscriber.notify(subject, params[:message])\n end\n\n continue(params)\n end", "def send_message(jid,text)\n m = Jabber::Message.new(jid, text)\n m.set_type :chat\n @client.send m\n end", "def join_notify_pusher\n Pusher.trigger('join', 'create', self.user.email.as_json)\n end", "def messaging\n end", "def request(property, &block)\n mid = WiseOMF::Client::ExperimentHelper.messageUID\n unless block.nil?\n @callback_cache.store(mid, block)\n end\n fail \"Can't request topic here\" if property.to_sym.eql? 'topic'.to_sym\n @group.topic.configure({property => mid})\n end", "def subscribe_to_topic(topic, device)\n raise NotImplementedError.new\n end", "def send_message(topic_arn, body, subject = nil)\n params = { 'TopicArn' => topic_arn, 'Message' => body }\n params.merge!({ 'Subject' => subject }) unless !subject || subject.length == 0\n req_hash = generate_post_request('Publish', params)\n request_info(req_hash, SnsStatusParser.new(:logger => @logger))\n rescue\n on_exception\n end", "def publish\n @topics = current_organization.topics\n @topics.each do |topic|\n topic.publish!\n end\n record_activity(\"update\", \"actualizó su programa de apertura.\")\n redirect_to new_inventory_path, :notice => \"Muy bien, tu programa de apertura está listo. De cualquier forma siempre puedes regresar a editarlo.<br/>El siguiente paso es subir un inventario de datos.\"\n end", "def approve\n approve_user\n return if notified?\n email_topic_subscribers\n end", "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 send(message, topic: '', **options)\n message = \"#{ topic } #{ (options[:encode] || @encode).call message }\"\n @socket.send_string message\n end", "def call\n topics.each do |topic|\n any_topics = !topic.responder&.topics.nil?\n log_messages = []\n\n if any_topics\n log_messages << \"#{topic.name} =>\"\n\n topic.responder.topics.each_value do |responder_topic|\n features = []\n features << (responder_topic.required? ? 'always' : 'conditionally')\n\n log_messages << format(responder_topic.name, \"(#{features.join(', ')})\")\n end\n else\n log_messages << \"#{topic.name} => (nothing)\"\n end\n\n Karafka.logger.info(log_messages.join(\"\\n\"))\n end\n end", "def notify_by_push\n PushNotification.new(user: context.user,\n message: context.message,\n n_type: context.n_type,\n data: { from_id: context.user_from.try(:id), from_name: context.user_from.try(:name),\n donation_id: context.donation.try(:id) })\n .simple_notification\n end", "def broadcast_message(text)\n @users.each {|u| u.enqueue_message(text) }\n end", "def subscribe_to(topic)\n StreamUser.create(:user => self, :stream_message => topic.stream_messages.last, :source => 'followed') if topic.stream_messages.last\n subscriptions << Subscription.new(:topic => topic)\n end", "def notify activity\n\n # people who are subscribed to the tags of the question\n t_subscribers = target.subscribers.all\n\n (t_subscribers).each do |subscriber|\n Notification.create :user => subscriber, :activity => activity\n end\n end", "def notify_on_mention?; true; end", "def publish(message)\n message_attributes = {\n message_id: message.message_id,\n topic_name: message.topic_name,\n event_name: message.event_name,\n primary_key: message.primary_key,\n schema_name: message.schema_name,\n maitredee_version: Maitredee::VERSION\n }.compact\n\n sns_client.publish(\n topic_arn: topics[message.topic_resource_name].arn,\n message: JSON.dump(message.body),\n message_attributes: sns_message_attributes(message_attributes)\n )\n end", "def push_notifications\n # post \"/push\" do\n Webpush.payload_send(\n message: params[:message],\n endpoint: params[:subscription][:endpoint],\n p256dh: params[:subscription][:keys][:p256dh],\n auth: params[:subscription][:keys][:auth],\n vapid: {\n subject: \"mailto:sender@example.com\",\n public_key: ENV['VAPID_PUBLIC_KEY'],\n private_key: ENV['VAPID_PRIVATE_KEY']\n }\n )\n end", "def ctopic(m, topic)\n if m.channel.nil?\n m.reply \"Silly #{m.user.nick}: This isn't a channel!\"\n else\n if is_chanadmin?(m.channel,m.user) && is_botpowerful?(m.channel)\n m.channel.topic = topic\n elsif !is_chanadmin?(m.channel,m.user)\n m.reply NOTADMIN, true\n elsif !is_botpowerful?(m.channel)\n m.reply NOTOPBOT, true\n end\n end\n end", "def broadcast( msg )\n @clients.each do |client|\n client.sock.puts \"Announce: #{msg}\"\n end\n log( \"[broadcast] #{msg}\" )\n end", "def publish_topic(options)\n assert_options(options, [:event, :service])\n\n publish_topic_impl(options)\n end", "def populate_topic(lst)\n # puts \"list is #{lst}\"\n self.arg_hash = {:host => 'localhost'}\n #self.mms_sender=MmscManager::MmsSendTopic.new(arg_hash) \n lst.each {|key| \n \n dst = key\n send_it(dst) #if SmscManager::Sms.check_destination(dst)\n \n }\n \n sleep(2) # should we wait till we get receipts for all?\n puts \"populate topic sent #{self.sent}\"\n sleep(self.attempts*0.5+1) if self.sent!=self.attempts\n puts \"populate topic sent after sleep #{self.sent}\"\n # self.mms_sender.disconnect_stomp\n end", "def create\n @topic = Topic.create(topic_params)\n current_user.topics.push(@topic)\n \n respond_with @topic\n end" ]
[ "0.699971", "0.66226083", "0.6611411", "0.65195584", "0.6487083", "0.6380094", "0.6282782", "0.62392765", "0.6177437", "0.61726207", "0.6136041", "0.61165684", "0.6105603", "0.60867095", "0.60844904", "0.6061362", "0.60434234", "0.60432816", "0.603741", "0.60295355", "0.60226923", "0.60178095", "0.59969175", "0.5984739", "0.5969111", "0.5958719", "0.5938864", "0.59161144", "0.5893341", "0.58783597", "0.58779985", "0.5873343", "0.5859684", "0.58501863", "0.5847817", "0.5846953", "0.58445", "0.58434975", "0.58364064", "0.58292174", "0.5807167", "0.58025867", "0.57877743", "0.5780413", "0.5765681", "0.5757401", "0.57569903", "0.5724256", "0.571243", "0.5707637", "0.5705359", "0.570496", "0.57042396", "0.5703043", "0.5699542", "0.56981725", "0.56979465", "0.56937414", "0.5690531", "0.5682825", "0.5680729", "0.5680729", "0.56779087", "0.5672554", "0.567183", "0.56680727", "0.5661738", "0.5654875", "0.56499016", "0.56486577", "0.5646828", "0.56396544", "0.5638878", "0.5636374", "0.5636012", "0.5632942", "0.563144", "0.562623", "0.56236184", "0.5621595", "0.5621594", "0.5617928", "0.5614635", "0.5609193", "0.5608545", "0.5607516", "0.56055427", "0.55963063", "0.5594207", "0.55881447", "0.5581055", "0.5576966", "0.5576501", "0.5573265", "0.55729854", "0.55715126", "0.55681413", "0.5566853", "0.55668193", "0.55648404" ]
0.6643092
1
sends notification for password reset
def notify_password_reset! with_user_locale do reset_single_access_token! UserMailer.password_reset(self).deliver! end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_reset_password_instructions\n end", "def send_password_reset_email\n UserNotifier.lost_password(self).deliver_now\n end", "def send_reset_password_instructions()\n generate_reset_password_token! if should_generate_reset_token?\n send_devise_notification(:reset_password_instructions)\n end", "def send_reset_password_instructions; end", "def send_password_resets\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n self.save!\n NotificationsMailer.password_reset_mail(self).deliver\n end", "def send_password_reset_email\n\t\tUserMailer.password_reset(id, self.reset_token).deliver_later\n \tend", "def send_password_reset\n \tgenerate_reset_token(:password_reset_token)\n \tself.password_reset_sent_at = Time.zone.now\n \tsave!(validate: false)\n \tUserMailer.password_reset(self).deliver\n end", "def reset_password_notify\n user = User.find_by_email(params[:email])\n\n if user\n user.reset_token\n ::NotifierMailer.reset_password_instructions(user).deliver\n flash.now.notice = t('flash.sessions.reset_password_notify.email_sent')\n else\n flash.now.alert = t('flash.sessions.reset_password_notify.user_not_found')\n end\n\n render :reset_password\n end", "def send_password_reset\n self.password_reset_sent_at = Time.now\n update_attribute(:password_reset_token, genrate_tokn(:password_reset_token) )\n UserMailer.password_reset(self).deliver\n end", "def send_password_reset_email\n GamerMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n GolferMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n \t\tUserMailer.password_reset(self).deliver_now\n \tend", "def send_password_reset_email\n #UserMailer.password_reset(self).deliver_now\n end", "def password_was_changed_notice\n @email = params[:email]\n @token = params[:token]\n\n mail to: @email, subject: 'Your password was changed'\n end", "def send_password_change_notification; end", "def send_password_reset\n\t generate_token(:password_reset_token)\n\t self.update_attribute(:password_reset_sent_at, Time.zone.now)\n\t #self.password_reset_sent_at = Time.zone.now\n\t #save!\n\t UserMailer.password_reset(self).deliver\n\tend", "def send_password_reset\n create_password_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end", "def send_password_reset_email\n AdminMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n \t\tUserMailer.password_reset(self).deliver_now\n \tend", "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n PasswordMailer.password_reset(self).deliver\n end", "def send_password_change_notification\n # do not notify the admins for now\n end", "def send_password_reset\n\t\tgenerate_token(:password_reset_token)\n\t\tself.password_reset_sent = Time.zone.now\n\t\tself.save!\n\n\t\tUserMailer.password_reset(self).deliver\n\tend", "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n self.save\n UserMailer.password_reset(self).deliver\n end", "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save(:validate => false)\n UserMailer.password_reset(self).deliver\n end", "def reset_password! \n\t\t\treset_perishable_token! \n\t\t\tNotifier.reset_password(self).deliver \n\t\tend", "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end", "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end", "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end", "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end", "def send_password_reset_email\n\t UserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t UserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now \n save!\n UserMailer.password_reset(self).deliver\n end", "def send_reset_password_instructions\n token = set_reset_password_token\n send_reset_password_instructions_notification(token)\n\n token\n end", "def send_password_reset\n generate_token(:password_reset_token)\n update_attributes!(password_reset_sent_at: Time.zone.now)\n UserMailer.password_reset(self).deliver\n end", "def send_password_reset\r\n # Generate password reset token\r\n self.password_reset_token = SecureRandom.urlsafe_base64\r\n # Set timestamp of when password reset was sent\r\n self.password_reset_sent_at = Time.zone.now\r\n # Do not run data validation upon saving the user\r\n save!(validate: false)\r\n # Notify the user that password reset instructions have been sent to their email\r\n UserMailer.password_reset(self).deliver\r\n end", "def send_password_reset_email\r\n UserMailer.password_reset(self).deliver_now\r\n end", "def send_password_reset_email\n \tUserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_email_password_changed\n Resque.enqueue(PasswordNotification,self)\n end", "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_password_reset_email\n\t\tUserMailer.password_reset(self).deliver_now\n\tend", "def send_reset_password_instructions\n generate_reset_password_token! if should_generate_reset_token?\n kickoff.deliver_password_reset(self)\n end", "def send_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver \n end", "def forgot_password\n NotificationsMailer.forgot_password\n end", "def forgot_password\n NotificationsMailer.forgot_password\n end", "def forgot_password\n NotificationsMailer.forgot_password\n end", "def send_password_reset\n generate_token(:password_reset_token)\n self.password_reset_sent_at = Time.zone.now\n save!(validate:false)\n UserMailer.delay.password_reset(self)\n end", "def send_password_reset\n generate_token\n self.password_reset_token_sent_at = Time.zone.now\n save!\n UserMailer.password_reset(self).deliver\n end", "def send_password_reset_email\n StaffMailer.password_reset(self).deliver_now\n end", "def send_password_reset_mail\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end", "def send_password_reset_email\n UserMailer.password_reset(self).deliver_now\n end" ]
[ "0.82343835", "0.8202745", "0.81396025", "0.8117338", "0.80392057", "0.80153745", "0.7939113", "0.7922726", "0.7920734", "0.7897149", "0.78947204", "0.78713644", "0.78605664", "0.7859448", "0.78477854", "0.78443426", "0.7843522", "0.78365093", "0.7835566", "0.78352946", "0.7833134", "0.78315586", "0.782907", "0.7821565", "0.781929", "0.78137386", "0.78137386", "0.78137386", "0.78137386", "0.7813093", "0.78120285", "0.78033525", "0.77987796", "0.77809644", "0.77776057", "0.7772237", "0.77662325", "0.77594185", "0.77543354", "0.77498895", "0.77449477", "0.77442276", "0.77442276", "0.77442276", "0.77442276", "0.77442276", "0.77442276", "0.77442276", "0.77442276", "0.77442276", "0.77429384", "0.7740171", "0.7740171", "0.7740158", "0.7736237", "0.7736237", "0.7736237", "0.77351683", "0.7720598", "0.7713122", "0.77088284", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433", "0.7704433" ]
0.77386653
54
sends notification for sign up confirmation
def notify_sign_up_confirmation! UserMailer.sign_up_confirmation(self).deliver! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_signup_notification\n deliver_activation_email(:signup, :subject => (MaSA[:activation_subject] || \"Please Activate Your Account\") )\n end", "def signup_email\n MnoEnterprise::SystemNotificationMailer.registration_instructions(params.require(:user).require(:email)).deliver_later\n\n head :no_content\n end", "def sign_up_notification\n # @greeting = \"Hi\"\n\n # mail to: \"to@example.org\"\n # @admin = User.where(is_admin: true).last\n @user = params[:user]\n mail(to: @user.email, subject: 'Sign Up successfull')\n end", "def finish_signup\n @identity = Identity.find(params[:id])\n\n if request.patch?\n @identity.skip_confirmation_notification!\n if finish_signed_up_but_email_not_confirmed? || @identity.duplicate_email?\n @identity.send_confirmation_instructions\n flash[:info] = I18n.t(\"devise.confirmations.send_instructions\")\n redirect_to \"/\"\n end\n end\n end", "def sign_up(new_user)\n @user = new_user\n @notify_subject = strip_tags \"NEW SIGN UP AT #{ENV['APPLICATION_CONFIG_name']}\"\n mail( :to => ENV['APPLICATION_CONFIG_admin_notification_address'], :subject => @notify_subject)\n end", "def send_on_create_confirmation_instructions\n self.devise_mailer.registration_notice(self).deliver_now\n end", "def signed_up(user)\n @user = user\n \n mail to: @user.email, subject: 'Sign Up Confirmation.'\n end", "def user_sign_up_notification(user)\n @user = user\n\n mail(to: \"<#{user.email}>\", subject: \"Success! You did it.\")\n end", "def signup_notification(user)\n setup_email(user)\n @subject += I18n.t 'mailer.signup.subject'\n \n @body[:url] = \"http://www.dripplet.com/#{user.locale}/activate/#{user.activation_code}\"\n \n end", "def signup_notification(user)\n\t\tsetup_email(user)\n\t\t subject self.site_name+\" : \"+I18n.t('mailer.signup_notification.subject')\n\t\t body :url => self.daurl+\"/admin/activate/#{user.activation_code}\",\n\t\t\t:site => self.site_name,\n\t\t\t:user_login => user.login,\n\t\t\t:user_password => user.password\n end", "def signup_confirmation user\n @user = user\n mail to: user.email, subject: \"Welcome to the Clone\"\n end", "def signup_confirmation\n FreelanceMailerMailer.signup_confirmation\n end", "def send_register_confirmation\n jump_to(\"/accounts/#{session[:account_id]}/register_confirmation\")\n end", "def signup(new_user)\n mail(to: new_user.email, subject: \"Congratulations on Signing up!\")\n end", "def after_confirmation # Send welcome mail after user is successfully registered\n send_user_mail\n end", "def registration_confirmation(user)\n @user = user\n\n mail to: \"yisheng90@gmail.com\", subject: \"Success! You did it.\"\n end", "def signup_confirmation(user)\n @user= user\n debugger\n mail to: @user.email , subject: \"MovieBox Sign Up Confirmation\"\n \n end", "def confirm!\n UserMailer.new_registration(self).deliver_now\n super\n end", "def new_signup_notification\n user = User.first\n UserMailer.new_signup_notification(user, \"x.x.x.x (aprox y)\")\n end", "def send_on_create_confirmation_instructions; end", "def send_on_create_confirmation_instructions; end", "def signup_confirmation(user)\n @user = user\n\n mail to: user.email, subject: \"Sign Up Confirmation\"\n end", "def signup(user_that_just_signed_up)\n mail to: user_that_just_signed_up.email,\n subject: \"You signed up for YardSale\"\n end", "def signup_confirmation(user)\n @user = user\n @greeting = \"Hi\"\n\n mail to: @user.email, subject: \"Hello new friend!\"\n end", "def register_confirmation\n @account.deliver_register_confirmation unless @account.checked\n end", "def create\n super\n NotificationMailer.sign_up_notification(@user).deliver\n end", "def signup_notification(user)\n provider = self.provider_account = user.account.provider_account\n\n subject = user.account.provider? ? \"3scale account confirmation\" : \"#{account_name(user)} API account confirmation\"\n\n headers(\n 'Return-Path' => from_address(user),\n 'X-SMTPAPI' => '{\"category\": \"Signup Notification\"}'\n )\n\n if user.activation_code\n activate_url = if user.account.provider?\n provider_activate_url(activation_code: user.activation_code, host: domain(user))\n else\n developer_portal.activate_url(activation_code: user.activation_code, host: domain(user))\n end\n end\n\n assign_drops user: Liquid::Drops::User.new(user),\n domain: Liquid::Drops::Deprecated.wrap(domain(user)),\n account_name: Liquid::Drops::Deprecated.wrap(account_name(user)),\n account: Liquid::Drops::Account.wrap(user.account),\n provider: Liquid::Drops::Provider.wrap(user.account.provider_account),\n url: activate_url,\n admin_url: Liquid::Drops::Deprecated.wrap(admin_url(user))\n\n mail(\n template_name: 'signup_notification_email',\n subject: subject,\n to: user.email,\n from: from_address(user)\n )\n end", "def signup\n @greeting = \"Hi\"\n\n mail to: \"ajayashok.01@gmail.com\"\n end", "def registration_confirmation\n\t\tuser = User.new\n\t\tuser.generate_token(:email_confirmation_token)\n\t\tUserMailer.registration_confirmation(user)\n end", "def notify_about_sign_up(user, admin)\n @user = user\n mail(:to => admin.email, :subject => \"New User | #{user.name}\", :reply_to => \"new_user@ambitionspotlight.com\")\n end", "def signup_confirmation(user_name, user_email)\n @user_name = user_name\n @user_email = user_email\n mail to: user_email, subject: \"Dum dum de dum... get started with Bridled!\"\n end", "def admin_notify\n UserMailer.signup_notification(self).deliver_later!(wait: 1.minute)\n end", "def do_signup\n hobo_do_signup do\n if this.errors.blank?\n #flash[:notice] << \"You must activate your account before you can log in. Please check your email.\"\n flash[:notice] << \" Your account has been created.\"\n\n # FIXME: remove these two lines after you get email working reliably\n # and before your application leaves its sandbox...\n #secret_path = user_activate_path :id=>this.id, :key => this.lifecycle.key\n #flash[:notice] << \"The 'secret' link that was just emailed was: <a id='activation-link' href='#{secret_path}'>#{secret_path}</a>.\"\n else\n flash[:notice] = @this.errors.full_messages.join(\"<br/>\")\n logger.info \"error is \" + flash[:notice]\n end\n\n end\n end", "def signup_confirmation(user)\n @greeting = \"Hi\"\n @user = user\n\n mail to: user.email, subject: \"Sign up confirmation!\"\n end", "def send_confirmation_instructions; end", "def send_confirmation_request\n send_confirmation_email\n send_confirmation_notification\n end", "def signup_confirmation(user)\n @user = user\n mail to: user.email, subject: \"Sign Up Confirmation\"\n end", "def send_on_create_confirmation_instructions\n end", "def send_on_create_confirmation_instructions\n send_confirmation_instructions\n end", "def send_on_create_confirmation_instructions\n end", "def signup_confirmation(user)\n @user = user\n mail to: user.email, subject: \"Welcome\"\n end", "def send_post_registration_email\n IdealsMailer.account_registered(self).deliver_now\n end", "def create\n user = find_user_for_create\n\n if user\n user.generate_confirmation_token\n Delayed::Job.enqueue(EmailConfirmationMailer.new(user.id)) if user.save\n end\n redirect_to root_path, notice: t(\".promise_resend\")\n end", "def signup\n return if generate_blank\n params[:user].delete('form')\n params[:user].delete('verified') # you CANNOT pass this as part of the request\n @user = User.new(params[:user])\n begin\n User.transaction(@user) do\n @user.new_password = true\n unless LoginEngine.config(:use_email_notification) and LoginEngine.config(:confirm_account)\n @user.verified = 1\n end\n if @user.save\n key = @user.generate_security_token\n url = url_for(:action => 'home', :user_id => @user.id, :key => key)\n flash[:notice] = 'Signup successful!'\n if LoginEngine.config(:use_email_notification) and LoginEngine.config(:confirm_account)\n UserNotify.deliver_signup(@user, params[:user][:password], url)\n flash[:notice] << ' Please check your registered email account to verify your account registration and continue with the login.'\n else\n flash[:notice] << ' Please log in.'\n end\n redirect_to :action => 'login'\n end\n end\n rescue Exception => e\n flash.now[:notice] = nil\n flash.now[:warning] = 'Error creating account: confirmation email not sent'\n logger.error \"Unable to send confirmation E-Mail:\"\n logger.error e\n end\n end", "def signup_confirmation(member)\n @member = member\n\n mail to: member.email, subject: \"Welcome to the community!\"\n end", "def signup_confirmation_advisee(user)\n @user = user\n mail to: @user.email, subject: \"Advisee new registration\"\n end", "def registration_confirmation(user)\n @account = user\n mail(:to => named_email(user), :subject => \"Outcircle - Welcome\")\n end", "def do_pending\n make_activation_code\n # send the user an email with an activation code\n UserMailer.deliver_signup_notification(self)\n end", "def resend_confirmation\n return unless request.post?\n if current_user.activated_at\n flash.now[:error] = \"Your account has already been activated.\"\n else\n UserNotifier.deliver_signup_notification(current_user)\n flash.now[:notice] = \"Your confirmation email has been re-sent\"\n render :action => 'index'\n end\n end", "def signup_confirmation(user)\n @user = user\n mail to: user.email, subject: \"Signup confirmation from FreeLance\"\n end", "def transaction_created(user)\n @user = user\n mail to: user.email, subject: \"Sign Up Confirmation\"\n end", "def signup_email(user)\n mail(\n to: \"terry.p.dignon@gmail.com\",\n subject: 'Thanks for signing up'\n )\n end", "def signed_up(user)\n @user = user\n\n mail to: user.email\n end", "def signup\n end", "def signup\n end", "def user_registered_confirmation(player)\r\n @user = player\r\n @tenant = LandLord.new(@user).tenant\r\n \r\n from = determine_mail_from_for_general_notifications(@tenant)\r\n to = format_email_to_user(@user)\r\n subject = subject_for_user_registered_confirmation\r\n \r\n mail(:from => from, :to => to, :subject => subject)\r\n end", "def send_signup_email()\n\n\t# @user = user\n\tmail( :to => 'ahmedwael2002@gmail.com',\n\t\t :subject => '!Thanks for signing up')\n \nend", "def signed_up_alert(evt)\n @evt = evt\n host = User.find_by_id(@evt.user_id)\n mail(:to => host.email, :subject => \"There is a seat request for your Local Yum event\", :from => \"\\\"Local Yum\\\" <notification@localyum.me>\")\n end", "def resend_confirmation_email\n WEPAY.call('/user/resend_confirmation', self.wepay_access_token, {\n email_message: 'Thank you for signing up with WeCrowd. In order to process payments, you will need to confirm your email address and set a secure payment password. Click the \"confirm\" button below to begin.'\n })\n end", "def signup_confirmation(user, root_url)\n @user = user\n @url = root_url + 'login'\n mail(to: user.username, subject: 'Sign Up Confirmation')\n end", "def registration_confirmation(user)\n \t@user = user\n \tmail(:to => \"#{user.name} #{user.last_name} <#{user.email}>\", :subject => \"(IMI-Map) Registered\")\n end", "def signup_confirmation(user_id)\n # Will make the newly registered user available to the view that will generate the email content\n @user = User.find(user_id)\n\n mail to: @user.email, subject: \"Sign up confirmation\"\n end", "def signup\n\n\t\temail = params[:email] # Extract the email from the params of the signup form\n\t\ttimezone = params[:timezone] # Extract the timezone from the params of the signup form\n\n\t\t@url = uniqueUrlKeyGenerator # Generate a unique url key\n\t\told_user = User.find_by_email(email)\n\n\t\t# If user exists\n\t\tif !old_user.nil?\n\t\t # If user is not registered\n\t\t if !old_user.registered?\n\t\t # Send welcome email again and save him\n\t\t old_user.sendWelcomeEmail\n\t\t old_user.save\n\t\t end\n\t\tend\n\n\t\t# Find the user in the user db with the same email as extracted in the params\n\t\tcheck_users = User.find_by_email(email)\n\n\t\t#create a new PotentialUser object with the extarcted email, timezone and url key\n\t\tuser = User.new(email: email, url: @url, timezone: timezone, day: 1, registered: false)\n\n\t\t# If no such user exists\n\t\tif check_users.nil?\n\n\t\t#If the new user is valid and can be saved\n\t\t if user.save\n\t\t user.sendWelcomeEmail\n\t\t @title = \"Thank you for signing up\"\n\t\t @result = \"A confirmation email with instructions has been sent to you\"\n\t\t @result2 = \"Your unique access key is: \" + @url\n\n\t\t#If not valid\n\t\t else\n\t\t #Set @result as the error message\n\t\t @title = \"Looks like something went wrong ...\"\n\t\t @result = \"Email #{user.errors[:email][0]}.\".html_safe\n\t\t end\n\n\t\t#User by this email already exists\n\t\telse\n\n\t\t if !check_users.registered?\n\t\t\t # Result instance variable for the view\n\t\t\t @title = \"Looks like something went wrong ...\"\n\t\t\t @result = \"User by this email already exists, but we sent another confirmation email just in case\"\n\t\t\t else\n\t\t\t @title = \"Looks like something went wrong ...\"\n\t\t\t @result = \"User by this email already exists\"\n\t\t end\n\n\tend\n\n\t\t# Respond to only javascript, set for AJAX\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend", "def after_create(user)\n #user.reset_perishable_token! # set the perishable token to some value\n #UserNotifier.deliver_signup_notification(user.email, user)\n end", "def send_confirmation\n send_message(\"confirmation\")\n end", "def signup_confirmation(employee)\n @employee = params[:employee]\n @url = \"http://example.com/login\"\n mail to: employee.email , subject: \"Sign Up Confirmation\"\n end", "def signed_up(user)\n @user = user\n mail to: @user.email\n end", "def signup_confirmation(new_user)\n # @greeting = \"Hi\"\n @resource = new_user\n \n # mail to: new_user.email\n mail(to: @resource.email, subject: \"Welcome!\", :tag => 'password-reset', :content_type => \"text/html\") do |format|\n format.html { render \"user_mailer/signup_confirmation\" }\n end\n \n end", "def act_signup_confirmation(user, act)\n @user = user\n @act = act\n\n mail to: user.email, subject: 'Act Sign Up Confirmation'\n end", "def registration_confirmation(customer)\n @customer = customer\n @url = 'www.shizencyokuhan.com'\n @greeting = \"おめでとうございます! あなたのアカウントが登録されました!\"\n mail(to: @customer.email, bcc:'info@shizencyokuhan.org', subject: 'アカウント登録完了のお知らせ' )\n \n end", "def signup(email)\n \n @greeting = \"Hi\"\n\n mail to: email\n end", "def send_signup_email\n mail( :to => 'davidbliu@gmail.com',\n :subject => 'Thanks for signing up for our amazing app' ).deliver\n end", "def paid_signup(user)\n DelayedKiss.alias(user.full_name, user.email)\n DelayedKiss.record(user.email, 'Sent Paid Signup Email')\n @user = user\n mail to: user.email, subject: \"You've Upgraded to our Business Pro plan!\"\n end", "def email_confirm\n end", "def signup_successful\n user = User.first\n UserMailer.signup_successful(user)\n end", "def registration( new_user )\n @greeting = \"Launch 'n Dine\"\n mail to: new_user.email,\n subject: \"Launch 'n Dine Welcomes You\"\n end", "def create_cleaner_account_confirmation(account)\n\t\t@first_name = account.first_name\n\t\t@last_name = account.last_name\n\t\t@email = account.email\n\n mail(:to => \"tom@cleanjay.ca\", :subject => \"New Cleaner Signup!\")\n end", "def registration_confirm\n mail = RegistrationMailer.confirm(temporary_registration)\n destroy_fixtures\n mail\n end", "def new_signup(user, email)\n @greeting = \"Hi\"\n @user = user\n @email = email\n mail to: @email, subject: \"Your Account has been created on blogApp\"\n end", "def activate_user\n self.save\n self.send_user_notification_email\n end", "def send_confirmation_email\n\t\tRentersConfirmationJob.perform_later self\n OwnersConfirmationJob.perform_later self\n\tend", "def send_on_create_confirmation_instructions\n nil\n end", "def send_on_create_confirmation_instructions\n nil\n end", "def registration_confirmation(parent)\n @parent = parent\n\n mail to: @parent.email, subject: \"Registration confirmation\"\n end", "def signup\n @greeting = \"Hi\"\n\n mail :to => \"to@example.org\"\n end", "def success_signup\n redirect_to root_path if flash[:notice].nil? || flash[:notice] != t('devise.registrations.signed_up_but_inactive')\n end", "def registration_confirmation(user)\n @user = user\n mail(to: \"#{user.name} #{user.last_name} <#{user.email}>\",\n subject: '(IMI-Map) Registered')\n end", "def signup_confirmation(user)\n # create an instance variable so that the view has access\n # to the user.\n @user = user\n\n # send email to the user\n mail to: user.email, subject: \"Sign Up Confirmation\"\n end", "def signup \n @user = params[:user]\n @link = params[:link]\n Merb.logger.info \"Sending Signup to #{@user.email} with code #{@user.activation_code}\"\n render_mail :text => :signup, :layout => :core\n end", "def new_user_signed_up _user, _request\n @user = _user\n @request_info = build_request_info(_request)\n @domain = Settings.fetch(:app,:hostname)\n mail(\n to: Settings.fetch(:app,:admin_notification_email),\n subject: \"New user created at #{@domain}\"\n )\n end", "def send_signup_email(taxpayer)\n @taxpayer = taxpayer\n mail( :to => @taxpayer.email,\n :subject => 'Thanks for signing up for our amazing app' )\n end", "def client_sign_up\n\n end", "def deliver_activation_instructions!\n Notifier.delay.signup_notification(self.id)\n end", "def new_self_job_signup_confirmation\n UserMailer.new_self_job_signup_confirmation(User.first, Job.first)\n end", "def resend_confirmation_instructions; end", "def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def signup_greeting(user, mode = :normal_signup)\n @user = user\n @need_password = (mode == :free_money_signup)\n swapidy_sendmail :to => @user.email, :subject => \"Welcome to Swapidy\"\n end", "def registration\n @greeting = \"Hi\"\n\n mail to: \"afzalmlakdawala@gmail.com\"\n end", "def reservation_confirmation\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def resend_confirmation_email\n unless current_user.confirmed?\n current_user.send_confirmation_instructions\n flash[:success] = I18n.t('flash.success.confirmation_sent')\n end\n redirect_to home_path\n end" ]
[ "0.8001082", "0.7680669", "0.75045353", "0.750069", "0.74309945", "0.74296886", "0.7428404", "0.7413921", "0.7397638", "0.7385989", "0.73800105", "0.7302603", "0.724891", "0.72397524", "0.7225533", "0.71696067", "0.71642977", "0.71474373", "0.7144565", "0.71250105", "0.71250105", "0.71177995", "0.71128166", "0.71125495", "0.7111568", "0.71112365", "0.7107213", "0.7086345", "0.7083319", "0.70824856", "0.70806366", "0.70793915", "0.70743805", "0.70608157", "0.7051023", "0.7029829", "0.7028997", "0.70000345", "0.6996717", "0.6970909", "0.6955386", "0.69483715", "0.69440836", "0.6941049", "0.69383526", "0.68983847", "0.68781036", "0.68780106", "0.6877619", "0.6877241", "0.68722", "0.6869518", "0.6866638", "0.6848223", "0.6848223", "0.68461233", "0.6833798", "0.6823003", "0.6822892", "0.6817768", "0.67979896", "0.678879", "0.6782511", "0.6766864", "0.6759195", "0.67463094", "0.67412925", "0.67400193", "0.67237246", "0.67220175", "0.67203915", "0.6719587", "0.6716959", "0.67054194", "0.6702144", "0.6690404", "0.6690239", "0.6686854", "0.6684729", "0.66779625", "0.6677619", "0.6671761", "0.6671761", "0.667123", "0.6668308", "0.6668291", "0.666654", "0.6663916", "0.66572535", "0.66569126", "0.6650631", "0.6641085", "0.663682", "0.6636075", "0.6628067", "0.66273254", "0.66263264", "0.66255844", "0.6618674", "0.6617523" ]
0.7901955
1
sends notification for private message
def notify_private_message!(sender) with_user_locale do UserMailer.private_message_notification(self, sender).deliver! end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private_message!\n @private_message = true\n end", "def private_message!\n @private_message = true\n end", "def send_notification\n\n\n end", "def send_new_message_notification\n message = self.message\n # Don't notify the message sender themselves\n return if message.sender_id == self.user_id\n data = {\n category: 'message',\n message: message.body.truncate(150, separator: ' '),\n is_private: message.is_private,\n offer_id: message.offer_id,\n order_id: message.order_id,\n item_id: message.item_id,\n author_id: message.sender_id,\n message_id: message.id\n }\n channel = Channel.private_channels_for(self.user_id, app_name)\n PushService.new.send_notification(channel, app_name, data)\n end", "def notify_private_reply(m, message_type = 'your interaction')\r\n if m.channel?\r\n m.reply(message_type + ' continues via PM', true)\r\n end\r\n end", "def on_private_message(connection, target, message)\n end", "def private(msg, sender, recipient)\n recipient.sock.puts \"#{sender}: #{msg}\"\n log( \"[private] #{sender} to #{recipient}: #{msg}\")\n end", "def privmsg(channel,nick,message)\n send_command(:privmsg, nick: nick, channel: channel , message: \"#{Filter.new(message)}\")\n end", "def send_notifications\n end", "def notify(msg, subject)\n end", "def pushover_notify(message)\n\t\t\t\t@pushover_req.set_form_data({\n\t\t\t\t\t:token => @app_key,\n\t\t\t\t\t:user => @user_key,\n\t\t\t\t\t:message => message\n\t\t\t\t})\n\t\t\t\t@pushover_res.start {|http| http.request(@pushover_req) }\n\t\t\tend", "def did_receive_private_message(stem, sender, msg)\n end", "def send_notification2(msg)\n raise \"please start server first before notify !!\" unless @x_notify\n puts \"[AmqpServer] notify: message=#{msg}\" if $DEBUG\n MQ.fanout(@x_notify).publish(Blix.to_binary_data(msg))\n end", "def send_notification(msg)\n $BLIX_NOTIFY.push(msg)\n puts \"[DummyServer] notify: message=#{msg}\" if $DEBUG\n end", "def set_private_message\n @private_message = PrivateMessage.where(id: params[:id], deleted_by_to_user: false)[0]\n end", "def send_notification(method, params); end", "def push(notif)\n\n end", "def send_notification\n\t\tSingleCellMailer.share_notification(self.study.user, self).deliver_now\n\tend", "def send_message_notification\n message = MessageBlueprint.render_as_json(self)\n ActionCable.server.broadcast \"conversation_#{ self.conversation_id }_notification_channel\", message\n # receiver = self.conversation.user_one_id == self.user_id ? self.conversation.user_two_id : self.conversation.user_one_id\n # response = self.attributes.merge(user: self.user&.name)\n # ActionCable.server.broadcast \"user_#{ receiver }_notification_channel\", response.as_json.to_s\n end", "def send_notification(msg)\n EM.next_tick do\n @do_notify.call(msg)\n end\n end", "def send_message(message); end", "def send_message(message); end", "def push_notification\n UserMailer.new_message(self).deliver_now\n end", "def on_message(m)\n end", "def privmsg(t, m)\n @socket << \"PRIVMSG #{t} :#{m}\"\n end", "def send_notification\n unless development?\n recipient_email = Hacker.first(:username => self.recipient).email\n Notifier.send_message_notification(recipient_email, self.sender)\n end\n end", "def privmsg(m, *args)\n args.each { |msg| m.user.safe_send(msg) }\n end", "def send_message(msg); end", "def privmsg(target, message)\n send_data(\"PRIVMSG #{target} :#{message}\")\n end", "def send_reply\n if self.response_changed?\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n\n if self.response == \"Declined\"\n @description = self.pupil.title + \" has sadly declined your offer\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You hve declined the offer by ' + @tutor.title)\n else\n @description = self.pupil.title + \" is now a student at your school\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You are now a student of ' + @tutor.title)\n end\n @notifiable.notifications.create(:user => @student, :receiver_id => @tutor.id, :message => @description)\n end\n end", "def on_private_message(message, buddy, command_executed)\n #at this stage we do nothing...\n end", "def message\n \"You have a new notification!\"\n end", "def send_message_notification(user, message)\n puts \"FFFFFFFF\", user.device_token\n notification = Houston::Notification.new(:device => user.device_token)\n notification.badge = 0\n notification.sound = \"sosumi.aiff\"\n notification.content_available = true\n notification.custom_data = {:user_id => user.id}\n notification.alert = message\n certificate = File.read(\"config/production_driver.pem\")\n pass_phrase = \"push\"\n connection = Houston::Connection.new(\"apn://gateway.push.apple.com:2195\", certificate, pass_phrase)\n connection.open\n connection.write(notification.message)\n connection.close\n end", "def notify(message)\n puts message['data']\n end", "def notify_via_service\n u = User.first\n u.update(last_notification_mail_sent: 30.days.ago)\n service = NotificationDigest.new(type: :notifications)\n service.notify_user(u, deliver: false)\n end", "def message_notification\n fetch(:hipchat_announce, false)\n end", "def update \n set_page_title \"Private Message\"\n \n compose_message\n \n # All threaded messages share the same original ID, so we'll just call the first record\n @private_message.original_message_id = original_message_id\n \n # Validate against SPAMMY behavior\n check_flood_limit @users.uniq unless @users.nil?\n \n \n # For brevity and convinience, the error checking and the recipient assignment are addressed together, sequentially, in the following line\n if @private_message.errors.count == 0 and @private_message.save and (@users.uniq.each {|username| @private_message.recipients.create(:user_id => User.find_by_username(username).id) }) \n if ConfigurationSetting.get_setting_to_bool(\"EmailPrivateMessageNotices\")\n spawn do\n @private_message.recipient_users.each do |u|\n NotificationsMailer.deliver_private_message(@private_message,u)\n end\n end\n end\n\n flash[:notice] = \"Reply sent\"\n redirect_to private_messages_path\n else\n @original_message = @private_messages.first\n render :action => session[:action_name]\n end \n end", "def notify_user user_id, message\n\n\t\tmsg = \"Hello PubNub, love the Ruby SDK\"\n\t\tchannel = \"demo\"\n\n\t \tpubnub.publish(:message => msg, :channel => channel) do |envelope|\n\t\t\tputs envelope.message\n\t\t\tputs envelope.channel\n\t\t\tputs envelope.status_code\n\t\t\tputs envelope.timetoken\n\t\tend\n\n\t\tputs \"#{channel_prefix + user_id}\"\n\tend", "def notification(params)\n mail(params)\n end", "def send_message(email, text)\n @notification_server.send_message email, text\n end", "def send_email_changed_notification; end", "def notify\n end", "def new_letter_notification(message)\n sender = User.find message.user_id\n reciever = User.find message.reciever\n setup_email(reciever)\n @subject += \"Вам пришло личное сообщение от #{sender.full_name}\"\n body[:sender] = sender\n body[:message] = message\n body[:url] = RAILS_URL + \"messages/view/#{message.id}\"\n end", "def notify(msg)\n @room_queue.push(msg)\n end", "def push_notification\n NotificationMailer.push_notification\n end", "def notify(message)\n messages << \"\\n#{message}\"\n send_email(messages) if (@last_sent.nil? || Time.now > (@last_sent + interval * 60))\n end", "def create_notification; end", "def new_notification\n mail(to: \"rhammett@ycp.edu\", subject: 'New Notification', sent_on: Time.now)\n end", "def push_notice_message(msg)\n push_message(:notice, msg)\n end", "def push_notice_message(msg)\n push_message(:notice, msg)\n end", "def create\n @message = Message.new(params[:message])\n if @message.save\n MessageMailer.notify_private_message_sent(@message.sender, @message.receiver).deliver\n puts \"FOI\"\n end\n respond_with(@message)\n end", "def command_privmsg(args)\n channel=args['channel']\n msg=args['message']\n target = bot.Target(channel)\n target.send(msg)\n privmsg(channel,bot.nick,msg)\n end", "def send_message!(params = {})\n call_api(\"directmessage/#{secret}/#{token}\",params)\n end", "def sendSecureMessage\n secureChat(\"This is confidential\")\n end", "def message(to, message)\n send_raw_line(\"PRIVMSG \"+to.to_s+\" :\"+message.chomp)\n end", "def send_notification(user_alias, message, base_uri = 'https://notifiable-staging.herokuapp.com', access_id = ENV['ACCESS_ID'], secret_key = ENV['SECRET_KEY'])\n sender = Notifiable::Sender.new access_id, base_uri: base_uri, secret_key: secret_key\n sender.send_notification_to_users([user_alias], message: message)\nend", "def messaging\n end", "def notify_receiver\n conversation = ConversationBlueprint.render_as_json(self, view: :normal)\n ActionCable.server.broadcast \"user_#{ self.user_two_id }_notification_channel\", conversation\n end", "def send_message(short_msg, long_msg, notification_type_name, sanitize_text = true, data = '', push_data = '')\n message = Alerter::MessageBuilder.new({\n recipients: self,\n short_msg: short_msg,\n long_msg: long_msg,\n data: data,\n push_data: push_data.to_s,\n notification_type: NotificationType.find_or_create_by(name: notification_type_name),\n }).build\n message.save!\n message.deliver sanitize_text\n end", "def notify\n {\n }\n end", "def notify\n {\n }\n end", "def privmsg(destination, s)\n sendmsg \"PRIVMSG #{destination} :#{s}\"\n end", "def create\n @user_private_message = User::PrivateMessage.new(user_private_message_params)\n\n # Reject messages not allowed to be sent.\n # Can only send messages when event allows it.\n # Can only send messages if they are attending that event\n # Blocked users are allowed to send messages to those who blocked them, but the recipient will not see them.\n\n respond_to do |format|\n if @user_private_message.event.allow_messaging?\n sender = @user_private_message.sender\n recipient = @user_private_message.recipient\n if (sender.events.ids & recipient.events.ids).include?(@user_private_message.event.id)\n if @user_private_message.save\n format.html { redirect_to inbox_user_current_event_path(id: @user_private_message.event_id), notice: 'Private message was successfully created.' }\n format.json { render :show, status: :created, location: @user_private_message }\n else\n format.html { render :new }\n format.json { render json: @user_private_message.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to root_path, notice: \"This message is not valid\" }\n format.json { render json: {error: \"This message is not valid\"}, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to root_path, notice: \"Messaging is not currently allowed for this event\" }\n format.json { render json: {error: \"Messaging is not currently allowed for this event\"}, status: :unauthorized }\n end\n\n end\n end", "def notify(user, message)\n if @send_real_messages\n real_message(user, message)\n else\n log_message(user, message)\n end\n end", "def notify(type,subject,target=nil)\n self.notices.create :type => type, :subject => subject, :target => target\n end", "def set_privatemessaging\n @privatemessaging = Privatemessaging.find(params[:id])\n end", "def set_private_message\n @private_message = PrivateMessage.find(params[:id])\n end", "def notify\n send_email_notification if allow_email_notifications\n send_slack_notification if allow_slack_notifications\n end", "def notify_business\n business.add_message_to_queue(\"Hey #{business.name}, we've just deposited #{amount} into your account! Thanks for being great!\")\n end", "def privmsg(msg, user)\n if @s\n @s.puts \"PRIVMSG #{user} :#{msg}\"\n end\n end", "def create_notification(chatroom)\n last_message = chatroom.messages.last\n user = last_message.user\n other_user = chatroom.other_user user.id\n n = other_user.notification || Notification.create(user_id: other_user.id)\n n.count += 1\n n.save\n last_message.notification_id = n.id\n last_message.save\n NotificationsChannel.broadcast_to other_user,\n user: last_message.user.name,\n content: last_message.content,\n picture: last_message.user.picture,\n topic: self.topic,\n id: last_message.id\n end", "def trigger_on_message(msg); @app.on_message(msg); end", "def push msg\n end", "def notifications\n end", "def send_app_notification\n if message.present?\n message.receipts.unread.each do |receipt|\n user = receipt.receiver\n if user.is_a?(User) #&& user.user_setting.\n user_setting = user.user_setting\n allow_push = false\n if message.message_type == 'user_messages' && user_setting.allow_user_messages?\n allow_push = true\n end\n if message.message_type == 'clan_messages' && !(user_setting.allow_clan_messages.include?(message.notified_object_id.to_s))\n allow_push = true\n end\n if allow_push && (user_setting.android? || user_setting.iphone? ) && user_setting.fcm_token.present?\n # sky start\n\n # fcm = FCM.new(\"AIzaSyCHC77aETrtuaAvNTQQqvnLhjFf6zHOSPc\")\n # options = {data: {message: \"#{sender.username}: #{subject}\", url: nil, id: receipt.id, type: :usermessages}, collapse_key: :updated_score}\n # registration_ids = [user_setting.fcm_token]\n # response = fcm.send(registration_ids, options)\n\n # sky end\n\n fcm = FCM.new(\"AAAAqD6vl5g:APA91bEE1FUBihFLdW6kO9XpN-srDxlama2BzzjimePRN-kBlfq0tKMsblhNPW7a2_CeM1J0Pz7SMAYx4c_notZMCx2schfCDYvizOW6EYWAhnUsYA10azWOenextxFiUaFotLT8Z8er\")\n if user_setting.android?\n options = { data: { title: sender.username, message: subject, url: nil, id: receipt.id, type: message.message_type}, collapse_key: :updated_score}\n else\n options = {notification: {title: sender.username, body: subject, icon: \"myicon\", sound: \"notificationRoster.wav\", url: nil, id: receipt.id, type: message.message_type}, priority: \"high\"}\n end\n\n registration_ids = [user_setting.fcm_token]\n response = fcm.send(registration_ids, options)\n\n end\n end\n end\n end\n end", "def notify_user\n NotiMailer.notification_proposal(self.homework.user.email, self, self.homework).deliver\n end", "def notify(params)\n client.post('/notify', params)\n end", "def did_receive_notice(stem, sender, recipient, msg)\n end", "def notify(msg, image)\n end", "def notify(message)\n g = Client.new(grove_channel_token,\n :service => grove_service,\n :icon_url => grove_icon_url,\n :url => grove_url\n )\n\n unless g.notify(message)\n # error\n logger.important \"Failed to send notification to grove.io\"\n end\n end", "def notify(mid, *args, **kwargs)\n @notification_name = mid\n do_notify(*args, **kwargs)\n end", "def notify(user, token, message)\n url = URI.parse(\"https://api.pushover.net/1/messages.json\")\n req = Net::HTTP::Post.new(url.path)\n req.set_form_data({\n :token => \"#{token}\",\n :user => \"#{user}\",\n :message => \"#{message}\",\n })\n res = Net::HTTP.new(url.host, url.port)\n res.use_ssl = true\n res.verify_mode = OpenSSL::SSL::VERIFY_PEER\n res.start {|http| http.request(req) }\n end", "def update_message(data); end", "def update_message(data); end", "def remote_msg(sender, body)\n add_msg(\"|#{sender}| #{body}\", :notice)\nend", "def add_notification_for_recipient\n # add to notifications\n @activity.recipient_user.friends_notifications.add(@activity.json_blob, score_key)\n # Increment counter\n @activity.recipient_user.notifications_counter.increment\n if @activity.recipient_user != @activity.user\n SendNotificationService.new(@activity.recipient_user, @activity.json_blob).user_notification\n SendNotificationService.new(@activity.recipient_user, @activity.json_blob).friend_notification\n end\n end", "def notification(to,f)\n send_as :notification\n recipients to\n from f\n fbml \"Not\"\n end", "def notify_administrators!\n AdminMailer.new_pending_interest_point(self).deliver!\n end", "def send_admin_notification\n Notifications.send_admin_notification(User.admin, self).deliver\n end", "def send_email_changed_notification?; end", "def create_notification\n subject = \"#{student_request.name} \"\n body = \"#{student_request.name} (#{student_request.email}) needs tutorial.\"\n tutor_request.notify(subject, body, self)\n end", "def notify(message)\n Mail.deliver do\n to to\n from from\n subject subject\n body message\n end\n\n puts \"New message has been notified on Mail: #{message}\"\n end", "def on_newmessage(time, userid, username, msg)\n end", "def sms_notify(username, source_system, message)\r\n sender = SmsGlobal::Sender.new :user => CONFIG[:sms_global_settings][:user_name].to_s, :password => CONFIG[:sms_global_settings][:password].to_s\r\n\r\n sender.send_text message, username, source_system\r\n Rails.logger.info \"#{Time.now.utc} - sms_notify - #{username} - #{source_system} - #{message}\"\r\n end", "def notify_user(user, message, action)\n ActionCable.server.broadcast(\n \"message_channel_#{user.aitu_id}\",\n message: {\n action: action,\n order_item: ::MessageBlueprint.render(message).to_json\n }\n )\n send_push(user, message)\n end", "def send_privmsg(message, *recipients)\n Log.debug(\"sending privmsg '#{message}' to '#{recipients}'\")\n normalize_message(message) { |message|\n recipients.each { |recipient|\n send_raw(PRIVMSG, recipient, message)\n }\n }\n end", "def notification\n BookingMailer.notification\n end", "def notify_by_push\n PushNotification.new(user: context.user,\n message: context.message,\n n_type: context.n_type,\n data: { from_id: context.user_from.try(:id), from_name: context.user_from.try(:name),\n donation_id: context.donation.try(:id) })\n .simple_notification\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 send_private to, text, from\n receiver = @circle.get to # A literal Java method call\n \n raise GeneralTiscapError.new \"No known user “#{to}”\" if receiver.nil?\n \n receiver.receive text, from, false # false for not public\n end" ]
[ "0.70331144", "0.70331144", "0.6963134", "0.6799917", "0.6770256", "0.6685632", "0.6612268", "0.6534004", "0.65101403", "0.64105463", "0.63560504", "0.6347512", "0.63412607", "0.6320071", "0.6310779", "0.6296572", "0.6293065", "0.62656647", "0.6242622", "0.62294364", "0.622016", "0.622016", "0.62087846", "0.6143537", "0.61412483", "0.6133506", "0.6123592", "0.6116449", "0.6088883", "0.6067203", "0.60540617", "0.6035506", "0.60168064", "0.6004039", "0.5987897", "0.5979839", "0.5972367", "0.5969409", "0.59445024", "0.59406626", "0.59330124", "0.59215486", "0.5918256", "0.5912276", "0.5912075", "0.59079933", "0.5904684", "0.59019476", "0.58940864", "0.58940864", "0.58938545", "0.5889305", "0.58829653", "0.58771694", "0.5865283", "0.5863541", "0.5862895", "0.585234", "0.5851699", "0.58473206", "0.58473206", "0.58378345", "0.58363664", "0.58323383", "0.58285016", "0.5824302", "0.5817598", "0.580788", "0.5797397", "0.5768271", "0.5768025", "0.5767166", "0.576097", "0.5758882", "0.57545626", "0.57520956", "0.57517934", "0.57512766", "0.57430065", "0.5742494", "0.57313", "0.57227486", "0.57205755", "0.57205755", "0.57172316", "0.5716223", "0.57099134", "0.57091594", "0.5705094", "0.5695689", "0.5690372", "0.56719923", "0.5669564", "0.5668578", "0.5668203", "0.5658842", "0.5655025", "0.5649923", "0.56481355", "0.5634607" ]
0.6795448
4
sets a prize badge or level or whatever reward model for the matter
def set_reward(reward) self.send("current_#{reward.class.to_s.underscore}=",reward) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_prize\n @prize = Prize.find(params[:id])\n @goal = Goal.find(params[:goal_id])\n end", "def set_prize\n @prize = Prize.find(params[:id])\n end", "def set_reward\n @product = current_user.products.find(params[:product_id])\n @reward = @product.rewards.find(params[:id])\n end", "def applyPrize(prize)\n # Increments the levels\n increaseLevels(prize.levels)\n # Adds the treasures\n prize.treasures.times {@hiddenTreasures << CardDealer.instance.nextTreasure}\n end", "def default_reward\n\t\tself.rewards.create(:description => \"Thanks!\", :dollar_amount => 1)\n\tend", "def reward(opponent, groupsize)\n @experience = @experience + opponent.max_health / groupsize\n if @experience >= LEVEL_THRESHOLDS[@level]\n upgrade(@level)\n end\n end", "def change_reward_status(quest_id, value = true)\n quest(quest_id).reward_given = value\n end", "def set_reward\n @reward = Reward.find(params[:id])\n end", "def set_reward\n @reward = Reward.find(params[:id])\n end", "def set_reward\n @reward = Reward.find(params[:id])\n end", "def set_default_attributes\n self.quantity = 1\n\n case self.purchasable.class\n when Package\n self.description = \"Upgrade package to #{self.purchasable.name}\"\n # Hitung kekurangan dari paket sebelumnya\n old_package = self.invoice.contest_upgrade.old_package\n new_package = self.invoice.contest_upgrade.new_package\n price = new_package.calculate_sell_price - old_package.calculate_sell_price\n self.upgrade_price = price\n self.transaction_fee = 300000\n when Feature\n self.description = \"Upgrade feature to #{self.purchasable.name}\"\n if !self.free_upgrade\n self.upgrade_price = self.purchasable.price\n else\n self.upgrade_price = 0\n end\n end\n\n end", "def set_pmprize\n @pmprize = Pmprize.find(params[:id])\n end", "def set_premium_reward_setting\n @premium_reward_setting = PremiumRewardSetting.find(params[:id])\n end", "def reputation_threshold_action\n :offer_reward\n end", "def set_reward_and_level\n @reward_and_level = RewardAndLevel.find(params[:id])\n end", "def create\n @goal = Goal.find(params[:goal_id])\n @prize = @goal.prizes.new(prize_params)\n\n if @prize.save\n flash[:notice] = 'Prize was successfully created.'\n redirect_to [current_user, @goal, @prize]\n end\n\n end", "def set_badge\n @badge = Badge.find(params[:id])\n end", "def set_badge\n @badge = Badge.find(params[:id])\n end", "def set_badge\n @badge = Badge.find(params[:id])\n end", "def reward_params\n params[:reward].permit(:title, :description, :limit, :price)\n end", "def set_badge\n @badge = Badge.find(params[:id])\n end", "def reward\n @reward ||= 0\n end", "def reward_params\n params.require(:reward).permit(:title, :description, :price, :product_id, :user_id)\n end", "def set_avaible \t\n self.avaible = self.quantity\n end", "def increase_insurance_premium\n self.insurance_premium += 100\n end", "def set_relevancy!\n # calculate total of ratings\n ratings = rating.count_attributes\n ratings.each do |key,value|\n ratings[key] = value * SolutionRelevancy.send(\"rating_value_#{key}\")\n end\n total = ratings.values.inject(0) { |sum, count| sum + count }\n \n # calculate total of views\n total += views * SolutionRelevancy.view_value\n \n # calculate updates\n total += updates * SolutionRelevancy.update_value\n \n # total # of items that are included in the updates\n num_of_items = total_votes + views + updates\n\n # set the relevancy\n settings.update_attribute('relevancy',num_of_items > 0 ? total/num_of_items : AppConstants::DEFAULT_SOLUTION_RELEVANCY) \n end", "def add_review\n UsersQuest.update(params[:id], params.require(:quest).permit(:review))\n quest = Quest.find(params[:id])\n\n if params[:quest][:points] == \"1\"\n quest.bounty_points += 10\n quest.save\n end\n if params[:quest][:points] == \"2\"\n quest.bounty_points += 20\n quest.save\n end\n if params[:quest][:points] == \"3\"\n quest.bounty_points += 30\n quest.save\n end\n if params[:quest][:points] == \"4\"\n quest.bounty_points += 40\n quest.save\n end\n if params[:quest][:points] == \"5\"\n quest.bounty_points += 50\n quest.save\n end\n redirect_to quest_path(quest.id)\n end", "def rate!(level)\n rating.increment!(level)\n end", "def set_badge\n @badge = Badge.find(params[:id])\n end", "def add_reward(value)\n self.reward += value\n end", "def set_penalty\n @penalty = Penalty.find params[:id]\n end", "def applyPrize(m)\n nLevels = m.getLevelsGained\n self.incrementLevels (nLevels)\n nTreasures = m.getTreasuresGained\n \n if nTreasures > 0\n dealer = CardDealer.instance\n nTreasures.times do\n treasure = dealer.nextTreasure\n @hiddenTreasures << treasure\n end\n end\n \n end", "def gain_experience(exp)\n self.experience += exp\n save\n end", "def applyPrize(m)\n incrementLevels(m.getLevelsGained)\n \n if(m.getTreasuresGained > 0)\n dealer=CardDealer.instance\n \n i=0\n while(i<m.getTreasuresGained)\n @hiddenTreasures.push(dealer.nextTreasure)\n i = i+1\n end\n \n end\n \n end", "def increase_insurance_premium\n self.insurance_premium += 100\n end", "def set_badge\n @badge = Badge.friendly.find(params[:id])\n authorize @badge\n end", "def set_prizes\n users.each_with_index do |u, i| \n u[:prize] = {id: prizes[i].id, name: prizes[i].name, class_name: prizes[i].class_name}\n u[:finished] = false\n u[:gift] = UNOPENED_GIFTS[rand(3)]\n u[:final] = i == 0 ? false : true\n u[:action] = i == 0 ? (u[:bot] ? \"DECIDING...\" : \"OPEN NEW GIFT\" ) :nil\n u[:id] = i\n u[:stolen] = false\n end\n end", "def reward_params\n params.require(:reward).permit(:result_no, :generate_no, :e_no, :battle_income, :add_income, :attack, :support, :defense, :defeat, :selling, :sub_quest, :enemy_caution, :colosseum_win, :fight_money, :total_income, :ammunition_cost, :preparation_deduction, :preparation_cost, :union_cost, :prize, :union_interest, :parts_sell)\n end", "def set_Probability(value)\n set_input(\"Probability\", value)\n end", "def set_curation_experience\n\n end", "def set_prise\n @prise = Prise.find(params[:id])\n end", "def set_reward_type\n @reward_type = RewardType.find(params[:id])\n end", "def assign_score; end", "def set_badge(badge_num, region = 1, value = true)\n region -= 1\n badge_num -= 1\n if (region * 8) >= @badges.size\n log_error('Le jeu ne prévoit pas de badge pour cette région. PSDK_ERR n°000_006')\n elsif badge_num < 0 || badge_num > 7\n log_error('Le numéro de badge indiqué est invalide, il doit être entre 1 et 8. PSDK_ERR n°000_007')\n else\n @badges[(region * 8) + badge_num] = value\n end\n end", "def setup( num_proposals )\r\n @chairperson = msg.sender\r\n @voters = Mapping.of( Address => Voter )\r\n @proposals = Array.of( Proposal, num_proposals )\r\n\r\n @voters[@chairperson].weight = 1\r\nend", "def mage(level)\n @enemy_type = \"Mage\"\n @enemy_health_points = rand(100..200)*level\n @enemy_max_health = @enemy_health_points\n @enemy_attack = 20*level\n @enemy_armor_score = 11\n end", "def pmprize_params\n params.require(:pmprize).permit(:amount, :name, :pmmatch_id, :pmplayer_id)\n end", "def update_current_rewards\n [Level, Badge, Prize].each do |klass|\n from, to = self.changes[:current_points]\n new_reward = klass.where(:amount_points_of_required => ((from)..(to))).order('amount_points_of_required DESC').first\n self.send(\"current_#{klass.to_s.underscore}_id=\", new_reward.id) if new_reward\n end if self.changes.has_key?(:current_points)\n end", "def assign_experience_points\n end", "def update\n respond_to do |format|\n if @prize.update(prize_params)\n format.html { redirect_to @prize, notice: 'Prize was successfully updated.' }\n format.json { render :show, status: :ok, location: @prize }\n else\n format.html { render :edit }\n format.json { render json: @prize.errors, status: :unprocessable_entity }\n end\n end\n end", "def premium_reward_setting_params\n params.require(:premium_reward_setting).permit(:points_for_registration, :min_purchase_amount_earn_points, :points_earn_for_min_amount, :min_points_to_redeem, :amount_for_min_redeem_points, :points_for_referral, :coupon_validity, :minimum_purchase_amount, :maximum_points_to_redeem, :minmum_purchase_amount_for_refer, :referee_premium_membership_validity)\n end", "def set_reward_owner\n @reward_owner = RewardOwner.find(params[:id])\n end", "def reward\n display_reward\n rewards = [\"some bandages\", \"a weapon\", \"a piece of armor\"]\n reward = rewards.sample\n case reward\n when \"some bandages\"\n hero.update(current_health: hero.max_health)\n puts \"Found #{reward}. Your health is restored.\"\n when \"a weapon\"\n weapon_power = rand(1..5)\n hero.update(power: hero.power + weapon_power)\n puts \"Found #{reward}. Power increased by #{weapon_power}.\"\n when \"a piece of armor\"\n armor_power = rand(1..10)\n hero.update(max_health: hero.max_health + armor_power)\n puts \"Found #{reward}. Max health increased by #{armor_power}.\"\n end\n sleep(3)\n end", "def grant_reward(user)\n score = user.score # get user score\n # for each category, get the value, if not nil, calculate new value for category\n attributes_to_update = {}\n [:stamina, :strength, :mind, :vitality, :agility].each do |reward_category|\n reward_value = send(\"#{reward_category}_reward\")\n if reward_value.present?\n # new_value = (score.send(reward_category).to_f * (1.0 + (reward_value.to_f / 100.0))).ceil\n new_value = score.send(reward_category).to_i + reward_value.to_i\n new_value = 100 if new_value > 100 # 100% max\n attributes_to_update[reward_category] = new_value\n end\n end\n score.update_attributes!(attributes_to_update)\n end", "def reward\n business.add_to_balance(amount)\n end", "def set_default_values_skill\n self.badge ||= Placeholder.image_generator(height: 250, width: 250) # self.=> is similar to 'this' keyword. referencing this specific skill.\n #if main_image is nil put my default value else put users inputted image value\n #setting default values for images\n end", "def update!(**args)\n @score_ratio = args[:score_ratio] if args.key?(:score_ratio)\n end", "def set_user_badge\n @user_badge = UserBadge.find(params[:user_badge_id])\n end", "def set_budget\n self.budget = self.package.price + self.affiliate_fee\n self.freelancer_fee = self.package.freelancer_fee\n end", "def set_award_type(name, expires_in, quality)\n case name\n when 'Blue First'\n BlueFirst.new(name, expires_in, quality)\n when 'Blue Distinction Plus'\n BlueDistinctionPlus.new(name, expires_in, quality)\n when 'Blue Compare'\n BlueCompare.new(name, expires_in, quality)\n when 'Blue Star'\n BlueStar.new(name, expires_in, quality)\n else\n StandardAward.new(name, expires_in, quality)\n end\n end", "def set_request_score\n @request_score = RequestScore.find(params[:id])\n end", "def set(point, producer)\n case producer\n when :deficit, nil\n super(\n point,\n [\n @fallback_price,\n last_available_dispatchable(point)&.cost_strategy&.cost_at(point)\n ].compact.max\n )\n when :surplus\n super(point, 0.0)\n else\n super(point, producer.cost_at(point))\n end\n end", "def api_regen_multiplier(level)\n if level >= User::Levels::GOLD\n 4\n else\n 1\n end\n end", "def set_admin_badge\n @badge = Badge.find(params[:id])\n end", "def set_price_levels\n @brand = Brand.find(params[:brand_id])\n end", "def assign_score_limit; end", "def prize_params\n params[:prize].permit(:name)\n end", "def update_reputation\n self.warband.reputation += achievement.reputation\n self.warband.save!\n end", "def reward_params\n params.fetch(:reward, {}).permit(:title, :description, :cost, :business_id)\n end", "def update!(**args)\n @inspiration_score = args[:inspiration_score] if args.key?(:inspiration_score)\n end", "def award_badge(participant_id, badge_name)\n badge_id = Badge.get_id_from_name(badge_name: badge_name)\n AwardedBadge.where(participant_id: participant_id, badge_id: badge_id, approval_status: 0).first_or_create\n end", "def set_quality_on_hand\n if self.quality_lot.present?\n quality_lot = self.quality_lot\n # quality_lotss.lot_quantity = quality_lotss.lot_quantity + self.so_shipped_count\n quality_lot.quantity_on_hand = quality_lot.quantity_on_hand - self.so_shipped_count\n\n\n if quality_lot.quantity_on_hand <= 0\n quality_lot.finished = true\n quality_lot.lot_finalized_at = Date.today.to_s\n quality_lot.lot_status = \"closed\"\n quality_lot.final_date = Time.now\n end\n if quality_lot.save(:validate => false)\n p quality_lot.to_yaml\n end\n end\n end", "def blue_first(award)\n award.expires_in -= 1\n if award.expires_in >= 0\n award.quality += 1\n elsif award.expires_in < 0\n award.quality += 2\n end\nend", "def prize_params\n params.require(:prize).permit(:name, :code, :price, :sponsor, :description, :match_id, :user_id, {images: []})\n end", "def update\n if @prize.update(prize_params)\n flash[:notice] = 'Prize was successfully updated.'\n end\n\n respond_with @prize\n end", "def set_prob\n @prob = Prob.find(params[:id])\n end", "def update!(**args)\n @discretized_aesthetics_score = args[:discretized_aesthetics_score] if args.key?(:discretized_aesthetics_score)\n @version = args[:version] if args.key?(:version)\n end", "def set_pricing\n\t\tself.current_price = self.starting_price if self.current_price.nil?\n\t\tself.product_is_sold = false if self.product_is_sold.nil?\n\t\tself.bids = 0 if self.bids.nil?\n\t\tself.auction_is_over = false if self.auction_is_over.nil?\n\tend", "def set_bet_value\n\t\tself.bet_value = self.bet_line\n end", "def reward_and_level_params\n params.require(:reward_and_level).permit(:lower_limit, :upper_limit, :reward, :level)\n end", "def set_brlevel\n @brlevel = Brlevel.find(params[:id])\n end", "def set_brlevel\n @brlevel = Brlevel.find(params[:id])\n end", "def update!(**args)\n @badge_specialization = args[:badge_specialization] if args.key?(:badge_specialization)\n @badge_specialization_state = args[:badge_specialization_state] if args.key?(:badge_specialization_state)\n end", "def set_quantity(qty) #should be quantity=(), but then calling from child doesn't work?\n @stall_current *= qty / @quantity\n @stall_torque *= qty / @quantity\n @max_power *= qty / @quantity\n @quantity = qty\n end", "def gain_experience(_xp)\n\t\t@experience += _xp\n\tend", "def rewardpurchase\n @reward = Reward.find(params[:id]).clone\n @rewardpurchase = @reward.rewardpurchases.create(params.permit(:reward_id,:user_id,:rewardname,:rewardbusiness,:rewardcost))\n @rewardpurchase.rewardname = @reward.name.dup\n @rewardpurchase.rewardbusiness = @reward.business.name.dup\n @rewardpurchase.rewardcost = @reward.cost.to_s.dup\n @rewardpurchase.user_id = current_user.id\n @rewardpurchase.rewarddescription = @reward.description\n \n \n if current_user.karma >= @reward.cost\n respond_to do |format|\n if @rewardpurchase.save\n current_user.purchase_reward(@reward.cost)\n format.html { redirect_to root_path, notice: 'Reward was successfully purchased.' }\n format.json { render json: @rewardpurchase, status: :created, location: @rewardpurchase }\n else\n format.html { redirect_to @reward}\n format.json { render json: @rewardpurchase.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to :back, notice: \"You do not have enough points to purchase this reward.\"\n end\n end", "def set_gm_rate\n @gm_rate = GmRate.find(params[:id])\n end", "def set_credibility_rating\n @credibility_rating = CredibilityRating.find(params[:id])\n end", "def reward_params\n params.require(:reward).permit(:name, :cost, :description, :expdate)\n end", "def update\n @prize = Prize.find(params[:id])\n\n respond_to do |format|\n if @prize.update_attributes(params[:prize])\n flash[:notice] = 'Prize was successfully updated.'\n format.html { redirect_to(@prize) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @prize.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pmprize.update(pmprize_params)\n format.html { redirect_to @pmprize, notice: 'Pmprize was successfully updated.' }\n format.json { render :show, status: :ok, location: @pmprize }\n else\n format.html { render :edit }\n format.json { render json: @pmprize.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @is_snippet_brain_bolding_triggered = args[:is_snippet_brain_bolding_triggered] if args.key?(:is_snippet_brain_bolding_triggered)\n @model_score = args[:model_score] if args.key?(:model_score)\n end", "def show\n\n @room = Room.find(params[:room_id])\n profile = Profile.find_by_user_id(current_user.id)\n if @room.roomtype== \"Single\"\n profile.update_attributes(:rewardp => 0)\n end\n end", "def badge_params\n params.require(:badge).permit(:title, :image, :rule, :rule_parameter)\n end", "def cap_redeem(num_bottles)\n\tnum_bottles/4\nend", "def reward_params\n params.require(:reward).permit(\n :name, :image, :require_points, :quantity, :price, :term,\n :store_id, :description, :start_date, :end_date, :claimed_reward_expired)\n end", "def reward_cost(klass, options={})\n options.reverse_merge!(:count => 1, :level => 1)\n\n metal_cost = klass.metal_cost(options[:level])\n energy_cost = klass.energy_cost(options[:level])\n zetium_cost = klass.zetium_cost(options[:level])\n\n reward_metal metal_cost * options[:count] if metal_cost > 0\n reward_energy energy_cost * options[:count] if energy_cost > 0\n reward_zetium zetium_cost * options[:count] if zetium_cost > 0\n end", "def update!(**args)\n @prior_score = args[:prior_score] if args.key?(:prior_score)\n @volume_based_score = args[:volume_based_score] if args.key?(:volume_based_score)\n end", "def set_level_progration\n @level_progration = LevelProgration.find(params[:id])\n end", "def set_reward_action\n @reward_action = RewardAction.find(params[:id])\n end" ]
[ "0.64748794", "0.61611515", "0.61373854", "0.60631955", "0.60559595", "0.59019715", "0.5872867", "0.5845035", "0.5845035", "0.5845035", "0.58322287", "0.5792951", "0.57748586", "0.57345194", "0.57338107", "0.5708214", "0.5664037", "0.5664037", "0.5664037", "0.5657174", "0.56175584", "0.5591916", "0.5590375", "0.5570738", "0.5570521", "0.55613655", "0.5537706", "0.55363286", "0.5529841", "0.55236506", "0.5511022", "0.550703", "0.54907286", "0.5482278", "0.5476117", "0.5458287", "0.5437454", "0.5427639", "0.5409438", "0.54035217", "0.5398375", "0.53802466", "0.53761446", "0.5367054", "0.5351904", "0.5346975", "0.53437847", "0.5314345", "0.5312478", "0.53083014", "0.5307357", "0.53030956", "0.5302916", "0.52974653", "0.52911955", "0.5269478", "0.52667016", "0.52653015", "0.52592313", "0.5257746", "0.52555406", "0.5247404", "0.52459013", "0.52395123", "0.52366287", "0.5230454", "0.52211815", "0.5213845", "0.51989937", "0.5193151", "0.51921296", "0.5191242", "0.5190273", "0.51886904", "0.51794803", "0.51726276", "0.51704556", "0.5169402", "0.5167341", "0.51575506", "0.5150952", "0.5150952", "0.514628", "0.5137786", "0.51304877", "0.51301444", "0.51277155", "0.51246774", "0.512373", "0.51170784", "0.51134145", "0.5112438", "0.5111363", "0.5110999", "0.51067024", "0.5106393", "0.51061577", "0.5098381", "0.5094883", "0.5094412" ]
0.60505587
5
Resets single access token for user
def reset_single_access_token! update_attribute(:single_access_token, User.encrypt_token(Time.now.to_i, "password reset--")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n session.delete(:access_token)\n session.delete(:refresh_token)\n redirect('/auth/gowalla')\n end", "def reset_auth_token!\n reset_auth_token\n save(:validate => false)\n end", "def reset_token\r\n authentication_token true\r\n end", "def reset_authentication_token!\n reset_authentication_token\n save(:validate => false)\n end", "def reset_authentication_token!\n reset_authentication_token\n save(validate: false)\n end", "def reset\n session.delete(:access_token)\n session.delete(:refresh_token)\n redirect('/auth/foursquare')\n end", "def reset\n reset_token\n end", "def reset_authentication_token!\n reset_authentication_token\n self.save\n end", "def token_reset\n current_owner.gen_api_token\n current_owner.save\n redirect_to \"/account\"\n end", "def renew_access_token!\n @access_token = nil\n true\n end", "def reset_token\n set_new_token\n save!\n temporary_token\n end", "def refresh_access_token!\n @access_token = access_token.refresh!\n end", "def token_refresh!\n self.access_token = access_token.refresh!\n end", "def reset_auth_token\n self.auth_token = generate_token(:auth_token)\n end", "def reset_token!\n api_key.delete if api_key.present?\n assign_api_key!\n end", "def refresh_access_token!\n @access_token = access_token.refresh!\n self.class.default_params :access_token => @access_token.token\n @access_token\n end", "def refresh_access_token!\n self.save! if refresh_access_token\n end", "def refresh_access_token\n self.expires_at = Time.now + 3600 \n save\n end", "def nuke_auth_token\n\t\t\tfile = get_access_token_file\n\t\t\t@logger.info \"Removing persisted access token: #{file}\"\n\t\t\tFile.delete file\n\t\t\tset_access_token(nil)\n\t\t\tset_auth_header ''\n\t\tend", "def invalidate_token(user)\n user.renew_token\n user.save\n end", "def reset_reset_token!\n self.set_reset_token\n self.save\n self.reset_token\n end", "def reset_authentication_token!\n self.authentication_token = generate_authentication_token\n self.save!\n end", "def reset_admin_login_token\n update_attribute(:admin_login_token, nil)\n end", "def reset_authentication_token!\n self.authentication_token = generate_authentication_token\n end", "def token\n #@user = User.where(:id => params[:user_id]).first\n #@user.reset_authentication_token!\n redirect_to edit_user_registration_path(@user)\n end", "def reset_token!\n self.session_token = User.generate_session_token\n self.save!\n self.session_token\n end", "def revoke_oauth_token\n current_user.revoke_token\n end", "def refresh_access!\n response = auth_connection.post(\n \"/api/v1/access_token\",\n grant_type: \"refresh_token\",\n refresh_token: access.refresh_token\n )\n access.refreshed!(response.body)\n reset_connection!\n end", "def reset_token\n @@token = nil\n end", "def fb_access_token_expired\n self.access_token = nil\n save!\n end", "def reset_api_key\n if request.post?\n if User.current.api_token\n User.current.api_token.destroy\n User.current.reload\n end\n User.current.api_key\n flash[:notice] = l(:notice_api_access_key_reseted)\n end\n redirect_to my_account_path\n end", "def reset_api_key\n if request.post?\n if User.current.api_token\n User.current.api_token.destroy\n User.current.reload\n end\n User.current.api_key\n flash[:notice] = l(:notice_api_access_key_reseted)\n end\n redirect_to my_account_path\n end", "def reset_api_key\n if request.post?\n if User.current.api_token\n User.current.api_token.destroy\n User.current.reload\n end\n User.current.api_key\n flash[:notice] = l(:notice_api_access_key_reseted)\n end\n redirect_to my_account_path\n end", "def reset_authentication_token\n self.authentication_token = self.class.authentication_token\n end", "def reset_authentication_token\n self.authentication_token = self.class.authentication_token\n end", "def reset_authentication_token\n self.authentication_token = self.class.authentication_token\n end", "def reset\n @token = params[:tokens]\n @id = params[:id]\n end", "def reset\n @token = params[:tokens]\n @id = params[:id]\n end", "def reset\n self.reset_token = User.new_token\n self.update_attributes(reset_digest: User.digest(reset_token),\n reset_sent_at: Time.zone.now)\n end", "def reset_token\n self.token = ''\n end", "def revoke\n oauth_access_token.revoke\n head :ok\n end", "def reset_session_token!\n self.session_token = User.generate_session_token\n self.save!\n self.session_token\n end", "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 clear_reset_password_token; end", "def reset!\n reset_secret\n refresh_expiry\n reset_confirmation\n save!\n end", "def refresh_single_use_oauth2_token!\n assign_single_use_oauth2_token\n save!\n end", "def reset_login(access_token)\n payload = { access_token: access_token }\n @client.post_with_auth('sandbox/item/reset_login', payload)\n end", "def reset_session_token!\n self.session_token = User.generate_session_token\n self.save\n self.session_token\n end", "def revoke!\n self.revoked = Time.now.to_i\n AccessToken.collection.update({ :_id=>token }, { :$set=>{ :revoked=>revoked } })\n Client.collection.update({ :_id=>client_id }, { :$inc=>{ :tokens_revoked=>1 } })\n end", "def revoke!\n self.revoked = Time.now.to_i\n AccessToken.collection.update({ :_id=>token }, { :$set=>{ :revoked=>revoked } })\n Client.collection.update({ :_id=>client_id }, { :$inc=>{ :tokens_revoked=>1 } })\n end", "def clear_request_token\n @request_token = nil\n end", "def reset_token!(instance)\n write_new_token(instance)\n instance.save! if Gitlab::Database.read_write?\n end", "def invalidate_token\n self.update_columns(auth_token: nil)\n end", "def abandon!\n @user = nil\n session.clear\n end", "def invalidate_auth_token\n self.update_columns(auth_token: nil)\n end", "def invalidate_auth_token\n self.update_columns(auth_token: nil)\n end", "def invalidate_token \n self.update_columns(auth_token: nil)\n end", "def revoke!\n self[:revoked] = Time.now\n save\n Client[client_id].token_revoked\n end", "def revoke!\n self.class.transaction do\n update_attribute :revoked, Time.now\n client.increment! :tokens_revoked\n end\n end", "def regenerate_token\n self.auth_token = nil\n generate_token\n save!\n end", "def access_token=(value)\n reset_agent\n @access_token = value\n end", "def access_token=(value)\n reset_agent\n @access_token = value\n end", "def refresh_auth_token\n generate_token(:auth_token)\n save!\n end", "def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end", "def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end", "def clear_credentials!\n @access_token = nil\n @refresh_token = nil\n @id_token = nil\n @username = nil\n @password = nil\n @code = nil\n @issued_at = nil\n @expires_at = nil\n end", "def reset_oauth2_client!\n @oauth2_client = nil\n end", "def reset_rss_key\n if request.post?\n if User.current.rss_token\n User.current.rss_token.destroy\n User.current.reload\n end\n User.current.rss_key\n flash[:notice] = l(:notice_feeds_access_key_reseted)\n end\n redirect_to my_account_path\n end", "def reset_rss_key\n if request.post?\n if User.current.rss_token\n User.current.rss_token.destroy\n User.current.reload\n end\n User.current.rss_key\n flash[:notice] = l(:notice_feeds_access_key_reseted)\n end\n redirect_to my_account_path\n end", "def reset_rss_key\n if request.post?\n if User.current.rss_token\n User.current.rss_token.destroy\n User.current.reload\n end\n User.current.rss_key\n flash[:notice] = l(:notice_feeds_access_key_reseted)\n end\n redirect_to my_account_path\n end", "def maybe_renewing_access_token(&block)\n first_attempt_request(&block) or (renew_access_token! and last_attempt_request(&block))\n end", "def fresh_token\n refresh! if token_expired?\n access_token\n end", "def logout\r\n self.update(token: nil) \r\n end", "def refresh_access_token()\n\n\t\tif(Time.now - @start_time) >=3000\n\t\t\tputs \"Access Token Expired .......Creating a new one\"\n\t\t\t@access_token = @new_token.get_access_token\n\t\t\t@start_time = Time.now\n\t\tend\n\tend", "def renew\n req_body = { grant_type: 'refresh_token', refresh_token: @token.refresh_token }\n\n response = JSON.parse(request_token(req_body).body)\n\n @token.update!(response['access_token'], response['expires_in'], response['refresh_token'])\n\n save\n rescue StandardError => e\n puts \"Unable to refresh token\\n#{e.message}\"\n end", "def log_out_api\n current_user_api.update_attribute(:user_token, nil)\n end", "def destroy_current_access_token\n AccessToken.find(current_access_token_id).destroy\n end", "def clear_expired_tokens\n access_tokens.where(\"token_expire < ?\", Time.now).destroy_all\n end", "def clear_expired_tokens\n access_tokens.where(\"token_expire < ?\", Time.now).destroy_all\n end", "def update_token!(object)\n self.refresh_token = object.refresh_token unless object.refresh_token.nil?\n self.access_token = object.access_token\n self.expires_at = object.expires_at\n end", "def revoke!\n return if revoked?\n update(revoked_at: Time.now)\n tokens.update_all(revoked_at: Time.now, updated_at: Time.now)\n end", "def abandon!\n @user = nil\n session.delete\n end", "def abandon!\n @user = nil\n session.delete\n end", "def reuse_access_token\n @config.instance_variable_set(:@reuse_access_token, true)\n end", "def reset_session_token!\n self.update!(session_token: SecureRandom::urlsafe_base64)\n end", "def fresh_token\n refresh! if expired?\n access_token\n end", "def refreshed!(body)\n @access_token = body[:access_token]\n @expires_at = Time.now + body[:expires_in]\n end", "def reset_session_token!\n self.session_token = User.generate_session_token\n self.save!\n self.session_token\nend", "def token_reset\n item = read\n item['token'] = SecureRandom.uuid.gsub(/[^a-f0-9]/, '')\n @aws.put_item(table_name: 'zold-wallets', item: item)\n end", "def reset_session_token!\n self.session_token = self.class.generate_session_token\n self.save!\n self.session_token\n end", "def reset_session_token!\n self.session_token = self.class.generate_session_token\n self.save!\n self.session_token\n end", "def reset_session_token!\n self.session_token = SecureRandom::urlsafe_base64(16)\n self.save!\n self.session_token\n end", "def refresh_token\n authorize current_user\n original = current_user.api_token\n current_user.generate_token!\n @success = current_user.api_token != original\n end", "def reset\n do_url 'reset', :put\n end", "def reset_session_token!\n self.session_token = SecureRandom::urlsafe_base64\n self.save!\n # save! to persist. when not checking if worked, bang version\n end", "def refresh_oauth2_token!\n ensure_oauth2_token(true)\n save!\n end", "def refresh_access_token\n new_token = FireCloudClient.generate_access_token(self.service_account_credentials)\n new_expiry = Time.zone.now + new_token['expires_in']\n self.access_token = new_token\n self.expires_at = new_expiry\n new_token\n end", "def reset_current_user(user_x)\n user = User === user_x ? user_x : User.find(user_x)\n unless user.nil? || current_user_id == user.id\n clear_auth_cookie\n reset_user_session\n set_current_user(user)\n end \n end", "def reset_session_token!\n self.session_token = SecureRandom.urlsafe_base64(16)\n self.save!\n self.session_token\n end", "def revoke_access_token\n\t\t\tif session[:token]\n\t\t\t\t# Use either the refresh or access token to revoke if present.\n\t\t\t\ttoken = session[:token].to_hash[:refresh_token]\n\t\t\t\ttoken = session[:token].to_hash[:access_token] unless token\n\n\t\t\t\t# You could reset the state at this point, but as-is it will still stay unique\n\t\t\t\t# to this user and we're avoiding resetting the client state.\n\t\t\t\tsession.delete(:state)\n\t\t\t\tsession.delete(:token)\n\n\t\t\t\t# Send the revocation request and return the result.\n\t\t\t\trevokePath = 'https://accounts.google.com/o/oauth2/revoke?token=' + token\n\t\t\t\turi = URI.parse revokePath\n\t\t\t\trequest = Net::HTTP.new uri.host, uri.port\n\t\t\t\trequest.use_ssl = true\n\t\t\t\trequest.get uri.request_uri\n\t\t\tend\n\t\tend" ]
[ "0.7779253", "0.7520163", "0.7363187", "0.73345065", "0.7310071", "0.728621", "0.72823536", "0.7277697", "0.72747725", "0.7239439", "0.72380817", "0.72291934", "0.7217942", "0.7217228", "0.7105236", "0.70980066", "0.70633", "0.7039718", "0.69984984", "0.6968136", "0.69253993", "0.6923667", "0.69017506", "0.68905914", "0.6865633", "0.68645984", "0.6857155", "0.68146944", "0.6802064", "0.6801088", "0.6729531", "0.6729531", "0.6729531", "0.6726456", "0.6726456", "0.6726456", "0.6699962", "0.6699962", "0.6693551", "0.6676098", "0.66160303", "0.6609697", "0.660162", "0.6598757", "0.657523", "0.6568166", "0.6556046", "0.65544957", "0.6551464", "0.6551464", "0.6522903", "0.6518727", "0.6514809", "0.650131", "0.64960814", "0.64960814", "0.6459112", "0.6456058", "0.6454895", "0.6452249", "0.6448808", "0.6448808", "0.6446464", "0.64300483", "0.64300483", "0.6425946", "0.6425301", "0.64211315", "0.64211315", "0.64211315", "0.6420857", "0.64151275", "0.639379", "0.6393051", "0.63925445", "0.6387635", "0.63837534", "0.6375511", "0.6375511", "0.63673747", "0.6358415", "0.63456804", "0.63456804", "0.6330761", "0.6313758", "0.63013524", "0.62817484", "0.6279441", "0.62732524", "0.62717086", "0.62717086", "0.6270395", "0.6264247", "0.6259108", "0.62531495", "0.62505347", "0.6248517", "0.62366796", "0.62333554", "0.6231892" ]
0.8090825
0
Compares passed password with the one encrypted in the database
def authenticate!(psw) User.encrypt_token(psw, password_salt) == encrypted_password end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matching_password?(pass)\n self.password_hash == encrypt_password(pass)\n end", "def password_compare(password, user_id)\n password_digest = db.execute(\"SELECT password_digest FROM users WHERE user_id=?\", user_id)[0][0]\n if BCrypt::Password.new(password_digest) == password\n return true\n else\n return false\n end\n\nend", "def compare_pass (pass)\r\n return self.encrypted_password == sha_hash(\"#{pass}--#{self.salt}\")\r\n end", "def password_match?(login_password)\n\t\tencrypted_password == encrypt(login_password)\t\n\tend", "def check_pw pw\n (encrypt pw) == (self[:password])\n end", "def match_password(login_password=\"\")\n password == BCrypt::Engine.hash_secret(login_password, salt)\n end", "def authenticate password\n hash = BCrypt::Engine.hash_secret password, password_salt\n hash == password_hash\n end", "def auth_pass(password)\n BCrypt::Password.create(password) == self.hash_pass\n end", "def password_match? password\n\t\tBCrypt::Password.new(@password) == password\n\tend", "def hasSamePassword?(submittedPassword)\n encrypted_password == encryptUsingSalt(submittedPassword)\n end", "def validate_password(email, password)\n password_for_email = $db.execute(\"SELECT password_digest FROM users WHERE email = ?\", email)[0][\"password_digest\"]\n p \"validating password\"\n if BCrypt::Password.new(password_for_email) == password\n p \"password match\"\n return true\n else\n p \"password not match\"\n return false\n end\nend", "def cdb_verify_password(given_password)\n encrypt_password(given_password) == @password\n end", "def authenticate(user, password)\n salt = user.password_salt \n\n hash = PBKDF2.new do |p|\n p.password = password.unpack(\"B*\").first\n p.salt = salt\n p.iterations = 10000\n end\n\n pass_hash = hash.hex_string\n \n pass_hash == user.password_hash \n end", "def has_password?( submitted_password )\n encrypted_password == encrypt( submitted_password )\n end", "def authenticate(password)\n BCrypt::Password.new(self.password_digest) == password\n end", "def matches_password(login_password)\n passhash == BCrypt::Engine.hash_secret(login_password, salt)\n end", "def password_check\n return self.encrypted_password==BCrypt::Engine.hash_secret(self.password_verify, self.salt)\n end", "def passwords_match?\n context.user.password == context.password\n end", "def has_password?(password)\n encrypted_password == encrypt(password)\n end", "def has_password?(submitted_password)\n\tpassword == encrypt(submitted_password) \n end", "def has_password?(submitted_password)\n self.password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def match_password_hash\n\n evaluated_password_e = Admin.get_encrypted_password(@password, @login_salt_d)\n return incorrect_login_error('am_l_pa_5') unless (evaluated_password_e == @admin.password)\n\n success\n end", "def has_password?(submitted_password)\r\n encrypted_password == encrypt(submitted_password)\r\n end", "def check_password(password, hash)\n BCrypt::Password.new(hash) == password\n end", "def has_password?(password_soumis)\n # Compare encrypted_password avec la version cryptée de password_soumis.\n encrypted_password == encrypt(password_soumis)\n end", "def valid_password?(plain)\n password == hash_crypt(plain.to_s) \n end", "def password_match?(entered_password = '')\n password == User.hash_with_salt(entered_password, salt)\n end", "def has_password?(submitted_password)\n # Return true if the user's password matches the submitted password.\n # Compare encrypted_password with the encrypted version of submitted_password\n encrypted_password == encrypt(submitted_password) \n end", "def validate_password(challenge)\n actual = BCrypt::Password.new(password_digest)\n actual == challenge\n end", "def check_password(password_provided)\n BCrypt::Engine.hash_secret(password_provided, self.password_salt) == self.password\n end", "def password_match?( password=\"\")\n hashedPassword == Admin.hash_with_salt(password, salt)\n end", "def has_password?(submitted_password)\n # compare encrypted_password with the encrypted version of submitted_password\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n #compare encrypted_password with the encrypted version of submitted password.\n password == submitted_password\n end", "def has_password?(a_password)\n self.encrypted_password == encrypt(a_password)\n end", "def has_password?(submitted_password)\n self.encrypted_password == encrypt(submitted_password)\n end", "def has_password?(password_soumis)\n\t\t# Compare encrypted_password avec la version cryptée de password_soumis.\n encrypted_password == encrypt(password_soumis)\n end", "def valid_password?(password, encrypted_password)\n\treturn false if encrypted_password.blank?\n\tbcrypt = ::BCrypt::Password.new(encrypted_password)\n pepper = \"39dd46bfe0dee2d2f5b98862b6b8bf24b736ee877efd5df95f48cf6ca5310b72d267f216d6138684de626297f2927ed7e99106058013e5d66d0b8ff3af8a234a\"\n\tpassword1 = ::BCrypt::Engine.hash_secret(\"#{password}#{pepper}\", bcrypt.salt)\n\tputs password1\n\tpassword = ::BCrypt::Engine.hash_secret(\"#{password}#{SecureRandom.hex(64)}\", bcrypt.salt)\n\tputs password\n\tputs encrypted_password\n\tstr = [password, nil].flatten.compact.join\n\tsecure_compare(Digest::MD5.hexdigest(str), encrypted_password)\n end", "def compare(crypted_string, plain_string)\n BCrypt::Password.new(crypted_string).is_password?(plain_string)\n rescue BCrypt::Errors::InvalidHash\n false\n end", "def has_password?(submitted_password)\n\tencrypted_password == encrypt(submitted_password)\nend", "def is_password?(password)\n BCrypt::Password.new(self.password_digest) == password\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n #Compare encrypted_password with the encrypted version of \n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end", "def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end", "def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end", "def login(try_password)\n pass = Password.new(self.password.encode('ascii-8bit'))\n return pass == try_password\n end", "def has_password?(submitted_password)\n # compare encrypted_password with the encrypted version of\n # the submitted password.\n\tencrypted_password == encrypt(submitted_password)\n end", "def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end", "def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end", "def has_password?(submitted_password)\n # Compare encrypted password with the encrypted version of\n # Submitted password\n encrypted_password == encrypt(submitted_password)\n end", "def password_match?\n self.password == self.password_confirmation\n end", "def authenticate password\n if self.password == password\n true\n else\n false\n end\n end", "def valid_password?(password); end", "def check(creds)\n creds[1].crypt(password) == password\n end", "def authenticate(password)\n\t\t# If the hashed version of the password matches what's in the database, it's valid\n\t\tif BCrypt::Password.new(self.password_digest) == password\n\t\t\treturn true\n\t\telse \n\t\t\treturn false\n\t\tend\n\tend", "def match_password_basic(p)\n puts \"p: #{p}\"\n puts \"password: #{password}\"\n p == password\n end", "def authenticated?(pass)\n encrypted_password == User.encrypt(pass, salt)\n end", "def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n\t encrypted_password == encrypt(submitted_password)\n end", "def valid_pass?(test_pass)\n Encrypt::Password.validatePassword test_pass, password\n end", "def authenticates?(password)\r\n self.password == Crypto::digest(password)\r\n end", "def authenticate(password)\n hashed_password == BCrypt::Engine.hash_secret(password, salt)\n end", "def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end", "def has_password?(submitted_password)\n # Compare encrypted_password with the encrypted version of\n # submitted_password.\n encrypted_password == encrypt(submitted_password)\n end", "def password_is?(password)\n ENCRYPT.hexdigest(password + self.salt) == self.encrypted_password\n end", "def authenticate(unencrypted_password)\n logger.debug(unencrypted_password)\n logger.debug(self)\n if BCrypt::Password.new(self.password_digest) == unencrypted_password\n \t return self\n else\n return false\n end\n end", "def check_password(password)\n return false unless key\n key == self.class.hash_password(password, key.split('|', 2).first)\n end", "def authenticated?(password)\n crypted_password == encrypt(password)\n end", "def has_password?(submitted_password)\n\t # Compare encrypted_password with the encrypted version of\n\t # submitted_password.\n\t encrypted_password == encrypt(submitted_password)\n\tend", "def has_password? (submitted_password)\n password_digest == encrypt(submitted_password)\n end", "def authenticate_with_password(plain_password)\n ::Challah::Encrypter.compare(self.crypted_password, plain_password)\n end", "def authenticate(test_password)\n if BCrypt::Password.new(self.password_digest) == test_password\n self\n else\n false\n end\n end", "def authenticated?(password)\n self.hashed_password == encrypt(password)\n end", "def is_valid_password?(password)\n\t\tself.password == BCrypt::Engine.hash_secret(password, self.password)\n\tend", "def valid_password?(pass)\n crypted = send(sorcery_config.crypted_password_attribute_name)\n return crypted == pass if sorcery_config.encryption_provider.nil?\n\n # Ensure encryption provider is using configured values\n self.class.set_encryption_attributes\n\n salt = send(sorcery_config.salt_attribute_name) unless sorcery_config.salt_attribute_name.nil?\n\n sorcery_config.encryption_provider.matches?(crypted, pass, salt)\n end", "def authenticated?(password)\n self.crypted_password == self.encrypt(password)\n end", "def login_verification(params_username, params_password) \n db = connect_to_database()\n database_info = db.execute(\"SELECT Username, Password, UserId FROM users WHERE users.Username = ?\", params_username)\n if database_info.length > 0 && BCrypt::Password.new(database_info.first[\"Password\"]) == params_password\n return true \n else\n return false\n end\n end", "def hasPassword?(passwordSoumis)\n\t\tself.encrypted_password == encrypt(passwordSoumis)\n\tend", "def check_password(pass)\n hash = calc_hash(pass)\n\n return false if hash.nil?\n crypt_pass == hash\n end" ]
[ "0.81973064", "0.8186958", "0.81193477", "0.8045274", "0.79478693", "0.78901684", "0.78633374", "0.7793813", "0.778", "0.76952785", "0.768267", "0.7624168", "0.75777113", "0.7572018", "0.7538334", "0.7532243", "0.749292", "0.74659896", "0.7433297", "0.74236596", "0.7398034", "0.73956525", "0.73956525", "0.7392501", "0.7367717", "0.7367717", "0.7367717", "0.7367717", "0.7367717", "0.7367717", "0.7367717", "0.7367717", "0.7367717", "0.7367717", "0.7367717", "0.7367717", "0.7367717", "0.7361623", "0.73559225", "0.7354617", "0.73335403", "0.732096", "0.7313506", "0.7308936", "0.727998", "0.72790694", "0.72783375", "0.7276813", "0.7265134", "0.7263121", "0.72601175", "0.7246662", "0.7239829", "0.7239257", "0.72328013", "0.72219694", "0.7216724", "0.7213453", "0.7213453", "0.7196881", "0.719401", "0.719401", "0.7192706", "0.71866745", "0.7163093", "0.7163093", "0.71622837", "0.71605694", "0.7159106", "0.7151664", "0.7135567", "0.7130339", "0.71239996", "0.7122949", "0.71159655", "0.7115282", "0.7096136", "0.70874673", "0.70786446", "0.70786446", "0.70786446", "0.70786446", "0.70786446", "0.70786446", "0.70786446", "0.707841", "0.7062348", "0.70593023", "0.70548785", "0.705114", "0.70249814", "0.7021872", "0.70167136", "0.7012069", "0.69988036", "0.6998777", "0.699679", "0.699292", "0.6967077", "0.6966444" ]
0.71865535
64
Scopes a block to the user's profile locale
def with_user_locale raise "No block given" unless block_given? begin tmp_locale = I18n.locale I18n.locale = profile.language yield ensure I18n.locale = tmp_locale end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locale(locale, &block)\n scope :locale => locale, &block\n end", "def l_scope(*sections, &block)\r\n ArkanisDevelopment::SimpleLocalization::Language.with_app_scope(*sections, &block)\r\n end", "def scope(&block)\n Videojuicer.enter_scope local_config\n block_out = block.call(Videojuicer.current_scope)\n Videojuicer.exit_scope\n return block_out\n end", "def localized\n redirect_to user_omniauth_authorize_path(params[:provider], locale: params[:locale])\n end", "def scope_by(&block)\n raise 'Cannot define scope after scope has been called.' if @scope\n\n @scope_block = block\n end", "def scope(scope, &block)\n @scopes[scope] ||= []\n @scopes[scope] << block\n end", "def user_time_zone(&block)\n Time.use_zone(current_user.time_zone, &block)\n end", "def user_time_zone(&block)\n Time.use_zone(current_user.time_zone, &block)\n end", "def scope_current_tenant &block\n if current_user\n current_user.create_tenant # make sure there is a tenant\n \n current_tenant.scope_schema &block\n else\n yield\n end\n end", "def blocked\n @user = current_user\n @blockedUsers = current_user.blocks\n\n end", "def ckeditor_filebrowser_scope(options = {})\n super({ :assetable_id => current_user.id, :assetable_type => 'User' }\n .merge(options))\n end", "def block\n if current_user.has_role?(:district)\n district = Admin::District.find_by_district_name(current_user.district_name)\n @blocks = Admin::Block.find_all_by_district_id(district)\n else\n \n end\n end", "def block!\n self.blocked = Time.now\n self.save\n Token.block_access!(client_uri, resource_owner_uri)\n Authorization.block_access!(client_uri, resource_owner_uri)\n end", "def scope\n Pundit.policy_scope!(user, record.class)\n end", "def user_timezone(&block)\n return yield unless current_user\n\n Time.use_zone(current_user.timezone, &block)\n end", "def current_user_scope\n current_user\n end", "def locale_scope\n I18n::Scope.new(locale_translations)\n end", "def with_tenant(tenant, &block)\n Multitenant.current_tenant = tenant\n Multitenant.in_block = true\n save_and_change_default_scope_for_all\n yield\n ensure\n restore_default_scope\n Multitenant.in_block = false\n Multitenant.current_tenant = nil\n end", "def scope(*args, &block)\n options = if args.last.is_a?(Hash)\n args.pop\n else\n {}\n end\n \n #\n # set locale\n if locale = options[:locale]\n old_locale = self.current_locale\n self.current_locale = if I18n.backend.available_locales.include?(locale = locale.to_sym)\n locale\n else\n base\n end\n end\n\n #\n # set format\n if format = options[:format]\n old_format = self.current_format\n self.current_format = format\n end\n\n #\n # adjust scope (from the remaining arguments)\n current_scope.push(*args)\n\n yield\n ensure\n current_scope.pop(*args)\n self.current_format = old_format if old_format\n self.current_locale = old_locale if old_locale\n end", "def read_scope(user)\n self\n end", "def regulate_scope(name, &block)\n name, block = __synchromesh_parse_regulator_params(name, block)\n singleton_class.send(:define_method, :\"__secure_remote_access_to_#{name}\") do |this, acting_user, *args|\n r = this.send(name, *args)\n r = ReactiveRecordPsuedoRelationArray.new(r) if r.is_a? Array\n __set_synchromesh_permission_granted(this, r, r, acting_user, args, &block)\n end\n end", "def scope(*)\n self['scope'] || self['current_account'].travel_plans\n end", "def add_block\n @user = User.current\n @user.pref.add_block params[:block]\n @user.pref.save\n redirect_to my_page_layout_path\n end", "def blocked\n @user = User.find(params[:id])\n @user.block!\n redirect_to dashboard_listing_path\n end", "def scope_callback(block, scope=nil)\n scope ? lambda { send(scope).instance_eval(&block) } : block\n end", "def set_time_zone(&block)\n time_zone = if user_signed_in?\n current_user.user_location.try(:time_zone) || 'UTC'\n else\n 'UTC'\n end\n Time.use_zone(time_zone, &block)\n end", "def activate\n Layout.send :is_site_scoped, :shareable => true\n Snippet.send :is_site_scoped, :shareable => true\n User.send :is_site_scoped, :shareable => true\n ApplicationHelper.send :include, ScopedHelper\n \n unless admin.users.edit.form && admin.users.edit.form.include?('choose_site')\n admin.users.edit.add :form, \"choose_site\", :after => \"edit_roles\" \n admin.layouts.edit.add :form, \"choose_site\", :before => \"edit_timestamp\" \n admin.snippets.edit.add :form, \"choose_site\", :before => \"edit_filter\" \n end\n end", "def policy_scopes; end", "def downgrade_scopes!\n return unless Feature.enabled?(:omniauth_login_minimal_scopes, current_user,\n default_enabled: :yaml)\n\n auth_type = params.delete('gl_auth_type')\n return unless auth_type == 'login'\n\n ensure_read_user_scope!\n\n params['scope'] = Gitlab::Auth::READ_USER_SCOPE.to_s if application_has_read_user_scope?\n end", "def authenticate_scope!\r\n send(:\"authenticate_user!\", :force => true)\r\n self.resource = send(:\"current_user\")\r\n end", "def scope\n return super if spree_current_user.present?\n\n super(skip_cancancan: true)\n end", "def block_user\n SecurityService.block_user(params[:id])\n redirect_to '/users/', notice: \"Käyttäjä ei voi enää luoda kursseja.\"\n end", "def show\n authorize! :read, @admin_language_code\n end", "def block_user\n current_user.block_user!(params[:user_id])\n redirect_to :back, notice: \"#{User.find(params[:user_id]).full_name(false)} has been successfully blocked\"\n end", "def current_user\n scope == object\n end", "def blocked_user\n is_blocked = false \n\n if params[:id]\n @user = User.find(params[:id])\n\n for r in current_user.inverse_relationships\n if r.usergroup.name == \"Blocked Users\" && r.user.id == @user.id \n is_blocked = true \n break \n end \n end \n end\n\n if is_blocked\n flash[:info] = \"This user has chosen to keep their profile hidden.\"\n redirect_to login_path \n end \n end", "def block\n current_user.block_user(@user.id)\n render json: {ok: 1}\n end", "def scope_to(*args, &block)\n config.scope_to(*args, &block)\n end", "def show\n session[:return_to] = request.referer\n authorize @profile\n end", "def block!\n self.update_attribute(:status, ConfigCenter::User::BLOCKED)\n end", "def try_to_set_scope\n #this is a commodity method\n if self.featurable.is_a?(Account)\n self.scope = \"AccountPlan\"\n end\n end", "def authenticate_scope!\r\n send(:\"authenticate_#{resource_name}!\")\r\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\r\n end", "def authenticate_scope!\n super\n end", "def auth_options\n { scope: resource_name }\n end", "def devise_scope(scope); end", "def show\n @profile=Profile.find(params[:id])\n authorize @profile\n #@profile=Profile.where(user==current_user)\n\n\n #authorize @profile\n\n #scope.where(:id => profile.id).exists?\n\n end", "def users_that_can_read_personal_snippet(users, snippet)\n DeclarativePolicy.subject_scope do\n users.select { |u| allowed?(u, :read_snippet, snippet) }\n end\n end", "def admin_area &block\n capture(&block) if current_user && current_user.admin?\n end", "def show\n authorize RoleCutoff\n end", "def show\n authorize @user # Can only see your own profile\n end", "def user_consenting; end", "def set_users_block\n @users_block = Block.find_by(id_params)\n end", "def set_locale\n I18n.locale = access_control.user.locale\n end", "def block\n #first pause those subscriptions as those will be reactivated once customer alters his payment details.\n @my_subscription.cancel_or_pause_subscription(\"paused\")\n #now, mark those subscription blocked.\n @my_subscription.block_subscription\n\n flash[:sub_cancelled] = \"#{@my_subscription.id} subscription has been paused \"\n redirect_to main_app.profile_users_path and return\n end", "def show\n authorize @client_profile\n end", "def consent_eng\n @consent_eng ||= Participants::Consent.new(locale: 'english')\nend", "def authenticated_only(&block)\n if logged_in?\n block.call\n end\n end", "def authenticated_only(&block)\n if logged_in?\n block.call\n end\n end", "def configure(&block)\n block.call @locale\n end", "def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\")\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\n end", "def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\")\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\n end", "def permissions_policy(&block); end", "def to_user_tz(&block)\n Time.use_zone(current_user.time_zone, &block)\n end", "def anonymous_only(&block)\n if !logged_in?\n block.call\n end\n end", "def authorize_user\n @profile = current_user.profile\n return if @profile\n flash[:alert] = \"You can only edit your own profile\"\n redirect_to profile_path\n end", "def show\n authorize @place\n end", "def show\n authorize HigherEducationInstitution\n end", "def index\n @users_blocks = Block.all.where(user_id: current_user.id)\n end", "def user_language\n USER_LANGUAGE[spoken_language]\n end", "def profile\n authorize @profile\n end", "def use_named_scope(&block)\n lang_eval { @use_named_scope_block = block }\n nil\n end", "def user_consenting=(_arg0); end", "def show?\n @current_user.permission('Currency', :guest)\n end", "def current_scope\n params[:scope].try(:to_sym) || railgun_resource.default_scope.try(:key)\n end", "def set_profile\n @profile = current_user\n end", "def show\n authorize @organization_profile\n end", "def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end", "def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end", "def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end", "def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end", "def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end", "def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end", "def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end", "def log_in(user)\n old_scoped_user = @@scoped_user\n @@scoped_user = user\n return if !block_given?\n yield\n @@scoped_user = old_scoped_user\n end", "def translation_scope\n \"devise.#{controller_name}\"\n end", "def in_scope(scope)\n cur_scope = @scope\n @scope = scope\n yield\n ensure\n @scope = cur_scope\n end", "def i18n_scope\n self.class.i18n_scope\n end", "def i18n_scope\n self.class.i18n_scope\n end", "def scope_langs\n if params[:language_id].present?\n langs_scope = []\n langs_scope << \"langs.language_id = #{params[:language_id]}\"\n langs_condition = \"SELECT user_id FROM langs WHERE #{langs_scope.join('AND')}\"\n @users = @users.where(\"users.id IN (#{langs_condition})\")\n end\n end", "def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end", "def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end", "def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end", "def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end", "def profile_show\n @user = User.find(current_user.id)\n\n $admin = User.where(\"admin = ? AND signed_in = ?\", true, true).first\n if $admin.nil?\n $admin = User.where(\"admin = ?\", true).first\n end\n $conversation = Conversation.between(current_user.id,$admin.id).first\n if $conversation.nil?\n $conversation = Conversation.create(sender_id: current_user.id, recipient_id: $admin.id)\n end\n gon.open = $conversation.open\n end", "def user_shares\n policy_scope(current_user.shares).kept\n end", "def current_user_method(&block)\n @current_user = block if block\n @current_user || DEFAULT_CURRENT_USER\n end", "def show\n # @blockers = @session.blockers\n end", "def scope &block\n env.scope(&block)\n end", "def scope &block\n env.scope(&block)\n end", "def scope &block\n env.scope(&block)\n end" ]
[ "0.6205569", "0.57523596", "0.5596278", "0.5557078", "0.5486455", "0.53251946", "0.52780575", "0.52779925", "0.52670324", "0.52548236", "0.5240761", "0.5231338", "0.5229526", "0.52157927", "0.5202352", "0.5182616", "0.5159665", "0.51307464", "0.5128995", "0.51274276", "0.5125005", "0.51249206", "0.51146203", "0.50954247", "0.5086797", "0.5078152", "0.5077374", "0.50676715", "0.5039396", "0.5035488", "0.501621", "0.50023454", "0.49895516", "0.49865118", "0.49762738", "0.49689907", "0.49672577", "0.4966655", "0.4950363", "0.49438992", "0.49415928", "0.49314466", "0.49219045", "0.49218643", "0.4892898", "0.48896676", "0.4874406", "0.4872928", "0.4865643", "0.48654172", "0.48623866", "0.48502573", "0.4849529", "0.48450842", "0.4840508", "0.48238418", "0.48237428", "0.48237428", "0.48084202", "0.47850764", "0.47850764", "0.47800165", "0.47692642", "0.47666502", "0.47580668", "0.47548085", "0.47435036", "0.47411996", "0.4740513", "0.47365388", "0.47358605", "0.47314602", "0.4730408", "0.4728235", "0.47151008", "0.47083196", "0.47068593", "0.47068593", "0.47068593", "0.47068593", "0.47068593", "0.47068593", "0.47068593", "0.47054794", "0.47036588", "0.47029915", "0.4701421", "0.4701421", "0.46992737", "0.46992162", "0.46992162", "0.46992162", "0.46992162", "0.46968418", "0.46889946", "0.46866676", "0.46832743", "0.46792078", "0.46792078", "0.46792078" ]
0.58253735
1
The name of the field.
def name @gapi.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_name\n @field.name\n end", "def field_name\r\n @field_name ||= begin\r\n %r/(\\w+)Field$/.match(name)[1]\r\n rescue\r\n %r/(\\w+)$/.match(name)[1]\r\n end\r\n end", "def name(value = nil)\n if value\n field_type.name(value)\n else\n # Return the name of the field\n @name\n end\n end", "def get_field_name\n\t\tend", "def field_name\n @gapi.field_name\n end", "def field_name\n self.class.name.split(\"::\").last.downcase.sub(\"of\", \"_of_\"). \\\n sub(\"field\", \"\").downcase\n end", "def field name\n @fields[name]\n end", "def field\n @field ||= quoted_field(field_name)\n end", "def get_field_name(options)\r\n field_name = options[:field_name]\r\n\r\n field_name\r\n end", "def field(name)\n attr_accessor name\n end", "def field_name(field=nil)\n result = field_name_fragment\n result << \"[#{field}]\" if field\n result\n end", "def field\n @field ||= @options.fetch(:field, repository.adapter.field_naming_convention.call(name))\n end", "def field\n raise \"Replace #field with the ElasticSearch field name\"\n end", "def get_field(name)\n self[name]\n end", "def name\n @_name\n end", "def field_name(ind)\n IBM_DB.field_name(@stmt, ind)\n end", "def name\n self[:name]\n end", "def name\n @name.to_s\n end", "def name\n @name.to_s\n end", "def get_field(field_name)\n\t\tend", "def name\n @attribute.name\n end", "def name\n self[ :name ]\n end", "def name\n attrs[:name]\n end", "def contact_field_name(contact_field)\n contact_field_translations[contact_field]\n end", "def name\n self.general_fields.where(fieldable_id: self.id).where(\"payload->>'key' = 'name'\").first.value\n end", "def field(name); end", "def attribute_field_name(attr)\n attr.to_s.camelize(:lower)\n end", "def getName()\n\t\t\treturn @_name\n\t\tend", "def name\n @name\n end", "def name\n read_attr :name\n end", "def name\n @name\n end", "def field_name\n return nil if virtual?\n @field_name ||= column ? quoted_field_name(column.name) : association.foreign_key\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n attributes.fetch(:name)\n end", "def field_name\n self.well_info.field_name\n end", "def to_field_name(name)\n # camelize strips leading underscores, which is undesirable.\n if name.to_s.starts_with?('_')\n \"_#{to_field_name(name.to_s[1..-1])}\"\n elsif Rails.config.camel_case\n name.to_s.camelize(:lower)\n else\n name.to_s\n end\n end", "def dynamic_custom_field_class_name(name)\n \"#{self.name}#{name.to_s.singularize.camelize}Field\"\n end", "def update_field_name\n self.field = field_name\n end", "def name\n return @name\n end", "def name()\n return @name\n end", "def name\n @custom_name || @attribute.to_s.humanize\n end", "def get_name\n @name\n end", "def name\n @attributes[:name]\n end", "def name\n\t\treturn @name\n\tend", "def name\n self[:Name]\n end", "def name\r\n @name\r\n end", "def get_name\r\n self.name\r\n end", "def ___name\n @name\n end", "def get_name\n return @m_name\n end", "def get_name\n return @m_name\n end", "def get_name\n return @m_name\n end", "def get_name\n return @m_name\n end", "def name\n @attributes[:name]\n end", "def name\n @attributes[:name]\n end", "def name\n @attributes[:name]\n end", "def name\n @attributes[:name]\n end", "def name\n\t\t\t\"#{self.nameFirst} #{self.nameLast}\"\n\t\tend", "def get_name\n\t\treturn @name\n\tend", "def get_name\n\t\treturn @name\n\tend", "def get_name\n\t\treturn @name\n\tend", "def field_named(name)\n ensure_setup!\n field_set.field_named(name)\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n value\n end", "def html_input_name\n if path?\n return \"path_\" + @name\n else\n return \"field_\" + @name\n end\n end", "def name_value\n send(self.class.name_attribute)\n end", "def define_field_name(field)\n (field.to_s + '_field').to_sym.tap do |field_method_name|\n field_method_names << field_method_name\n end\n end", "def choice_field_name(value)\n \"#{name}___#{value}\"\n end", "def getName\r\n\t\t\t\t\treturn @name\r\n\t\t\t\tend" ]
[ "0.8847835", "0.838569", "0.8138121", "0.8100964", "0.80348366", "0.7827843", "0.7800643", "0.77403957", "0.75374365", "0.7532276", "0.7502172", "0.73982644", "0.73238385", "0.7297759", "0.72744876", "0.7261315", "0.7189371", "0.7185839", "0.7185839", "0.7181642", "0.71790195", "0.7171417", "0.7142315", "0.7127758", "0.71082056", "0.70694166", "0.7062575", "0.7062014", "0.7055769", "0.70529217", "0.70331323", "0.70292556", "0.7022988", "0.7022988", "0.7022988", "0.7022988", "0.7022988", "0.7022988", "0.7022988", "0.7022988", "0.701668", "0.7010802", "0.7010802", "0.7010802", "0.7010802", "0.7010802", "0.7010802", "0.7010802", "0.7010802", "0.7010802", "0.7010802", "0.7010802", "0.7010802", "0.7010802", "0.7010802", "0.7010802", "0.7010802", "0.7010802", "0.6991155", "0.69902456", "0.6990037", "0.6981715", "0.69668907", "0.6963771", "0.6959041", "0.69515294", "0.6951479", "0.6951057", "0.69470894", "0.6945441", "0.6931149", "0.692455", "0.69206756", "0.69179535", "0.69179535", "0.69179535", "0.69179535", "0.6893644", "0.6893644", "0.6893644", "0.6893644", "0.68928707", "0.68829215", "0.68829215", "0.68829215", "0.6876783", "0.6876765", "0.6876765", "0.6876765", "0.6876765", "0.6876765", "0.6876765", "0.6876765", "0.6876765", "0.6876765", "0.68639004", "0.6862884", "0.6858177", "0.68530357", "0.6851985", "0.6839195" ]
0.0
-1
Updates the name of the field.
def name= new_name @gapi.update! name: String(new_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_field_name\n self.field = field_name\n end", "def field_name= new_field_name\n frozen_check!\n @gapi.field_name = new_field_name\n end", "def new_name(new_name)\n @name = new_name\n end", "def name_setter(new_name)\n @name = new_name\n end", "def name=(name)\n\t\t@new_name = name\n\tend", "def name=(new_name)\n if new_name != self.name\n self.old_name = self.name\n self.write_attribute(:name, new_name)\n end\n end", "def name=(name)\n @name = (name)\n unless parameters.has_key?(:field)\n parameters[:field] = name\n end\n end", "def name=(new_name)\n\t\t@name = new_name\n\tend", "def update_name=(new_name)\n name_element.click\n self.text_field(:id=>\"entity_name_text\").set new_name + \"\\n\"\n end", "def change_name(field, new_name)\n CONNECTION.execute(\"UPDATE #{table_name} SET #{field} = '#{new_name}' WHERE id = #{@id};\")\n end", "def name=(value)\n @name = value.to_s\n end", "def name=(new_name)\n @name = new_name\n end", "def name=(new_name)\n @name = new_name\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def name=(name)\n @name = name.to_s\n end", "def name=(name)\n @name = name.to_s\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def name=(new_name)\n @name = new_name\n end", "def name=(new_name)\n @name = new_name\n end", "def name=(new_name)\n @name = new_name\n end", "def name=(value)\n self.shortname = conform_name_to_shortname(value)\n write_attribute(:name, value)\n end", "def name=(value)\n self.shortname = conform_name_to_shortname(value)\n write_attribute(:name, value)\n end", "def name=(value)\n self.shortname = conform_name_to_shortname(value)\n write_attribute(:name,value)\n end", "def name=(value)\n self.shortname = conform_name_to_shortname(value)\n write_attribute(:name,value)\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value.to_s.strip\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def set_NewName(value)\n set_input(\"NewName\", value)\n end", "def set_NewName(value)\n set_input(\"NewName\", value)\n end", "def name(value)\n model.name = value\n end", "def name(value)\n model.name = value\n end", "def set_name\n self.update(name: \"Large Washer ##{self.id}\") unless self.name\n end", "def set_name\n self.update(name: \"Medium Washer ##{self.id}\") unless self.name\n end", "def name= (new_name)\n @name = new_name\n end", "def change_name=(name)\n @name = name\n end", "def name=(new_name)\n @name=new_name\n end", "def name=(val)\n @name = val\n end", "def name=(val)\n @name = val\n end", "def name=(val)\n self['name'] = val\n end", "def name=(new_name) \n @name = new_name\n end", "def name=(value)\n @name = attributes[:name] = value\n end", "def field(name)\n attr_accessor name\n end", "def update_event_name\n new_name = self.class.prompt.ask(\"New event name:\")\n self.update(name: new_name)\n end", "def name_setter\n @name\n end", "def name=(name)\r\n @name = name.capitalize\r\n end", "def on_name_changed(new_name:, **)\n @name = new_name\n end", "def set_name(name)\n @name = name\n end", "def name= new_name\n @name = new_name\n end", "def append_name\n self.name = self.content\n end", "def name=(val)\n self[:name] = val\n end", "def rename_field(old_key, new_key)\n pdf_field(old_key).setFieldName(new_key.to_s)\n end", "def name= new_name\n patch_gapi! name: new_name\n end", "def update_name(new_name)\n self.update(name: new_name)\n self\n puts \"Your username has been updated.\".colorize(:magenta)\n end", "def setName(n)\n @name = n\n end", "def name=(name)\n @name ||= name.to_s\n end", "def change_name(name)\n self.change_all_attribute(name, 'name')\n end", "def rename new_name\n @name = new_name.to_sym\n end", "def rename new_name\n @name = new_name.to_sym\n end", "def update_research_name\n res_name = I18n.transliterate(Tag.sanitize_name(self.name)).to_s\n self.update_column(:research_name, res_name)\n end", "def name=(new_name)\n write_attribute(:name, EventType.event_name_formatter(new_name))\n end", "def name=(new_name)\n changeset.append(:name_changed, old_name: @name, new_name: new_name)\n end", "def name=(_name)\n write_attribute(:name, _name.strip)\n end", "def change_item_name(new_name:, **)\n self.name = new_name # This will generate the event!\n end", "def name=(value)\n client.put(path, { :name => value })\n self.data['name'] = value\n end", "def _name ( name )\n @name = name.to_s\n return self\n end", "def name=(value)\n @name = value.to_sym\n end", "def update_name\n # update the name so it includes the standard_template string\n name_array = [@standard_template]\n name_array << get_building_type\n @building_sections.each do |bld_tp|\n name_array << bld_tp.standards_building_type\n end\n name_array << @name if !@name.nil? && !@name == ''\n @name = name_array.join('|').to_s\n end", "def name=(s)\n write_attribute(:name, s.to_s.titleize)\n end" ]
[ "0.85042167", "0.7981409", "0.7337001", "0.7323985", "0.72800684", "0.7256678", "0.7232134", "0.7095701", "0.7082548", "0.70709884", "0.70659924", "0.7044868", "0.7044868", "0.7011498", "0.7011498", "0.7011498", "0.7011498", "0.7011498", "0.7011498", "0.7011498", "0.7011498", "0.6938709", "0.6938553", "0.6938553", "0.6938553", "0.69380605", "0.69380605", "0.69380605", "0.69380605", "0.69327223", "0.69327223", "0.69297695", "0.69174623", "0.69174623", "0.6915712", "0.69123954", "0.69123954", "0.6911267", "0.6911267", "0.69071966", "0.69071966", "0.69071966", "0.69071966", "0.69071966", "0.69071966", "0.69071966", "0.69071966", "0.69071966", "0.69071966", "0.69071966", "0.69071966", "0.69071966", "0.69071966", "0.69071966", "0.69071966", "0.69071966", "0.68985254", "0.6894406", "0.6894406", "0.6887231", "0.6887231", "0.6864326", "0.6864326", "0.6852921", "0.6849584", "0.68486196", "0.68276376", "0.6824647", "0.68062365", "0.6801827", "0.6788401", "0.67871463", "0.678256", "0.67711985", "0.6762826", "0.6745244", "0.6744635", "0.6735037", "0.67248267", "0.67187196", "0.6716306", "0.67150855", "0.67143166", "0.6711967", "0.67091537", "0.6703485", "0.67029744", "0.67013216", "0.66998976", "0.66998976", "0.66993195", "0.6695842", "0.66858757", "0.666451", "0.6662869", "0.66455054", "0.6638275", "0.66375554", "0.6609395", "0.6609328" ]
0.7228612
7
The data type of the field.
def type @gapi.type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_type\n get_field_config['type']\n end", "def data_type\n if @data_type\n @data_type\n else\n (@is_string ? String : nil)\n end\n end", "def data_type\n return @data_type\n end", "def type\n field[:type]\n end", "def type\n data.type\n end", "def data_type\n MtkField.field_to_datatype(grid.file.file_name, grid.grid_name, field_name)\n end", "def data_type=(value)\n @data_type = value\n end", "def data_type\n\t\tend", "def get_field_type\n\t\tend", "def datatype\n @options[:datatype] || (@column ? @column.type : nil)\n end", "def determine_dataype(value)\n return validate_field(value)\n end", "def data_type\n @options[:data_type].presence\n end", "def data_type\n\tend", "def value_type\n return @value_type\n end", "def value_type\n @type.value_type\n end", "def field_type=(value)\n super(value.to_s)\n end", "def field_type(key)\n pdf_field(key).getFormType.toString\n end", "def schema_data_type\n case type\n when \"N\", \"F\"\n decimal > 0 ? \":float\" : \":integer\"\n when \"I\"\n \":integer\"\n when \"D\"\n \":date\"\n when \"T\"\n \":datetime\"\n when \"L\"\n \":boolean\"\n when \"M\"\n \":text\"\n else\n \":string, :limit => #{length}\"\n end\n end", "def field_type\n @field_type ||= FieldType.new(self, def_metadata[:field_type])\n end", "def field_type(key)\n IBM_DB.field_type(@stmt, key)\n end", "def deimos_field_type(schema_field)\n _field_type(schema_field.type)\n end", "def type\n @data['type']\n end", "def type\n @data['type']\n end", "def attribute_type\n (float? || integer? || text? || boolean? ? field_type : 'string').to_sym\n end", "def type\n\t\t\t@data[\"type\"]\n\t\tend", "def type\n raw_data['type']\n end", "def column_type\r\n @type\r\n end", "def _field_type(avro_schema)\n Deimos::SchemaBackends::AvroBase.field_type(avro_schema)\n end", "def get_field_type(field_name)\n\t\tend", "def get_field_class(value)\n case\n when value.is_a?(String)\n 'string'\n when value.is_a?(Integer)\n 'integer'\n when value.is_a?(Float)\n 'float'\n when value.is_a?(BigDecimal)\n 'decimal'\n when value.is_a?(DateTime)\n 'datetime'\n when value.is_a?(FalseClass) || value.is_a?(TrueClass)\n 'boolean'\n else\n raise FieldTypeError, 'Invalid field type.'\n end\n end", "def type=(val)\n\n dtype = val\n #return self if @chars_allowed # disallow changing\n # send in a regexp, we just save it.\n if dtype.is_a? Regexp \n @chars_allowed = dtype\n return self\n end\n dtype = dtype.to_s.downcase.to_sym if dtype.is_a? String\n case dtype # missing to_sym would have always failed due to to_s 2011-09-30 1.3.1\n when :integer, Integer\n @chars_allowed = /\\d/\n when :numeric, :float, Numeric, Float\n @chars_allowed = /[\\d\\.]/ \n when :alpha\n @chars_allowed = /[a-zA-Z]/ \n when :alnum\n @chars_allowed = /[a-zA-Z0-9]/ \n else\n raise ArgumentError, \"Field type: invalid datatype specified. Use :integer, :numeric, :float, :alpha, :alnum \"\n end\n self\n end", "def text_type\n return @text_type\n end", "def get_datatype(field)\n #Remove if field has any comma's for int and float rep\n if field != nil && field.class == String\n num = field.gsub(/,/,'')\n else\n num = field\n end\n if(Integer(num) rescue false)\n if num.class == Float\n return \"float\"\n end\n return \"int\"\n elsif(Float(num) rescue false)\n return \"float\"\n elsif(Date.parse(field) rescue false || Date.strptime(field, '%m/%d/%Y') rescue false || Date.strptime(field, '%m-%d-%Y') rescue false || Date.strptime(field, '%m %d %Y') rescue false)\n if datetime_pattern(field)\n if field =~ /:/ # To check if the field contains any pattern for Hours:minutes\n return \"datetime\"\n else\n return \"date\"\n end\n end\n end\n return \"string\"\n end", "def content_type\n @record.send( :\"#{@column}_content_type\" ) rescue ''\n end", "def type\n data['type'].to_sym\n end", "def type\n if validator_hash[:numericality] == true ||\n validator_hash[:numericality] == { allow_nil: true }\n 'Decimal'\n elsif validator_hash.dig(:numericality, :only_integer)\n 'Integer'\n elsif validator_hash[:ingested_date]\n 'Date'\n elsif validator_hash.dig(:case_insensitive_inclusion, :in) == %w[Y N]\n 'YesNo'\n elsif inclusion_list_with_lookup_values?(validator_hash.dig(:case_insensitive_inclusion, :in))\n attr.name.tr(' ', '')\n else\n 'String'\n end\n end", "def datatypes\n value.document.fetch(\"#{value.key}_type\", [])\n end", "def type\n @type.to_s\n end", "def get_datatype(field)\n #Remove if field has any comma's for int and float rep\n if field != nil && field.class == String\n num = field.gsub(/,/,'')\n else\n num = field\n end\n if(Integer(num) rescue false)\n if num.class == Float\n return \"float\"\n end\n return \"int\"\n elsif(Float(num) rescue false)\n return \"float\"\n elsif(Date.parse(field) or Date.strptime(field, '%m/%d/%Y') or Date.strptime(field, '%m-%d-%Y') or Date.strptime(field, '%m %d %Y') rescue false)\n if datetime_pattern(field)\n if field =~ /:/ # To check if the field contains any pattern for Hours:minutes\n return \"datetime\"\n else\n return \"date\"\n end\n end\n end\n return \"string\"\n end", "def datatype(value)\n _datatype(value) or fail ArgumentError, \"Unknown value for datatype: #{value}\"\n end", "def type\n attr_val('./@typeCode')\n end", "def type\n return @data.nm_dtype if dtype == :nmatrix\n\n if @type.nil? or @possibly_changed_type\n @type = :numeric\n self.each do |e|\n unless e.nil?\n unless e.is_a?(Numeric)\n @type = :object\n break\n end\n end\n end\n @possibly_changed_type = false\n end\n\n @type\n end", "def get_dataType(field_name)\n if(field_name.is_a? Array)\n firstKey = field_name.shift\n field_name.unshift(:default)\n field_name.unshift(firstKey)\n cursor = fields\n while(field_name.length > 0)\n nextKey = field_name.shift\n if((cursor.is_a?(Hash) && cursor.include?(nextKey)) || (cursor.is_a?(Array) && cursor.length > nextKey))\n cursor = cursor[nextKey]\n end\n end\n return(typeOf(cursor))\n else\n typeOf(fields[field_name.to_sym][:default])\n end\n end", "def text_type\n @@text_type_ord_to_text_type[self.text_type_ord]\n end", "def _type\n special_attribute('@type'.freeze)\n end", "def type\n @type\n end", "def data_match_field_type field\n\t\tfield = field.to_s\n\t\tif field[-2,2] == 'id'\n\t\t\ttype = Scfg[:field_number][0]\n\t\telsif Scfg[:field_fixnum].include? field\n\t\t\ttype = 'Fixnum'\n\t\telsif Scfg[:field_time].include? field\n\t\t\ttype = 'Time'\n\t\telse\n\t\t\ttype = 'String'\n\t\tend\n\t\ttype\n\tend", "def types\n FIELD_TYPES\n end", "def type *val\n return @chars_allowed if val.empty?\n\n dtype = val[0]\n #return self if @chars_allowed # disallow changing\n if dtype.is_a? Regexp \n @chars_allowed = dtype\n return self\n end\n dtype = dtype.to_s.downcase.to_sym if dtype.is_a? String\n case dtype # missing to_sym would have always failed due to to_s 2011-09-30 1.3.1\n when :integer, Integer\n @chars_allowed = /\\d/\n when :numeric, :float, Numeric, Float\n @chars_allowed = /[\\d\\.]/ \n when :alpha\n @chars_allowed = /[a-zA-Z]/ \n when :alnum\n @chars_allowed = /[a-zA-Z0-9]/ \n else\n raise ArgumentError, \"Field type: invalid datatype specified. Use :integer, :numeric, :float, :alpha, :alnum \"\n end\n self\n end", "def type\n @type\n end", "def type\n @type\n end", "def type\n @type\n end", "def type\n @type\n end", "def type\n self.class.type_to_string(self)\n end", "def type\n return @type\n end", "def type\n return @type\n end", "def type\n return @type\n end", "def type\n return @type\n end", "def type\n return @type\n end", "def type\n return @type\n end", "def type\n return @type\n end", "def field_types\r\n return @field_types\r\n end", "def value_type=(value)\n @value_type = value\n end", "def is_datatype?(); @type == GRT_DATATYPE; end", "def get_data_type(data) # :nodoc:\n # Check for no data in the series.\n return 'none' unless data\n return 'none' if data.empty?\n\n # If the token isn't a number assume it is a string.\n data.each do |token|\n next unless token\n return 'str' unless token.kind_of?(Numeric)\n end\n\n # The series data was all numeric.\n 'num'\n end", "def type\n self['TYPE'].to_i\n end", "def DataType()\r\n ret = _getproperty(1610743811, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def field_type\n if self.type == 'Button'\n if push_button?\n 'push_button'\n elsif radio_button?\n 'radio_button'\n else\n 'check_box'\n end\n elsif self.type == 'Text'\n if file?\n 'file_field'\n elsif password?\n 'password_field'\n elsif multiline?\n 'text_area'\n else\n 'text_field'\n end\n elsif self.type == 'Choice'\n 'select'\n else\n self.type.downcase\n end\n end", "def type\n @ar_column_info.type\n end", "def column_type\n class_name.columns_hash[@column.to_s].type\n end", "def type\n self[:type]\n end", "def value_types; end", "def type\n self[:type]\n end", "def notable_type_data\n notable_type\n end", "def get_data_type(data) # :nodoc:\n # Check for no data in the series.\n return 'none' unless data\n return 'none' if data.empty?\n return 'multi_str' if data.first.is_a?(Array)\n\n # If the token isn't a number assume it is a string.\n data.each do |token|\n next unless token\n return 'str' unless token.is_a?(Numeric)\n end\n\n # The series data was all numeric.\n 'num'\n end", "def presentation_type\n field_type.presentation_type\n end", "def field_type field\n case field\n when Symbol then members_types[field]\n # when Array\n # if field.length > 1 then members_types[field.first].field_type(field[1..-1])\n # else field_type field.first\n # end\n end\n end", "def elasticsearch_datatype\n case self\n when TextArea,TextField\n 'string'\n when IntegerField\n 'integer'\n when NumberField\n 'float'\n when BooleanField\n 'boolean'\n when DateField\n 'date'\n when AttachmentField\n 'attachment'\n when ArrayField\n 'string'\n else\n 'string'\n end\n end", "def value_field\n \"string\"\n end", "def type\n @type\n end", "def yaml_field_type name\n self.yaml_fields[name]\n end", "def column_type(type)\n case type\n when :integer then Integer\n when :float, :decimal then Float\n when :string, :text, :uuid then String\n when :datetime, :timestamp, :time then DateTime\n when :date then Date\n when :boolean then Virtus::Attribute::Boolean # Boolean is not a standard Ruby class\n else\n raise \"Could not match column type '#{type}' for #{model_name}\"\n end\n end", "def type\n return @type\n end", "def get_data_type_from_body(body)\n return nil unless body\n body['_data_type'] || body['type']\n end", "def data_type(data_type)\n state_depth_must_be(States::ATTRIBUTE)\n raise 'data_type already defined' if @current_attribute.data_type\n @current_attribute.data_type = data_type\n end", "def value\n to_type(@value)\n end", "def type\n @data[:type].empty? ? false : @data[:type]\n end", "def type\n TYPES[self[:type_flags] & 0x3]\n end", "def type\n self['type']\n end", "def type\n self.attributes[:type]\n end", "def default_variable_type\n field_type.default_variable_type\n end", "def type\n\t\t@type\n\tend", "def serialized_type(reference_state)\n result = field_type.serialize(reference_state)\n optional_field ? field_type.class.union_with_null(result) : result\n end", "def value\n send property.type_field\n end", "def FieldTypes\n @_FieldTypes ||= OLEProperty.new(@ole, 9, [VT_BSTR], [VT_BSTR, VT_BSTR])\n end", "def type_of_field_in_database(class_name, field_name)\n all_fields = class_name.get_table_info\n all_fields.each do |field|\n if field[\"name\"] == field_name\n return field[\"type\"]\n end\n end\n false\n end", "def type\n @attributes[:type]\n end", "def type\n @attributes[:type]\n end", "def type\n @attributes[:type]\n end", "def fbe_type\n TYPE\n end", "def fbe_type\n TYPE\n end" ]
[ "0.8430979", "0.8326582", "0.82934535", "0.7998151", "0.7971986", "0.7819991", "0.7798819", "0.77840173", "0.7498337", "0.7476232", "0.74703187", "0.74572486", "0.7451391", "0.73127764", "0.7276509", "0.72640145", "0.7225995", "0.7205526", "0.7149492", "0.71407396", "0.7136189", "0.7098457", "0.7062944", "0.70529246", "0.6987995", "0.6983218", "0.6968659", "0.69330716", "0.69298863", "0.6904506", "0.6859436", "0.68479943", "0.6805695", "0.6801205", "0.6779622", "0.67418283", "0.6734289", "0.6707622", "0.6702056", "0.665088", "0.6643278", "0.66361165", "0.6616536", "0.6615103", "0.66090673", "0.6597711", "0.6580912", "0.65722877", "0.6565987", "0.65601933", "0.65583104", "0.65583104", "0.65583104", "0.65513426", "0.65417933", "0.65417933", "0.65417933", "0.65417933", "0.65417933", "0.65417933", "0.65417933", "0.6526908", "0.6510965", "0.6508382", "0.65008426", "0.649955", "0.64958936", "0.64814013", "0.64809626", "0.6471494", "0.64635736", "0.6460592", "0.6460421", "0.6448237", "0.6446277", "0.64418787", "0.6431722", "0.6424802", "0.64100677", "0.64051473", "0.63978744", "0.6384119", "0.63768554", "0.63729024", "0.6364965", "0.63590723", "0.63519573", "0.6350871", "0.6349868", "0.6342724", "0.6342224", "0.6340826", "0.63365394", "0.63305837", "0.6329671", "0.63267225", "0.63220894", "0.63220894", "0.63220894", "0.6304349", "0.6304349" ]
0.0
-1
Updates the data type of the field.
def type= new_type @gapi.update! type: verify_type(new_type) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_type=(value)\n @data_type = value\n end", "def field_type=(value)\n super(value.to_s)\n end", "def update_value_type\n write_attribute :value_type, EavEntry.get_value_type(@value)\n end", "def type=(val)\n\n dtype = val\n #return self if @chars_allowed # disallow changing\n # send in a regexp, we just save it.\n if dtype.is_a? Regexp \n @chars_allowed = dtype\n return self\n end\n dtype = dtype.to_s.downcase.to_sym if dtype.is_a? String\n case dtype # missing to_sym would have always failed due to to_s 2011-09-30 1.3.1\n when :integer, Integer\n @chars_allowed = /\\d/\n when :numeric, :float, Numeric, Float\n @chars_allowed = /[\\d\\.]/ \n when :alpha\n @chars_allowed = /[a-zA-Z]/ \n when :alnum\n @chars_allowed = /[a-zA-Z0-9]/ \n else\n raise ArgumentError, \"Field type: invalid datatype specified. Use :integer, :numeric, :float, :alpha, :alnum \"\n end\n self\n end", "def enforce_type (workitem, value)\n\n value = if not @type\n value\n elsif @type == 'string'\n value.to_s\n elsif @type == 'int' or @type == 'integer'\n Integer(value)\n elsif @type == 'float'\n Float(value)\n else\n raise\n \"unknown type '#{@type}' for field '#{@field}'\"\n end\n\n workitem.attributes[@field] = value\n end", "def update_typed_field(header, val, processed)\n if header.match?(type_header_pattern)\n stripped_header = header.gsub('_type', '')\n processed[stripped_header.to_sym] ||= []\n processed[stripped_header.to_sym] << { type: val }\n else\n fields = Array(processed[header.to_sym])\n fields.last[:name] = val\n end\n end", "def update_typed_field(header, val, processed)\n if header.match(type_header_pattern)\n stripped_header = header.gsub('_type', '')\n processed[stripped_header.to_sym] ||= []\n processed[stripped_header.to_sym] << { type: val }\n else\n fields = Array(processed[header.to_sym])\n fields.last[:name] = val\n end\n end", "def data_type(data_type)\n state_depth_must_be(States::ATTRIBUTE)\n raise 'data_type already defined' if @current_attribute.data_type\n @current_attribute.data_type = data_type\n end", "def edit_value(val)\n if data_type == \"string\"\n self.text_raw_value = val\n elsif data_type == \"number\"\n self.number_raw_value = val\n end\n # Note: *_validated_value field is set in the set_validated_values\n # validator.\n end", "def type= new_type\n frozen_check!\n @gapi.type = new_type\n end", "def type= new_type\n frozen_check!\n @gapi.type = new_type\n end", "def get_data_type\n get_field_config['type']\n end", "def feed_data_type=(new_feed_data_type)\n @feed_data_type = new_feed_data_type\n unless self.cache_object.nil?\n self.cache_object.feed_data_type = new_feed_data_type\n end\n if self.feed_data_type != :xml\n @xml_document = nil\n end\n end", "def DataType=(arg0)", "def data_type\n if @data_type\n @data_type\n else\n (@is_string ? String : nil)\n end\n end", "def data_type\n MtkField.field_to_datatype(grid.file.file_name, grid.grid_name, field_name)\n end", "def type=(new_type)\n self[:type_flags] = (flags | TYPES[new_type])\n end", "def set_data_type_and_array\n column_schema = SearchFacet.get_table_schema(column_name: self.big_query_id_column)\n detected_type = column_schema[:data_type]\n self.is_array_based = detected_type.include?('ARRAY')\n item_type = BQ_DATA_TYPES.detect {|d| detected_type.match(d).present?}\n self.data_type = BQ_TO_FACET_TYPES[item_type]\n end", "def data_type\n return @data_type\n end", "def change\n change_column(:table_name, :column_name, :new_type)\nend", "def type\n field[:type]\n end", "def data_type\n\t\tend", "def field(type_name, *names)\n options = names.extract_options!\n data_field = @field\n changed_ivar = \"#{data_field}_changed\"\n type = SerializableAttributes.types[type_name].new(options)\n names.each do |name|\n name_str = name.to_s\n @fields[name_str] = type\n\n @model.send(:define_method, name) do\n send(data_field)[name_str]\n end\n\n if type.is_a? Boolean\n @model.send :alias_method, \"#{name}?\", name\n end\n\n @model.send(:define_method, \"#{name}=\") do |value|\n write_serialized_field name_str, value\n end\n\n @model.send(:define_method, \"#{name}_changed?\") do\n send(changed_ivar).include?(name_str)\n end\n\n @model.send(:define_method, \"#{name}_before_type_cast\") do\n value = send(name)\n value = type.encode(value) if type\n value.to_s\n end\n\n @model.send(:define_method, \"#{name}_change\") do\n if send(\"#{name}_changed?\")\n [instance_variable_get(\"@#{changed_ivar}\")[name_str], send(data_field)[name_str]]\n else\n nil\n end\n end\n end\n end", "def update!(**args)\n @column_type = args[:column_type] if args.key?(:column_type)\n @data_type = args[:data_type] if args.key?(:data_type)\n @name = args[:name] if args.key?(:name)\n end", "def update!(**args)\n @column_type = args[:column_type] if args.key?(:column_type)\n @data_type = args[:data_type] if args.key?(:data_type)\n @name = args[:name] if args.key?(:name)\n end", "def update!(**args)\n @column_type = args[:column_type] if args.key?(:column_type)\n @data_type = args[:data_type] if args.key?(:data_type)\n @name = args[:name] if args.key?(:name)\n end", "def update!(**args)\n @column_type = args[:column_type] if args.key?(:column_type)\n @data_type = args[:data_type] if args.key?(:data_type)\n @name = args[:name] if args.key?(:name)\n end", "def type\n data.type\n end", "def value_type=(value)\n @value_type = value\n end", "def set_type\n end", "def type=(new_type)\n @type = new_type.to_sym\n end", "def set_data_type_and_array\n column_schema = SearchFacet.get_table_schema(column_name: big_query_id_column)\n detected_type = column_schema[:data_type]\n self.is_array_based = detected_type.include?('ARRAY')\n item_type = BQ_DATA_TYPES.detect { |d| detected_type.match(d).present? }\n self.data_type = BQ_TO_FACET_TYPES[item_type]\n end", "def write_type(field_info, value)\n # if field_info is a Fixnum, assume it is a Thrift::Types constant\n # convert it into a field_info Hash for backwards compatibility\n if field_info.is_a? Fixnum\n field_info = {:type => field_info}\n end\n\n case field_info[:type]\n when Types::BOOL\n write_bool(value)\n when Types::BYTE\n write_byte(value)\n when Types::DOUBLE\n write_double(value)\n when Types::I16\n write_i16(value)\n when Types::I32\n write_i32(value)\n when Types::I64\n write_i64(value)\n when Types::STRING\n if field_info[:binary]\n write_binary(value)\n else\n write_string(value)\n end\n when Types::STRUCT\n value.write(self)\n else\n raise NotImplementedError\n end\n end", "def update\n @type.update(type_params)\n end", "def record_type(t)\n @type = t\n end", "def type=(type)\n write_attr :type, type\n end", "def determine_dataype(value)\n return validate_field(value)\n end", "def update_client_field(field_id, field_value, field_type)\n if field_value.present?\n ClientField.where(cltID: self.cltId, cltfieldID: field_id).update_all(Field: field_value, DataType: field_type)\n end\n end", "def update!(**args)\n @column_type = args[:column_type] if args.key?(:column_type)\n @data_type = args[:data_type] if args.key?(:data_type)\n @name = args[:name] if args.key?(:name)\n end", "def data_type\n\tend", "def changeType(newType)\n\t\t\t#remove accessors for old type\n\t\t\tremoveAccessors()\n\t\t\t@type = newType\n\n\t\t\t#produce accessors for the newly set type\n\t\t\tproduceAccessors()\n\t\tend", "def value_type= value_type\n self.type = value_type.gsub(\"-\", \"_\").camelize\n end", "def text_type=(value)\n self.text_type_ord = @@text_type_to_text_type_ord[value]\n end", "def define_write_field_method(field_type)\n define_method \"#{field_type}=\" do |value|\n self[field_type] = value\n end\n end", "def convert_to_type(val)\n case type\n when 'NilClass'\n if val != false && val.blank?\n # Leave the type of the Column open. Unfortunately, false counts as\n # blank and we don't want it to. It should be classified as a boolean.\n new_val = nil\n else\n # Only non-blank values are allowed to set the type of the Column\n bool_val = convert_to_boolean(val)\n new_val =\n if bool_val.nil?\n convert_to_date_time(val) ||\n convert_to_numeric(val) ||\n convert_to_string(val)\n else\n bool_val\n end\n @type =\n if [true, false].include?(new_val)\n 'Boolean'\n elsif new_val.is_a?(Date) || new_val.is_a?(DateTime)\n 'DateTime'\n elsif new_val.is_a?(Numeric)\n 'Numeric'\n elsif new_val.is_a?(String)\n 'String'\n else\n msg = \"can't add #{val} of type #{new_val.class.name} to a column\"\n raise UserError, msg\n end\n end\n new_val\n when 'Boolean'\n if val.is_a?(String) && val.blank? || val.nil?\n nil\n else\n new_val = convert_to_boolean(val)\n if new_val.nil?\n msg = \"attempt to add '#{val}' to a column already typed as #{type}\"\n raise UserError, msg\n end\n new_val\n end\n when 'DateTime'\n if val.blank?\n nil\n else\n new_val = convert_to_date_time(val)\n if new_val.nil?\n msg = \"attempt to add '#{val}' to a column already typed as #{type}\"\n raise UserError, msg\n end\n new_val\n end\n when 'Numeric'\n if val.blank?\n nil\n else\n new_val = convert_to_numeric(val)\n if new_val.nil?\n msg = \"attempt to add '#{val}' to a column already typed as #{type}\"\n raise UserError, msg\n end\n new_val\n end\n when 'String'\n if val.nil?\n nil\n else\n new_val = convert_to_string(val)\n if new_val.nil?\n msg = \"attempt to add '#{val}' to a column already typed as #{type}\"\n raise UserError, msg\n end\n new_val\n end\n else\n raise UserError, \"Mysteriously, column has unknown type '#{type}'\"\n end\n end", "def update!(**args)\n @disable_type_inference = args[:disable_type_inference] if args.key?(:disable_type_inference)\n @encoding = args[:encoding] if args.key?(:encoding)\n end", "def update!(**args)\n @disable_type_inference = args[:disable_type_inference] if args.key?(:disable_type_inference)\n @encoding = args[:encoding] if args.key?(:encoding)\n end", "def deimos_field_type(schema_field)\n _field_type(schema_field.type)\n end", "def text_type=(value)\n @text_type = value\n end", "def set_type(val)\n self.type = val\n self\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def set_Type(value)\n set_input(\"Type\", value)\n end", "def set_Type(value)\n set_input(\"Type\", value)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @enum_type = args[:enum_type] if args.key?(:enum_type)\n @primitive_type = args[:primitive_type] if args.key?(:primitive_type)\n end", "def value=(new_value)\n return nil if readonly?\n @value = send(\"sanitize_#{options[:type]}\", new_value)\n end", "def type_setter\n @type_setter ||= type.__setter__\n end", "def mutate!(type)\n set_type(type)\n end", "def type=(type); end", "def type=(value)\n @type = value\n end", "def type=(value)\n @type = value\n end", "def type=(value)\n @type = value\n end" ]
[ "0.71815324", "0.6864695", "0.6838144", "0.66620445", "0.6641485", "0.6482189", "0.6478726", "0.6369581", "0.628206", "0.6202365", "0.6202365", "0.6120037", "0.6118188", "0.60513866", "0.60496414", "0.6040707", "0.6029401", "0.6021026", "0.59497344", "0.59194624", "0.5914514", "0.59125054", "0.5911797", "0.5910816", "0.5910816", "0.5910816", "0.5910816", "0.590573", "0.59049994", "0.590443", "0.5891937", "0.5879894", "0.587573", "0.5869342", "0.5867982", "0.58582646", "0.5847475", "0.584438", "0.58344096", "0.58316034", "0.5823213", "0.58147424", "0.5798932", "0.57909656", "0.57688624", "0.5761058", "0.5761058", "0.5760694", "0.5748914", "0.5741866", "0.5739973", "0.5738937", "0.5738937", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57377577", "0.57324386", "0.5709092", "0.5696228", "0.5693479", "0.5691993", "0.5680665", "0.5680665", "0.5680665" ]
0.6427022
7
Checks if the type of the field is `NULLABLE`.
def nullable? mode == "NULLABLE" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def null?(field_info, field)\n field_info[\"notnull\"] == 1 && self.send(field).blank?\n end", "def nullable?\n @nullable\n end", "def nullable?\n @nullable\n end", "def nullable?\n @nullable\n end", "def null?(record)\n type.nullable? && record[:header][:field_nulls][position]\n end", "def nullable?\n subtype.nullable?\n end", "def optional?(field)\n field.type.type_sym == :union &&\n field.type.schemas.first.type_sym == :null\n end", "def not_null?\n IsNotNull.new(self)\n end", "def is_not_null?\n @flags & NOT_NULL_FLAG != 0\n end", "def is_not_null?\n @flags & NOT_NULL_FLAG != 0\n end", "def check_null(field_info, field)\n \n if null?(field_info, field)\n add_null_message_to_errors(field)\n end\n end", "def valid?(value)\n value.kind_of?(primitive) || (value.nil? && nullable?)\n end", "def nullability(col_name, is_nullable, nullable)\n not_nullable = (!is_nullable || !nullable.to_s.match('NO').nil?)\n result = !(not_nullable || nullable == SQL_NO_NULLS)\n\n # HACK!\n # MySQL native ODBC driver doesn't report nullability accurately.\n # So force nullability of 'id' columns\n col_name == 'id' ? false : result\n end", "def null?\n false\n end", "def null?\n false\n end", "def nullable\n self['nullable']\n end", "def null?\n false\n end", "def null?\n false\n end", "def null?\n false\n end", "def null?\n false\n end", "def null?\n true\n end", "def null?\n true\n end", "def not_nil?\n msg = \"#{self} was nil/null\"\n check_if !self.nil?, msg\n end", "def null?\n IsNull.new(self)\n end", "def null?; false end", "def field?\n false \n end", "def preconditions\n !column.null && column.default.nil? && !primary_field? && !timestamp_field? && !column.default_function\n end", "def check_blank_value(key, val)\n # if we explicitly want nil attributes\n return true if self.options[:include_nil_attributes]\n # or if the attribute has changed to nil\n return true if self.record.changes[key].present?\n # make sure our value isn't blank\n return !val.nil?\n end", "def null?\n self == NULL\n end", "def blank?\n @value == nil\n end", "def not_nil?\n !nil?\n end", "def not_nil?\n !nil?\n end", "def has_datatype?\n !datatype.nil?\n end", "def member_uses_custom_type?(field)\n field.type.schemas.any? do |klass|\n Avromatic.type_registry.fetch(klass) != NullCustomType\n end\n end", "def nil?() true; end", "def is_not_null(val)\n @builder.is_not_null(LLVM::Script::Validate(val, :value))\n end", "def nil?\r\n false\r\n end", "def null_value\n match = /((\\w*) NULL)/i.match(definition)\n return true unless match\n\n match[2].downcase == 'not' ? false : true\n end", "def nil_value?\n casted_value.nil?\n end", "def is_nil?(value)\n\t\tvalue.nil?\n\tend", "def enforce_not_null(options = {})\n args = build_validation_args(options, :not_null, :blank)\n return if args.first.is_a?(Hash)\n validates_presence_of(*args)\n end", "def nil?\n false\n end", "def nil?\n false\n end", "def field?\n true \n end", "def is_null(val)\n @builder.is_null(LLVM::Script::Validate(val, :value))\n end", "def nil?\n true\n end", "def nil?\n true\n end", "def value_required?\n if (@data_type == :none) || (@data_type == :global_class)\n return false\n else\n return true\n end\n end", "def not_nil?(obj)\n\t\t!obj.nil?\n\tend", "def empty_required_value?( value )\n required? && value.nil?\n end", "def nil?; false; end", "def nil?() end", "def nil?() end", "def blank?\n self.value.blank? || self.deleted?\n end", "def nullable=(val)\n self['nullable'] = val\n end", "def nil?\n none?\n end", "def paranoid_only_condition\n val = field_not_destroyed.respond_to?(:call) ? field_not_destroyed.call : field_not_destroyed\n column_sql = self.sanitize_sql_for_assignment(destroyed_field)\n case val\n when nil then \"#{column_sql} IS NOT NULL\"\n else [\"#{column_sql} != ?\", val]\n end\n end", "def object_type?\n !value_type?\n end", "def type_conforms?(obj, field)\n true\n end", "def valid?\n !(@variable.nil? || @attribute.nil?)\n end", "def nil?\n return true\n end", "def valid?\n type != nil && id != nil && name != nil\n end", "def valid_attribute?( attroid )\n\t\treturn !self.valid_attribute_type( attroid ).nil?\n\tend", "def custom?\n self.type.blank?\n end", "def null?\n @kind == :null_kw\n end", "def assert_required(base_object, *fields)\n fields.each do |field|\n obj = base_object.dup\n setter = to_setter(field)\n\n obj.send(setter, nil)\n assert obj.invalid?, \"Validation allows nil value for #{field}.\"\n\n if obj.column_for_attribute(field) == :string\n obj.send(setter, \"\")\n assert obj.invalid?, \"Validation allows empty value for #{field}.\"\n end\n end\n end", "def null?(record)\n nullable? && record.header.nulls.include?(@name)\n end", "def must_have_value?()\n return @df_int == nil\n end", "def empty?()\n fields.empty?\n end", "def valid?\n !type.nil?\n end", "def valid?\n !type.nil?\n end", "def truthy?\n if respond_to? :blank?\n not blank?\n else\n not nil?\n end\n end", "def truthy?\n if respond_to? :blank?\n not blank?\n else\n not nil?\n end\n end", "def null_controlled_fields!(attrs)\n ::ScoobySnacks::METADATA_SCHEMA.controlled_field_names.each do |field_name|\n # do not null fields that are not being changed\n next unless attrs.keys.include?(\"#{field_name}_attributes\")\n\n object.public_send(\"#{field_name}=\", [])\n end\n end", "def nullables\r\n []\r\n end", "def nullables\r\n []\r\n end", "def nullables\r\n []\r\n end", "def nullables\r\n []\r\n end", "def nullables\r\n []\r\n end", "def nullables\r\n []\r\n end", "def nullables\r\n []\r\n end", "def nullables\r\n []\r\n end", "def nullables\r\n []\r\n end", "def nullables\r\n []\r\n end", "def field?(name)\n ! self[name].nil?\n end", "def empty?\n\t\treturn self.fields.empty?\n\tend", "def is_not_null\n @operator = :is_null\n @negated = true\n self\n end", "def empty?\n @fields.empty?\n end", "def null_record?\n self == self.class.null_record\n end", "def null_record?\n self == self.class.null_record\n end", "def check_value_empty(data)\n case @type\n when 'str', 'text', 'password', 'img', 'url'\n data.empty?\n when 'int', 'float', 'enum'\n # These values are always non-empty\n false\n when 'set'\n data == 0\n else\n raise \"Invalid type #{@type.inspect} encountered on attribute #{@name.inspect}\"\n end\n end", "def nil?\n @date.nil?\n end", "def blank?\n value.blank?\n end", "def is_pnil?(t)\n return t.nil? || t.is_a?(Types::PNilType)\n end", "def required?(field)\n\n # If the field can be null, then assume it is not required\n return false if @model.columns_hash[field]&.null\n\n # Check for a presence validator on the association\n return true if @model.validators_on(field)\n .select { |v| v.is_a?(ActiveModel::Validations::PresenceValidator) }\n .reject { |v| v.options.include?(:if) || v.options.include?(:unless) }\n .any?\n\n # Check if this is a belongs_to foreign key\n reflection = @model.reflect_on_association(field)\n reflection&.macro == :belongs_to\n end", "def null?\n if( @length == 0 )\n return true\n else\n return false\n end\n end", "def nil_value\n Validation.new { |d| d.nil? }\n end", "def nil_if_blank\n NULL_ATTRS.each { |attr| self[attr] = nil if self[attr].blank? }\n end", "def is_required(resource_type)\n result = false\n is_required = property.is_required\n if is_required and value.blank?\n result = true\n errors.add(:value, \"of the field cannot be blank\")\n end\n result\n end", "def no_nil_attributes\n GroupEvent.attribute_names.without(\"deleted\").each do |a|\n if self.send(a).blank?\n errors.add(:base, \"All fields are required to publish an event\")\n return false\n end\n end\n return true\n end" ]
[ "0.7116849", "0.7033838", "0.7033838", "0.7033838", "0.6741239", "0.67272633", "0.65234756", "0.64722276", "0.6397258", "0.6397258", "0.6327046", "0.6263092", "0.6189515", "0.60874486", "0.60874486", "0.6068387", "0.60558814", "0.60558814", "0.60491836", "0.6020958", "0.5983354", "0.59624535", "0.5957143", "0.59228116", "0.58959395", "0.58951396", "0.58912647", "0.58500046", "0.5826763", "0.58253646", "0.582533", "0.582533", "0.5817634", "0.57887256", "0.57845867", "0.57707876", "0.5749373", "0.57386947", "0.5738382", "0.57374316", "0.57333165", "0.57025355", "0.57025355", "0.56945574", "0.56911784", "0.568853", "0.568853", "0.56877613", "0.5676204", "0.5663271", "0.56436414", "0.5635661", "0.5635661", "0.5632229", "0.5616667", "0.56080866", "0.55939335", "0.5584169", "0.5578808", "0.55698", "0.5565418", "0.5554349", "0.5540785", "0.5540135", "0.552843", "0.55178976", "0.5501975", "0.5492852", "0.54845506", "0.54828274", "0.54828274", "0.54812765", "0.54812765", "0.54534626", "0.5452404", "0.5452404", "0.5452404", "0.5452404", "0.5452404", "0.5452404", "0.5452404", "0.5452404", "0.5452404", "0.5452404", "0.5450194", "0.54483986", "0.54389614", "0.5430596", "0.5425775", "0.5425775", "0.5422724", "0.54068923", "0.5406327", "0.5403706", "0.5394363", "0.539184", "0.5390571", "0.5388694", "0.538535", "0.53847486" ]
0.7666801
0
Checks if the type of the field is `REQUIRED`.
def required? mode == "REQUIRED" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_required(resource_type)\n result = false\n is_required = property.is_required\n if is_required and value.blank?\n result = true\n errors.add(:value, \"of the field cannot be blank\")\n end\n result\n end", "def required?\n true\n end", "def required(type, name, tag, options={})\n define_field(:required, type, name, tag, options)\n end", "def required(type, name, tag, options={})\n define_field(:required, type, name, tag, options)\n end", "def required(type_class, name, tag, options = {})\n define_field(:required, type_class, name, tag, options)\n end", "def required?\n options[:required] == true\n end", "def required(type_class, name, tag, options = {})\n define_field(:required, type_class, name, tag, options)\n end", "def required?\n unless @required\n @required = options_by_type(:required)\n @required = true if @required.nil?\n end\n return @required\n end", "def required?\n @required == true\n end", "def required(type, name, number, options = {})\n define_field(type, name, number, options.merge(required: true))\n end", "def validate_presence_of(field_name, type)\n type || raise(::ArgumentError, \"Type is required for #{field_name}.\")\n end", "def validate_presence_of(field_name, type)\n type || raise(::ArgumentError, \"Type is required for #{field_name}.\")\n end", "def required?\n @required\n end", "def required?\n @required\n end", "def required?\n @required\n end", "def required?\n @required\n end", "def required?\n @required\n end", "def required?\n @rule == :required\n end", "def required?\n @required\n end", "def has_required?\n false\n end", "def required?()\n return @is_required\n end", "def mark_required(object, attribute) \n \"*\" if object.class.validators_on(attribute).map(&:class).include? ActiveModel::Validations::PresenceValidator \n end", "def required?\n @schema['required'] ? true : false\n end", "def required?\n (required == true)\n end", "def required?\n @required\n end", "def required?(property, type, field = nil)\n @json.subrecord_requirements.each do |requirements|\n next unless type.nil? || requirements['record_type'].nil? || requirements['record_type'] == type.to_s\n next unless property.nil? || requirements['property'] == property.to_s\n return true if property && type && field.nil? && requirements['required']\n return true if requirements['required_fields'].include?(field.to_s) && field.present?\n end\n false\n end", "def is_required\n return @is_required\n end", "def attr_required?(klass, attribute)\n klass.validators_on(attribute).map(&:class).include?(\n ActiveModel::Validations::PresenceValidator)\n end", "def has_required?; end", "def required(type_class, name, tag, options = {})\n required_field_tags << tag\n define_field(:required, type_class, name, tag, options)\n end", "def required? #:nodoc:\n options[:required]\n end", "def is_required=(value)\n @is_required = value\n end", "def required?\n if @required.nil?\n !(omittable? || nillable?)\n else\n @required\n end\n end", "def required_field(name, options = {})\n field(name, options.merge(:required => true))\n end", "def has_required_fields\n return unless format.is_a?(LocalPostal::Format)\n\n format.required_fields.each do |field|\n field_name = self.class.formatting_variables_lookup_table[field.to_sym]\n value = public_send(field_name)\n errors.add(field_name, 'is required') if \"#{value}\".empty?\n end\n end", "def required(**props)\n validate(type: :required, message: \"is required\", **props) do |value|\n !value.nil?\n end\n end", "def required?\n\t\t@required\n\tend", "def required?\n spec['Required']\n end", "def method_required?(attribute) #:nodoc:\n if @object && @object.class.respond_to?(:reflect_on_validations_for)\n attribute_sym = attribute.to_s.sub(/_id$/, '').to_sym\n\n @object.class.reflect_on_validations_for(attribute_sym).any? do |validation|\n validation.macro == :validates_presence_of &&\n validation.name == attribute_sym &&\n (validation.options.present? ? options_require_validation?(validation.options) : true)\n end\n else\n @@all_fields_required_by_default\n end\n end", "def required_fields_valid?\n check_required\n errors.empty?\n end", "def required_fields_valid?\n check_required\n errors.empty?\n end", "def attribute_required?(attribute)\n validates_presence?(attribute) || validates_inclusion?(attribute)\n end", "def check_required_fields(data)\r\n @field_names[1..-1].each do |f|\r\n raise(ArgumentError,\r\n 'A value for this field is required: %s' % f) if \\\r\n @field_requireds[@field_names.index(f)] and data[f].nil? \r\n end\r\n end", "def required?(key)\n model_class.validators_on(key).any?{|v| v.kind_of? ActiveModel::Validations::PresenceValidator}\n end", "def required?(key)\n model_class.validators_on(key).any?{|v| v.kind_of? ActiveModel::Validations::PresenceValidator}\n end", "def required?(key)\n self.class.validators_on(key).any?{|v| v.kind_of? ActiveModel::Validations::PresenceValidator}\n end", "def required?(key)\n self.class.validators_on(key).any?{|v| v.kind_of? ActiveModel::Validations::PresenceValidator}\n end", "def check_required(validation:, key:, schema:)\n return false unless validation[:required] && schema.nil?\n\n error! key, \"was required\"\n true\n end", "def required\n !!parameter[:required]\n end", "def check_required_fields(options, locals)\n input_fields = options.values[0].inject({}){|r,(k,v)| r[k.to_s] = v; r}\n required_fields = locals['required']\n\n required_fields.each_pair do |k,v|\n unless input_fields.has_key?(k) \n raise MissingFieldError.new(\"#{k} is required\") if v.nil? \n options.values[0][k] = v \n end\n end\n return options\n end", "def required?\n !optional?\n end", "def required?(in_reply)\n return true if in_reply && required_in_select_form && required_in_select_form.include?(in_reply)\n required == \"required\"\n end", "def method_required?(attribute)\n if @object && @object.class.respond_to?(:reflect_on_validations_for)\n attribute_sym = attribute.to_s.sub(/_id$/, '').to_sym\n\n @object.class.reflect_on_validations_for(attribute_sym).any? do |validation|\n [:validates_presence_of, :validates_date, :validates_time].include?(validation.macro) &&\n validation.name == attribute_sym && !(validation.options.present? && (validation.options[:allow_nil] || validation.options[:allow_blank])) &&\n (validation.options.present? ? options_require_validation?(validation.options) : true)\n end\n else\n @@all_fields_required_by_default\n end\n end", "def valid?\n REQUIRED_FIELDS[type].all? do |f|\n f.is_a?(Array) ? !(f & fields.keys).empty? : !fields[f].nil?\n end\n end", "def required(options)\n default = true\n return default unless options.is_a?(Hash)\n return default unless options.key?(:required)\n return options[:required]\n end", "def required?(name); end", "def required_for_step?(step)\n # All fields are required if no form step is present\n return true if form_step.nil?\n \n # All fields from previous steps are required\n ordered_keys = self.class.form_steps.keys.map(&:to_sym)\n !!(ordered_keys.index(step) <= ordered_keys.index(form_step))\n end", "def value_required?\n false\nend", "def required\n @optional = false\n end", "def test_mandatory_field(field, fieldname)\n if field.nil?\n show_usage\n ui.fatal(\"You must specify a #{fieldname}\")\n exit 1\n end\n end", "def required?\n required.any?\n end", "def required(required)\n state_depth_must_be(States::ATTRIBUTE)\n raise 'required already defined' if @current_attribute.required\n required = required.strip.downcase\n raise 'must be boolean' unless %w[true false].include?(required)\n r = (required == 'true')\n @current_attribute.required = r\n end", "def valid?\n if field_validation\n required_fields_present? && present_fields_valid?\n else\n required_fields_present?\n end\n end", "def valid?\n self.errors = []\n self.content_type.fields.each do |field|\n if field.required\n if self.dynamic_getter(field.name).blank?\n self.errors << field.name\n end\n end\n end\n self.errors.blank?\n end", "def empty_required_value?( value )\n required? && value.nil?\n end", "def validation_class\n if self.required?\n 'required' \n else\n ''\n end\n end", "def required?(field)\n\n # If the field can be null, then assume it is not required\n return false if @model.columns_hash[field]&.null\n\n # Check for a presence validator on the association\n return true if @model.validators_on(field)\n .select { |v| v.is_a?(ActiveModel::Validations::PresenceValidator) }\n .reject { |v| v.options.include?(:if) || v.options.include?(:unless) }\n .any?\n\n # Check if this is a belongs_to foreign key\n reflection = @model.reflect_on_association(field)\n reflection&.macro == :belongs_to\n end", "def attr_need_validation? attr\n return false unless required_attributes\n required_attributes.include?(attr)\n end", "def assert_required(base_object, *fields)\n fields.each do |field|\n obj = base_object.dup\n setter = to_setter(field)\n\n obj.send(setter, nil)\n assert obj.invalid?, \"Validation allows nil value for #{field}.\"\n\n if obj.column_for_attribute(field) == :string\n obj.send(setter, \"\")\n assert obj.invalid?, \"Validation allows empty value for #{field}.\"\n end\n end\n end", "def validate_must_attributes\n\t\tself.must_attribute_types.each do |attrtype|\n\t\t\toid = attrtype.name\n\t\t\tif attrtype.single?\n\t\t\t\tself.errors.add( oid, \"MUST have a value\" ) if self[ oid ].nil?\n\t\t\telse\n\t\t\t\tself.errors.add( oid, \"MUST have at least one value\" ) if self[ oid ].empty?\n\t\t\tend\n\t\tend\n\tend", "def document_has_required_fields?\n [value_field, reverse_shelfkey_field, shelfkey_field, combined_key_field].each do |field|\n return false if @original_document[field].blank?\n end\n true\n end", "def required_fields\n required_fields = []\n ignore_fields = [:id, :date_entered, :date_modified]\n self.fields.each_value do |field|\n next if ignore_fields.include? field[\"name\"].to_sym\n required_fields << field[\"name\"].to_sym if field[\"required\"] == 1\n end \n required_fields\n end", "def required_fields\n required_fields = []\n ignore_fields = [:id, :date_entered, :date_modified]\n self.fields.each_value do |field|\n next if ignore_fields.include? field[\"name\"].to_sym\n required_fields << field[\"name\"].to_sym if field[\"required\"] == 1\n end \n required_fields\n end", "def required=(value)\n @required = value\n end", "def required(type)\n self.send(\"#{type}_num_required\")\n end", "def has_required?\n attribute_required? && SimpleForm.use_html5 && !SimpleForm.disable_browser_validations\n end", "def fill_required_fields(record) \n record.class.validators.select { |v| v.is_a? ActiveModel::Validations::PresenceValidator }.each do |validator|\n validator.attributes.each do |attribute|\n fill_field(record, attribute)\n end\n end\n end", "def has_required?\n attribute_required? && SimpleForm.html5 && SimpleForm.browser_validations\n end", "def check_presence(model, field)\n assert model.invalid?, \"#{model.class} without #{field} should not be valid\"\n assert_not_empty model.errors[field]\n end", "def validate_required!\n raise UserMissing if user.nil?\n raise PaymentMissing if payment.nil? || !payment.valid?\n end", "def is_mandatory\n # Uncomment the following line for CWA unaries (not nullable, just T/F)\n # @references[-1].is_unary ||\n !@references.detect{|ref| !ref.is_mandatory || ref.is_unary }\n end", "def auto_validate_presence?\n @auto_validate_presence\n end", "def validate_required(*required_parameters)\n if self[:ensure] == :present\n required_parameters.each do |req_param|\n raise ArgumentError, \"parameter '#{req_param}' is required\" if self[req_param].nil?\n end\n end\n end", "def validate_required(*required_parameters)\n if self[:ensure] == :present\n required_parameters.each do |req_param|\n raise ArgumentError, \"parameter '#{req_param}' is required\" if self[req_param].nil?\n end\n end\n end", "def validate_required(*required_parameters)\n if self[:ensure] == :present\n required_parameters.each do |req_param|\n raise ArgumentError, \"parameter '#{req_param}' is required\" if self[req_param].nil?\n end\n end\n end", "def validate_required\n [\n :project_name,\n :status,\n :requester_id,\n :subject_expert_id,\n :sponsor_id,\n :vision,\n :goal,\n :description,\n :scope,\n :advice_required,\n :program_id,\n :train_id,\n :funding_method,\n :cost_center,\n :funding_status,\n :budget_allocated,\n :priority,\n :start_date,\n :end_date,\n :risk_rating,\n :risks,\n :projected_revenue,\n ].each do |field|\n if self.attributes[field.to_s].nil? || self.attributes[field.to_s].blank?\n # intentionally vague!\n add_validation 'All fields are required to perform further validations'\n return false\n end\n end\n true\n end", "def value_required?\n if (@data_type == :none) || (@data_type == :global_class)\n return false\n else\n return true\n end\n end", "def _pv_required(opts, key, is_required=true)\n if is_required\n if (opts.has_key?(key.to_s) && !opts[key.to_s].nil?) ||\n (opts.has_key?(key.to_sym) && !opts[key.to_sym].nil?)\n true\n else\n raise Exceptions::ValidationFailed, \"Required argument #{key} is missing!\"\n end\n end\n end", "def validate_required(model, key)\n if model.get_attribute(key).nil?\n [ :error, \"A value is required for attribute: '#{key}'\" ]\n else\n [ :ok, \"\" ]\n end\n end", "def validate_required_attributes\n required = %i[currency_code direction epic force_open guaranteed_stop order_type size\n time_in_force]\n\n required.each do |attribute|\n raise ArgumentError, \"#{attribute} attribute must be set\" if attributes[attribute].nil?\n end\n end", "def required_by_option?(options)\n req = (options.is_a?(Hash) ? options.stringify_keys[:required] : options)\n !(req.to_s === 'false' || req.nil?)\n end", "def guard_required!\n required.each do |key|\n raise ArgumentError, \"Missing required attribute #{key}\" if self[key].nil?\n end\n end", "def mandatory?\n @declarer.mandatory_attributes.include?(attribute)\n end", "def check_required_attributes\n attributes = DSL.attributes.values.select(&:required?)\n attributes.each do |attr|\n value = spec.send(attr.name)\n unless value && (!value.respond_to?(:empty?) || !value.empty?)\n if attr.name == :license\n results.add_warning('attributes', 'Missing required attribute ' \\\n \"`#{attr.name}`.\")\n else\n results.add_error('attributes', 'Missing required attribute ' \\\n \"`#{attr.name}`.\")\n end\n end\n end\n end", "def validate_required!\n validate_nil_attributes\n\n validate_rubygems_version\n\n validate_required_attributes\n\n validate_name\n\n validate_require_paths\n\n @specification.keep_only_files_and_directories\n\n validate_non_files\n\n validate_self_inclusion_in_files_list\n\n validate_specification_version\n\n validate_platform\n\n validate_array_attributes\n\n validate_authors_field\n\n validate_metadata\n\n validate_licenses_length\n\n validate_lazy_metadata\n\n validate_duplicate_dependencies\n end", "def required\n return @required\n end", "def optional?\n !@required\n end", "def e_required\n ElementReqs_::Required\n end", "def presence_of_mandatory_fields\n if promo_amount.blank? and info.blank?\n errors[:base] << 'Au moins un des champs doivent être remplis'\n end\n end", "def validates_presence?(attribute)\n validator_of_type_exists?(validators_for(attribute), :presence)\n end" ]
[ "0.7840421", "0.7228461", "0.72031933", "0.72031933", "0.7189", "0.71667135", "0.7153553", "0.71464217", "0.71172744", "0.7088425", "0.7073207", "0.7073207", "0.70698524", "0.70698524", "0.70698524", "0.70698524", "0.7026312", "0.7025041", "0.7024866", "0.7022123", "0.70166075", "0.70082843", "0.699966", "0.6961174", "0.6960051", "0.69339913", "0.6924253", "0.6922902", "0.69069266", "0.6882112", "0.6846526", "0.68320704", "0.6831884", "0.68246216", "0.67976516", "0.6759849", "0.67402583", "0.6737206", "0.67249805", "0.6683132", "0.6683132", "0.6673645", "0.667109", "0.6605186", "0.6605186", "0.6595444", "0.6595444", "0.65884775", "0.6585406", "0.6583064", "0.6572884", "0.6571943", "0.65196455", "0.65104574", "0.64833254", "0.6412095", "0.6391421", "0.6368374", "0.63634044", "0.6337542", "0.63206583", "0.6319758", "0.6314275", "0.6313464", "0.62874115", "0.6286773", "0.6271113", "0.6270494", "0.6266255", "0.624862", "0.6243339", "0.6226509", "0.6226509", "0.62166834", "0.62058717", "0.6199527", "0.61936396", "0.61917466", "0.618534", "0.6178718", "0.6166519", "0.6154783", "0.61380666", "0.6137608", "0.6137608", "0.613046", "0.6121037", "0.61045915", "0.6103203", "0.60982853", "0.6090841", "0.6089388", "0.6085469", "0.60842794", "0.608125", "0.6075352", "0.60728925", "0.60561323", "0.6049445", "0.6031729" ]
0.6663567
43
Checks if the type of the field is `REPEATED`.
def repeated? mode == "REPEATED" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def must_recreate\n @args[:___recreate___]\n end", "def validate_task(task, instance, options)\n return true unless options[:task] == \"retire_now\" && instance.retired?\n task.error(\"#{instance.name} is already retired\")\n false\n end", "def temporary?\n !new_record? && valid_until\n end", "def modifiable?\n !(self.complete? || self.ready_to_post?)\n end", "def ensure_valid_remindable_type\n self.remindable_type = \"Other\" unless Reminder::REMINDABLE_TYPES.include?(self.remindable_type)\n self.remindable_id = nil if self.remindable_type == \"Other\"\n end", "def reminded?\n !!reminded_at\n end", "def is_retrigger\n attributes.fetch(:isRetrigger)\n end", "def redeemed?\n self.redeemed_at?\n end", "def is_required?\n return self.schedule_status == 'reschedule' ? true : false\n end", "def rejected?\n !self.rejected_at.nil?\n end", "def needs_revalidation?(response)\n return true if forces_revalidation?\n return true if response.stale?\n return true if max_age && response.current_age > max_age\n return true if response.must_be_revalidated?\n false\n end", "def check_receipt_state\n\t\tunless account_movement.nil? || account_movement.receipt.nil?\n\t\t\terrors.add(\"Recibo confirmado\", \"Los pagos de un recibo confirmado no pueden ser modificados.\") unless account_movement.receipt.editable?\n\t\tend\n\tend", "def is_redeemed?\n redeemed_at?\n end", "def has_pushed_since_last_respin?(type)\n jobs = push_jobs_since_last_state(type, 'NEW_FILES').where('pub_task_id is not null')\n jobs.reject(&:is_nochannel?).any?(&:is_committed?)\n end", "def rejected?\n !!self.rejected_at\n end", "def field_revised?(name)\n new_record? ? false : revised_changes.has_key?(name.to_s)\n end", "def check_frozen\n if rec_was_frozen && changed? then\n errors.add( :base, I18n.t( 'cfr_records.msg.frozen_rec' ))\n return false\n else\n return true\n end\n end", "def replied_to?\n !replied_at.nil?\n end", "def revokable?\n\t\tstatus == \"pending\" && created_at >= Donation.revoke_time.ago\n\tend", "def being_created?(item)\n state_group(item) == :create\n end", "def rec_was_frozen\n if changed? && rec_frozen then\n return !( changed_attributes.key?( :freeze_date ) && changed_attributes[ :freeze_date ].nil? )\n else\n return false\n end\n end", "def validate!(properties)\n if retired_at\n raise ::MetaEvents::Definition::DefinitionSet::RetiredEventError, \"Event #{full_name} was retired at #{retired_at.inspect} (or its category or version was); you can't use it any longer.\"\n end\n end", "def can_be_replied_to?\n !locked?\n end", "def pending?\n self.state == :created || self.state == :requested\n end", "def ready_to_create?\n valid? && processed? && import_level_ok?\n end", "def reconfirmation_required?\n self.class.reconfirmable && @reconfirmation_required # && !self.email.blank?\n end", "def fresh?\n return false if FORMATS_TO_ALWAYS_RECREATE.include?(format)\n\n return false unless updated_at # new record - too fresh!\n\n current_time = Time.now.gmtime\n yesterday = current_time - 1.day\n (yesterday..current_time).cover?(Time.at(updated_at).gmtime)\n end", "def guard_process_payment_from_created; true; end", "def guard_process_payment_from_created; true; end", "def relaunch?\n errors.present?\n end", "def editable?\n ((Time.now - self.created_at ) / 1.minute).round < MINUTES_UNTIL_UNEDITABLE\n end", "def create_attempted?\n create_attempted\n end", "def on_create_called?\n !!@on_create_called\n end", "def should_notify?\n self.created_at == self.updated_at\n end", "def ready_to_rsvp?(event = nil)\n return false if self.class == Person\n self.validate_ready_to_rsvp = true\n self.valid?\n end", "def do_refresh_created!\n # refresh the preauth for this booking.\n ft = self.financial_transactions.preauth.take\n\n if ft.present? && ft.pending? || ft.processing?\n LOG.info message: \"process_refresh! for ft\", booking_id: self.id, financial_transaction_id: ft.id\n ft.process_refresh!\n end\n\n if ft.blank?\n LOG.error message: \"All bookings need one preauth financial_transaction. \" \\\n \"You are trying to refresh a booking without one. This is an error and \" \\\n \"should never happen.\", booking_id: self.id\n elsif ft.processing?\n LOG.info message: \"preauth financial_transaction is still processing\", booking_id: self.id\n elsif ft.pending?\n LOG.info message: \"preauth financial_transaction is still pending\", booking_id: self.id\n elsif ft.errored? || ft.unknown_state?\n # set booking to failed preauthoration status.\n self.payment_preauthorization_fail!\n\n elsif ft.finished? #&& ft.preauth_waiting?\n # Preauth is ready to be charged! Once the « PreAuthorization » object gets\n # \"Status\" = \"SUCCEEDED\" and \"PaymentStatus\" = \"WAITING\" you can charge the card.\n # See: https://docs.mangopay.com/api-references/payins/preauthorized-payin/\n LOG.error message: \"preauth financial_transaction does not \" \\\n \" have preauth_payment_status: preauth_waiting\" unless ft.preauth_waiting?\n\n self.payment_preauthorize!\n end\n\n LOG.info message: \"Booking now has status: #{self.status}\", booking_id: self.id\n end", "def is_late\n Time.current > object.deadline if object.deadline.present?\n end", "def pending?\n entered_at.present? && started_at.nil?\n end", "def can_change_type?\n new_record? || self.class.valid_migration_paths[self.field_type].present?\n end", "def rebus_fill?\n rebus_value?(fill)\n end", "def modification?\n !self.creation? && !self.destruction?\n end", "def created_before_proposal_deadline\n errors.add(:base, \"The proposal deadline has passed.\") if\n DateTime.now > Quarter.active_quarter.project_proposal_deadline\n end", "def ready_to_submit?\n return self.new_record? == false && \\\n self.approvable.new_record? == false && \\\n self.mail_sent == false\n end", "def recurring\n self.recurrence.present?\n end", "def is_reservable?\n if self.is_a? Patient\n return false\n end\n true\n end", "def validate_task(task, instance, options)\n if instance.try(:ext_management_system)&.zone&.maintenance?\n task.error(\"#{instance.ext_management_system.name} is paused\")\n return false\n end\n\n return true unless options[:task] == \"retire_now\" && instance.retired?\n task.error(\"#{instance.name} is already retired\")\n false\n end", "def determine_content_freshness\n @auto_tags_need_update = self.class.auto_tag_fields.any? {|field| self.changed.include? field.to_s }\n true\n end", "def creatable?(fields=false)\n modifiable? :create, fields\n end", "def creation?\n self.diff['attributes']['new'] && !self.diff['attributes']['old']\n end", "def daf_retrial_combo_ignorable\n @record.claim.case_type.requires_retrial_dates? && !@record.claim.editable?\n rescue StandardError\n false\n end", "def editable?\n if self.new_record?\n true\n else\n Date.today < show.payment_deadline\n end\n end", "def publication_pending?\n validating? || creating? || testing?\n end", "def has_date?\n !fields.select { |f| f.responsible_for?('Date') }.empty?\n end", "def valid_data_on_creation?\n valid_data_on_creation\n end", "def still_valid?\n return false if self.reply_type == 'conversation'\n participation_request = ParticipationRequest.find self.participation_request_id\n\n return false if participation_request.state != 'pending'\n return false if participation_request.date < Time.current\n\n !used\n end", "def reedition_should_be_known\n if @reedition_title.present? && !reedition_id\n errors.add(:reedition_title, :invalid)\n end\n end", "def able_to_set_updated_at?\n !frozen? && !timeless? && (new_record? || changed?)\n end", "def rejected?\n self.status == STATUS_REJECTED\n end", "def failed? participate\n return participate.continuous_check_in == 0 || participate.updated_at.to_date != Time.now.utc.to_date\nend", "def needs_pruning?(table)\n last_pruned = get_pruned(table)\n return false if !last_pruned.nil? && DateTime.now < last_pruned + reaggregate_interval / 86400.0\n\n table_rules = rules_for(table)\n return false if table_rules.length == 0\n\n true\n end", "def requeue?\n !self.success? && (@requeue === true || @requeue === :requeue)\n end", "def has_response_field?(field, target)\n !!get_response_field(field, target)\n end", "def rescan?\n @rescan_required\nend", "def resurrectable?\n @state_mutex.synchronize {\n Time.now > @dead_since + ( @options[:resurrect_timeout] * 2 ** (@failures-1) )\n }\n end", "def incomplete\n # check if an individual rep, complete reps of day if not\n if self.rep_parent.nil?\n self.repititions.\n where(:show_date => Date.current).each do |rep|\n rep.incomplete\n end\n return\n end\n\n if self.state == Activity::COMPLETE\n # only set as incomplete if before expiration\n if self.expiration_date.nil? or \n self.expiration_date >= Date.current \n self.state = Activity::INCOMPLETE\n else\n self.state = Activity::EXPIRED\n end\n self.completed_date = nil\n self.save!\n self.rep_parent.count = self.rep_parent.count - 1\n self.rep_parent.save!\n end\n end", "def is_processed?\n self.asset_clone_id.present? && self.asset_clone.present? ? self.asset_clone.processed : self.processed\n end", "def incomplete_payment?\n past_due || incomplete\n end", "def ensure_not_updating\n unless created_at.blank?\n errors.add(:base, \"RoleAssignments cannot be updated, only created or destroyed\")\n end\n end", "def validate_reuse\n QA::Runtime::Logger.debug([\"Validating a #{self.class.name} that was reused as #{reuse_as}\", identifier].compact.join(' '))\n\n fresh_resource = reference_resource\n diff = reuse_validation_diff(fresh_resource)\n\n if diff.present?\n raise ResourceReuseError, <<~ERROR\n The reused #{self.class.name} resource does not have the attributes expected.\n The following change was found: #{diff}\"\n The resource's web_url is #{web_url}.\n It was used in these tests: #{self.class.resources[reuse_as][:tests].to_a.join(', ')}\n ERROR\n end\n\n ensure\n fresh_resource.remove_via_api!\n end", "def repealed?\n !!repealed_on\n end", "def delete_data_with_storage_name?\n type == :retired\n end", "def completed?\n self.completed_at.present?\n end", "def before_save\n changed_fields?\n if(@changed_fields && @changed_fields.keys.include?('rmt_product_id') && ((bins = Bin.find_all_by_delivery_id(self.id)).length>0))\n raise \"sorry cannot change rmt_product of this delivery , #{bins.length} bin(s) have already been scanned for this delivery\"\n end\n puts\n end", "def post_is_create?\n\t\ttrue\n\tend", "def type_conforms?(obj, field)\n true\n end", "def check_deadline\n true\n end", "def completed?\n !completed_at.blank?\n end", "def patch_valid?\n validate(false).empty?\n end", "def test_necessary_existence_of_communication_note\n puts @communication.communication_note\n test_necessary_existence_of_model_field(\"cannot be empty\", @communication, :communication_note)\n end", "def due?\n super && !violations.empty?\n end", "def overdue?\n !self.attempt_next_contact_by.nil? && self.attempt_next_contact_by < Time.current\n end", "def fresh?\n created_at == updated_at\n end", "def generate_immediate_notification? \n\t submitted && ((not defined? @submitted_value_on_load) || (not @submitted_value_on_load) )\n end", "def check_data(model, # not-yet-reloaded db model\n ref, # symbol-value hash of reference data\n ignore = nil, # array of symbol field names to ignore (even if in ref param)\n approx_time = false, # fuzzy .now time compare\n disallow = nil, # array of symbol field names that must not be present (must be nil in model/db) Arbitrarily overrides ref fields.\n line = nil)\n pre_record = model.dup\n model.reload\n untouched_fields = model.class.accessible_attributes.to_a - ref.stringify_keys.keys\n line = line ? \" [*_test:\" + line.to_s + \"]\" : \"\"\n\n check_valid_field = lambda do |ref|\n field = ref[0]\n\n # wierd - db fields can be accessed as model[field],\n # attr_accessor fields can't. So must distinguish.\n # But note this only works when checking the model used to create,\n # since attr_accessor fields are not persisted.\n # There might be a less hacky way...\n dbfield = model.instance_variables.include?((\"@\" + field.to_s).to_sym) ?\n model.send(field) : model[field]\n\n if (disallow && disallow.include?(field))\n if (@@trace)\n print \"check_data checking field is nil: \" + model.class.to_s + \".\" + field.to_s + \": \" + dbfield.to_s + line + \"\\n\"\n end\n return dbfield == nil ?\n nil :\n { expected: nil, actual: dbfield }\n end\n\n if (!ignore || !ignore.include?(field))\n\n ref_val = ref[1]\n if (@@trace)\n print \"check_data checking: \" + model.class.to_s + \".\" + field.to_s + \": \" + dbfield.to_s + \"=\" + ref_val.to_s + line + \"\\n\"\n end\n return ((dbfield.class == ActiveSupport::TimeWithZone) ?\n # Not checking format here, just value.\n (approx_time ?\n # XXX Tighten this back to 1, by passing request time into check_key_event\n fuzzy_compare_datetime(DateTime.parse(ref_val), dbfield, 6) :\n equal_normalize_iso8601(ref_val, dbfield.utc.iso8601(3))) :\n (ref_val.to_s == dbfield.to_s)) ?\n nil :\n { expected: ref_val, actual: dbfield }\n end\n nil\n end\n\n assert_each_log_results(ref, true, \"have wrong values in database\" + line, &check_valid_field)\n\n #makes sure that other database fields are untouched\n if pre_record\n untouched_fields.each do |field|\n=begin\n # Turn this on to see what fields might never be checked for being touchable across all tests.\n # Need a way to filter out dont-care/obsolete fields.\n if (@@trace)\n print \"check_data checking field was untouched: \" + model.class.to_s + \".\" + field + \"\\n\"\n end\n=end\n assert_equal pre_record.read_attribute(field), model.read_attribute(field), (\"*** \" + field + line + \":\")\n end\n end\n end", "def incomplete?\n attributes['percentDone'] < 1\n end", "def profile_filled?\n !((created_at.to_s == updated_at.to_s) && provider)\n end", "def is_completely_trashed?(participant)\n return false unless participant\n receipts_for(participant).trash.count == receipts_for(participant).count\n end", "def field?\n false \n end", "def is_false_duplicate?\n payment_complete? && has_completed_duplicates?\n end", "def submitted?\n !self.submitted_at.nil?\n end", "def check_resolved_at\n self.errors.add('Resolved at', 'can\\'t be blank') if (self.resolved && self.resolved_at.blank?)\n end", "def show_wait_to_clear_pickup_form?\n self.persisted?\n end", "def created?\n synchronize { !!@created }\n end", "def completed?\n \t!completed_at.blank?\n end", "def pending\n !as_stripe_subscription.pending_update.nil?\n end", "def exclude_pending_create_attribute?(obj, prop)\n prop.type < Annotation or super\n end", "def is_due?\n self.datetime.past?\n end", "def pickup_date_entered?\n pickup_date.present?\n end", "def exist?\n @created\n end", "def time_over?\r\n return self.due_date <= Time.now\r\n end" ]
[ "0.56279904", "0.55290604", "0.5352991", "0.5344293", "0.5280932", "0.51619273", "0.51452637", "0.5143574", "0.51344734", "0.51068354", "0.5084741", "0.5069809", "0.50224143", "0.5022201", "0.4972323", "0.4969593", "0.49602592", "0.49500215", "0.49348223", "0.4924736", "0.49199292", "0.4919826", "0.49030778", "0.48889798", "0.48582736", "0.48575386", "0.4857409", "0.48412433", "0.48412433", "0.4840847", "0.4819159", "0.48178673", "0.48012605", "0.47974858", "0.4796121", "0.47944084", "0.479111", "0.47866836", "0.47702494", "0.47670397", "0.47603923", "0.4756866", "0.47523406", "0.47520587", "0.4733368", "0.4711037", "0.470841", "0.47015443", "0.47008327", "0.46806195", "0.46776432", "0.46700612", "0.46664697", "0.4661643", "0.46596226", "0.46582428", "0.46580192", "0.4655412", "0.46496096", "0.46419886", "0.46407837", "0.46366173", "0.463582", "0.46323562", "0.46291462", "0.46270922", "0.46258983", "0.46255505", "0.46228576", "0.46226475", "0.46219826", "0.46184254", "0.46181715", "0.46152297", "0.46098357", "0.46075654", "0.46067613", "0.46066743", "0.46052697", "0.46048093", "0.460424", "0.46014977", "0.46003914", "0.45977223", "0.4597262", "0.45967355", "0.4594343", "0.45939317", "0.45894036", "0.45887944", "0.45883647", "0.45872778", "0.45869285", "0.45859495", "0.4585457", "0.45818463", "0.45770946", "0.4573997", "0.45738333", "0.45720866" ]
0.6251948
0
The description of the field.
def description @gapi.description end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description\n field[:description]\n end", "def description\n fields['description']\n end", "def get_description\n get_field_config['description']\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n return @description\n end", "def description\n end", "def description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n return @description\n end", "def description\n data.description\n end", "def description\n data.description\n end", "def description\n data.description\n end", "def description\n @attributes[:description]\n end", "def description\n data[:description]\n end", "def description\n data[:description]\n end", "def description\n self[:description] || name\n end", "def description\n\n return @description\n\n end", "def description\n parameter[:description]\n end", "def description\n text_attribute('description')\n end", "def description()\n @description.nil? ? raw_description : @description\n end", "def getDescription\r\n\t\t\t\t\treturn @description\r\n\t\t\t\tend", "def getDescription\r\n\t\t\t\t\treturn @description\r\n\t\t\t\tend", "def description\n @data['description']\n end", "def description d\n @description = d\n end", "def description\n attributes.fetch(:description)\n end", "def description\n \"\"\n end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description\n\t\t\t@data[\"description\"]\n\t\tend", "def get_description\n @description\n end", "def description\n @data['description']\n end", "def description\n data['Description']\n end", "def description\n self[:description]\n end", "def description\n info[\"Description\"]\n end", "def description\n metadata[:description]\n end", "def description\n @data['description']\n end", "def description\n @data['description']\n end", "def describe\n @description\n end", "def describe\n @description\n end", "def description\n object[\"description\"]\n end", "def description\n\t\t\treturn @description || self.generate_description\n\t\tend", "def description\n end", "def description; @text; end", "def short_description\n description\n end", "def description\n @description || Defaults::DEFAULT_DESCRIPTION\n end", "def description\n data['description']\n end", "def get_description\n return @m_description\n end", "def get_description\n return @m_description\n end", "def description\n nil\n end", "def description\n nil\n end", "def description\n override_desc || self.to_s\n end", "def description\n text_get(7, @id)\n end", "def field_description description, options = nil\n (\n \"\".in_span(class:'libelle') +\n description.in_span(class:'value descfield')\n ).in_div(class:'row description')\n end", "def description\n self[:message]\n end", "def get_description( field )\n\t\tconstraint = self.constraints[ field.to_sym ] or return nil\n\t\treturn constraint.description\n\tend", "def description\n nil\n end", "def description\n ensure_full_data!\n @gapi[\"description\"]\n end", "def full_description\n \"#{self.class.description} #{self.description}\"\n end", "def description\n options[:description]\n end", "def formal_description\n @data['formalDescription']\n end", "def description\n @description || raise(\"#{name}.description isn't defined\")\n end", "def description\n parsed {\n @description\n }\n end", "def desc\n return @desc\n end", "def description\n @ole.Description\n end", "def description\n @ole.Description\n end" ]
[ "0.91365427", "0.8243952", "0.82154214", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7922153", "0.7879035", "0.7879035", "0.7738499", "0.7738499", "0.7738499", "0.7738499", "0.7736245", "0.7734967", "0.7734967", "0.7734967", "0.77191615", "0.7706589", "0.7706589", "0.7703578", "0.7699403", "0.76904356", "0.7671899", "0.7625186", "0.7619317", "0.7619317", "0.75940007", "0.7577353", "0.75772494", "0.75728804", "0.75236636", "0.75236636", "0.75236636", "0.75236636", "0.75236636", "0.75236636", "0.75236636", "0.75236636", "0.75236636", "0.75236636", "0.7520314", "0.7502396", "0.75018024", "0.7500697", "0.74882627", "0.748431", "0.7472758", "0.7457279", "0.7457279", "0.74495053", "0.74495053", "0.7445472", "0.7434513", "0.7388024", "0.73802567", "0.7362487", "0.73604167", "0.73580873", "0.7341958", "0.7341958", "0.7302381", "0.7302381", "0.7287422", "0.7272092", "0.7267391", "0.7250172", "0.7246562", "0.72447234", "0.72409844", "0.7209758", "0.72063744", "0.7203782", "0.7183801", "0.71751946", "0.71688765", "0.71528655", "0.71528655" ]
0.0
-1
Updates the description of the field.
def description= new_description @gapi.update! description: new_description end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(description) # :nodoc:\n @description = description\n self\n end", "def update(description) # :nodoc:\n @description = description\n self\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def description=(value)\n @description = value\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def set_Description(value)\n set_input(\"Description\", value)\n end", "def description= new_description\n patch_gapi! description: new_description\n end", "def description=(val)\n self[:description] = val\n end", "def description=(v)\n @description = v\n end", "def desc( description )\n @description = description\n end", "def description\n field[:description]\n end", "def setDescription(description)\r\n\t\t\t\t\t@description = description\r\n\t\t\t\tend", "def setDescription(description)\r\n\t\t\t\t\t@description = description\r\n\t\t\t\tend", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n end", "def update\n json_response(@description.update!(description_params))\n end", "def description=(str)\n @description = str\n end", "def edit_description\n end", "def description=(description)\n end", "def setDescription(description)\n @description = description.to_s\n end", "def set_description(description)\n @description = description\n end", "def description=(description)\r\n\t\t\t`#{BITS::BITSADMIN} /setdescription {#{@id}} \\\"#{description}\\\"`\r\n\t\tend", "def set_description(desc)\n @result.description = desc\n end", "def description\n fields['description']\n end", "def description(value)\n @ole.Description = value\n nil\n end", "def description(value)\n @ole.Description = value\n nil\n end", "def description d\n @description = d\n end", "def description(session, id, new_description)\n write_task('rvpe.image.description', session) do\n err_msg = \"You don't have permission to modify the description \" +\n 'of the image.'\n sanity_check(session, id, err_msg) do\n call_one_xmlrpc('one.image.update', session, id,\n 'DESCRIPTION', new_description)\n end\n end\n end", "def get_description\n get_field_config['description']\n end", "def description\n @description = \"Espresso\"\n end", "def change_description_of_issue(issue_name, description_text)\n\tissue = @client.Issue.find(issue_name)\n\tissue.save({\"fields\"=>{\"description\"=>description_text}})\nend", "def description(description)\n @controller.description = description\n end", "def description=(str)\n @description = str.to_s\n end", "def description=(value)\n start = Time.now\n debug \"Updating description on device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n update_device_group(connection,\n resource[:full_path],\n value,\n resource[:properties],\n resource[:disable_alerting])\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end", "def description!\n read_attribute :description\n end", "def desc(text)\n @storage[:description] = text\n end", "def set_description(text)\n @description_label.set_text(text)\n if text\n @description_label.set_hidden(false)\n else\n @description_label.set_hidden(true)\n end\n end", "def desc(description)\n last_options[:description] = description\n end", "def description\n read_attribute(:description).presence || self.original_description\n end", "def describe(description)\n @description = description\n end", "def description(desc = nil)\n @description = desc if desc\n @description\n end", "def set_expense_entry_description\n data=params\n @tne_invoice_expense_entry = TneInvoiceExpenseEntry.find(data[:id])\n @tne_invoice_expense_entry.update_attribute(:description,data[:value])\n render :text => @tne_invoice_expense_entry.description\n end", "def set_description\n\t\t@description = \"Sales by Rails\"\n\tend", "def desc(description) #:doc:\n return unless Apipie.active_dsl?\n if _apipie_dsl_data[:description]\n raise \"Double method description.\"\n end\n _apipie_dsl_data[:description] = description\n end", "def description(str)\n @description = str\n end", "def description=(str)\n @description = str\n write_properties\n end", "def add_description(description)\n @mod.instance_variable_set(:@description, description)\n @mod.define_singleton_method(:description) { @description }\n end", "def description=(value)\n super(\"value\" => value)\n end", "def description=(value)\n super(\"value\" => value)\n end", "def description=(desc)\n @link.Description = desc\n end", "def desc(description) #:doc:\n return unless Apipie.active_dsl?\n if Apipie.last_dsl_data[:description]\n raise \"Double method description.\"\n end\n Apipie.last_dsl_data[:description] = description\n end", "def description\n @description = \"Dark Roast Coffee\"\n end", "def set_description\n self.description = \"#{self.manufacturer.code} #{self.manufacturer_model}\" unless self.manufacturer.nil?\n end", "def description=(desc)\n zombie_check\n @metadata.update(@name, desc: desc) \n end", "def add_description(desc)\n @description = desc\n puts \"#{@title} now has a description of: '#{@description}'\"\n end", "def field_description description, options = nil\n (\n \"\".in_span(class:'libelle') +\n description.in_span(class:'value descfield')\n ).in_div(class:'row description')\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n @description\n end", "def description\n text_attribute('description')\n end" ]
[ "0.7363507", "0.7363507", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73502105", "0.73353183", "0.73353183", "0.73353183", "0.73353183", "0.73353183", "0.73353183", "0.73353183", "0.73353183", "0.73353183", "0.73353183", "0.73353183", "0.73353183", "0.7292639", "0.7286659", "0.7273606", "0.7167728", "0.715609", "0.71524304", "0.7000147", "0.7000147", "0.6992769", "0.6992769", "0.6992769", "0.6992769", "0.6992769", "0.6953195", "0.6943845", "0.6920634", "0.6912354", "0.6874914", "0.68722755", "0.6860549", "0.6844117", "0.682632", "0.68194216", "0.68194216", "0.68091375", "0.67959064", "0.6792905", "0.6760005", "0.6749662", "0.67113286", "0.6676734", "0.6671776", "0.662991", "0.6626866", "0.6625529", "0.66165257", "0.66077656", "0.6589849", "0.6549703", "0.6539349", "0.6537545", "0.65345097", "0.6521963", "0.65103835", "0.6506676", "0.65052855", "0.65052855", "0.65010804", "0.64995176", "0.6491502", "0.6466464", "0.6461444", "0.64577615", "0.6455406", "0.6452288", "0.6452288", "0.6452288", "0.6452288", "0.6434527" ]
0.76463753
0
The mode of the field.
def mode @gapi.mode end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mode\n @mode\n end", "def mode\n options[:mode]\n end", "def mode; end", "def mode; end", "def mode; end", "def mode; end", "def mode() @mode ||= detect_mode end", "def get_mode()\n end", "def mode\n Initialize() if @_mode == nil\n\n @_mode\n end", "def mode=(type)\n @mode = type.to_s\n end", "def selected_mode\n @selected_mode\n end", "def mode\n\t\treturn self.modes[0]\n\tend", "def mode\n params['mode']\n end", "def mode() end", "def mode\n attributes.fetch(:mode) do\n Ably::Util::Crypto::DEFAULTS.fetch(:mode)\n end.downcase\n end", "def mode\n \"%o\" % (self.stat(:mode) & 007777)\n end", "def type\n params['mode']\n end", "def type\n params['mode']\n end", "def mode=(mode)\n @mode = mode ? mode.to_sym : nil\n end", "def mode=(val)\n if val.blank? or val.kind_of? Fixnum then\n write_attribute(:mode, val)\n else\n write_attribute(:mode, Mode[val])\n end\n end", "def mode?\n return @mode\n end", "def mode\n case @data_list\n when QRNumeric\n :mode_number\n when QRAlphanumeric\n :mode_alpha_numk\n else\n :mode_8bit_byte\n end\n end", "def mode_name\n if mode >= 0 && mode <= 15\n MODES[mode]\n else\n \"(#{mode})\"\n end\n end", "def mode\n request.mode\n end", "def name\n return mode_desc\n end", "def modes; end", "def set_Mode(value)\n set_input(\"Mode\", value)\n end", "def mode\n raise \"Not implemented\"\n end", "def mode\n TflApi::Client::Mode.new(self)\n end", "def mode\n modes(false)[0]\n end", "def mode\n modes(false)[0]\n end", "def mode_name=(value)\n @mode_name = Mode.new value\n end", "def set_Mode(value)\n set_input(\"Mode\", value)\n end", "def set_Mode(value)\n set_input(\"Mode\", value)\n end", "def mode=(m)\n @mode = m.to_sym\n end", "def get_mode()\n session['mode'] = session['mode'] || 'edit'\n return session['mode']\n end", "def mode_sym\n (mode || :off).to_sym\n end", "def mode=(new_mode)\n LOGGER.mode = new_mode\n end", "def mode=(new_mode)\n LOGGER.mode = new_mode\n end", "def mode=(a_mode)\n @@mode = a_mode.to_sym\n end", "def mode=(mode)\n Nitro.mode = mode.to_sym\n end", "def mode=(mode)\n request.mode = mode\n end", "def mode=(mode)\n super(0100000 | (mode & 07777))\n end", "def mode=(mode)\n super(0120000 | (mode & 07777))\n end", "def mode=(mode)\n super(040000 | (mode & 07777))\n end", "def mode\n if stat = resource.stat\n return (stat.mode & 007777).to_s(8)\n else\n return :absent\n end\n end", "def target_mode\n return nil if resource.mode.nil?\n (resource.mode.respond_to?(:oct) ? resource.mode.oct : resource.mode.to_i) & 007777\n end", "def mode=(new_mode)\n handle_old_mode\n @mode = new_mode\n handle_new_mode\n end", "def mode\n Mode.new(ENV).mode\n end", "def mode\n site.mode\n end", "def mode=(mode)\n validator = EnumAttributeValidator.new('String', [\"default\", \"custom\"])\n unless validator.valid?(mode)\n fail ArgumentError, \"invalid value for 'mode', must be one of #{validator.allowable_values}.\"\n end\n @mode = mode\n end", "def fmode(mode)\n if FeatureGuard.enabled? :encoding\n mode\n else\n mode.split(':').first\n end\n end", "def mode\n @mode ||= :smart \n end", "def engine_mode\n data[:engine_mode]\n end", "def set_mode(new)\n @mode = new\n end", "def mode\n Relation.mode(sender_type, receiver_type)\n end", "def mode\n Relation.mode(sender_type, receiver_type)\n end", "def set_mode(m)\n @mode = m\n end", "def in_mode(mode)\n\t\t@mode = mode\n\t\tself\n\tend", "def modes\n fix_mode.modes\n end", "def usermode; @user_mode; end", "def get_mode\n send_request(FUNCTION_GET_MODE, [], '', 1, 'C')\n end", "def current_mode\n self.say \"The current mode is: #{@config[:mode]}\"\n end", "def get_modes\n @_modes\n end", "def in_mode(mode)\n @mode = mode\n self\n end", "def mode\n\t\t@mode || (proxy_owner.mode if proxy_owner.respond_to?(:mode))\n\tend", "def modes\n mode_codes.keys\n end", "def get_mode(key)\n case key\n when \"S\", \"s\" then -1 # AUTO\n when \"N\", \"n\" then 0 # NUMERIC\n when \"A\", \"a\" then 1 # ALNUM - British number: 0-9 A-Z SP $% * + - /.:\n when \"8\" then 2 # 8BIT\n when \"K\", \"k\" then 3 # KANJI\n end\n end", "def mode\n @announcer.mode\n end", "def mode=(mode)\n \n write(\"++mode 1\" ) if mode==:Device \n write(\"++mode 0\" ) if mode==:Controller\n @mode = write(\"++mode\",true).to_i==1 ? :Controller : :Device\n end", "def iom_mode\n provider.facts[\"iom_mode\"] || \"\"\n end", "def mode=(_arg0); end", "def mode=(_arg0); end", "def mode=(_arg0); end", "def mode= new_mode\n @gapi.update! mode: verify_mode(new_mode)\n end", "def mode\n \"%o\" % (File.stat(@resource[:name]).mode & 007777)\n end", "def format_class\n @mode == :modal ? \"floating\" : @mode.to_s\n end", "def mode=(mode)\n validator = EnumAttributeValidator.new('String', [\"test\", \"live\"])\n unless validator.valid?(mode)\n fail ArgumentError, \"invalid value for \\\"mode\\\", must be one of #{validator.allowable_values}.\"\n end\n @mode = mode\n end", "def binmode\n self\n end", "def mode name, &b\n mode_definitions << [name, b]\n end", "def colour_mode\n instance.options[:colour_mode]\n end", "def colour_mode\n instance.options[:colour_mode]\n end", "def fileModeToFileType\n @@FM2FT[@mode & MSK_FILE_MODE]\n end", "def fileModeToFileType\n @@FM2FT[@mode & MSK_FILE_MODE]\n end", "def mode\n @mode = Vedeu.config.terminal_mode\n end", "def mode\n @_mode ||= Configuration.terminal_mode\n end", "def getter_mode\n @getter_mode ||= :tube_name\n end", "def file_mode\n super | 0o111\n end", "def selected_mode\n return @data[self.index]\n end", "def mode\n if File.exists?(@resource[:name])\n \"%o\" % (File.stat(@resource[:name]).mode & 007777)\n else\n :absent\n end\n end", "def mode_desc\n case mode\n when 'single' then 'each'\n when 'bracketed' then \"for #{volume} or more\"\n when 'boxed' then \"for every #{volume}\"\n end\n end", "def currentgamemode\r\n\t\t\t@gamemode\r\n\t\tend", "def mode=(mode)\n validator = EnumAttributeValidator.new('String', [\"sync\", \"async\"])\n unless validator.valid?(mode)\n fail ArgumentError, \"invalid value for \\\"mode\\\", must be one of #{validator.allowable_values}.\"\n end\n @mode = mode\n end", "def mode(io) \n readable, writable = try_handle(io, \"mode\")\n\n case\n when readable && writable then \"r+\"\n when readable then \"r\"\n when writable then \"w\"\n else\n # occurs for r+ mode, for some reason\n \"r+\"\n end\n end", "def modes\n @modes + autobuild.utilities.values.\n find_all { |u| u.enabled? }.\n map(&:name)\n end", "def demo_mode\n @demo_mode\n end", "def docmode(mode)\n @doc_state[:is_plain] = mode == :plain\n noth\n end", "def set_mode\n @mode = Mode.find(params[:id])\n end", "def colormode\n # TODO: Return a ColorMode object\n mode_value = @attributes.fetch('colormode', nil)\n ColorMode.new(mode_value)\n end", "def mode\n case attributes['mode']\n when 'udp' then :udp\n else :tcp\n end\n end" ]
[ "0.82831115", "0.7741382", "0.75799763", "0.75799763", "0.75799763", "0.75799763", "0.75516474", "0.7516442", "0.7502006", "0.7390442", "0.73488104", "0.7315261", "0.72717655", "0.7258919", "0.7197753", "0.70861113", "0.7072776", "0.704463", "0.70438856", "0.70396066", "0.70375675", "0.70285976", "0.70146453", "0.6997562", "0.6969395", "0.6955803", "0.6936652", "0.69323933", "0.69144005", "0.69106996", "0.69106996", "0.68955874", "0.6889241", "0.6889241", "0.6885169", "0.6821119", "0.68153304", "0.67910147", "0.67910147", "0.6781925", "0.6762748", "0.67286867", "0.67266154", "0.6666536", "0.666197", "0.66298497", "0.65918374", "0.6590115", "0.65577316", "0.65416163", "0.6480436", "0.64719754", "0.64447385", "0.6417209", "0.6398784", "0.6393861", "0.6393861", "0.6372596", "0.6308038", "0.6305014", "0.630387", "0.62921786", "0.62705016", "0.6265997", "0.6260205", "0.6255802", "0.6240526", "0.6226319", "0.62226325", "0.62111825", "0.6197381", "0.6147048", "0.6147048", "0.6147048", "0.61401856", "0.613878", "0.61100787", "0.61003107", "0.60797465", "0.60679907", "0.6066272", "0.6066272", "0.60657156", "0.60657156", "0.60594845", "0.60560304", "0.60154796", "0.5990027", "0.59699696", "0.596608", "0.5937455", "0.5936965", "0.5921631", "0.5917858", "0.590856", "0.5878594", "0.587599", "0.586731", "0.5863505", "0.58624345" ]
0.68950915
32
Updates the mode of the field.
def mode= new_mode @gapi.update! mode: verify_mode(new_mode) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mode=(new_mode)\n handle_old_mode\n @mode = new_mode\n handle_new_mode\n end", "def set_mode(new)\n @mode = new\n end", "def set_Mode(value)\n set_input(\"Mode\", value)\n end", "def set_Mode(value)\n set_input(\"Mode\", value)\n end", "def set_Mode(value)\n set_input(\"Mode\", value)\n end", "def update!(**args)\n @mode = args[:mode] if args.key?(:mode)\n end", "def mode=(new_mode)\n LOGGER.mode = new_mode\n end", "def mode=(new_mode)\n LOGGER.mode = new_mode\n end", "def mode=(val)\n if val.blank? or val.kind_of? Fixnum then\n write_attribute(:mode, val)\n else\n write_attribute(:mode, Mode[val])\n end\n end", "def set_mode(m)\n @mode = m\n end", "def mode=(mode)\n @mode = mode ? mode.to_sym : nil\n end", "def mode=(type)\n @mode = type.to_s\n end", "def mode=(a_mode)\n @@mode = a_mode.to_sym\n end", "def mode=(mode)\n super(0100000 | (mode & 07777))\n end", "def edit(mode=@mode)\n\told_mode = @mode unless @mode == mode\n\t\n\t\t@mode = mode\n\t\t\n\t\tself.tap |mode_handle|\n\t\t\tyield mode_handle\n\t\tend", "def mode=(newmode)\n case newmode\n when :auto\n update('--auto', @resource.value(:name))\n when :manual\n # No change in value, but sets it to manual\n update('--set', name, path)\n end\n end", "def mode=(mode)\n super(0120000 | (mode & 07777))\n end", "def mode=(mode)\n request.mode = mode\n end", "def mode=(mode)\n super(040000 | (mode & 07777))\n end", "def set_mode\n @mode = Mode.find(params[:id])\n end", "def edit(mode=@mode) # not sure if you can use an instance variable like this\n\told_mode = @mode\n\t\t@mode = mode\n\t\t\n\t\tself.tap |mode_handle|\n\t\t\tyield mode_handle\n\t\tend", "def mode=(m)\n @mode = m.to_sym\n end", "def in_mode(mode)\n @mode = mode\n self\n end", "def modify_with(mode)\n representer.modify_with(self, mode)\n end", "def mode=(mode)\n Nitro.mode = mode.to_sym\n end", "def in_mode(mode)\n\t\t@mode = mode\n\t\tself\n\tend", "def mode=(mode)\n \n write(\"++mode 1\" ) if mode==:Device \n write(\"++mode 0\" ) if mode==:Controller\n @mode = write(\"++mode\",true).to_i==1 ? :Controller : :Device\n end", "def mode_name=(value)\n @mode_name = Mode.new value\n end", "def set_mode\n @mode = Mode.find(params[:id])\n end", "def set_mode(mode)\n send_request(FUNCTION_SET_MODE, [mode], 'C', 0, '')\n end", "def mode\n @mode\n end", "def mode\n Initialize() if @_mode == nil\n\n @_mode\n end", "def change_mode!( new_mode )\n unless new_mode.nil? or actor.modes.has_key?(new_mode)\n raise \"Unsupported mode #{new_mode} for actor #{actor}\"\n end\n\n if actor.mode and actor.has_behavior?(actor.mode)\n actor.remove_behavior(actor.mode)\n end\n\n if new_mode\n mode_opts = actor.modes[new_mode]\n add_behavior(new_mode, mode_opts)\n end\n actor.mode = new_mode\n end", "def mode=(select_mode)\n #ensure active\n if select_mode\n @active = true \n else\n @target_area.clear\n end\n @mode = select_mode\n end", "def set_mode newmode\n @mode = newmode\n @view.set_mode newmode\n case newmode\n when :idle\n reset_all_stats\n end\n end", "def update_mode(params)\n target_mode = params[:autograded]\n return if target_mode == autograded || !allow_mode_switching?\n\n if target_mode == true\n self.autograded = true\n self.password = nil\n self.delayed_grade_publication = false\n elsif target_mode == false # Ignore the case when the params is empty.\n self.autograded = false\n self.skippable = false\n end\n end", "def mode=(mode)\n validator = EnumAttributeValidator.new('String', [\"default\", \"custom\"])\n unless validator.valid?(mode)\n fail ArgumentError, \"invalid value for 'mode', must be one of #{validator.allowable_values}.\"\n end\n @mode = mode\n end", "def next_mode new_mode\n if has_mode? new_mode\n @mode = new_mode\n else\n warn \"Robot #{self.class} switched to unknown mode :#{new_mode}!\"\n @mode = :idle\n end\n end", "def mode=(mode)\n validator = EnumAttributeValidator.new('String', [\"sync\", \"async\"])\n unless validator.valid?(mode)\n fail ArgumentError, \"invalid value for \\\"mode\\\", must be one of #{validator.allowable_values}.\"\n end\n @mode = mode\n end", "def update\n authorize @mode\n\n unless @mode.update(mode_params)\n 'Mode was not updated.'\n end\n redirect_to game_path(@mode.game)\n end", "def update!(**args)\n @polite_mode_enabled = args[:polite_mode_enabled] if args.key?(:polite_mode_enabled)\n end", "def mode() @mode ||= detect_mode end", "def mode\n options[:mode]\n end", "def mode=(mode)\n #Can be Rufirmata::INPUT, OUTPUT, ANALOG, PWM or UNAVAILABLE\n return if @mode == mode #Nothing is changing, so nothing to do\n\n raise \"#{to_s} does not have PWM capabilities\" if mode == Rufirmata::PWM and !pwm\n raise \"#{to_s} cannot be used through Firmata\" if @mode == Rufirmata::UNAVAILABLE\n\n changing :pin_mode_changed, :changes=>{ :from=>@mode, :to=>mode } do\n @mode = mode\n unless mode == Rufirmata::UNAVAILABLE\n board.write_command(Rufirmata::SET_PIN_MODE, pin_number, mode)\n enable_reporting if mode == Rufirmata::INPUT\n end\n end\n\n end", "def update_mode(new_mode) \t\n \t#return if new_mode == mode\n \t#gateway = Eth485Gateway.new(ENV['ETH485_GATEWAY_IP'], ENV['ETH485_GATEWAY_PORT'].to_i)\n gateway = SerialportGateway.new(ENV['SERIAL_PORT'])\n meter = Mercury.new(gateway, ENV['METER_ADDRESS'].to_i)\n result = {}\n \tcase new_mode\n \t when HEATIN_CORD_OFF_MODE then\n \t \tresult = meter.disable_consumer\n if result['status'] = 'OK'\n self.update!(enable: false, mode: new_mode) \n end \n \t when HEATIN_CORD_MANUAL_ON_MODE then\n result = meter.enable_consumer\n if result['status'] = 'OK'\n self.update!(enable: true, mode: new_mode) \n end \n \t when HEATIN_CORD_AUTOMATIC_1H_SWITCH_MODE, HEATIN_CORD_AUTOMATIC_1H_PER_DAY_MODE then\n update!(mode: new_mode) \n \t #puts meter.enable_consumer \n \tend\n \n result\n end", "def current_mode=(id)\n @current_mode = id.is_a?(ChipMode) ? id.id : id\n Origen.app.listeners_for(:on_mode_changed).each do |listener|\n listener.on_mode_changed(mode: @current_mode, instance: self)\n end\n @current_mode # rubocop:disable Lint/Void\n end", "def set_flyto_mode_to(mode)\n Kamelopard::DocumentHolder.instance.current_document.flyto_mode = mode\n end", "def mode_changed\n @new_mode = Mode.find(params[:expression_mode_id])\n #FIXME : does not appear to make sense @expression_mode_id = load_expression_instance_from_session # Not possible to pass id if not saved\n \n @expression = load_expression_instance_from_session\n @expression.mode = @new_mode\n save_expression_instance_in_session\n end", "def update_transation_mode\n if self.payment_mode != \"Advance Fees\"\n self.payment_mode = self.payment_mode + \" and \"+t('advance_fees_text')\n self.transaction_ledger.update_attributes(:payment_mode => self.payment_mode)\n end\n end", "def update!(**args)\n @text_redaction_mode = args[:text_redaction_mode] if args.key?(:text_redaction_mode)\n end", "def update_inherited_mode(device, mode, changes)\n device.mode = mode\n owner.save_config\n do_apply_changes(changes)\n end", "def update\n respond_to do |format|\n if @auto_mode.update(auto_mode_params)\n format.html { redirect_to @auto_mode, notice: 'Auto mode was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @auto_mode.errors, status: :unprocessable_entity }\n end\n end\n end", "def quick_edit(mode)\n\told_mode = self.mode\n\t\tself.mode = mode\n\t\t\n\t\tself.tap |mode_handle|\n\t\t\tyield mode_handle\n\t\tend", "def change_mode(mode)\n\n @mode = mode\n\n # Create new effect and volume modifier\n case mode\n when 'normal', ''\n @effect = @fx_nil\n\n when 'cave'\n @effect = @fx_cave\n \n end\n\n #@sfx.each{ |s| s = nil }\n #@sfx = []\n #GC.start\n\n @sfx.each{ |e| e.feed(@effect,0) }\n \n end", "def mode; end", "def mode; end", "def mode; end", "def mode; end", "def mode() end", "def update!(**args)\n @mode = args[:mode] if args.key?(:mode)\n @name = args[:name] if args.key?(:name)\n @type = args[:type] if args.key?(:type)\n end", "def mode=(new_mode)\n @mode , @previous_mode = new_mode, @mode\n build_chains() if @mode != @previous_mode && @previous_mode != nil && @previous_mode != \"\"\n end", "def set_mode\n if (mode = target_mode) && (mode != (stat.mode & 007777))\n File.chmod(target_mode, file)\n Chef::Log.info(\"#{log_string} mode changed to #{mode.to_s(8)}\")\n modified\n end\n end", "def mode=(mode)\n validator = EnumAttributeValidator.new('String', [\"test\", \"live\"])\n unless validator.valid?(mode)\n fail ArgumentError, \"invalid value for \\\"mode\\\", must be one of #{validator.allowable_values}.\"\n end\n @mode = mode\n end", "def update\n @mode = Mode.find(params[:id])\n\n respond_to do |format|\n if @mode.update_attributes(params[:mode])\n flash[:notice] = \"Your changes to the #{@mode.name} Preset have been saved.\"\n format.html { redirect_to(:action => \"edit\", :id => @mode) }\n format.xml { head :ok }\n else\n flash[:notice] = \"There was an errors saving your changes. Please try again.\"\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mode.errors, :status => :unprocessable_entity }\n end\n end\n end", "def change_mode\n if @mode\n new_mode = @mode.cur.or('ace/mode/javascript')\n else\n new_mode = 'ace/mode/javascript'\n end\n `this.editor.getSession().setMode(new_mode)`\n end", "def toggle_editmode\n\t\t@editmode = true\n\t\t$screen.write_message(\"Edit mode\")\n\tend", "def mode\n TflApi::Client::Mode.new(self)\n end", "def with_mode(id, _options = {})\n orig = mode\n self.mode = id\n yield\n self.mode = orig\n end", "def set_mode(mode)\n puts \"Setting mode to #{mode}\" if $verbose\n m='MD'+mode.to_s+';'\n puts m if $verbose\n ret=send_cmd(m,'MD;',m,0.1,0.5,3)\n if(ret)\n return(ret.gsub(/^MD/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend", "def set_calc_mode(mode, calc_id = nil)\n @calc_mode = mode || 'auto'\n\n if mode == 'manual'\n @calc_on_load = false\n elsif mode == 'auto_except_tables'\n @calc_mode = 'autoNoTable'\n end\n\n @calc_id = calc_id if calc_id\n end", "def update!(**args)\n @evaluation_mode = args[:evaluation_mode] if args.key?(:evaluation_mode)\n end", "def switch_mode!\n return cooked_mode! if raw_mode?\n\n raw_mode!\n end", "def mode=(value)\n File.chmod(Integer(\"0\" + value), @resource[:name])\n end", "def set_mode\n\t\tif @year.nil? and @month.nil?\n\t\t\t@mode = :all\n\t\tend\n\n\t\tif /\\d{4}/ === @year.to_s\n\t\t\t@mode = :year\n\t\telse\n\t\t\t@year = nil\n\t\tend\n\n\t\tif /[12]H/ === @month.to_s\n\t\t\t@mode = :half\n\t\telsif /[1-4]Q/ === @month.to_s\n\t\t\t@mode = :quarter\n\t\telsif (1..12).include?(@month.to_i)\n\t\t\t@mode = :month\n\t\telse\n\t\t\t@month = nil\n\t\tend\n\n\tend", "def mode\n attributes.fetch(:mode) do\n Ably::Util::Crypto::DEFAULTS.fetch(:mode)\n end.downcase\n end", "def mode=(value)\n File.chmod(Integer(\"0#{value}\"), @resource[:name])\n end", "def modes; end", "def mode name, &b\n mode_definitions << [name, b]\n end", "def set_mode pin, mode\n reg = pin / 10\n shift = (pin % 10) * 3\n new_value = (get_int_at(reg) & ~(7 << shift)) | (mode << shift)\n set_int_at(reg, new_value)\n end", "def mode=(mode)\n case mode\n when :scene\n when :toys_only\n @current_tool = :grab\n if @selected.is_a?(ToyInScene)\n mode = :toy_selected\n else\n @selected = nil\n end\n #@truly_selected = @selected = nil\n @delegate.selected_toy = @selected\n # if @delegate.is_a?(ActionAdderViewController)\n # @delegate.start_action_flow\n # end\n setNeedsDisplay\n when :toy_selected\n @delegate.selected_toy = @selected\n if @mode.nil?\n @delegate.start_action_flow\n end\n else\n @current_point = nil\n end\n\n @mode = mode\n end", "def set_mode(mode)\n @mode = mode\n\n if mode == 'w'\n File.open(\"#{ GPIO_PATH }/gpio#{ pin_num }/direction\", \"w\") { |f| f.write(GPIO_DIRECTION_WRITE) }\n @pin_file = File.open(\"#{ GPIO_PATH }/gpio#{ pin_num }/value\", \"w\")\n elsif mode =='r'\n File.open(\"#{ GPIO_PATH }/gpio#{ pin_num }/direction\", \"w\") { |f| f.write(GPIO_DIRECTION_READ) }\n @pin_file = File.open(\"#{ GPIO_PATH }/gpio#{pin_num}/value\", \"r\")\n end\n end", "def switch_to_mode(mode)\n @name = \"\"\n\n singleton_class.send(:alias_method, :match, :\"match_#{mode}\")\n singleton_class.send(:alias_method, :finish, :\"finish_#{mode}\")\n end", "def mode=(m)\n case m\n when :udp then attributes['mode'] = 'udp'\n else attributes['mode'] = 'tcp'\n end\n end", "def set_TagMode(value)\n set_input(\"TagMode\", value)\n end", "def set_TagMode(value)\n set_input(\"TagMode\", value)\n end", "def mode_params\n params.require(:mode).permit(:name)\n end", "def mode\n params['mode']\n end", "def mode(*modes, &block)\n fail_if_wrong_modes modes\n fail 'Block required' unless block_given?\n self.current_modes = modes\n instance_eval(&block)\n reset_modes\n end", "def selected_mode\n @selected_mode\n end", "def modify_with(dataset, mode)\n raise(ArgumentError, 'Provided mode is not supported') unless support?(mode)\n raise(ArgumentError, 'No such modifier found') unless @modes[mode][:modifier]\n\n @modes[mode][:modifier].call(dataset)\n end", "def mode\n @mode ||= :smart \n end", "def update\n @travel_mode.update(travel_mode_params)\n @travel_modes = TravelMode.all\n @travel_mode = TravelMode.new\n end", "def reload_scan_mode=(mode)\n if mode == Csingular\n @reload_scan_mode = Csingular\n else\n @reload_scan_mode = Cplural\n end\n end", "def sync\n current = @resource.stat ? @resource.stat.mode : 0644\n set(desired_mode_from_current(@should[0], current).to_s(8))\n end", "def get_mode()\n session['mode'] = session['mode'] || 'edit'\n return session['mode']\n end", "def change_mode!\n chmod_params = [Integer(\"0\" + self.target_mode), self.target]\n\n if(File.symlink?(self.target) && (self.no_follow == 'both' || self.no_follow == 'chmod'))\n File.lchmod *chmod_params\n elsif(self.stat(:ftype) == 'directory' && (self.recursive == 'both' || self.recursive == 'chmod'))\n FileUtils.chmod_R *chmod_params\n else\n File.chmod *chmod_params\n end\n rescue NotImplementedError => ex\n WarningShot::PermissionResolver.logger.error(\"lchmod is not implemented on this machine, (disable nofollow).\")\n return false\n rescue Exception => ex\n WarningShot::PermissionResolver.logger.error(\"Unable to change mode for file: #{self.target}; Exception: #{ex.message}\")\n return false\n end", "def getter_mode=(mode)\n unless SUPPORTED_MODES.include? mode\n raise ArgumentError, \"Unsupported mode for acts_as_getter.\"\n end\n @getter_mode = mode\n end", "def update!(**args)\n @copy_mode = args[:copy_mode] if args.key?(:copy_mode)\n end", "def strict_mode=(value); end", "def get_mode()\n end" ]
[ "0.74436414", "0.7338009", "0.72996503", "0.72996503", "0.72854596", "0.71889395", "0.71225977", "0.71225977", "0.6927123", "0.68225056", "0.6785598", "0.6779125", "0.67547053", "0.6741139", "0.6693237", "0.66868323", "0.6656586", "0.6616257", "0.66143656", "0.6610173", "0.6482327", "0.6477574", "0.6456815", "0.6451697", "0.6443699", "0.6439239", "0.6414693", "0.6412283", "0.6371173", "0.62956643", "0.6255743", "0.6207612", "0.62009096", "0.61806524", "0.6165756", "0.6138157", "0.6098266", "0.60651934", "0.6058755", "0.6053786", "0.60467523", "0.6038927", "0.6034317", "0.60080945", "0.5996053", "0.5993053", "0.5989416", "0.59833944", "0.5980238", "0.5970916", "0.59699076", "0.594004", "0.59324104", "0.59302014", "0.5915369", "0.5915369", "0.5915369", "0.5915369", "0.5898479", "0.5889701", "0.5888572", "0.5876776", "0.58764213", "0.5867281", "0.5865152", "0.57763183", "0.5772426", "0.577044", "0.576441", "0.57637715", "0.57383764", "0.5729247", "0.5686934", "0.5680291", "0.56767595", "0.5662498", "0.5610679", "0.5603742", "0.55970883", "0.55902344", "0.55877906", "0.55802125", "0.5575949", "0.55109423", "0.55109423", "0.55053866", "0.5491844", "0.5476911", "0.5475089", "0.5472107", "0.54523623", "0.54470456", "0.54431826", "0.54356855", "0.5419336", "0.54190344", "0.5417353", "0.54116267", "0.54049563", "0.54031974" ]
0.7462092
0
The policy tag list for the field. Policy tag identifiers are of the form `projects//locations//taxonomies//policyTags/`. At most 1 policy tag is currently allowed.
def policy_tags names = @gapi.policy_tags&.names names.to_a if names && !names.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_policy_tags\n policy_tags = []\n if @policy_tags_enabled\n if @node.respond_to?('policy_group') && !@node.policy_group.nil?\n policy_tags << \"#{@scope_prefix}policy_group:#{@node.policy_group}\"\n end\n if @node.respond_to?('policy_name') && !@node.policy_name.nil?\n policy_tags << \"#{@scope_prefix}policy_name:#{@node.policy_name}\"\n end\n end\n policy_tags\n end", "def policy_tags= new_policy_tags\n # If new_policy_tags is nil, send an empty array.\n # Sending a nil value for policy_tags results in no change.\n new_policy_tags = Array(new_policy_tags)\n policy_tag_list = Google::Apis::BigqueryV2::TableFieldSchema::PolicyTags.new names: new_policy_tags\n @gapi.update! policy_tags: policy_tag_list\n end", "def tag_list\n data[:tag_list]\n end", "def tag_list\n data[:tag_list]\n end", "def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end", "def list_of_tags\n tag_list\n end", "def tag_list\n\t\tself.tags.map(&:name).join(\", \")\n\tend", "def tag_list\n tags.map(&:name).join(\", \")\n end", "def policy_list_names\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('policy/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tlist = Array.new\n\t\t\tdocxml.root.elements['contents'].elements['policies'].each_element('//policy') {|policy|\n\t\t\t\tlist.push policy.elements['policyName'].text\n\t\t\t}\n\t\t\treturn list\n\t\tend", "def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end", "def tag_list\n tags.collect(&:name).join(', ')\n end", "def tag_list\n tags.collect(&:name).join(', ')\n end", "def tag_list\n\t\t@tag_list ||= self.tags.map { |tag| tag.name }.join(', ')\n\tend", "def tags\n @fields.tag_list\n end", "def tag_list\n tags.join(\", \")\n end", "def tag_list\n tags.collect do |tag|\n tag.name\n end.join(', ')\n end", "def tag_list\n tags.map(&:name).join(', ')\n end", "def tag_list\n tags.map(&:name).join(\", \")\n end", "def tag_list\n tags.map(&:name).join(\", \")\n end", "def tag_list\n tags.map(&:name).join(\", \")\n end", "def aws_tags_list\n @aws.tags\n end", "def policy_list_names\r\n\t\tpost= { \"token\" => @token } \r\n\t\tdocxml=nessus_request('policy/list', post)\r\n\t\tlist = Array.new\r\n\t\tdocxml.root.elements['contents'].elements['policies'].each_element('//policy') {|policy|\r\n\t\t\t\tlist.push policy.elements['policyName'].text\r\n\t\t}\r\n\t\treturn list\r\n\tend", "def tag_list\n tag_list_array = self.tags.to_a\n tag_list_array.delete_if { |tag| Tag.main_tags.include?(tag.name) }\n tag_list_array.map(&:name).join(\", \")\n end", "def raw_tags_plist\n plist_virtual_attribute_get(:raw_tags)\n end", "def policy_list_uids\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('policy/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tpids=Array.new\n\t\t\tdocxml.root.elements['contents'].elements['policies'].each_element('//policy') { |policy|\n\t\t\t\tpids.push(policy.elements['policyID'].text) }\n\t\t\treturn pids\n\t\tend", "def tags\n attributes[:tags] || []\n end", "def tag_list\n\t\tself.tags.collect do |tag|\n\t\t\ttag.name\n\t\tend.join(\", \") #When we joined the array Ruby called the default #to_s method on every one of these Tag instances \n\tend", "def tag_list\n #tags sie bierze z asocjacji\n tags.map { |t| t.name }.join(\",\")\n end", "def taglist\n\tself.tags.map {|t| t.name}\n end", "def get_tags(feature)\n tags = []\n feature.custom_fields.each { |field| tags = field.value if field.name = 'Tag' }\n tags\n end", "def allowed_tags; end", "def allowed_tags; end", "def policy_list_uids\r\n\t\tpost= { \"token\" => @token } \r\n\t\tdocxml=nessus_request('policy/list', post)\r\n\t\tpids=Array.new\r\n\t\tdocxml.root.elements['contents'].elements['policies'].each_element('//policy') { |policy| \r\n\t\t\tpids.push(policy.elements['policyID'].text) }\r\n\t\treturn pids\r\n\tend", "def tag_names\n if tags_string\n tags_string.split(',').map(&:strip)\n else\n []\n end\n end", "def tag_names\n self.tags.map(&:name).join(\", \")\n end", "def linked_tags\n taggings.map {|tagging| tagging.tag.value}\n end", "def tags\n\t\tt = read_attribute(:tags)\n\t\tt.nil? ? \"\" : t.join(', ')\n\tend", "def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end", "def tag_list; []; end", "def tag_names\n self.tags.map{ |t| t.name }.join(\", \")\n end", "def tags\n @tags ||= []\n end", "def tag_list\n tags.map{ |tag| tag.name }.reject(&:empty?).join(\" \")\n end", "def skill_tags\n return @skill_tags\n end", "def tag_list\n #converting all tag objects to an array of tag names\n self.tags.collect do |tag|\n tag.name\n end.join(\", \") #join the array of tag names with a comma\n end", "def tag_list(list = [])\n taggings = ActsAsTaggableOn::Tagging.find_all_by_taggable_id(id)\n if taggings\n taggings.each do |tagging|\n next unless tagging.context == 'interest'\n list << ActsAsTaggableOn::Tag.find(tagging.tag_id).name\n end\n end\n # return empty default or tags retrieved via ActsAsTaggableOn\n list\n end", "def tags\n @values.keys.map { |key| @tag_names[key] }\n end", "def tag_list\n tags.map { |tag| tag.name.include?(\" \") ? '\"' +\"#{tag.name}\" + '\"' : tag.name }.join(\" \")\n end", "def my_tag_list\n self.taggings.order('id ASC').map(&:tag).map(&:name)\n end", "def policy_list_hash\n\t\t\tpost= { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('scan/list', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tpolicies=Array.new\n\t\t\tdocxml.elements.each('/reply/contents/policies/policies/policy') { |policy|\n\t\t\t\tentry=Hash.new\n\t\t\t\tentry['id']=policy.elements['policyID'].text if policy.elements['policyID']\n\t\t\t\tentry['name']=policy.elements['policyName'].text if policy.elements['policyName']\n\t\t\t\tentry['comment']=policy.elements['policyComments'].text if policy.elements['policyComments']\n\t\t\t\tpolicies.push(entry)\n\t\t\t}\n\t\t\treturn policies\n\t\tend", "def product_tags\n self.tag_list.join(\", \")\n end", "def tag_list\r\n \treturn self.blog_post_tags.join(\", \")\r\n end", "def tags\n ['any'] + @tags\n end", "def tags\n ['any'] + @tags\n end", "def tag_names\n @tag_names || tags.map(&:name).join(',')\n end", "def tag_list\n reindex unless @clean\n @tags.keys\n end", "def access_tags\n tags = []\n tags << 'admin' if admin?\n tags << 'speaker' if speaker?\n tags << 'staff' if staff?\n tags\n end", "def get_tags\n [['pxb', 'PXB'], ['ind', 'Individuals'], ['bus', 'Businesses'], ['grp', 'Peer Groups']]\n end", "def tags\n Array(@options[:tags]).map { |tag| CGI.escape(tag) }\n end", "def product_tags=(values)\n self.tag_list = values\n end", "def applied_tags\n parent_model.respond_to?(:all_tags) ? parent_model.all_tags : []\n end", "def tag_names\n @tag_names ||= tags.map(&:name).join(' ')\n end", "def tags(*list)\n @tags.concat(makelist(list)) unless list.empty?\n @tags\n end", "def tags\n @tags ||= []\n end", "def tags\n usertags = []\n proposals.each do |proposal|\n usertags << proposal.tags.map(&:name) unless usertags.include?(proposal.tags.map(&:name))\n end\n remove_duplicates(usertags.flatten)\n end", "def tags\n request_libraries.collect(&:tag_id)\n end", "def tags\n self.lib.tags.map { |r| tag(r) }\n end", "def requested_tags\n @requested_tags ||= []\n end", "def tags\n @obj['tags']\n end", "def list_tags\n\n r = []\n n = @node\n\n while n\n ts = n['tags']\n r.concat(ts) if ts\n n = @execution['nodes'][n['parent']]\n end\n\n r\n end", "def tags\n data[:tags]\n end", "def tags\n data[:tags]\n end", "def tags\n data[:tags]\n end", "def tags\n data[:tags]\n end", "def tags\n data[:tags]\n end", "def tags\n normal[:tags] = Array(normal[:tags])\n normal[:tags]\n end", "def user_tags\n self.tag_list.join(\" , \")\n end", "def course_tags(params)\n return [] unless params.fetch(:course, {}).fetch(:tags_list, false).present?\n\n tags_param = params[:course][:tags_list].split(',')\n\n tags_param.map! { |tag| { name: tag } }\n end", "def tags\n return @tags\n end", "def tags\n return @tags\n end", "def tags\n return @tags\n end", "def tags\n libraries.collect(&:tag_id)\n end", "def tag_list_name\n self.tag_list if tag_list\n end", "def tags\n article_tags = data['tags']\n\n if article_tags.is_a? String\n article_tags.split(',').map(&:strip)\n else\n Array(article_tags).map(&:to_s)\n end\n end", "def get_tag_list\n args = receive_should_validate?\n get('redtube.Tags.getTagList', {}, [], args[:should_validate])\n end", "def skill_tags=(value)\n @skill_tags = value\n end", "def tags()\n\t\t\treturn @metadata.attributes[:tags].to_a\n\t\tend", "def all_tags\n all_tags = []\n meanings.each do |meaning_hash|\n if meaning_hash.tags.size > 0\n all_tags << meaning_hash.tags\n end\n end\n return all_tags.flatten\n end", "def git_tag_list\n `git tag --list 'v*' --format='%(tag) %(taggerdate:short)'`\n end", "def tag_list= value\n self.tags = value.split(',').map(&:strip)\n end", "def tag_list= value\n self.tags = value.split(',').map(&:strip)\n end", "def tags\n @values.keys.map {|tag| Values.tag_map[tag]}\n end", "def tags\n attributes.fetch(:tags)\n end", "def tags\n attributes.fetch(:tags)\n end", "def get_tag_list\n # body = {\n # cmd: \"get_tag_list\"\n # }\n\n end", "def tag(tags = self.tags)\n tags.to_s.split(/\\s*,\\s*/).uniq\n end", "def tags\n article_tags = data.tags || data.tag\n \n if article_tags.is_a? String\n article_tags.split(',').map(&:strip)\n else\n Array(article_tags).map(&:to_s)\n end \n end", "def tags=(value)\n value = value.split(',') if value.is_a?(String)\n\n write_attribute(:tags, Taggable.sanitize_tag_list(Array(value)))\n end", "def list_policies\n nessus_rest_get('policies')['policies']\n end", "def tags\n response[\"tags\"]\n end", "def all_tags\n self.tags.map(&:name).join(\", \")\n end" ]
[ "0.686827", "0.64193606", "0.6193602", "0.6193602", "0.60909736", "0.6085833", "0.60737056", "0.606432", "0.6043317", "0.6029182", "0.6021539", "0.6021539", "0.601281", "0.59840417", "0.59713894", "0.5930394", "0.5914106", "0.5884815", "0.5884815", "0.5884815", "0.58509874", "0.58280677", "0.5790679", "0.5787661", "0.5725109", "0.5712254", "0.5708084", "0.56627536", "0.56538934", "0.5589172", "0.5544904", "0.5544904", "0.55278206", "0.552554", "0.5520337", "0.5514224", "0.54882413", "0.54875946", "0.5486301", "0.54379755", "0.5433482", "0.5419459", "0.5413144", "0.5404539", "0.5401004", "0.53897184", "0.5360696", "0.5357555", "0.53561985", "0.53481543", "0.5344057", "0.5339417", "0.5339417", "0.5338204", "0.53231245", "0.5321581", "0.5314818", "0.53125167", "0.52867365", "0.5283595", "0.52829695", "0.5282935", "0.5264854", "0.52643645", "0.5264219", "0.52554524", "0.52465343", "0.5228353", "0.5222944", "0.52216107", "0.52216107", "0.52216107", "0.52216107", "0.52216107", "0.52140176", "0.5206828", "0.5203739", "0.5201379", "0.5201379", "0.5201379", "0.51998484", "0.519858", "0.5197081", "0.5187102", "0.5168489", "0.5168148", "0.5165028", "0.5164399", "0.516439", "0.516439", "0.5161774", "0.5157081", "0.5157081", "0.51549417", "0.51456106", "0.5139016", "0.51338995", "0.5103217", "0.5101739", "0.50969553" ]
0.7704126
0
Updates the policy tag list for the field.
def policy_tags= new_policy_tags # If new_policy_tags is nil, send an empty array. # Sending a nil value for policy_tags results in no change. new_policy_tags = Array(new_policy_tags) policy_tag_list = Google::Apis::BigqueryV2::TableFieldSchema::PolicyTags.new names: new_policy_tags @gapi.update! policy_tags: policy_tag_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_tags=(values)\n self.tag_list = values\n end", "def tag_list= value\n self.tags = value.split(',').map(&:strip)\n end", "def tag_list= value\n self.tags = value.split(',').map(&:strip)\n end", "def update_tags\n if self.tags.any?\n self.tags.each do |tag|\n tag.update(owner: User.first)\n end\n end\n end", "def update\n new_tags = params[:problem].to_unsafe_h[\"tag_list\"].scan(/\\w+/)\n new_tags.each do |tag|\n @problem.tag_list.add(tag)\n end\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @problem }\n else\n format.html { render :edit }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @organization\n @organization.tag_list.add @tags\n if @organization.save\n render :json => @organization.reload.tags\n else\n error!(:invalid_resource, @organization.errors, \"Tags have not been saved\")\n end\n end", "def raw_tags_plist=(value)\n obj = value.to_s.from_plist\n self.raw_tags = obj\n end", "def tag_names=(list)\n # Throw away extra space and blank tags\n list = list.map {|x| x.strip}.reject {|x| x.blank?}\n \n # Re-use any tags that already exist\n self.tags = device.account.tags.all(:conditions => {:name => list})\n tag_names = self.tags.map(&:name)\n \n # Create new tags for any names left in the list\n list.reject! {|x| tag_names.find {|name| name.casecmp(x) == 0}}\n self.tags += device.account.tags.create(list.map {|n| {:name => n}}).select(&:valid? )\n end", "def tags=(list)\n tag(self.class.name)\n tag(*list)\n end", "def policy_tags\n names = @gapi.policy_tags&.names\n names.to_a if names && !names.empty?\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @policy_tags = args[:policy_tags] if args.key?(:policy_tags)\n end", "def attributes_for_update(attribute_names)\n tag_lists = tag_types.map { |tags_type| \"#{tags_type.to_s.singularize}_list\" }\n super.delete_if { |attr| tag_lists.include? attr }\n end", "def update_tags(tag_list, reload_tags = true)\n new_tags = Tag.parse_to_tags(tag_list)\n return tag_with(new_tags | self.tags, reload_tags)\n end", "def update_tags\n return unless tag_string\n new_tag_names = tag_string.split(\",\").map { |t| t.strip.downcase }\n current_tag_names = tags.collect(&:name)\n new_tag_names.each do |tag_name| \n unless current_tag_names.include? tag_name\n tag = Tag.where(name: tag_name)[0]\n tag = Tag.create! name: tag_name unless tag\n self.tags << tag \n end\n end\n tags.each { |t| (tags.remove t) unless (new_tag_names.include? t.name) }\n end", "def added_tags=(value)\n @added_tags = value\n end", "def update_tags_value\n feature_value = FeatureValue.find(params[:feature_value_id])\n tag_id = params[:tag_id].to_i\n current_value = feature_value.value_genuine || []\n if current_value.include?(tag_id)\n current_value.delete(tag_id)\n else\n current_value << tag_id\n end\n feature_value.set_value(current_value, nil, nil, current_user)\n render :update do |page| end\n end", "def add_tags\n \tunless tags_field.blank?\n\t\t\ttags = tags_field.split(\",\")\n\t\t\ttags.each do |tag|\n self.tags << Tag.find_or_initialize_by_name(tag.strip)\n\t\t\tend\n\t\tend\t\n end", "def cache_tag_list\n set_cached_tag_list\n save\n end", "def tags_to_add=(value)\n @tags_to_add = value\n end", "def update\n authorize @user\n @user.tag_list.add @tags\n if @user.save\n render :json => @user.reload.tags\n else\n error!(:invalid_resource, @user.errors, \"Tags have not been saved\")\n end\n end", "def tag_list=(my_tags)\n\t\t_new_tags = my_tags.split(',').map { |t| t.strip }.uniq\n\t\t_recent_tags = self.tags.map { |tag| tag.name }\n\n\t\t(_recent_tags - _new_tags).each { |tag| self.tags.where(name: tag).first.destroy } unless _recent_tags.blank?\n\t\tself.tags << (_new_tags - _recent_tags).map { |tag| Tag.find_or_create_by(name: tag) } unless _new_tags.blank?\n\t\t@tag_list = nil\n\tend", "def update_tags!\n return unless @params.key?(:tags)\n\n tags_to_remove.each do |tag_title|\n TaskTag.where(task: task).joins(:tag).merge(Tag.where(title: tag_title)).destroy_all\n end\n\n tags_to_add.each do |tag_title|\n TaskTag.where(task: task, tag: tag_from_title(tag_title)).first_or_create!\n end\n end", "def update_policy(arn, doc)\n MU::Cloud::AWS::Role.update_policy(arn, doc, credentials: @credentials)\n end", "def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\nend", "def assign_tags_to_user\n current_user.tag(@quote, :with => params[:quote][:tag_list], :on => :tags)\n end", "def update_tags\n tags=self.tag_ids.clone\n unless tags.nil?\n self.associations.each do |a|\n #destroy an association if its tag wasn't checked in the form\n a.destroy unless tags.include?(a.tag_id.to_s)\n #for each existing association, delete its tag from the parameters(to prevent duplicate associations)\n tags.delete(a.tag_id.to_s)\n end\n devs=Tag.find(:all,:conditions=>'type_id=4',:select=>'id').map{|d| d.id.to_s}\n genres=Tag.find(:all,:conditions=>'type_id=2',:select=>'id').map{|g| g.id.to_s}\n if (tags&devs).length==0\n indie=Tag.find_by_name('Independent')\n # if no developer has been selected, assume \"Independent\"\n self.associations.create(:tag_id=>indie.id)\n end\n if (tags&genres).length==0\n other=Tag.find_by_name('Other')\n # if no genre has been selected, assume \"Other\"\n self.associations.create(:tag_id=>other.id)\n end\n tags.each do |t|\n self.associations.create(:tag_id=>t) unless t.blank?\n end\n reload\n end\n end", "def tags=(list)\n @tags = makelist(list)\n end", "def tags_to_add\n current_tags - linked_tags\n end", "def all_tags=(proverb_tags)\n tag_names = proverb_tags.collect{|tag_name| tag_name.strip.downcase}.uniq\n self.tags = tag_names.map do |proverb_tag|\n Tag.where(name: proverb_tag).first_or_create!\n end\n end", "def all_tags=(proverb_tags)\n tag_names = proverb_tags.collect{|tag_name| tag_name.strip.downcase}.uniq\n self.tags = tag_names.map do |proverb_tag|\n Tag.where(name: proverb_tag).first_or_create!\n end\n end", "def update_policy new_policy_hash\n new_policy_hash = new_policy_hash.try(:to_hash) || {}\n\n new_policy = new_policy_hash.underscorify_keys\n policy = to_hash.underscorify_keys.deep_reset(false)\n\n policy.deep_merge! new_policy\n update_attribute(:the_policy, _jsonable(policy))\n end", "def update\n unless @listing.tag_list == listing_params[:tag_list].split(\",\")\n @listing.tag_list = listing_params[:tag_list]\n @listing.save\n end\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Your listing has been updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end", "def tag_list=(names)\n self.tags = names.split(\",\").map do |n|\n SimpleTags::Tag.where(name: n.strip).first_or_create!\n end\n end", "def set_current_tags_state\n return unless params.dig 'site_page', 'tags_attributes'\n tags = params.dig('site_page', 'tags_attributes').split(' ')\n new_tags = []\n\n # Remove old ones\n @page.tags.find_each { |t| new_tags << { id: t.id, _destroy: 1 } unless tags.include?(t.value) }\n\n # Add new ones\n tags.delete_if { |t| @page.tags.pluck(:value).include?(t) }\n\n new_tags << tags.map { |t| { value: t } } if tags.any?\n new_tags.flatten!\n\n @page.tags_attributes = new_tags\n\n session[:tags_attributes][\"#{@page_id}\"] = new_tags\n end", "def update!(**args)\n @child_policy_tags = args[:child_policy_tags] if args.key?(:child_policy_tags)\n @description = args[:description] if args.key?(:description)\n @display_name = args[:display_name] if args.key?(:display_name)\n @policy_tag = args[:policy_tag] if args.key?(:policy_tag)\n end", "def add_tags(tag)\n remove_previous_tags\n if @page.find(input_elements[:tag_input_field]).present?\n @page.find(input_elements[:tag_input_field]).set(tag)\n else\n @page.find(input_elements[:tag_input_field2]).set(tag)\n end\n @page.find(input_elements[:tag_selected]).click\n @used_tag = tag\n end", "def write_tag_list_on(context, tags)\n if (self.is_auto_tag_ownership_enabled?)\n self.tag_owner.tag(self, :with => tags, :on => context, :skip_save => true)\n else\n self.set_tag_list_on(context, tags)\n end\n end", "def reorder_list(field)\n index = 1\n list_scope(field).order_by(field => 'asc').each do |document|\n next if document.id == id\n\n index += 1 if index == self[field] && persisted?\n document.set(field => index)\n index += 1\n end\n\n if list_scope_changed?(field)\n list_scope_was(field).order_by(field => 'asc').each_with_index do |document, index|\n document.set(field => index + 1)\n end\n end\n end", "def update_tags(metricDefinition)\n @client.http_put(\"/#{@resource}/#{metricDefinition.id}/tags\",metricDefinition.hash[:tags])\n end", "def update\n super\n\n if resource.save\n params.permit(:tags_interest_areas => [])\n @interest_tags = params[:tags_interest_areas]\n\n resource.interest_areas.destroy_all\n\n if not @interest_tags.nil?\n @interest_tags.each do |tag|\n temp_tag = Tag.find_by_tag_name(tag)\n if not temp_tag.nil?\n resource.interest_areas << temp_tag if not resource.interest_areas.include?(temp_tag) \n else\n resource.interest_areas << Tag.create(tag_name: tag)\n end\n end\n end\n\n params.permit(:tags_expertise_areas => [])\n @expertise_tags = params[:tags_expertise_areas]\n\n resource.expertise_areas.destroy_all\n\n if not @expertise_tags.nil?\n @expertise_tags.each do |tag|\n temp_tag = Tag.find_by_tag_name(tag)\n if not temp_tag.nil?\n resource.expertise_areas << Tag.find_by_tag_name(tag) if not resource.expertise_areas.include?(temp_tag) \n else\n resource.expertise_areas << Tag.create(tag_name: tag)\n end\n end\n end\n end\n end", "def update\n story = Story.find(params[:id])\n authorize story # check policies/story_policy.rb for auth rules\n\n if story_params[:tags]\n story_params[:tags].each do |tag|\n # If tag exists then use existing tag name\n if Tag.exists?(tag)\n story.tags << Tag.find_by_name(tag[\"name\"])\n else\n story.tags << Tag.new(tag)\n end\n end\n end\n\n if story.update(story_params.except(:tags)) && story.save\n response_with('Story successfully saved', 200)\n else\n response_with('Could not update story', 400)\n end\n end", "def update_policy(resource, name, config)\n puts Colors.blue(\"\\tupdating policy #{name}...\")\n policy = resource.policy(name)\n if config.empty?\n policy.delete()\n else\n policy.put({\n :policy_document => config.as_pretty_json\n })\n end\n end", "def tag_list=(names)\n tag_names = names.split(\",\").map! {|tag| tag.downcase.strip.gsub(/[^\\w]/,'_') }\n tags_array = []\n tag_names.each do |name|\n tags_array << Tag.where(name: name).first_or_create\n end\n self.tags = tags_array\n end", "def tags=(value)\n value = value.split(',') if value.is_a?(String)\n\n write_attribute(:tags, Taggable.sanitize_tag_list(Array(value)))\n end", "def save_new_tag_to_tag_table(tag_attributes)\n\n tag_attributes.split(\",\").each do |value|\n value=value.strip\n available_tag = Tag.where('tagname = ?', value).first #checking if added tag is available in the list/not.\n new_tag = Tag.create(:tagname => value) if available_tag.blank? #If it's a new tag then create and Add it to Tag list.\n available_tag.blank? ? self.insert_ids_to_post_tags(new_tag.id) : self.insert_ids_to_post_tags(available_tag.id) #Depending on tag available or it's a new tag, updating post_tags tag.\n end\n\n end", "def update_tag_attribute(content, tag_name, attr_name, init_val); end", "def update\n @record = user_records.find(params[:id])\n current_user.tag(@record, with: double_escape_quotes(params[:record][:tag_list]), on: :tags)\n respond_with(@record)\n end", "def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").map{ |s| s.strip.downcase }.uniq\n new_or_found_tags = tag_names.map { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end", "def tag_list_tokens=(tokens)\n self.tag_list = tokens.gsub(\"'\", \"\")\n end", "def update_tags(tags)\n rescue_extra_data\n tags = tags.split(\",\").strip\n post_tags = post_type.post_tags\n post_tags = post_tags.where.not(name: tags) if tags.present?\n term_relationships.where(\"term_taxonomy_id in (?)\", post_tags.pluck(\"#{CamaleonCms::TermTaxonomy.table_name}.id\")).destroy_all\n tags.each do |f|\n post_tag = post_type.post_tags.where({name: f}).first_or_create(slug: f.parameterize)\n term_relationships.where({term_taxonomy_id: post_tag.id}).first_or_create\n end\n update_counters(\"tags\")\n end", "def tag_list=(names)\n self.tags = names.split(\",\").map do |n|\n Tag.where(name: n.strip).first_or_create!\n end\n end", "def propagate_privacy\n return unless name_tag\n name_tag.is_global = List.exists? name_tag_id: name_tag_id, availability: [0,1]\n name_tag.save if name_tag.changed?\n end", "def tag_list=(names)\n self.tags = names.split(\",\").map do |n|\n Tag.where(name: n.strip).first_or_create!\n end\n end", "def tag_list=(names)\n self.tags = names.split(\",\").map do |n|\n Tag.where(name: n.strip).first_or_create!\n end\n end", "def tag_list=(names)\n self.tags = names.split(\",\").map do |n|\n Tag.where(name: n.strip).first_or_create!\n end\n end", "def set_Tags(value)\n set_input(\"Tags\", value)\n end", "def set_Tags(value)\n set_input(\"Tags\", value)\n end", "def set_Tags(value)\n set_input(\"Tags\", value)\n end", "def set_Tags(value)\n set_input(\"Tags\", value)\n end", "def set_Tags(value)\n set_input(\"Tags\", value)\n end", "def set_Tags(value)\n set_input(\"Tags\", value)\n end", "def tag_list=(names)\n self.tags = names.split(\", \").map do |n|\n Tag.where(name: n.strip.downcase).first_or_create!\n end\n end", "def tag_list=(names)\n\t\tself.tags = names.split(\",\").map do |name|\n\t\t\tTag.where(name: name.strip).first_or_create!\n\t\tend\n\tend", "def get_updated_tag_list\n if is_filtered?\n @tags = Tag.filtered_hacker_tags(session[:filter], current_user.id)\n else\n @tags = Tag.current_hacker_tags(current_user.id)\n end\n end", "def update_definition(definition) \n raise \"error no id for domain #{id}, #{self.inspect}\" unless id\n raise \"wrong set_tags definition\" unless definition[:set_tags].nil? or definition[:set_tags].is_a?(Array)\n\n # :set_tags is an array either of tag's ids (so already existing) or a list of string (in this case the tag \n # will be created)\n new_tags_ids = definition[:set_tags].collect { |tag_or_id| check_value_bis(tag_or_id) }.flatten\n \n # compute the difference between the existings tag of this domain and the new list\n tag_ids_to_destroy = tag_ids.clone\n\n tags_ids_to_add = []\n \n new_tags_ids.each { |tag_id| tag_ids_to_destroy.delete(tag_id) if tag_ids_to_destroy.include?(tag_id) }\n \n tag_ids_to_destroy.each { |tag_id_to_destroy| destroy_tag(tag_id_to_destroy) }\n \n super({:tag_ids => new_tags_ids})\n end", "def update\n authorize @ticket\n @ticket.tag_list.add @tags\n if @ticket.save\n render :json => @ticket.reload.tags\n else\n error!(:invalid_resource, @ticket.errors, \"Tags have not been saved\")\n end\n end", "def tag_list=(tags_string)\n tag_names = tags_string.split(/[\\s,\",\"]/).map{ |s| s.strip.downcase }.uniq\n new_or_found_tags = tag_names.map { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end", "def update_policy(arn, doc)\n begin\n MU::Cloud::AWS.iam(credentials: @config['credentials']).create_policy_version(\n policy_arn: arn,\n set_as_default: true,\n policy_document: JSON.generate(doc)\n )\n rescue Aws::IAM::Errors::LimitExceeded => e\n delete_version = MU::Cloud::AWS.iam(credentials: @config['credentials']).list_policy_versions(\n policy_arn: arn,\n ).versions.last.version_id\n MU.log \"Purging oldest version (#{delete_version}) of IAM policy #{arn}\", MU::NOTICE\n MU::Cloud::AWS.iam(credentials: @config['credentials']).delete_policy_version(\n policy_arn: arn,\n version_id: delete_version\n )\n retry\n end\n end", "def add_tags\n self.tag_list = 'bug, feature, improvement, feedback, discussion, help'\n end", "def tag_with(tag_list, reload_tags = true)\n return remove_tags(self.tags) if tag_list.blank?\n new_tags = Tag.parse_to_tags(tag_list)\n tags_to_update = new_tags & self.tags\n tags_to_add = new_tags - self.tags\n tags_to_delete = self.tags - new_tags\n TxactionTagging.transaction do\n tags_to_update.each {|t| update_tagging(t) }\n tags_to_add.each {|t| create_tagging(t) }\n destroy_taggings(tags_to_delete) if tags_to_delete.any?\n update_attribute(:tagged, true)\n end\n\n self.taggings(reload_tags)\n return self.tags(reload_tags) # need to reload or AR doesn't see the changes\n end", "def spaced_tags=(value)\n self.tag_list = value.to_s.split(' ')\n end", "def update\n respondent = SurveyRespondent.find(params[:respondent_id])\n tag_context = params[:context] # tag context\n tag_list = params[:tags] # comma seperated list of tags\n\n if getTagOwner\n getTagOwner.tag(respondent, :with => tag_list, :on => tag_context)\n else\n respondent.set_tag_list_on(tag_context, tag_list) # set the tag list on the respondent for the context\n end\n \n respondent.save\n \n render :layout => 'content'\n end", "def tag_list=(tags_string)\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n new_or_found_tags = tag_names.collect { |name| Tag.find_or_create_by(name: name) }\n self.tags = new_or_found_tags\n end", "def tags_input\n adding_field do |f|\n f.text_field :tags, :value => question.tags.join(\", \"), :class => \"text_field autocomplete_for_tags\"\n end\n end", "def update_tags\n @updated = Tag.refresh_counts\n @deleted = []\n Tag.unused.order(:title).all.each do |tag|\n @deleted << tag.destroy\n end\n end", "def update\n @post.update_attributes(post_params)\n @post.tag_list=(params[:tag_list])\n respond_with @post\n end", "def update\n @image_tags = ActsAsTaggableOn::Tag.all\n\n tag_list = params[:image][:tag_list]\n @image.tag_list = tag_list.keys.select{|t| tag_list[t] == \"1\"}\n\n\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: \"Image was successfully updated.\" }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_tags(*value)\n @value[:post_tags] = value.flatten\n end", "def tags=(list)\n tags.clear\n for id in list\n tags << Tag.find(id) if !id.empty?\n end\n end", "def after_save\n save_tags\n end", "def tags_attributes=(tag_attributes)\n tag_attributes.values.each do |tag_name|\n tag_name.values.each do |tag|\n tag.split(\", \").each do |name|\n tag = Tag.find_or_create_by(name: name)\n tag.slug = tag.to_slug\n tag.save\n self.tags << tag\n end\n end\n end\n end", "def tag_list=(tags_string)\n self.taggings.destroy_all\n\n tag_names = tags_string.split(\",\").collect{|s| s.strip.downcase}.uniq\n\n tag_names.each do |tag_name|\n tag = Tag.find_or_create_by_name(tag_name)\n tagging = self.taggings.new\n tagging.tag_id = tag.id\n end # end of do iteration\n end", "def field_params\n params.require(:tag).permit(:tag)\n end", "def update\n\n tags = params[:tags]\n @piece.taggings.destroy_all\n\n tags.downcase.split(',').each do |tag_name|\n tag = Tag.find_or_create_by(name: tag_name.strip)\n @piece.taggings.create(user_id: current_user.id, tag_id: tag.id)\n end\n\n if @piece.update(piece_params)\n redirect_to @piece, notice: 'Piece was successfully updated.'\n else\n render :edit\n end\n end", "def update_allowed_values\n self.url_allowed = true if url_required\n self.description_allowed = true if description_required\n self.title_allowed = true if title_required\n\n TagSet::TAG_TYPES.each do |tag_type|\n required = eval(\"#{tag_type}_num_required\") || eval(\"self.#{tag_type}_num_required\") || 0\n allowed = eval(\"#{tag_type}_num_allowed\") || eval(\"self.#{tag_type}_num_allowed\") || 0\n if required > allowed\n eval(\"self.#{tag_type}_num_allowed = required\")\n end\n end\n end", "def tag_ids=(list)\n tags.clear\n for id in list\n tags << Tag.find(id) if !id.empty?\n end\n end", "def update\n @post = Post.find(params[:id])\n current_user.tag(@post, :with => params[:post][:tag_list], :on => :tags)\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(@post, :notice => 'Post was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @tags = args[:tags] if args.key?(:tags)\n end", "def update!(**args)\n @tags = args[:tags] if args.key?(:tags)\n end", "def add_tag(tag)\n\n (h.fields['__tags__'] ||= []) << tag\n end", "def tag_list\n reindex unless @clean\n @tags.keys\n end", "def tag_list=(tags)\n new_tags = tags.is_a?(String) ? tags.split(',') : tags\n location_tags = [self.location, self.city, self.state, self.country]\n updated_tags = [location_tags, new_tags].flatten.compact.reject{|n| n.blank?}.map{|n| n.strip}.uniq.join(', ')\n super updated_tags\n end", "def skill_tags=(value)\n @skill_tags = value\n end", "def set_tags(tags)\n @tags.update(tags)\n end", "def tag_names=(tags)\n tag_array = tags.split(\",\").map{|tag| tag.strip}\n tag_array.each do |tag|\n new_tag = Tag.find_or_create_by(name: tag)\n if self.tags.include?(new_tag)\n next\n end\n self.tags << new_tag\n self.owner.tags << new_tag\n end\n end", "def update_tag_count(tenant_id,tags)\n @instance_counter.update_tag_count(tenant_id,tags)\n end", "def update!(**args)\n @child_policy_tags = args[:child_policy_tags] if args.key?(:child_policy_tags)\n @description = args[:description] if args.key?(:description)\n @display_name = args[:display_name] if args.key?(:display_name)\n @name = args[:name] if args.key?(:name)\n @parent_policy_tag = args[:parent_policy_tag] if args.key?(:parent_policy_tag)\n end", "def tag_names=(tag_names)\n self.tags = tag_names.map do |tag_name|\n tag_name.strip!\n self.tags.find_or_create_by(name: tag_name)\n end\n end", "def additional_tags=(value)\n @additional_tags = value\n end" ]
[ "0.55922896", "0.539742", "0.539742", "0.53874755", "0.535781", "0.5308555", "0.5232926", "0.5229278", "0.5211289", "0.5194023", "0.51815975", "0.5173509", "0.5172196", "0.51485544", "0.5132083", "0.5130251", "0.51200163", "0.51054484", "0.50936425", "0.509348", "0.50623614", "0.50533473", "0.50505936", "0.50492805", "0.5037254", "0.50369316", "0.5028384", "0.50173235", "0.49742055", "0.49742055", "0.49456444", "0.49405047", "0.49024448", "0.48982587", "0.48912904", "0.48764148", "0.4874019", "0.48740083", "0.4870856", "0.48696372", "0.48663518", "0.4866224", "0.48644587", "0.48582074", "0.48577532", "0.48572755", "0.48564842", "0.48478666", "0.4846708", "0.48383957", "0.4827303", "0.48270744", "0.48268694", "0.4825793", "0.4825793", "0.4825793", "0.48241693", "0.48241693", "0.48241693", "0.48241693", "0.48241693", "0.48241693", "0.4823426", "0.48222744", "0.48077464", "0.48051506", "0.48030147", "0.47953084", "0.47858918", "0.47779033", "0.47744474", "0.47680536", "0.4766465", "0.4765039", "0.47500506", "0.47477478", "0.4747055", "0.47397256", "0.47231928", "0.4705062", "0.47049832", "0.47001058", "0.46991646", "0.46970677", "0.46905065", "0.46887392", "0.46786788", "0.46673033", "0.46646956", "0.46646956", "0.46482143", "0.4645418", "0.46440482", "0.46435925", "0.46396428", "0.46273804", "0.4623003", "0.46207383", "0.46167246", "0.46107018" ]
0.68708473
0
The default value of a field using a SQL expression. It can only be set for top level fields (columns). Default value for the entire struct or array is set using a struct or array expression. The valid SQL expressions are: Literals for all data types, including STRUCT and ARRAY. The following functions: `CURRENT_TIMESTAMP` `CURRENT_TIME` `CURRENT_DATE` `CURRENT_DATETIME` `GENERATE_UUID` `RAND` `SESSION_USER` `ST_GEOPOINT` Struct or array composed with the above allowed functions, for example: "[CURRENT_DATE(), DATE '20200101'"]
def default_value_expression @gapi.default_value_expression end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_definition_default_sql(sql, column)\n sql << \" DEFAULT #{literal(column[:default])}\" if column.include?(:default)\n end", "def default_value_expression= default_value_expression\n @gapi.update! default_value_expression: default_value_expression\n end", "def default_value(field)\n case field.type\n when TYPE_STRING, TYPE_BYTES\n %{\"#{field.default_value}\"}\n when TYPE_BOOL\n field.default_value\n when TYPE_ENUM\n typename = field_typename(field)\n %{#{typename}::#{capfirst(field.default_value)}}\n else\n field.default_value\n end\n end", "def default_values_clause\n 'VALUES (DEFAULT)'\n end", "def default(col)\n _col = column(col)\n _col.nil? ? nil : _col.default\n end", "def default(column)\n column_named(column).default || nil\n end", "def default\n #----------\n \n # the default field value; retrieve from the options\n default = options[ :default ]\n \n # is there are default value?\n unless default.nil?\n self.value_from( default.respond_to?( :call ) ? default.call : default )\n end\n \n end", "def default_when_null(sql, default)\n \"COALESCE (#{sql}, #{dispatch(default)})\"\n end", "def column_definition_default_sql(sql, column)\n super\n if !column[:serial] && !['smallserial', 'serial', 'bigserial'].include?(column[:type].to_s) && !column[:default]\n if (identity = column[:identity])\n sql << \" GENERATED \"\n sql << (identity == :always ? \"ALWAYS\" : \"BY DEFAULT\")\n sql << \" AS IDENTITY\"\n elsif (generated = column[:generated_always_as])\n sql << \" GENERATED ALWAYS AS (#{literal(generated)}) STORED\"\n end\n end\n end", "def attribute_default(field)\n return unless field.has_default?\n val = field.default\n case\n when val.is_a?(Proc) && (val.arity == 0)\n self.instance_exec(&val)\n when val.is_a?(UnboundMethod) && (val.arity == 0)\n val.bind(self).call\n when val.respond_to?(:call)\n val.call(self, field.name)\n else\n val.try_dup\n end\n end", "def to_default_fields_sql(builder, definition, &block)\n raise ScopedSearch::QueryNotSupported, \"Value not a leaf node\" unless rhs.kind_of?(ScopedSearch::QueryLanguage::AST::LeafNode)\n\n # Search keywords found without context, just search on all the default fields\n fragments = definition.default_fields_for(rhs.value, operator).map { |field|\n builder.sql_test(field, operator, rhs.value,'', &block) }.compact\n\n case fragments.length\n when 0 then nil\n when 1 then fragments.first\n else \"#{fragments.join(' OR ')}\"\n end\n end", "def default_db_value\n class_name.columns_hash[@column.to_s].default\n end", "def eval_default(doc)\n if fields = doc.__selected_fields\n evaluated_default(doc) if included?(fields)\n else\n evaluated_default(doc)\n end\n end", "def default_value\n default_db_value ? default_db_value.to_s : \"null\"\n end", "def default_value\n match = if definition =~ /timestamp|datetime/i\n /default '?(.+[^'])'?/i.match(definition)\n else\n /default '?(\\w+)'?/i.match(definition)\n end\n\n return unless match\n\n match[1].downcase != 'null' ? match[1] : nil\n end", "def default\n @default ||= \"#{fields.first.sql} ASC\"\n end", "def default_value(value); value; end", "def default_value\n column = association_class.column_for_attribute(attribute_name)\n\n case column.type\n when :date\n direction == :asc ? DATE_MIN : Date.current\n when :datetime\n (direction == :asc ? DATE_TIME_MIN : Time.current.utc).iso8601(6)\n when :string, :text\n direction == :asc ? STRING_MIN : STRING_MAX\n else\n ActiveModel::Type::Integer.new(limit: column.limit).send(direction == :asc ? :min_value : :max_value)\n end\n end", "def evaluated_default(doc)\n if default_val.respond_to?(:call)\n evaluate_default_proc(doc)\n else\n serialize_default(default_val.__deep_copy__)\n end\n end", "def default_values\n @query = \"default values\"\n end", "def column_default(key)\n self.class.column_default(key)\n end", "def defaults\n fields.inject({}) do |defs, (field_name,field)|\n next(defs) if field.default.nil?\n defs[field_name.to_s] = field.default\n defs\n end\n end", "def column_schema_to_ruby_default_fallback(default, options)\n if default.is_a?(String) && options[:same_db] && use_column_schema_to_ruby_default_fallback?\n default = default.to_s\n def default.inspect\n \"#{super}.lit\"\n end\n default\n end\n end", "def default_value(obj, options)\n field_value = options[name]\n if field_value.nil?\n if default?\n default_value = default\n elsif block?\n default_value = block[obj]\n end\n else\n field_value\n end\n end", "def default\n if @default\n sql = \"SELECT CAST(#{@default} AS #{column_def}) FROM RDB$DATABASE\"\n connection = ActiveRecord::Base.connection\n if connection\n value = connection.select_one(sql)['cast']\n if value.acts_like?(:date) or value.acts_like?(:time)\n nil\n else\n type_cast(value)\n end\n else\n raise ConnectionNotEstablished, \"No Firebird connections established.\"\n end\n end\n end", "def sql_expr\n @sql_expr ||= (meta[:sql_expr] || to_sql_name)\n end", "def quote_default_value(value, column)\n if column.type == :uuid && value =~ /\\(\\)/\n value\n else\n quote(value)\n end\n end", "def dynamic_value(val, type = nil)\n FieldDefaults.calculate_default(current_instance, val, type, allow_nil: true)\n end", "def default(*names)\n self.class.schema.default(self.class, names)\n end", "def default\n return nil unless default_value\n default_value.respond_to?(:call) ? default_value.call : default_value.dup\n end", "def new_column_from_field(table_name, field)\n column_name, type, default, notnull, oid, fmod, collation, comment = field\n type_metadata = fetch_type_metadata(column_name, type, oid.to_i, fmod.to_i)\n default_value = extract_value_from_default(default)\n default_function = extract_default_function(default_value, default)\n\n if match = default_function&.match(/\\Anextval\\('\"?(?<sequence_name>.+_(?<suffix>seq\\d*))\"?'::regclass\\)\\z/)\n sequence_name = match[:sequence_name]\n is_schema_name_included = sequence_name.split(\".\").size > 1\n _table_name = is_schema_name_included ? table_name : table_name.split(\".\").last\n\n serial = sequence_name_from_parts(_table_name, column_name, match[:suffix]) == sequence_name\n end\n\n PostgreSQL::Column.new(\n column_name,\n default_value,\n type_metadata,\n !notnull,\n default_function,\n collation: collation,\n comment: comment.presence,\n serial: serial\n )\n end", "def column_schema_to_ruby_default_fallback(default, options)\n if default.is_a?(String) && options[:same_db] && use_column_schema_to_ruby_default_fallback?\n default = default.dup\n def default.inspect\n \"Sequel::LiteralString.new(#{super})\"\n end\n default\n end\n end", "def column(name, type, options = {})\n def_accessors(name)\n set_attribute_default(name, options[:default])\n end", "def revert_default( type, default, ruby_default )\n if type.to_s =~ /date|time/\n case default\n when /CURRENT_TIMESTAMP/i\n # This matches our use of MySQL timestamps in schema definitions.\n return Sequel.lit('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP')\n end\n end\n\n default = ruby_default unless ruby_default.nil?\n\n case default\n when /'(.*?)'::integer/\n return $1.to_i\n when nil, String, Numeric, TrueClass, FalseClass\n return default\n when DateTime\n return default.strftime( '%F %T' )\n else\n return default.to_s\n end\n end", "def extract_value_from_default(default)\n case default\n # Quoted types\n when /\\A[\\(B]?'(.*)'.*::\"?([\\w. ]+)\"?(?:\\[\\])?\\z/m\n # The default 'now'::date is CURRENT_DATE\n if $1 == \"now\" && $2 == \"date\"\n nil\n else\n $1.gsub(\"''\", \"'\")\n end\n # Boolean types\n when 'true', 'false'\n default\n # Numeric types\n when /\\A\\(?(-?\\d+(\\.\\d*)?)\\)?(::bigint)?\\z/\n $1\n # Object identifier types\n when /\\A-?\\d+\\z/\n $1\n else\n # Anything else is blank, some user type, or some function\n # and we can't know the value of that, so return nil.\n nil\n end\n end", "def default_value(relvar, tuple)\n case d = options[:default]\n when ::Rubyrel::Defaults::DefaultHandler\n d.compute_value(relvar, self, tuple)\n else\n d\n end\n end", "def default_value\n self['default']\n end", "def build\n column_value.nil? ? default_value : send(:\"column_value_#{column_type}\")\n end", "def default_value\n return unless default?\n\n node_parts[1]\n end", "def default=(value); end", "def default(value)\n Defaulting.new default: value\n end", "def get_default\n @df_int\n end", "def add_field(field, default=nil)\n _define_method(field.to_sym) unless @options[field.to_sym]\n send(\"#{field.to_sym}=\", default)\n end", "def change_column_default_value(col_name, value)\r\n raise \"Do not execute this method in client/server mode!\" if \\\r\n @db.client?\r\n\r\n raise \":recno cannot have a default value!\" if col_name == :recno\r\n\r\n raise 'Invalid column name: ' % col_name unless \\\r\n @field_names.include?(col_name)\r\n\r\n raise 'Cannot set default value for this type: ' + \\\r\n '%s' % @field_types.index(col_name) unless \\\r\n KBTable.valid_default_type?(\r\n @field_types[@field_names.index(col_name)])\r\n \r\n if value.nil?\r\n @db.engine.change_column_default_value(self, col_name, nil)\r\n else\r\n @db.engine.change_column_default_value(self, col_name,\r\n convert_to_encoded_string(\r\n @field_types[@field_names.index(col_name)], value))\r\n end\r\n \r\n # Need to reinitialize the table instance and associated indexes.\r\n @db.engine.remove_recno_index(@name)\r\n @db.engine.remove_indexes(@name)\r\n\r\n update_header_vars\r\n create_indexes\r\n create_table_class unless @db.server?\r\n end", "def default\n `return self.$default;`\n end", "def default_select\n if (sel = associated_class.dataset.opts[:select]) && sel.all?{|c| selection_is_qualified?(c)}\n sel\n else\n Sequel::SQL::ColumnAll.new(associated_class.table_name)\n end\n end", "def default(default_value)\n lambda do |rec, acc|\n if acc.empty?\n acc << default_value\n end\n end\n end", "def default_value\n # generally, elements contain string (except containers)\n ''\n end", "def evaluate_default_proc(doc)\n serialize_default(default_val[])\n end", "def default\n d = opts[ :default ]\n d = type_default if d.nil? && ! allow_null\n d\n end", "def set_default\n (!default || value?) ? self : add_value(default)\n end", "def default_column?(col)\n if col == \"id\" || col == \"created_at\" || col == \"updated_at\" then\n return true\n end\n false\n end", "def date_default_value(date)\n date.nil? || date == '' ? '0000-00-00' : date.to_s\n end", "def default\n by_id(default_id)\n end", "def default\n attributes.default\n end", "def date_default_value(date)\n default_date = date.to_s\n default_date.blank? ? '0000-00-00' : default_date\n end", "def add_field_to_column_family(*args)\n new_field = self.class.add_field_to_column_family(*args)\n method = \"#{new_field.name}=\"\n send(method, new_field.default) if respond_to? method\n end", "def default_value\n @default_value ||= (value_hash[{}] ||= Value.new(self, labels: labels))\n end", "def default_value\n if @default_value\n @default_value\n elsif @multiple\n []\n end\n end", "def default value = nil\n @default = value if value\n @default\n end", "def default_value(name)\n @@default_value[name]\n end", "def set_default_values\n h = {}\n if @db_schema\n @db_schema.each do |k, v|\n if v[:callable_default]\n h[k] = v[:callable_default]\n elsif !v[:ruby_default].nil?\n h[k] = convert_default_value(v[:ruby_default])\n end\n end\n end\n @default_values = h.merge!(@default_values || OPTS)\n end", "def extract_value_from_default(default)\n super ||\n extract_escaped_string_from_default(default) ||\n extract_time_from_default(default) ||\n extract_empty_array_from_default(default) ||\n extract_decimal_from_default(default)\n end", "def default_query\n data_class.column_names.map do |c|\n column_type = data_class.columns_hash[c].type\n operator = (self.class.js_property(:attribute_operators_map)[column_type] || []).first.try(:fetch, 0) || \"matches\"\n {:attr => c, :attr_type => column_type, :operator => operator}\n end\n end", "def dynamic_fields\n default_columns.collect do |c|\n {\n :name => c[:name],\n :type => c[:attr_type] == :json ? :text : c[:attr_type], # store :json columns as :text\n :default => c[:default_value]\n }\n end\n end", "def get_default\n @df_str\n end", "def default(values, default_value)\n if values.present?\n values\n else\n default_value\n end\n end", "def default=(val)\n self['default'] = val\n end", "def default_schema\n # TODO: add parsing of available tags and measurements to put together\n # a default schema\n nil\n end", "def default_variable_type\n field_type.default_variable_type\n end", "def default_value\n if @default.is_a?(Proc)\n @default.call\n else\n @default\n end\n end", "def default=(obj)\n `return self.$default = obj;`\n end", "def default_value\n return @default_value\n end", "def default!\n @value = default\n end", "def sql_literal(value)\n Arel::Nodes::SqlLiteral.new(value)\n end", "def convert_default_value(v)\n case v\n when Sequel::CURRENT_DATE\n lambda{Date.today}\n when Sequel::CURRENT_TIMESTAMP\n lambda{dataset.current_datetime}\n when Hash, Array\n v = Marshal.dump(v).freeze\n lambda{Marshal.load(v)}\n when Delegator\n # DelegateClass returns an anonymous case, which cannot be marshalled, so marshal the\n # underlying object and create a new instance of the class with the unmarshalled object.\n klass = v.class\n case o = v.__getobj__\n when Hash, Array\n v = Marshal.dump(o).freeze\n lambda{klass.new(Marshal.load(v))}\n else\n v\n end\n else\n v\n end\n end", "def select_default(select)\n defaults[:select] = select\n end", "def default_values\n self.date ||= DateTime.now\n end", "def default_value\n self[:value] ||= {}\n self[:value][:default_value] ||= ''\n self[:value][:default_value].to_f unless self[:value][:default_value].empty?\n end", "def get_default_value\n raise 'get_default_value must be implemented'\n end", "def change_column_default(table, column, value)\n current_instructions << Instructions::ChangeColumnDefault.new(\n table: table,\n column: column,\n value: value,\n )\n end", "def default(entity)\n case options[:default]\n when Proc\n entity.instance_eval options[:default]\n else\n options[:default]\n end\n end", "def default(value)\n @default_value = value\n end", "def default_value\n\t\t# This bizarre construct is done in order to not be reliant\n\t\t# on the inherent assignment-order when using Property.new({...})\n\t\t# since that hash can be ordered anywhich way .daniel\n\t\tif value_id\n\t\t\tvalue_object.default_value\n\t\telse\t\t\t\n\t\t\t@default_value\n\t\tend\n\tend", "def columns_default_values\n columns.inject({}) do |r,c|\n assoc, assoc_method = assoc_and_assoc_method_for_column(c)\n if c[:default_value].nil?\n r\n else\n if assoc\n r.merge(assoc.options[:foreign_key] || assoc.name.to_s.foreign_key => c[:default_value])\n else\n r.merge(c[:name] => c[:default_value])\n end\n end\n end\n end", "def evaluate_default_proc(doc)\n serialize_default(doc.__send__(default_name))\n end", "def default_value(default)\n case default\n # This is a performance optimization for Ruby 1.9.2 in development.\n # If the value is nil, we return nil straight away without checking\n # the regular expressions. If we check each regular expression,\n # Regexp#=== will call NilClass#to_str, which will trigger\n # method_missing (defined by whiny nil in ActiveSupport) which\n # makes this method very very slow.\n when NilClass\n nil\n # Numeric types\n when /\\A\\(?(-?\\d+(\\.\\d*)?\\)?)\\z/\n $1\n # Character types\n when /\\A'(.*)'::(?:character varying|bpchar|text)\\z/m\n $1\n # Character types (8.1 formatting)\n when /\\AE'(.*)'::(?:character varying|bpchar|text)\\z/m\n $1.gsub(/\\\\(\\d\\d\\d)/) { $1.oct.chr }\n # Binary data types\n when /\\A'(.*)'::bytea\\z/m\n $1\n # Date/time types\n when /\\A'(.+)'::(?:time(?:stamp)? with(?:out)? time zone|date)\\z/\n $1\n when /\\A'(.*)'::interval\\z/\n $1\n # Boolean type\n when 'true'\n true\n when 'false'\n false\n # Geometric types\n when /\\A'(.*)'::(?:point|line|lseg|box|\"?path\"?|polygon|circle)\\z/\n $1\n # Network address types\n when /\\A'(.*)'::(?:cidr|inet|macaddr)\\z/\n $1\n # Bit string types\n when /\\AB'(.*)'::\"?bit(?: varying)?\"?\\z/\n $1\n # XML type\n when /\\A'(.*)'::xml\\z/m\n $1\n # Arrays\n when /\\A'(.*)'::\"?\\D+\"?\\[\\]\\z/\n $1\n # Object identifier types\n when /\\A-?\\d+\\z/\n $1\n else\n # Anything else is blank, some user type, or some function\n # and we can't know the value of that, so return nil.\n nil\n end\n end", "def default_value\n { 'value' => '', 'other' => '' }\n end", "def set_column_default(table, *args)\n alter_table(table) {set_column_default(*args)}\n end", "def set_column_default(table, *args)\n alter_table(table) {set_column_default(*args)}\n end", "def property(name, default=0, &block)\n define_db_property(name, default, &block)\n end", "def default_values\n {name: \"default\", index: -1, experiment_id: nil}\n end", "def sql_literal(ds)\n ds.literal(sql_expr)\n end", "def add_field!(field_name, value = T.unsafe(nil)); end", "def field_ast(field, arguments = {}, &blk)\n type = field.type.unwrap\n\n # Bail unless we have the required arguments.\n required_args_are_present = field.arguments.all? do |arg_name, arg|\n arguments.key?(arg_name) || valid_input?(arg.type, nil)\n end\n\n if !required_args_are_present\n nil\n else\n f_alias = field.graphql_name == 'id' ? nil : random_alias\n f_args = arguments.map do |name, value|\n GraphQL::Language::Nodes::Argument.new(name: name, value: value)\n end\n\n GraphQL::Language::Nodes::Field.new(name: field.graphql_name, alias: f_alias, arguments: f_args)\n end\n end", "def default_value\n @value || recommended_value\n end", "def default_value\n @value || recommended_value\n end", "def default_expression_label\n self.default_options[:expression_label].present? ? self.default_options[:expression_label] : 'Expression'\n end", "def sql_for_field(field, operator, value, db_table, db_field, is_custom_filter=false)\n sql = ''\n case operator\n when \"=\"\n if value.any?\n case type_for(field)\n when :date, :date_past\n sql = date_clause(db_table, db_field, (Date.parse(value.first) rescue nil), (Date.parse(value.first) rescue nil))\n when :integer\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) = #{value.first.to_i})\"\n else\n sql = \"#{db_table}.#{db_field} = #{value.first.to_i}\"\n end\n when :float\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) BETWEEN #{value.first.to_f - 1e-5} AND #{value.first.to_f + 1e-5})\"\n else\n sql = \"#{db_table}.#{db_field} BETWEEN #{value.first.to_f - 1e-5} AND #{value.first.to_f + 1e-5}\"\n end\n else\n sql = \"#{db_table}.#{db_field} IN (\" + value.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \")\"\n end\n else\n # IN an empty set\n sql = \"1=0\"\n end\n when \"!\"\n if value.any?\n sql = \"(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (\" + value.collect{|val| \"'#{connection.quote_string(val)}'\"}.join(\",\") + \"))\"\n else\n # NOT IN an empty set\n sql = \"1=1\"\n end\n when \"!*\"\n sql = \"#{db_table}.#{db_field} IS NULL\"\n sql << \" OR #{db_table}.#{db_field} = ''\" if is_custom_filter\n when \"*\"\n sql = \"#{db_table}.#{db_field} IS NOT NULL\"\n sql << \" AND #{db_table}.#{db_field} <> ''\" if is_custom_filter\n when \">=\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, (Date.parse(value.first) rescue nil), nil)\n else\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) >= #{value.first.to_f})\"\n else\n sql = \"#{db_table}.#{db_field} >= #{value.first.to_f}\"\n end\n end\n when \"<=\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, nil, (Date.parse(value.first) rescue nil))\n else\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) <= #{value.first.to_f})\"\n else\n sql = \"#{db_table}.#{db_field} <= #{value.first.to_f}\"\n end\n end\n when \"><\"\n if [:date, :date_past].include?(type_for(field))\n sql = date_clause(db_table, db_field, (Date.parse(value[0]) rescue nil), (Date.parse(value[1]) rescue nil))\n else\n if is_custom_filter\n sql = \"(#{db_table}.#{db_field} <> '' AND CAST(CASE #{db_table}.#{db_field} WHEN '' THEN '0' ELSE #{db_table}.#{db_field} END AS decimal(30,3)) BETWEEN #{value[0].to_f} AND #{value[1].to_f})\"\n else\n sql = \"#{db_table}.#{db_field} BETWEEN #{value[0].to_f} AND #{value[1].to_f}\"\n end\n end\n when \"o\"\n sql = \"#{queried_table_name}.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{connection.quoted_false})\" if field == \"status_id\"\n when \"c\"\n sql = \"#{queried_table_name}.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{connection.quoted_true})\" if field == \"status_id\"\n when \"><t-\"\n # between today - n days and today\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, 0)\n when \">t-\"\n # >= today - n days\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, nil)\n when \"<t-\"\n # <= today - n days\n sql = relative_date_clause(db_table, db_field, nil, - value.first.to_i)\n when \"t-\"\n # = n days in past\n sql = relative_date_clause(db_table, db_field, - value.first.to_i, - value.first.to_i)\n when \"><t+\"\n # between today and today + n days\n sql = relative_date_clause(db_table, db_field, 0, value.first.to_i)\n when \">t+\"\n # >= today + n days\n sql = relative_date_clause(db_table, db_field, value.first.to_i, nil)\n when \"<t+\"\n # <= today + n days\n sql = relative_date_clause(db_table, db_field, nil, value.first.to_i)\n when \"t+\"\n # = today + n days\n sql = relative_date_clause(db_table, db_field, value.first.to_i, value.first.to_i)\n when \"t\"\n # = today\n sql = relative_date_clause(db_table, db_field, 0, 0)\n when \"ld\"\n # = yesterday\n sql = relative_date_clause(db_table, db_field, -1, -1)\n when \"w\"\n # = this week\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = Date.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago, - days_ago + 6)\n when \"lw\"\n # = last week\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = Date.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago - 7, - days_ago - 1)\n when \"l2w\"\n # = last 2 weeks\n first_day_of_week = l(:general_first_day_of_week).to_i\n day_of_week = Date.today.cwday\n days_ago = (day_of_week >= first_day_of_week ? day_of_week - first_day_of_week : day_of_week + 7 - first_day_of_week)\n sql = relative_date_clause(db_table, db_field, - days_ago - 14, - days_ago - 1)\n when \"m\"\n # = this month\n date = Date.today\n sql = date_clause(db_table, db_field, date.beginning_of_month, date.end_of_month)\n when \"lm\"\n # = last month\n date = Date.today.prev_month\n sql = date_clause(db_table, db_field, date.beginning_of_month, date.end_of_month)\n when \"y\"\n # = this year\n date = Date.today\n sql = date_clause(db_table, db_field, date.beginning_of_year, date.end_of_year)\n when \"~\"\n sql = \"LOWER(#{db_table}.#{db_field}) LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'\"\n when \"!~\"\n sql = \"LOWER(#{db_table}.#{db_field}) NOT LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'\"\n else\n raise \"Unknown query operator #{operator}\"\n end\n\n return sql\n end", "def initialize(name, default, sql_type = nil)\n @name, @default, @type = name, default, simplified_type(sql_type)\n @limit = extract_limit(sql_type) unless sql_type.nil?\n end" ]
[ "0.67377514", "0.6483813", "0.6316746", "0.6221594", "0.6145545", "0.6050926", "0.600729", "0.599084", "0.59106916", "0.5907113", "0.588262", "0.58748096", "0.58539283", "0.5853167", "0.5814387", "0.57894194", "0.5741978", "0.5655963", "0.5608236", "0.56039613", "0.56001836", "0.55849457", "0.55622715", "0.5506505", "0.5458403", "0.542188", "0.5411887", "0.5408598", "0.53947943", "0.5340007", "0.5307728", "0.53075874", "0.52649313", "0.52512735", "0.523891", "0.52108103", "0.5205618", "0.51929384", "0.51914525", "0.51817757", "0.51735073", "0.515752", "0.51570356", "0.5154653", "0.5153365", "0.51463985", "0.51411444", "0.512464", "0.5117987", "0.51176655", "0.5117086", "0.51143867", "0.5111206", "0.5104467", "0.50946134", "0.5078226", "0.5066395", "0.50607777", "0.5055649", "0.50389093", "0.50327206", "0.5030954", "0.50014484", "0.5000895", "0.49942905", "0.4988598", "0.49803376", "0.49746254", "0.49686548", "0.49610588", "0.49581158", "0.49566874", "0.49564946", "0.4955113", "0.4950166", "0.49478158", "0.49475446", "0.49472445", "0.4941031", "0.49393472", "0.49372974", "0.49275613", "0.49160278", "0.49055794", "0.48980576", "0.4896759", "0.48964375", "0.4889582", "0.48837847", "0.48837847", "0.48722303", "0.48666534", "0.48654667", "0.48650068", "0.48585454", "0.48526436", "0.48526436", "0.48418403", "0.48386976", "0.4837871" ]
0.65507853
1
Updates the default value expression of the field.
def default_value_expression= default_value_expression @gapi.update! default_value_expression: default_value_expression end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_value_expression\n @gapi.default_value_expression\n end", "def attribute_default(field)\n return unless field.has_default?\n val = field.default\n case\n when val.is_a?(Proc) && (val.arity == 0)\n self.instance_exec(&val)\n when val.is_a?(UnboundMethod) && (val.arity == 0)\n val.bind(self).call\n when val.respond_to?(:call)\n val.call(self, field.name)\n else\n val.try_dup\n end\n end", "def set_default\n (!default || value?) ? self : add_value(default)\n end", "def default_value=(value)\n\t\t@default_value = value\n\tend", "def default_value(field)\n case field.type\n when TYPE_STRING, TYPE_BYTES\n %{\"#{field.default_value}\"}\n when TYPE_BOOL\n field.default_value\n when TYPE_ENUM\n typename = field_typename(field)\n %{#{typename}::#{capfirst(field.default_value)}}\n else\n field.default_value\n end\n end", "def default=(value); end", "def default_value=(value)\n @default_value = value\n end", "def default\n #----------\n \n # the default field value; retrieve from the options\n default = options[ :default ]\n \n # is there are default value?\n unless default.nil?\n self.value_from( default.respond_to?( :call ) ? default.call : default )\n end\n \n end", "def default_value=(default)\n @default_value = default\n end", "def default_value(value); value; end", "def default=(value)\n self.value = value\n @default = value\n end", "def default!\n @value = default\n end", "def default=(val)\n self['default'] = val\n end", "def set_default(value)\r\n\t\t\tself.default_value = value\r\n\t\tend", "def set_default(method_binding, default_value )\n defaults_for(method_binding.klass)[method_binding.operator] = default_value\n end", "def default(value)\n @default_value = value\n end", "def default\n return nil unless default_value\n default_value.respond_to?(:call) ? default_value.call : default_value.dup\n end", "def default_expression_label\n self.default_options[:expression_label].present? ? self.default_options[:expression_label] : 'Expression'\n end", "def default=(obj)\n `return self.$default = obj;`\n end", "def evaluated_default(doc)\n if default_val.respond_to?(:call)\n evaluate_default_proc(doc)\n else\n serialize_default(default_val.__deep_copy__)\n end\n end", "def default=(value)\n @default = value\n end", "def default_value\n return unless default?\n\n node_parts[1]\n end", "def dynamic_value(val, type = nil)\n FieldDefaults.calculate_default(current_instance, val, type, allow_nil: true)\n end", "def default_value(obj, options)\n field_value = options[name]\n if field_value.nil?\n if default?\n default_value = default\n elsif block?\n default_value = block[obj]\n end\n else\n field_value\n end\n end", "def default_value\n return @default_value\n end", "def default_value\n self[:value] ||= {}\n self[:value][:default_value] ||= ''\n self[:value][:default_value].to_f unless self[:value][:default_value].empty?\n end", "def column_definition_default_sql(sql, column)\n sql << \" DEFAULT #{literal(column[:default])}\" if column.include?(:default)\n end", "def default_value(relvar, tuple)\n case d = options[:default]\n when ::Rubyrel::Defaults::DefaultHandler\n d.compute_value(relvar, self, tuple)\n else\n d\n end\n end", "def default(default_value)\n lambda do |rec, acc|\n if acc.empty?\n acc << default_value\n end\n end\n end", "def default_value\n @value || recommended_value\n end", "def default_value\n @value || recommended_value\n end", "def default_value\n self['default']\n end", "def add_field(field, default=nil)\n _define_method(field.to_sym) unless @options[field.to_sym]\n send(\"#{field.to_sym}=\", default)\n end", "def default(value)\n Defaulting.new default: value\n end", "def with_default_value_of(default_value)\n @attribute_options[:default] = default_value\n @description << \" with a default value of #{default_value.inspect}\"\n @expected_ancestors << \"ActiveAttr::AttributeDefaults\"\n @attribute_expectations << lambda { @model_class.allocate.send(:_attribute_default, @attribute_name) == default_value }\n self\n end", "def default value = nil\n @default = value if value\n @default\n end", "def item_default_value(item)\n return nil if item.group? || item.default.nil?\n if item.default.respond_to?(:call)\n # Callable default, call in context of a root cursor, yielding our context (generally a\n # model instance) to the block.\n val = DslProxy.exec(Cursor.new(root, @values), @context, &(item.default))\n val = Settings.parse(val, item.type)\n else\n val = item.default\n end\n Settings.restore(val, item.type)\n end", "def set_default_attribute(key, value)\n attr_hash = HashWithIndifferentAccess.from_dotted_path(key, value)\n self.default = self.default.merge(attr_hash)\n end", "def default_value\n if @default.is_a?(Proc)\n @default.call\n else\n @default\n end\n end", "def default_value\n default_db_value ? default_db_value.to_s : \"null\"\n end", "def default=(new_default)\n @default_proc = nil\n @default = new_default\n end", "def add_defaults(field)\n default, name = field.default_val, field.name.to_s\n remove_defaults(name)\n unless default.nil?\n if field.pre_processed?\n pre_processed_defaults.push(name)\n else\n post_processed_defaults.push(name)\n end\n end\n end", "def default_value\n match = if definition =~ /timestamp|datetime/i\n /default '?(.+[^'])'?/i.match(definition)\n else\n /default '?(\\w+)'?/i.match(definition)\n end\n\n return unless match\n\n match[1].downcase != 'null' ? match[1] : nil\n end", "def default_value(val); @next_default_value = val; end", "def default_value(val); @next_default_value = val; end", "def default_value\n @default_value ||= (value_hash[{}] ||= Value.new(self, labels: labels))\n end", "def default_value(name)\n @@default_value[name]\n end", "def default=(_); end", "def evaluate_default_proc(doc)\n serialize_default(default_val[])\n end", "def _apply_field_defaults args\n _apply_default_options args, field_options.reverse_merge(label: true, wrap_field: true, label_first: true)\n end", "def default_value(val); @@next_default_value = val; end", "def default_value\n column = association_class.column_for_attribute(attribute_name)\n\n case column.type\n when :date\n direction == :asc ? DATE_MIN : Date.current\n when :datetime\n (direction == :asc ? DATE_TIME_MIN : Time.current.utc).iso8601(6)\n when :string, :text\n direction == :asc ? STRING_MIN : STRING_MAX\n else\n ActiveModel::Type::Integer.new(limit: column.limit).send(direction == :asc ? :min_value : :max_value)\n end\n end", "def default=( val )\r\n @opts[:default] = val\r\n end", "def inplace_editable_default_display_with(value); value; end", "def default_amount=(new_amount)\n new_amount = new_amount.gsub(/[^0-9.]/i, '') unless new_amount.is_a?(Numeric)\n self[:default_amount] = new_amount\n end", "def default(value)\n @default = value\n @is_default_set = true\n class << self\n define_method :default do |*args|\n raise ArgumentError, \"default has already been set to #{@default.inspect}\" unless args.empty?\n\n alternative(@default)\n end\n end\n nil\n end", "def defaults\n fields.inject({}) do |defs, (field_name,field)|\n next(defs) if field.default.nil?\n defs[field_name.to_s] = field.default\n defs\n end\n end", "def default_values_clause\n 'VALUES (DEFAULT)'\n end", "def default_value\n\t\t# This bizarre construct is done in order to not be reliant\n\t\t# on the inherent assignment-order when using Property.new({...})\n\t\t# since that hash can be ordered anywhich way .daniel\n\t\tif value_id\n\t\t\tvalue_object.default_value\n\t\telse\t\t\t\n\t\t\t@default_value\n\t\tend\n\tend", "def default\n @default ||= \"#{fields.first.sql} ASC\"\n end", "def default_values\n @query = \"default values\"\n end", "def set_default_values\n self.base_exp ||= 0\n self.time_bonus_exp ||= 0\n end", "def set_default_values\n self.base_exp ||= 0\n self.time_bonus_exp ||= 0\n end", "def default(default)\n @default = default\n end", "def default_value(attr)\n\t\t\t@defaults ||= {}\n\t\t\t@defaults[attr.to_sym]\n\t\tend", "def default_equation\n if machine_name.present? && default_value.present? && unit_value_down.present? && unit_value_up.present?\n \"(#{machine_name} - #{default_value}) * (#{machine_name} < #{default_value} ? #{unit_value_down} : #{unit_value_up})\"\n end\n end", "def eval_default(doc)\n if fields = doc.__selected_fields\n evaluated_default(doc) if included?(fields)\n else\n evaluated_default(doc)\n end\n end", "def override_setter_on(model)\n model.class_eval %(\n def #{attribute}=(raw_value)\n definition = self.class.bitmask_definitions[:#{attribute}]\n if raw_value_index = definition.values.find_index(raw_value)\n @#{attribute} = raw_value\n self[:#{attribute}] = raw_value_index\n end\n @#{attribute}\n end\n )\n\n if default_raw.present? then\n model.class_eval %(\n before_save do |m|\n self[:#{attribute}] ||= #{default_raw}\n end\n )\n end\n\n end", "def compute_default(value)\n @which == :block ? @default_value.call(value) : @default_value\n end", "def default_search_field\n @default_search_field ||= super || search_fields.values.find { |f| f.default == true } || search_fields.values.first\n end", "def default(col)\n _col = column(col)\n _col.nil? ? nil : _col.default\n end", "def default=(p0) end", "def default\n `return self.$default;`\n end", "def default_value\n { 'value' => '', 'other' => '' }\n end", "def default_value(val=nil, &b)\n if b\n @def_default = :proc\n @default_val = proc(&b)\n else\n @def_default = :val\n @default_val = val\n end\n self\n end", "def default(default)\n @default = default\n self\n end", "def get_default_value\n raise 'get_default_value must be implemented'\n end", "def default\n attributes.default\n end", "def default_value\n if @default_value\n @default_value\n elsif @multiple\n []\n end\n end", "def default_value_if_blank(value, default)\n # Stolen from: http://api.rubyonrails.org/classes/Object.html#method-i-blank-3F\n empty = value.respond_to?(:empty?) ? !!value.empty? : !value\n if empty\n return default\n else\n return value\n end\n end", "def default_value \n self[:value] ||= {}\n self[:value][:default_value] ||= []\n self[:value][:default_value].delete('-1')\n self[:value][:default_value]\n end", "def set_default\n end", "def set_default_values\n self.base_exp ||= 0\n self.time_bonus_exp ||= 0\n self.extra_bonus_exp ||= 0\n end", "def default_value\n return @default_value if @default_value\n\n superclass.default_value if superclass.respond_to?(:default_value)\n end", "def set_default_values\n # set_new_record_default_values\n set_attr_accessor_default_values\n end", "def default_for name, value\n @default_options[name] = value\n end", "def default(value = nil)\r\n self.default_params = default_params.merge(value).freeze if value\r\n default_params\r\n end", "def default_attributes=(v)\n cfg_set(:default_attributes, v)\n end", "def default_value\n config[:default]\n end", "def default_expiration= new_default_expiration\n patch_gapi! default_expiration: new_default_expiration\n end", "def default_attributes=(v)\n cfg_set(:default_attributes, v)\n end", "def update!(**args)\n @always_use_default_value = args[:always_use_default_value] if args.key?(:always_use_default_value)\n @default_currency_code = args[:default_currency_code] if args.key?(:default_currency_code)\n @default_value = args[:default_value] if args.key?(:default_value)\n end", "def set_default(value)\r\n\t\tif value.kind_of? Array\r\n\t\t\tself.default_value = value.first\r\n\t\telse\r\n\t\t\tself.default_value = value\r\n\t\tend\r\n\tend", "def default(value = nil)\n self.default_params = default_params.merge(value).freeze if value\n default_params\n end", "def set_record_value_for_attribute(record, attr, value, role = :default)\n end", "def define_default_method(object)\n object.__send__(:define_method, default_name, default_val)\n end", "def evaluate_default_proc(doc)\n serialize_default(doc.__send__(default_name))\n end", "def set_default\n self.state ||= :active\n self.validity_days ||= 14\n end", "def setDefault\n self.monthlyCost ||= 0.0 # will set the default value only if it's nil\n self.annualCost ||= 0.0\n end", "def initialize(default)\n @value = @default = default\n end" ]
[ "0.7305109", "0.67668134", "0.6487752", "0.64311534", "0.6340553", "0.63329947", "0.63080865", "0.6295609", "0.62812674", "0.62658536", "0.625919", "0.6181035", "0.6158315", "0.6101479", "0.6034576", "0.59987116", "0.5988971", "0.5962693", "0.59526", "0.5948998", "0.59461987", "0.59291595", "0.58848554", "0.5870154", "0.5862105", "0.58380204", "0.5835904", "0.5827906", "0.5826493", "0.58262384", "0.58262384", "0.5766108", "0.5738124", "0.5713143", "0.5695063", "0.56843305", "0.5684151", "0.5657313", "0.56290436", "0.56059", "0.55963254", "0.5591736", "0.55893326", "0.5584586", "0.5584586", "0.55795246", "0.556744", "0.5564376", "0.55512714", "0.55470604", "0.55418193", "0.55304265", "0.55258006", "0.5516461", "0.5501783", "0.54720944", "0.5464717", "0.5459484", "0.54508996", "0.5450074", "0.5449323", "0.54476655", "0.54476655", "0.54378915", "0.5410168", "0.5380598", "0.53791237", "0.5369716", "0.5369018", "0.536416", "0.5355026", "0.5338751", "0.533495", "0.53317976", "0.5323334", "0.5311272", "0.53095335", "0.5302153", "0.52976215", "0.52944976", "0.52905583", "0.528019", "0.52800775", "0.52714837", "0.5267194", "0.52506566", "0.52423227", "0.52279454", "0.52279425", "0.52134764", "0.5209002", "0.51944584", "0.5189014", "0.5186871", "0.51682603", "0.51533884", "0.5150888", "0.51391774", "0.51376444", "0.5136402" ]
0.7989715
0
Checks if the type of the field is `STRING`.
def string? type == "STRING" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string?\n data_type == String\n end", "def is_string?(); @type == GRT_STRING; end", "def is_string\n return @is_string\n end", "def value?(value) value.is_a?(String) end", "def is_strtype?(); @type == GRT_STRTYPE; end", "def valid_string?(field, param)\n true\n end", "def string?(description)\n description.type == :str\n end", "def expected_type\n 'string'\n end", "def string?(str)\n str.is_a?(String)\n end", "def is_string(input)\n input.kind_of?(String)\n end", "def require_string(value)\n if value.nil? == true || value.to_s.empty?\n log_error_and_raise(\"expected string value, got nil or empty string\")\n end\n\n if value.is_a?(String) != true\n log_error_and_raise(\"expected string value, got #{value.class}, #{value.inspect}\")\n end\n\n end", "def string?\n @kind == :double_string_lit || @kind == :single_string_lit\n end", "def should_be_string(data)\n if data.class != String\n raise \"Data needs to be a string; you passed in a #{data.class}: #{data}\"\n end\n end", "def is_string?\n columns.all? { |col| col.is_string? }\n end", "def is_ustring?(); @type == GRT_USTRING; end", "def plain_string?\n (type == :string || type == :text) && # String typed\n !value.nil? &&\n !value.empty? &&\n !is_text_run? && # No inline styles\n !is_formula? &&\n !is_array_formula?\n end", "def expect_string name, value\n expect_type name,\n value, \n \"string\",\n String\n end", "def has_a_minimum_one_string_type?\n self.index_table_fields.map(&:field_name).each do |field_name|\n self.table_name.constantize.columns.each {|elt| return true if (elt.name == field_name && (elt.type == :string || elt.type == :text))} \n end\n return false\n end", "def string?(input)\n input.class == String\nend", "def check_and_set_string_type\n key = self.key.to_sym\n if KEY_TO_STRING_OPTIONS.key?(key)\n # If there are explicit string options, match the value to one of them.\n matched = false\n options = KEY_TO_STRING_OPTIONS[key]\n options.each do |opt|\n if Metadatum.str_to_basic_chars(text_raw_value) == Metadatum.str_to_basic_chars(opt)\n # Ex: Match 'neb ultra-iifs dna' to 'NEB Ultra II FS DNA'\n # Ex: Match '30-day mortality' to \"30 Day Mortality\"\n self.text_validated_value = opt\n matched = true\n break\n end\n end\n unless matched\n errors.add(:text_raw_value, \"#{text_raw_value} did not match options #{options.join(', ')}\")\n end\n else\n self.text_validated_value = text_raw_value\n end\n end", "def is_string?\n @name.is_a?(String) && @stack.empty?\n end", "def string(value)\n message = \"Invalid typeface: must be a string\"\n raise ArgumentError, message unless value.is_a?(String)\n end", "def validates_not_string(atts, opts={})\n validatable_attributes(atts, opts) do |a,v,m|\n next unless v.is_a?(String)\n next m if m\n (sch = db_schema[a] and typ = sch[:type]) ? \"is not a valid #{typ}\" : \"is a string\"\n end\n end", "def is_s?\n true if String(self) rescue false\n end", "def validate_string(value)\n raise CustomErrors::FilterArgumentError, 'Value must be a string' unless value.is_a?(String)\n end", "def value_field\n \"string\"\n end", "def is_strclass?(); @type == GRT_STRCLASS; end", "def string?\n !@arg[:textValue].nil?\n end", "def valid_string?(string)\n if string.class == String\n string\n else\n false\n end\nend", "def is_strname?(); @type == GRT_STRNAME; end", "def apply_validations_for_string\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a String\") if value && (! value.kind_of?(String)) && (! value.kind_of?(Symbol))\n end\n end", "def type_for_attribute(_attribute)\n ActiveModel::Type.lookup(:string, limit: 200)\n end", "def form_must_be_string\n errors[:form] << 'must be a json string' unless form_is_string\n end", "def form_must_be_string\n errors[:form] << 'must be a json string' unless form_is_string\n end", "def attribute_type\n (float? || integer? || text? || boolean? ? field_type : 'string').to_sym\n end", "def string?(value, options = nil)\n return true if value.nil? and not required(options) \n return false unless value.is_a?(String)\n return true unless options.is_a?(Hash)\n if options.key?(:min)\n return false unless gt(options[:min], value.split(\"\").size, options[:include])\n end\n\n if options.key?(:max)\n return false unless gt(value.split(\"\").size, options[:max], options[:include])\n end\n\n return true\n end", "def validate_string( str )\r\n if str.kind_of?(String)\r\n return true\r\n else\r\n puts \"#{self.class}:check_string: Error: Input must be a string.\"\r\n return false\r\n end\r\n end", "def string(string)\n Types::String.cast(string)\n end", "def database_column_type\n :string\n end", "def test_js_type_string(t)\n\treturn t.class == String\nend", "def text?\n type == :text\n end", "def cast_with_string(object, type)\n object.is_a?(::String) ? :string : cast_without_string(object, type)\n end", "def is_string()\n res = super(context,self)\n return res\n end", "def missing_default_forged_as_empty_string?(default)\n type != :string && ! null && default == ''\n end", "def is_texttype?(); @type == GRT_TEXTTYPE; end", "def string_at?(line, column)\n node = node_at(line, column)\n # @todo raise InvalidOffset or InvalidRange or something?\n return false if node.nil?\n node.type == :str or node.type == :dstr\n end", "def type_string!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 36 )\n\n\n\n type = TYPE_STRING\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 212:14: 'string'\n match( \"string\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 36 )\n\n\n end", "def string_condition_type=(string_condition_type)\n validator = EnumAttributeValidator.new('String', ['equals', 'contains', 'starts_with', 'ends_with', 'regex'])\n unless validator.valid?(string_condition_type)\n fail ArgumentError, 'invalid value for \"string_condition_type\", must be one of #{validator.allowable_values}.'\n end\n @string_condition_type = string_condition_type\n end", "def get_primitive_type_string(attr_details)\n attr_details[:primitive].to_s.downcase == 'nilclass' ? 'string' : attr_details[:primitive].to_s.downcase\n end", "def only_with_a_string(value)\r\n if value.is_a?(String)\r\n yield(value)\r\n return self\r\n else\r\n raise ArgumentError, 'only string values are accepted'\r\n end\r\n end", "def string_class_name?(class_pair)\n class_pair.children[1].str_type?\n end", "def get_string(field)\n field['stringValue']\n end", "def not_nil_and_string(str)\n return true unless ((str == nil) or (not str.instance_of? String))\n return false\n end", "def not_nil_and_string(str)\n return true unless ((str == nil) or (not str.instance_of? String))\n return false\n end", "def not_nil_and_string(str)\n return true unless ((str == nil) or (not str.instance_of? String))\n return false\n end", "def buffer_valid?\r\n @buffer.is_a?(String)\r\n end", "def bson_type\n String::BSON_TYPE\n end", "def type_is_text\n self.stimulus_type=\"text\"\n end", "def type_literal_generic_string(column)\n if column[:text]\n :text\n elsif column[:fixed]\n \"char(#{column[:size]||default_string_column_size})\"\n elsif column[:text] == false || column[:size]\n \"varchar(#{column[:size]||default_string_column_size})\"\n else\n :text\n end\n end", "def coerce str\n return str if Kiwi::Validator === self.type || self.type === str\n\n str = str.to_s.strip\n rule = Kiwi.input_types[self.type]\n raise TypeError, \"Can't coerce #{str.class} into #{self.type}\" unless rule\n\n rule.respond_to?(:call) ? rule.call(str) : str.__send__(rule)\n end", "def get_string_field(field_name)\n\t\tend", "def is_name_value?(val)\n val.is_a?(String) || val.is_a?(Symbol)\n end", "def double_quotes_required?(string); end", "def double_quotes_required?(string); end", "def isStringConstant(str)\n return (str[0].to_s == \"\\\"\" and str[str.to_s.size - 1].to_s == \"\\\"\") #if statement surrounded by quotation marks of any kinds\n\n return false\nend", "def true_string?(field)\n field == 'true' || field == true\n end", "def provider_id_should_be_string\n errors.add(:provider_id, 'is not a string') unless provider_id.is_a?(String)\n end", "def empty_str?(value)\n EMPTY_STRING.eql?(value)\n end", "def unserializable_attribute?(attr_name, column)\n @attributes[attr_name] && column.send(:type) == :text && @attributes[attr_name].is_a?(String) && self.class.serialized_attributes[attr_name]\n end", "def check_string(string)\n string.empty? ? nil : string\n end", "def text_field?(field_name); end", "def type_str\n self.class.const_get(:TYPE_STR)\n end", "def string_value?(value)\n string = value.to_s\n [NonWordMatcher, KeywordMatcher].any? { |matcher|\n matcher.match string\n }\n end", "def valid?\n [:region, :security_group, :security_key].all? do |var|\n self.send(var).is_a? String\n end\n end", "def string_check(arg)\n return arg if arg.is_a?(String)\n return arg.send(:to_str) if arg.respond_to?(:to_str, true) # MRI honors it, even if private\n return arg.to_path if arg.respond_to?(:to_path)\n raise TypeError\n end", "def term_valid?(term)\n term.is_a?(String)\n end", "def string?; end", "def validate_presence_of(field_name, type)\n type || raise(::ArgumentError, \"Type is required for #{field_name}.\")\n end", "def validate_presence_of(field_name, type)\n type || raise(::ArgumentError, \"Type is required for #{field_name}.\")\n end", "def field_type=(value)\n super(value.to_s)\n end", "def data_match_field_type field\n\t\tfield = field.to_s\n\t\tif field[-2,2] == 'id'\n\t\t\ttype = Scfg[:field_number][0]\n\t\telsif Scfg[:field_fixnum].include? field\n\t\t\ttype = 'Fixnum'\n\t\telsif Scfg[:field_time].include? field\n\t\t\ttype = 'Time'\n\t\telse\n\t\t\ttype = 'String'\n\t\tend\n\t\ttype\n\tend", "def is_missing?(value)\n value.nil? or (String===value and value.strip.empty?)\n end", "def is_blank_space?\n get_type == :empty\n end", "def type\n if validator_hash[:numericality] == true ||\n validator_hash[:numericality] == { allow_nil: true }\n 'Decimal'\n elsif validator_hash.dig(:numericality, :only_integer)\n 'Integer'\n elsif validator_hash[:ingested_date]\n 'Date'\n elsif validator_hash.dig(:case_insensitive_inclusion, :in) == %w[Y N]\n 'YesNo'\n elsif inclusion_list_with_lookup_values?(validator_hash.dig(:case_insensitive_inclusion, :in))\n attr.name.tr(' ', '')\n else\n 'String'\n end\n end", "def typecast_value_string(value)\n case value\n when Hash, Array\n raise Sequel::InvalidValue, \"invalid value for String: #{value.inspect}\"\n else\n value.to_s\n end\n end", "def validate\n validate_string_attributes\n end", "def type_of_field_in_database(class_name, field_name)\n all_fields = class_name.get_table_info\n all_fields.each do |field|\n if field[\"name\"] == field_name\n return field[\"type\"]\n end\n end\n false\n end", "def is_text?(); @type == GRT_TEXT; end", "def type *val\n return @chars_allowed if val.empty?\n\n dtype = val[0]\n #return self if @chars_allowed # disallow changing\n if dtype.is_a? Regexp \n @chars_allowed = dtype\n return self\n end\n dtype = dtype.to_s.downcase.to_sym if dtype.is_a? String\n case dtype # missing to_sym would have always failed due to to_s 2011-09-30 1.3.1\n when :integer, Integer\n @chars_allowed = /\\d/\n when :numeric, :float, Numeric, Float\n @chars_allowed = /[\\d\\.]/ \n when :alpha\n @chars_allowed = /[a-zA-Z]/ \n when :alnum\n @chars_allowed = /[a-zA-Z0-9]/ \n else\n raise ArgumentError, \"Field type: invalid datatype specified. Use :integer, :numeric, :float, :alpha, :alnum \"\n end\n self\n end", "def valid_type?(type)\n !native_database_types[type].nil?\n end", "def column_type_of(attribute)\n column = @ar_class.columns_hash[attribute.to_s]\n return :string unless column\n return :numeric if column.number? or [:datetime,:time,:date,:timestamp].include?(column.type)\n return :string\n end", "def string(size = nil)\n Validation.new { |d| d.is_a?(String) && in_range?(d.size, size) }\n end", "def string_or_numeric!(v)\n case v\n when ''\n nil\n when String, Numeric\n true\n else\n raise Error, \"unexpected value received: #{v.inspect}\"\n end\n end", "def collection_name\n 'string_fields'\n end", "def type=(val)\n\n dtype = val\n #return self if @chars_allowed # disallow changing\n # send in a regexp, we just save it.\n if dtype.is_a? Regexp \n @chars_allowed = dtype\n return self\n end\n dtype = dtype.to_s.downcase.to_sym if dtype.is_a? String\n case dtype # missing to_sym would have always failed due to to_s 2011-09-30 1.3.1\n when :integer, Integer\n @chars_allowed = /\\d/\n when :numeric, :float, Numeric, Float\n @chars_allowed = /[\\d\\.]/ \n when :alpha\n @chars_allowed = /[a-zA-Z]/ \n when :alnum\n @chars_allowed = /[a-zA-Z0-9]/ \n else\n raise ArgumentError, \"Field type: invalid datatype specified. Use :integer, :numeric, :float, :alpha, :alnum \"\n end\n self\n end", "def convert_to_data_type_from_string(type, value)\n case type\n when \"boolean\"\n # Since we've determined this is a boolean data type, we can assume that:\n # If the value as an int is 1, return true\n # If the value as an int is 0 (not 1), return false\n value.to_i == 1\n when \"integer\"\n value.to_i\n when \"float\"\n value.to_f\n when \"string\", \"dictionary\"\n value\n when nil\n \"\"\n else\n raise \"Unknown or unsupported data type: #{type.class}\"\n end\n end", "def text_type=(value)\n @text_type = value\n end", "def text?\n [:ascii, :text].include?(type)\n end", "def check_value!(value)\n # Allow nil and Strings to fall back on the validations for typecasting\n case value\n when nil, String, expected_type\n value\n else\n raise TypeError, \"#{@name} expected #{expected_type.inspect} but got #{value.inspect}\"\n end\n end", "def get_field_class(value)\n case\n when value.is_a?(String)\n 'string'\n when value.is_a?(Integer)\n 'integer'\n when value.is_a?(Float)\n 'float'\n when value.is_a?(BigDecimal)\n 'decimal'\n when value.is_a?(DateTime)\n 'datetime'\n when value.is_a?(FalseClass) || value.is_a?(TrueClass)\n 'boolean'\n else\n raise FieldTypeError, 'Invalid field type.'\n end\n end" ]
[ "0.766883", "0.7502291", "0.7177248", "0.7105687", "0.7097787", "0.69959325", "0.69954354", "0.6947247", "0.6862597", "0.6823381", "0.6794733", "0.6788983", "0.6743994", "0.6729507", "0.66976947", "0.6691452", "0.66257066", "0.6589806", "0.6552939", "0.6374711", "0.636748", "0.6324039", "0.6311408", "0.6245357", "0.62234414", "0.6211007", "0.61966676", "0.61960554", "0.61757964", "0.61360633", "0.6109733", "0.6050873", "0.5975712", "0.5975712", "0.59345645", "0.5914325", "0.5909195", "0.58806586", "0.5872139", "0.58680177", "0.5827104", "0.57939506", "0.5780672", "0.57476383", "0.57471734", "0.57220715", "0.5695677", "0.56920654", "0.56653094", "0.56189966", "0.5608718", "0.5607752", "0.55822253", "0.55822253", "0.55822253", "0.55676824", "0.55572236", "0.55427575", "0.5536477", "0.5519203", "0.5513145", "0.5508812", "0.5492046", "0.5492046", "0.5476521", "0.5472729", "0.5445148", "0.54387873", "0.54294854", "0.54024976", "0.54001254", "0.53781724", "0.5375118", "0.53658897", "0.5343804", "0.5341554", "0.53398293", "0.53231317", "0.53231317", "0.5320171", "0.53129065", "0.5303811", "0.528475", "0.5270367", "0.5241631", "0.52363735", "0.5233908", "0.522203", "0.5214206", "0.52125114", "0.5211966", "0.52116674", "0.52055925", "0.51925445", "0.51864696", "0.5185759", "0.5178481", "0.5177014", "0.5168015", "0.5145661" ]
0.8085952
0
Checks if the type of the field is `INTEGER`.
def integer? type == "INTEGER" || type == "INT64" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_be_integer?(field_info, field)\n field_info[\"type\"] == \"INTEGER\"\n end", "def validate_integer_type(field)\n if field.is_a?(Integer)\n return true\n else\n return false\n end\n end", "def integer?(field)\n self.send(field).is_a? Integer\n end", "def check_integer(field_info, field)\n if should_be_integer?(field_info, field) && !integer?(field) && !foreign_key?(field)\n add_integer_message_to_errors(field)\n end\n end", "def integer?\n primary_key_attribute = klass.attribute_types.select { |name, _| name == User.primary_key }\n if primary_key_attribute.key?(klass.primary_key.to_s)\n primary_key_attribute[klass.primary_key].type == :integer\n else\n true\n end\n end", "def integer?(value)\n value.is_a?(Integer)\n end", "def cast_tinyint_integer?(field)\n field.length != 1\n end", "def apply_validations_for_integer\n options = { :numericality => { :only_integer => true } }\n options[:allow_nil] = true unless not_nullable?\n flex_column_class.validates field_name, options\n end", "def integer?\n @kind == :integer_lit || @kind == :integer_exp_lit || @kind == :hex_lit || @kind == :bin_lit\n end", "def type_literal_generic_integer(column)\n :integer\n end", "def is_int(value)\n true if Integer(value) rescue false\n end", "def enforce_integer_columns(options = {})\n # first get the non-integers\n options[:allow_nil] = true\n args = build_validation_args(options, :numeric, :not_a_number)\n validates_numericality_of(*args) unless args.first.is_a? Hash\n # now do the integers\n options[:only_integer] = true\n args = build_validation_args(options, :integer, :not_a_number)\n validates_numericality_of(*args) unless args.first.is_a? Hash\n end", "def require_integer(value)\n if value.is_a?(Integer) != true\n log_error_and_raise(\"expected integer value, got #{value.class}, #{value.inspect}\")\n end\n end", "def is_integer?\n self.to_i.to_s == self\n end", "def type_literal_generic_integer(column)\n column[:serial] ? :serial : super\n end", "def type_literal_generic_integer(column)\n column[:serial] ? :serial : super\n end", "def is_int\r\n\t\tself.to_i.to_s != self.to_s\r\n\tend", "def expect_integer name, value\n expect_type name,\n value,\n \"integer\",\n Integer\n end", "def is_integer?\n self =~ /\\A-?(?:0|[1-9][0-9]*)\\z/\n end", "def integer?() end", "def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super unless type.to_s == 'integer'\n return 'integer' unless limit\n\n case limit\n when 1..8; 'integer'\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}. Use a numeric with precision 0 instead.\")\n end\n end", "def isint\n int? ? Q::ONE : Q::ZERO\n end", "def integer?\n self.to_i.to_s == self\n end", "def integer_dtype?\n [:byte, :int8, :int16, :int32, :int64].include?(self.dtype)\n end", "def validates_integer(atts, opts={})\n validatable_attributes(atts, opts) do |a,v,m|\n begin\n Kernel.Integer(v.to_s)\n nil\n rescue\n m || 'is not a number'\n end\n end\n end", "def is_integer? string\n true if Integer(string) rescue false\n end", "def is_integer?(obj)\n\t\tif obj\n\t\t\treturn obj.to_s == obj.to_i.to_s\n\t\tend\n\t\treturn false\n\tend", "def integer_exception?(field)\n foreign_key?(field) || self.send(field).blank?\n end", "def integer?(str)\n true if Integer(str)\n rescue ArgumentError, TypeError\n false\n end", "def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super unless type.to_s == 'integer'\n return 'integer' unless limit\n\n case limit\n when 1, 2; 'smallint'\n when 3, 4; 'integer'\n when 5..8; 'bigint'\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}. Use a numeric with precision 0 instead.\")\n end\n end", "def integer?(obj)\n obj = obj.to_s unless obj.is_a? String\n /^\\d+$/.match obj\nend", "def integer?(object)\n (object.to_s.to_i == object) || (object.to_i.to_s == object)\nend", "def integer?(input)\n Integer(input) rescue false\nend", "def is_integer?(input)\n input.to_i.to_s == input\nend", "def int64?\n type == INT64_TYPE\n end", "def is_column_the_rowid?(field, column_definitions)\n return false unless INTEGER_REGEX.match?(field[\"type\"]) && field[\"pk\"] == 1\n # is the primary key a single column?\n column_definitions.one? { |c| c[\"pk\"] > 0 }\n end", "def force_numeric?(column)\n (column.nil? || [:integer, :float, :decimal].include?(column.type))\n end", "def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super unless type.to_s == 'integer'\n \n if limit.nil? || limit == 4\n 'integer'\n elsif limit < 4\n 'smallint'\n else\n 'bigint'\n end\n end", "def attr_get_integer(attr_type, strict = true)\n #This is a stub, used for indexing\n end", "def is_integer(str)\n Integer(str) != nil rescue false\n end", "def integer?(input)\n input.to_i.to_s == input\nend", "def integer?(input)\n input.to_i.to_s == input\nend", "def integer?(input)\n input.to_i.to_s == input\nend", "def integer?(input)\n # could also do input.to_i.to_s == input but something with a\n # leading 0 (\"00\", \"01\", etc) will return false\n Integer(input)\nrescue ArgumentError\n false\nend", "def integer?(string)\n true if Integer(string)\n rescue\n false\n end", "def validate_str_is_integer(value)\n !!(value =~ /\\A[-+]?[0-9]+\\z/)\n end", "def initialize_integer(field_info, field)\n if should_be_integer?(field_info, field) && !integer_exception?(field)\n update_value_of_variable(field, self.send(field).to_i)\n end\n end", "def validate_str_is_integer(value)\n !!(value =~ /\\A[-+]?[0-9]+\\z/)\n end", "def integer(limit = nil)\n Validation.new { |d| d.is_a?(Integer) && in_range?(d, limit) }\n end", "def check_integer\n if @position == 0 \n return false\n else return true\n end\n end", "def match_integer( val )\n\t\treturn Integer( val ) rescue nil\n\tend", "def is_i?\n self.to_f == self.to_f.floor\n end", "def can_be_numeric?\n type == :numeric\n end", "def contains_int?\r\n \treturn false if self.empty?\r\n \treturn self.match(/^[0-9]+$/)\r\n end", "def integer?(num)\n num.to_i > 0 && num.to_i.to_s == num\nend", "def inqlinetype\n inquiry_int { |pt| super(pt) }\n end", "def integer?(num)\n num.to_i.to_s == num\nend", "def is_int? str\n Integer(str) rescue return false\n return true\nend", "def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n case type.to_s\n when 'integer'\n return 'integer' unless limit\n\n case limit\n when 1, 2; 'smallint'\n when nil, 3, 4; 'integer'\n when 5..8; 'bigint'\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}. Use a numeric with precision 0 instead.\")\n end\n else\n super\n end\n end", "def is_integer str\n return str.class == Fixnum || str == str.to_i.to_s\n end", "def is_real_int(value)\n value.ceil == value.floor\n end", "def is_integer(str)\n \tbegin\n \t\tInteger(str)\n \t\treturn true\n \trescue ArgumentError\n \t\treturn false\n \tend\n end", "def is_integer?(num)\n num.class == Fixnum || num.class == Bignum ||\n ( num.is_a?(Float) && !num.nan? && num.to_i == num )\n end", "def is_integer?(num)\n num.class == Fixnum || num.class == Bignum ||\n ( num.is_a?(Float) && !num.nan? && num.to_i == num )\n end", "def value_is_integer?(string)\n return string.strip.numeric?\n end", "def validate?\n integer? && more_than_nine?\n end", "def is_numeric?\n self.data_type == 'number'\n end", "def is_integer?(num)\n\tif num.is_a? Integer\n\t\ttrue\n\telsif num.is_a? Float\n\t\tif num.nan?\n\t\t\tfalse\n\t\telsif num == num.floor\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\telse\n\t\tfalse\n\tend\nend", "def is_numeric?\n data_type == 'number'\n end", "def integer?(num)\n num.to_i().to_s()==num\nend", "def is_integer?(input)\n return input.to_s.ord >= 48 and input.to_s.ord <= 57\nend", "def declare_integer_field(model, declaration)\n precision = declaration.attributes[:h_precision] || declaration.attributes[:precision] || 0\n declaration.remove_attributes! :h_precision, :precision\n if precision==0\n model.integer_h declaration.name\n else\n model.number_h declaration.name, :precision=>precision\n end\n end", "def is_value?(value)\n\t\tvalue.to_i < 10\n\tend", "def digits_only?(value)\n case value\n when Integer, ActiveModel::Type::Integer, ActiveSupport::Duration\n true\n when String, Symbol, Numeric, ActiveModel::Type::Float\n (s = value.to_s).present? && s.delete('0-9').blank?\n else\n false\n end\n end", "def int?(value, options = nil)\n return true if value.nil? and not required(options) \n\n return false unless value.is_a?(Integer)\n return true unless options.is_a?(Hash)\n\n if options.key?(:min)\n return false unless gt(options[:min], value, options[:include])\n end\n\n if options.key?(:max)\n return false unless gt(value, options[:max], options[:include])\n end\n\n return true\n end", "def valid_integer?(string)\r\n string.to_i.to_s == string\r\nend", "def is_integer(string)\n string.to_i.to_s == string\nend", "def valid_id?(value)\n digits_only?(value)\n end", "def is_int(latex, step)\n\tlatex[step+1..step+3].join == \"int\"\nend", "def string_is_integer?(n)\n n == n.to_i.to_s\nend", "def integer?(token)\n token.to_i.to_s == token\n end", "def integer_to_sql(limit)\n return 'integer' if limit.nil?\n case limit\n when 1..2 then 'smallint'\n when 3..4 then 'integer'\n when 5..8 then 'bigint'\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}. Use a NUMERIC with PRECISION 0 instead.\")\n end\n end", "def age_data_type_format_msg\n puts \"Age should be an Integer.\"\n return false\nend", "def bson_int32?\n (MIN_32BIT <= self) && (self <= MAX_32BIT)\n end", "def integer(key, options = {})\n before_all(key, options)\n match?(key, /\\A\\d+\\Z/) ? store_numeric(key, ->(item){item.to_i}, options) : raise_type_error(key, \"Integer\")\n end", "def valid_integer?(string)\n string.to_i.to_s == string\nend", "def valid_integer?(string)\n string.to_i.to_s == string\nend", "def is_numeric(val)\n\t\treturn Integer(val).is_a? Integer rescue false\n\tend", "def integer(name, options={})\n param(:integer, name, options)\n end", "def integer?(str)\n /\\A[+-]?\\d+\\z/ === str\n end", "def is_integer?(num)\n # first two arguments can be replaced with num.is_a?(Integer)\n num.class == Fixnum || num.class == Bignum || ( num.class == Float && !num.nan? && num == num.floor )\nend", "def valid_type?(type)\n !native_database_types[type].nil?\n end", "def is_integer(string)\n /\\A[+-]?\\d+\\Z/ === string\n end", "def get_integer_value(field_name)\n\t\tend", "def is_integer(str)\n str.to_i.to_s == str\n end", "def has_ints(*attrs)\n options = attrs.extract_options!\n attrs.each do |attr|\n attr_reader attr\n define_reader_with_options(attr,options)\n\n define_method(\"#{attr.to_s}=\") do |val| \n instance_variable_set(\"@#{attr}\", val.to_i)\n attributes[attr] = val\n val\n\n end\n end\n end", "def schema_column_type(db_type)\n db_type =~ /\\Atinyint\\(1\\)/ ? :boolean : super\n end", "def integer(*args, &block)\n args = [{ :using => Option, :kind => Integer }, *args]\n da = option(*args, &block)\n da.instance_eval do\n from String do |s|\n s =~ /^\\d+$/ or raise \"must be a whole number\"\n s.to_i\n end\n end\n end", "def is_integer?(num)\n num.class == Fixnum || num.class == Bignum ||\n ( num.is_a?(Float) && !num.nan? && num.to_i == num )\nend", "def int32()\n _int32(\"int32\")\n end" ]
[ "0.8816761", "0.79230464", "0.7527394", "0.7145677", "0.70655954", "0.68046695", "0.68038917", "0.6634229", "0.6520246", "0.65108705", "0.6387364", "0.6367998", "0.6316398", "0.6302311", "0.62349486", "0.62349486", "0.6187975", "0.6181883", "0.6145409", "0.60884315", "0.6077995", "0.6068469", "0.6028109", "0.59063804", "0.59028894", "0.58660173", "0.585368", "0.58427155", "0.58248293", "0.58175963", "0.5808774", "0.5773196", "0.5772007", "0.5735073", "0.5700144", "0.5680335", "0.56735396", "0.5671962", "0.56707394", "0.5659978", "0.56235194", "0.5622439", "0.5622439", "0.5617859", "0.55990386", "0.5550657", "0.5534022", "0.5509563", "0.5502734", "0.5476971", "0.5469536", "0.54427475", "0.54200053", "0.5416921", "0.54075634", "0.5403596", "0.5384579", "0.53551036", "0.5338725", "0.5333002", "0.53184396", "0.5317687", "0.53146446", "0.53146446", "0.5310955", "0.5308881", "0.5307726", "0.5304288", "0.526899", "0.52552706", "0.5249648", "0.52458125", "0.5240245", "0.5231407", "0.52301544", "0.5227173", "0.5224214", "0.520407", "0.5192165", "0.5190829", "0.5185673", "0.5185358", "0.5184928", "0.51754206", "0.5174535", "0.51651347", "0.51651347", "0.5164047", "0.5157699", "0.5156989", "0.5155862", "0.5154543", "0.5154514", "0.5144305", "0.51341313", "0.5128209", "0.5125674", "0.5121812", "0.5113833", "0.51100534" ]
0.7569757
2
Checks if the type of the field is `FLOAT`.
def float? type == "FLOAT" || type == "FLOAT64" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_be_float?(field_info, field)\n field_info[\"type\"] == \"REAL\"\n end", "def float?(field)\n self.send(field).is_a? Float\n end", "def float?\n !!Float(self)\n rescue ArgumentError, TypeError\n false\n end", "def is_float?\n\t\tFloat(self) != nil rescue false\n\tend", "def expect_float(value, field, subfield)\n return true if value.blank?\n return true if value.is_a?(Float)\n errors.add(field, \"#{subfield} must be a float if present\")\n false\n end", "def float?\n @kind == :float_lit || @kind == :float_exp_lit\n end", "def check_real(field_info, field)\n if should_be_float?(field_info, field) && !float?(field)\n add_float_message_to_errors(field)\n end\n end", "def is_float?\n self.to_f.to_s == self\n end", "def isFloat?\n !!Float(exp) rescue false\n end", "def float?(object)\n return true if Float(object)\n rescue \n return false\nend", "def float?\n self.class.float?(self)\n end", "def float?(str)\n true if Float(str) rescue false\n end", "def is_float?(input)\n input.to_f.to_s == input\nend", "def are_floats?(x,y)\n return x.is_a?(Float) && y.is_a?(Float)\n end", "def float_dtype?\n [:float32, :float64].include?(dtype)\n end", "def is_float(answer)\n float_answer = answer.to_f\n if float_answer == 0.0\n float_answer = nil\n end\n [float_answer, \"#{answer} must be a valid float.\"]\nend", "def is_numeric?(val)\n Float val rescue false\n end", "def float_val?(val)\n !!(val =~ /\\A[-+]?\\d+(\\.\\d+)?\\z/)\n end", "def float3?(input)\n Float(input) rescue false\nend", "def expect_integer_or_float(value, field, subfield)\n return true if value.blank?\n return true if value.is_a?(Integer) || value.is_a?(Float)\n errors.add(field, \"#{subfield} must be an integer or float if present\")\n false\n end", "def to_Float\n begin\n fl = Float stripn\n return fl\n rescue ArgumentError\n return false\n end\n end", "def is_numeric?\n begin Float(self)\n true \n end\n rescue\n false\n end", "def float?\n !!strip.match(/^-?\\d+\\.\\d+$/)\n end", "def numeric?\n !!Float(self) rescue false\n end", "def validate_float(inFloat) \n\t returnValue = []\n\t if nil == inFloat\n\t\t returnValue << \"cannot be null \"\n\t else\n\t\t begin \n\t\t\t Float(inFloat)\n\t\t\t returnValue = nil \n\t\t rescue Exception => err \n\t\t\t returnValue = \" #{err.message }\" \n\t\t end \n\t end\n\t returnValue\n end", "def valid_float_number?(num)\n num.to_f.to_s == num\nend", "def is_valid_float_param(param_name)\n # this is the equivalent one-liner ruby-style\n # true if Float params[param_name] rescue false\n begin\n Float(params[param_name])\n return true\n rescue\n return false\n end\n end", "def value_is_float?(string)\n return false if string.scan(/\\./).length != 1\n sides = string.split('.')\n return sides[0].numeric? && sides[1].numeric? && sides[1].to_i >= 0\n end", "def type_float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 35 )\n\n\n\n type = TYPE_FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 211:13: 'float'\n match( \"float\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 35 )\n\n\n end", "def float?(word)\n (word.to_f.to_s != word) && word\n end", "def apply_validations_for_float\n flex_column_class.validates field_name, :numericality => true, :allow_nil => true\n end", "def match_float( val )\n\t\treturn Float( val ) rescue nil\n\tend", "def float?(num)\n num.to_f.to_s == num\nend", "def float?(num)\n num.to_f().to_s()==num\nend", "def float?(num)\n num == num.to_f.to_s\nend", "def numeric?(object)\n true if Float(object) rescue false\nend", "def float(limit = nil)\n Validation.new { |d| d.is_a?(Float) && in_range?(d, limit) }\n end", "def is_numeric?(value)\n !!Float(value) rescue false \n end", "def type\n Attribute::Float\n end", "def type\n Attribute::Float\n end", "def is_f?\n !!(self =~ /^[-+]?[0-9,]+\\.[0-9]+$/)\n end", "def numeric_check(first_num)\n Float(first_num) != nil rescue false\nend", "def numeric?(input)\n !Float(input).nil?\n rescue\n false\n end", "def numeric?(object)\n \t\ttrue if Float(object) rescue false\n\tend", "def numeric?; float?; end", "def numeric(input)\n return Float(input) != nil rescue false\n end", "def check_for_float(company)\n float(company) unless\n company.floated? ||\n (initial_offering.percentage_owned(company) > BigDecimal.new('0.5'))\n end", "def has_floats(*attrs)\n options = attrs.extract_options!\n attrs.each do |attr|\n\n attr_reader attr\n define_reader_with_options(attr,options)\n\n define_method(\"#{attr.to_s}=\") do |val|\n instance_variable_set(\"@#{attr}\", val.to_f)\n attributes[attr] = val\n val\n\n end\n end\n end", "def represents_f?\n f_value = self.to_f\n # is this not equal to zero and also not actually an integer?\n if (f_value != 0) && (f_value.to_s == self)\n true\n else\n false\n end\n end", "def number?\n\t\ttrue if Float(string) rescue false\n\tend", "def numeric(x)\n true if Float(x) rescue false\n end", "def numeric?(object)\n true if Float(object) rescue false\n end", "def valid_float_str?(str)\n str =~ /^[+\\-]?[\\d\\.]*$/ # optional sign, then only digits OR '.'\n end", "def check_float(a, b)\n #tolerance = 1e-12\n tolerance = 1e-2\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\n end", "def float?(string)\n b = Float(string.tr(',', '.'))\n return b\nrescue ArgumentError\n return false\nend", "def assert_floatable *args\n args.each do |var|\n assert do\n var.not_nil? && var.is_a?(Numeric)\n end\n end\n end", "def float?(num)\n /\\d/.match(num) && /^-?\\d*\\.?\\d*$/.match(num) ? true : false\nend", "def check_float(a, b)\n tolerance = Math::TOLERANCE\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend", "def check_float(a, b)\n tolerance = Math::TOLERANCE\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend", "def initialize_float(field_info, field)\n if should_be_float?(field_info, field) && !self.send(field).blank?\n update_value_of_variable(field, self.send(field).to_f)\n end\n field\n end", "def numeric?(num)\n !!Float(num) rescue false\nend", "def float name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :float, description: description, mode: mode, policy_tags: policy_tags\n end", "def numeric?(string)\n Float(string) != nil rescue false\n end", "def _is_numeric?(str)\n Float(str) != nil rescue false\n end", "def is_number?(input)\n true if Float(input) rescue false\n end", "def to_float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = TO_FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 313:11: 'float:'\n match( \"float:\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 11 )\n\n end", "def is_numeric?(s)\n !!Float(s) rescue false\n end", "def is_number(num)\n true if Float(num) rescue false\nend", "def like_f?\n return false unless self.to_f?\n\n num = self.without_leading_zeros\n (num.to_i != num.to_f) || num.include?(\".\")\n end", "def float_check(num)\n\tif num.include?(\".\")\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def float_check(num)\n\tif num.include?(\".\")\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def check_float(a, b)\n tolerance = 1e-12\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend", "def is_number?\n is_float? || is_integer?\n end", "def is_num_float(num_string)\n !(num_string !~ /^\\s*[+-]?((\\d+_?)*\\d+(\\.(\\d+_?)*\\d+)?|\\.(\\d+_?)*\\d+)(\\s*|([eE][+-]?(\\d+_?)*\\d+)\\s*)$/)\nend", "def operand?(str)\n\t\ttrue if Float(str) rescue false\n end", "def is_numeric?(s)\n !!Float(s) rescue false\n end", "def number?\n [:double, :float, :integer, :long].include?(type)\n end", "def is_number?(i)\n true if Float(i) rescue false\nend", "def is_number?(i)\n true if Float(i) rescue false\nend", "def is_numeric?\n self.data_type == 'number'\n end", "def is_numeric?(x)\n return false if x.is_a?(Time) # we want to treat times as dimensions\n return false if x.is_a?(Complex) # not all complex can be converted to float\n return true if x.is_a?(Numeric)\n true if Float(x) rescue false\n end", "def float2?(input)\n /\\d/.match(input) && /^-?\\d*\\.?\\d*$/.match(input)\nend", "def is_number(string)\r\n\ttrue if Float(string) rescue false\r\nend", "def check_float(param, default, options = {})\n min = (options[:min] ? param.to_f >= options[:min] : true)\n max = (options[:max] ? param.to_f <= options[:max] : true)\n\n if (param && param.strip =~ /^-?[0-9]+(\\.[0-9]+)?$/ && min && max)\n param.to_f\n else\n default\n end\n end", "def is_number?(variable)\n true if Float(variable) rescue false\n end", "def can_be_numeric?\n type == :numeric\n end", "def typecast_value_float(value)\n Float(value)\n end", "def is_numeric?\n data_type == 'number'\n end", "def force_numeric?(column)\n (column.nil? || [:integer, :float, :decimal].include?(column.type))\n end", "def is_number? string\n true if Float(string) rescue false\nend", "def is_digit?(input)\n !!Float(input) rescue false\nend", "def is_numeric(str)\n Float(str) != nil rescue false\n end", "def is_number? string\n \t\ttrue if Float(string) rescue false\n\tend", "def test_NilClass_InstanceMethod_to_f\n\t\tassert_equal(0.0, nil.to_f)\n\tend", "def numeric?\n val.numeric?\n end", "def is_number?(string)\n true if Float(string) rescue false #need to understand this\nend", "def is_numeric?(s)\n begin\n Float(s)\n rescue\n false # not numeric\n else\n true # numeric\n end\nend", "def floating?(ctx)\n source.floating?(ctx)\n end", "def is_number(str)\n true if Float(str)\nrescue StandardError\n false\nend", "def ==(f)\n self.toFloat() == f.toFloat()\n end" ]
[ "0.85790896", "0.8445893", "0.78699714", "0.77761734", "0.77434534", "0.76264244", "0.7608694", "0.74386245", "0.7383327", "0.734307", "0.7325684", "0.7205356", "0.7172576", "0.71485484", "0.7016743", "0.700799", "0.6999478", "0.69910985", "0.69802356", "0.6971501", "0.69662637", "0.6941982", "0.6836625", "0.683252", "0.6776974", "0.67542684", "0.672619", "0.6724502", "0.6703934", "0.66954315", "0.66794306", "0.6673911", "0.6643829", "0.65286976", "0.65170753", "0.65060705", "0.6480788", "0.64785445", "0.64751095", "0.64751095", "0.6467109", "0.6430177", "0.64125323", "0.6389446", "0.63744336", "0.63725215", "0.6331135", "0.6315126", "0.6301533", "0.62799907", "0.6251781", "0.6217754", "0.6207038", "0.6198107", "0.6198021", "0.61843437", "0.61764824", "0.6170161", "0.6170161", "0.61663693", "0.614356", "0.61413896", "0.61384207", "0.6128858", "0.61207896", "0.61182326", "0.610471", "0.61032635", "0.6097393", "0.6066529", "0.6066529", "0.6061457", "0.60607445", "0.6060573", "0.60408497", "0.6035187", "0.6033764", "0.6031391", "0.6031391", "0.60203356", "0.60027146", "0.5990802", "0.5963715", "0.5960997", "0.5956646", "0.59541667", "0.5943352", "0.5938531", "0.5902668", "0.59005857", "0.5856767", "0.5854396", "0.5854206", "0.5847435", "0.58200026", "0.58181447", "0.58149976", "0.5811928", "0.57892185", "0.57871544" ]
0.8395093
2
Checks if the type of the field is `NUMERIC`.
def numeric? type == "NUMERIC" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_be_numeric?\n type == :numeric\n end", "def is_numeric?\n self.data_type == 'number'\n end", "def is_numeric?\n data_type == 'number'\n end", "def force_numeric?(column)\n (column.nil? || [:integer, :float, :decimal].include?(column.type))\n end", "def is_numeric?\n begin Float(self)\n true \n end\n rescue\n false\n end", "def numeric?\n val.numeric?\n end", "def numeric?\n true\n end", "def istype_numeric?(type)\n case type\n when GAUGE, GAUGE32, INTEGER, TIMETICKS, COUNTER, INTEGER32, COUNTER32, COUNTER64\n true\n else\n false\n end\n end", "def numeric?\n false\n end", "def numeric?\n properties.include?(\"numeric\")\n end", "def is_numeric?\n\t\treturn (self.to_f.to_s == self.to_s || self.to_i.to_s == self.to_s)\n\tend", "def is_numeric?(val)\n Float val rescue false\n end", "def has_numeric(types)\n types.each do |elem|\n if elem != 'string'\n return true\n end\n end\n \n return false\n end", "def numeric?(column)\n if column.is_a?(ActiveRecord::ConnectionAdapters::Column)\n type = connection.lookup_cast_type_from_column(column).class\n else\n type = attribute_types[column.to_s].class\n end\n type.included_modules.include?(ActiveModel::Type::Helpers::Numeric)\n end", "def is_numeric(o)\n true if Integer(o) rescue false \n end", "def is_numeric(o)\n true if Integer(o) rescue false \n end", "def is_numeric?(x)\n return false if x.is_a?(Time) # we want to treat times as dimensions\n return false if x.is_a?(Complex) # not all complex can be converted to float\n return true if x.is_a?(Numeric)\n true if Float(x) rescue false\n end", "def numeric?\n !!(self =~ /\\A[0-9]+\\.*[0-9]*\\z/)\n end", "def number?(value)\n value.is_a?(Numeric)\n end", "def is_numeric(val)\n\t\treturn Integer(val).is_a? Integer rescue false\n\tend", "def numeric?\n Integer(self) != nil rescue false\n end", "def is_numeric?(s)\n !!Float(s) rescue false\n end", "def is_numeric?(value)\n !!Float(value) rescue false \n end", "def is_numeric?\n self.match(/^[0-9]+$/)\n end", "def numeric?(input)\n !Float(input).nil?\n rescue\n false\n end", "def isNumeric(s)\n\t\tbegin\n\t\t\tFloat(s)\n\t\trescue\n\t\t\tfalse # not numeric\n\t\telse\n\t\t\ttrue # numeric\n\t\tend\n\tend", "def numeric?\n !!Float(self) rescue false\n end", "def numeric?\n\t\tself.to_i.to_s == self || self.to_f.to_s == self\n\tend", "def is_numeric?(options={:decimals => true})\n begin\n if options[:decimals] == true\n Float(self)\n else\n Integer(self)\n end\n return true\n rescue\n return false\n end\n end", "def is_numeric?(s)\n begin\n Float(s)\n rescue\n false # not numeric\n else\n true # numeric\n end\nend", "def is_numeric?(obj)\n obj.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n end", "def _is_numeric?(str)\n Float(str) != nil rescue false\n end", "def numeric?(value)\n !value.nil? && value.is_a?(Integer)\n end", "def numeric?\n\t\treturn all? {|x| Math.Is_Numeric?(x)}\n\tend", "def numeric(x)\n true if Float(x) rescue false\n end", "def is_numeric?(s)\n !!Float(s) rescue false\n end", "def number?\n [:double, :float, :integer, :long].include?(type)\n end", "def validates_numeric(atts, opts={})\n validatable_attributes(atts, opts) do |a,v,m|\n begin\n Kernel.Float(v.to_s)\n nil\n rescue\n m || 'is not a number'\n end\n end\n end", "def numeric?(object)\n true if Float(object) rescue false\n end", "def numeric?(object)\n \t\ttrue if Float(object) rescue false\n\tend", "def is_numeric(str)\n Float(str) != nil rescue false\n end", "def type_literal_generic_numeric(column)\n column[:size] ? \"numeric(#{Array(column[:size]).join(', ')})\" : :numeric\n end", "def numeric?(object)\n \t\ttrue if Integer(object) rescue false\n \tend", "def is_num_type?(obj)\n Numeric === obj && obj.respond_to?(:between?) && obj.class.method_defined?(:<)\n end", "def numeric?(obj)\n obj.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/).nil? ? false : true\n end", "def IS_NUMBER(value)\n value.first.is_a?(Numeric)\n end", "def numeric?(string)\n Float(string) != nil rescue false\n end", "def numeric?(object)\n true if Float(object) rescue false\nend", "def numeric?; float?; end", "def is_numeric?(obj)\n obj.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\nend", "def is_numeric?(i)\n # check if i is a number\n i.to_i.to_s == i || i.to_f.to_s == i\n end", "def should_be_float?(field_info, field)\n field_info[\"type\"] == \"REAL\"\n end", "def numeric(input)\n return Float(input) != nil rescue false\n end", "def is_number?\n is_float? || is_integer?\n end", "def is_numeric?(num)\n num == num.to_i.to_s || num == num.to_f.to_s\nend", "def number?\n\t\ttrue if Float(string) rescue false\n\tend", "def all_numeric?\n all? {|e| e.kind_of? Numeric }\n end", "def is_numeric(str)\n true if Integer(str) rescue false\nend", "def numeric?\n self.command =~ /^\\d+$/\n end", "def is_number? string\n \t\ttrue if Float(string) rescue false\n\tend", "def is_numeric?\n for c in self.gsub('.', '').gsub('-', '').scan(/./)\n return false unless (0..9).to_a.map { |n| n.to_s }.include?(c)\n end\n return true\n end", "def string_or_numeric!(v)\n case v\n when ''\n nil\n when String, Numeric\n true\n else\n raise Error, \"unexpected value received: #{v.inspect}\"\n end\n end", "def check_is_numeric(csv_data, column_name)\n data = csv_data.select{|item| !item[column_name].nil? }\n non_numeric_values = data.filter{|i| !CSV::Converters[:integer].call(i[column_name]).is_a?(Numeric) }\n naughty_values = non_numeric_values.map{|i| \" 👉 \\\"#{i[column_name]}\\\"\" }.join(\"\\n\")\n if non_numeric_values.length > 0\n puts \"🔴 Found non numeric data in #{column_name} \\n\\n#{naughty_values}\\n\\n\"\n return true \n else \n return false\n end\n end", "def is_numeric?(obj)\n if /[^0-9]/.match(obj) != nil\n return true\n end\n false\nend", "def test_price_always_numeric\n property_of {\n string\n }.check { |name|\n assert_kind_of Numeric, @market.price(name)\n }\n end", "def numeric?(num)\n !!Float(num) rescue false\nend", "def is_number? string\n true if Float(string) rescue false\n end", "def is_numeric(num)\n\n if num.to_f.to_s == num || num.to_i.to_s == num\n return true\n else\n return false\n end\n\nend", "def numeric?(numberInput)\n numberInput = numberInput.to_s\n if numberInput =~ /^[-+]?[0-9]*\\.?[0-9]+$/\n \n return true\n else\n return false\n end\nend", "def isNum(c)\r\n\tInteger(c) rescue return false\r\n\treturn true\r\nend", "def is_number?(input)\n true if Float(input) rescue false\n end", "def bignumeric?\n type == \"BIGNUMERIC\"\n end", "def is_number? string\n true if Float(string) rescue false\n end", "def is_number? string\n true if Float(string) rescue false\n end", "def numeric?(character)\n (character =~ /[0-9]/) == 0\n end", "def is_numeric?(s)\n # input -> s: a string\n # output -> true if the string is a number value, false otherwise\n begin\n if Float(s)\n return true\n end\n rescue\n return false\n end\n end", "def test_numeric\n assert_equal(true, RpnCalc.new.numeric?('0'))\n assert_equal(true, RpnCalc.new.numeric?('0.0'))\n assert_equal(true, RpnCalc.new.numeric?('-0'))\n assert_equal(true, RpnCalc.new.numeric?('-0.0'))\n assert_equal(false, RpnCalc.new.numeric?('A'))\n assert_equal(false, RpnCalc.new.numeric?('-E'))\n assert_equal(false, RpnCalc.new.numeric?(nil))\n end", "def is_number? string\n true if Float(string) rescue false\n end", "def numeric_empty(num)\n false\n end", "def is_number? string\n true if Float(string) rescue false\nend", "def is_number(string)\r\n\ttrue if Float(string) rescue false\r\nend", "def is_number()\n res = super(context,self)\n return res\n end", "def valid_atom?(atom)\n raise(ISO8601::Errors::TypeError, \"The atom argument for #{self.class} should be a Numeric value.\") \\\n unless atom.is_a?(Numeric)\n end", "def check_numericity\n check_patterns(@income.to_s)\n check_patterns(@age.to_s)\n end", "def consume_numeric; end", "def value_is_integer?(string)\n return string.strip.numeric?\n end", "def numeric_check(first_num)\n Float(first_num) != nil rescue false\nend", "def is_number?(str)\n true if Float(str) rescue false\n end", "def numeric?(string)\n !!(string =~ /\\A\\d+\\Z/)\nend", "def valid_number?(num)\n integer?(num) || float?(num)\nend", "def is_number?(string)\n true if Float(string) rescue false\n end", "def is_number(num)\n true if Float(num) rescue false\nend", "def is_number?(string)\n true if Float(string) rescue false\n end", "def float?(field)\n self.send(field).is_a? Float\n end", "def is_number? token\n Float(token) && true rescue false\n end", "def is_datatype?(); @type == GRT_DATATYPE; end", "def is_number(value) #method\n if is_bool(value)\n false\n elsif value[0] == \"\\\"\"\n false\n else\n true\n end\n end", "def digits_only?(value)\n case value\n when Integer, ActiveModel::Type::Integer, ActiveSupport::Duration\n true\n when String, Symbol, Numeric, ActiveModel::Type::Float\n (s = value.to_s).present? && s.delete('0-9').blank?\n else\n false\n end\n end", "def is_valid_input?\n\n\t\t@lines.each do |i|\n\t\t\tif !numeric?(i)\n\t\t\t\treturn false\n\t\t\tend\n\t\tend \n\tend", "def numeric?(str)\n !str.to_s.match(/^-?[\\d.]+$/).nil?\n # str.to_i.to_s == str\nend" ]
[ "0.8123423", "0.81146765", "0.80457455", "0.7489456", "0.74260485", "0.736178", "0.7325247", "0.71158636", "0.7065441", "0.70591086", "0.7019456", "0.70072466", "0.6976461", "0.6957395", "0.69145", "0.6912553", "0.6883778", "0.6883057", "0.68391424", "0.6837754", "0.6830816", "0.6826594", "0.6822544", "0.6798213", "0.6793878", "0.6791933", "0.6781816", "0.6752955", "0.67495835", "0.67373514", "0.67239493", "0.6723484", "0.67150766", "0.6702675", "0.66875815", "0.668581", "0.667427", "0.6650036", "0.6643224", "0.6607251", "0.65799564", "0.6569582", "0.654905", "0.65298945", "0.65283275", "0.6506135", "0.6501468", "0.64551705", "0.6452716", "0.64471376", "0.644544", "0.64399457", "0.6399682", "0.63974637", "0.63874793", "0.6377343", "0.6366655", "0.6359863", "0.6324844", "0.6312922", "0.6284965", "0.62844115", "0.62803423", "0.6278537", "0.62766707", "0.6233439", "0.6158215", "0.6144714", "0.61240774", "0.611553", "0.61098045", "0.6095738", "0.6093709", "0.6093709", "0.60864276", "0.608194", "0.6078839", "0.60736424", "0.6073293", "0.6065484", "0.6060291", "0.6022461", "0.60142434", "0.6011196", "0.59849524", "0.5977282", "0.5973738", "0.59702104", "0.5967071", "0.5961384", "0.59546226", "0.5951117", "0.59510183", "0.5933862", "0.59312", "0.59202766", "0.5919914", "0.5919823", "0.59159094", "0.58907115" ]
0.8336803
0
Checks if the type of the field is `BIGNUMERIC`.
def bignumeric? type == "BIGNUMERIC" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numeric?\n type == \"NUMERIC\"\n end", "def type_literal_generic_bigdecimal(column)\n type_literal_generic_numeric(column)\n end", "def is_numeric?\n self.data_type == 'number'\n end", "def is_numeric?\n data_type == 'number'\n end", "def can_be_numeric?\n type == :numeric\n end", "def type_literal_generic_bignum(column)\n column[:serial] ? :bigserial : super\n end", "def type_literal_generic_bignum_symbol(column)\n :bigint\n end", "def istype_numeric?(type)\n case type\n when GAUGE, GAUGE32, INTEGER, TIMETICKS, COUNTER, INTEGER32, COUNTER32, COUNTER64\n true\n else\n false\n end\n end", "def numeric?\n false\n end", "def force_numeric?(column)\n (column.nil? || [:integer, :float, :decimal].include?(column.type))\n end", "def numeric?\n true\n end", "def type_literal_generic_bignum_symbol(column)\n column[:serial] ? :bigserial : super\n end", "def numeric?\n val.numeric?\n end", "def cast_tinyint_integer?(field)\n field.length != 1\n end", "def numeric?\n properties.include?(\"numeric\")\n end", "def numeric?(object)\n \t\ttrue if Integer(object) rescue false\n \tend", "def bigtable?\n @gapi.source_format == \"BIGTABLE\"\n end", "def has_numeric(types)\n types.each do |elem|\n if elem != 'string'\n return true\n end\n end\n \n return false\n end", "def numeric?\n Integer(self) != nil rescue false\n end", "def integer?\n type == \"INTEGER\" || type == \"INT64\"\n end", "def number?\n [:double, :float, :integer, :long].include?(type)\n end", "def numeric?(column)\n if column.is_a?(ActiveRecord::ConnectionAdapters::Column)\n type = connection.lookup_cast_type_from_column(column).class\n else\n type = attribute_types[column.to_s].class\n end\n type.included_modules.include?(ActiveModel::Type::Helpers::Numeric)\n end", "def is_uinteger?(); @type == GRT_UINTEGER; end", "def numeric?\n\t\tself.to_i.to_s == self || self.to_f.to_s == self\n\tend", "def is_numeric?\n begin Float(self)\n true \n end\n rescue\n false\n end", "def bson_int64?\n (MIN_64BIT <= self) && (self <= MAX_64BIT)\n end", "def type_literal_generic_numeric(column)\n column[:size] ? \"numeric(#{Array(column[:size]).join(', ')})\" : :numeric\n end", "def is_numeric?\n\t\treturn (self.to_f.to_s == self.to_s || self.to_i.to_s == self.to_s)\n\tend", "def is_datatype?(); @type == GRT_DATATYPE; end", "def int64?\n type == INT64_TYPE\n end", "def is_num_type?(obj)\n Numeric === obj && obj.respond_to?(:between?) && obj.class.method_defined?(:<)\n end", "def numeric?(object)\n \t\ttrue if Float(object) rescue false\n\tend", "def numeric?(object)\n true if Float(object) rescue false\n end", "def validate_integer_type(field)\n if field.is_a?(Integer)\n return true\n else\n return false\n end\n end", "def numeric?\n !!(self =~ /\\A[0-9]+\\.*[0-9]*\\z/)\n end", "def integer_dtype?\n [:byte, :int8, :int16, :int32, :int64].include?(self.dtype)\n end", "def number?(value)\n value.is_a?(Numeric)\n end", "def is_numeric(val)\n\t\treturn Integer(val).is_a? Integer rescue false\n\tend", "def is_numeric(o)\n true if Integer(o) rescue false \n end", "def is_numeric(o)\n true if Integer(o) rescue false \n end", "def numeric?\n !!Float(self) rescue false\n end", "def should_be_integer?(field_info, field)\n field_info[\"type\"] == \"INTEGER\"\n end", "def is_ruby_value_type(object)\r\n [String, Fixnum, Bignum, Time, Number, Float].include?(object.class)\r\n end", "def number?\n\t\ttrue if Float(string) rescue false\n\tend", "def needs_encoding?\n ![ :binary, :date, :datetime, :boolean, :float, :integer ].include?(type)\n end", "def big?(num)\n return true if num > 100\n return false if num <= 100\nend", "def is_numeric?(val)\n Float val rescue false\n end", "def numeric?(value)\n !value.nil? && value.is_a?(Integer)\n end", "def needs_encoding?\n ![ :binary, :date, :datetime, :boolean, :float, :integer ].include?(type)\n end", "def numeric?(object)\n true if Float(object) rescue false\nend", "def bytes?\n type == \"BYTES\"\n end", "def numeric?(obj)\n obj.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/).nil? ? false : true\n end", "def is_numeric?(x)\n return false if x.is_a?(Time) # we want to treat times as dimensions\n return false if x.is_a?(Complex) # not all complex can be converted to float\n return true if x.is_a?(Numeric)\n true if Float(x) rescue false\n end", "def integer?(field)\n self.send(field).is_a? Integer\n end", "def is_number?\n is_float? || is_integer?\n end", "def read_bignum; end", "def is_number?(obj)\n obj.to_s == obj.to_i.to_s\n end", "def is_bgnstr?(); @type == GRT_BGNSTR; end", "def has_decimal_part?()\n #This is a stub, used for indexing\n end", "def as_many_bytes_as?(other)\n type_id.abs >= other.type_id.abs # TODO: use possible_byte_sizes\n end", "def numeric?\n\t\treturn all? {|x| Math.Is_Numeric?(x)}\n\tend", "def should_be_float?(field_info, field)\n field_info[\"type\"] == \"REAL\"\n end", "def bson_int32?\n (MIN_32BIT <= self) && (self <= MAX_32BIT)\n end", "def entitylike?(bsubtype)\n backend_entity_subtypes.include?(bsubtype)\n end", "def is_numeric?(obj)\n obj.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n end", "def isNum(c)\r\n\tInteger(c) rescue return false\r\n\treturn true\r\nend", "def is_match_data_type?(db_field, gw_field)\n result = true\n if gw_field.is_a? Hash\n gw_value = gw_field[\"value\"]\n else\n gw_value = gw_field\n end\n case db_field.value_data_type\n when :integer\n if gw_value.class != Fixnum\n result = false\n end\n when :float\n if gw_value.class != Float\n result = false\n end\n end\n unless result\n Rails.logger.warn \"[DeviceService][sync_with_latest_state] Data type not match\"\n Rails.logger.warn \"db_field data type: #{db_field.value_data_type.to_s}.\"\n Rails.logger.warn \"gw_field value: #{gw_value}.\"\n end\n result\n end", "def is_numeric?(value)\n !!Float(value) rescue false \n end", "def numeric?(num)\n !!Float(num) rescue false\nend", "def numeric(x)\n true if Float(x) rescue false\n end", "def bigdecimal\n Util.from_bytes :bigdecimal, value\n end", "def binary?\n t = @type.downcase\n !!((t =~ /binary/) || (t =~ /blob/))\n end", "def is_number? string\n \t\ttrue if Float(string) rescue false\n\tend", "def type_literal_generic_fixnum(column)\n type_literal_generic_integer(column)\n end", "def number?\n #just regex\n #most likely faster\n #than exception handling\n match = /\\b[0-9]+([.]{1}[0-9]+){0,1}\\b/.match(self)\n if match.nil?\n return false\n else\n return match[0]==self\n end\n end", "def is_number(value) #method\n if is_bool(value)\n false\n elsif value[0] == \"\\\"\"\n false\n else\n true\n end\n end", "def numeric?(input)\n !Float(input).nil?\n rescue\n false\n end", "def numeric_empty(num)\n false\n end", "def is_numeric?(s)\n !!Float(s) rescue false\n end", "def numeric?(string)\n Float(string) != nil rescue false\n end", "def test_price_always_numeric\n property_of {\n string\n }.check { |name|\n assert_kind_of Numeric, @market.price(name)\n }\n end", "def all_numeric?\n all? {|e| e.kind_of? Numeric }\n end", "def must_convert?\n self.big_query_conversion_column.present? && self.unit != 'seconds'\n end", "def number?( item )\n [Float, Fixnum, Integer].any? {|type| item.is_a?( type )}\n end", "def number?(num)\n integer?(num) || float?(num)\nend", "def subtype\n self.numeric_type\n end", "def subtype\n self.numeric_type\n end", "def can_be?(btype)\n backend_types.keys.include?(btype)\n end", "def is_numeric?\n for c in self.gsub('.', '').gsub('-', '').scan(/./)\n return false unless (0..9).to_a.map { |n| n.to_s }.include?(c)\n end\n return true\n end", "def is_numeric?(num)\n num == num.to_i.to_s || num == num.to_f.to_s\nend", "def is_numeric?\n self.match(/^[0-9]+$/)\n end", "def integer?\n @kind == :integer_lit || @kind == :integer_exp_lit || @kind == :hex_lit || @kind == :bin_lit\n end", "def value_is_integer?(string)\n return string.strip.numeric?\n end", "def is_numeric?(s)\n !!Float(s) rescue false\n end", "def must_convert?\n big_query_conversion_column.present? && unit != 'seconds'\n end", "def valid_type?(type)\n !native_database_types[type].nil?\n end", "def integer?() end", "def schema_column_type(db_type)\n if convert_smallint_to_bool && db_type =~ /smallint/i \n :boolean\n else\n super\n end\n end", "def is_number? string\n true if Float(string) rescue false\n end", "def unbounded?(unbounded_type = nil)\n return false unless numeric?\n\n unboundedness = case unbounded_minimum | unbounded_maximum\n when 3 then :infinite\n when 2 then :maximum\n when 1 then :minimum\n end\n\n return unbounded_type && unboundedness ? ( unboundedness == :infinite ) || ( unboundedness == unbounded_type ) : unboundedness\n end" ]
[ "0.6738808", "0.6559789", "0.6464305", "0.6322639", "0.6197289", "0.61915845", "0.61214185", "0.60701454", "0.60350496", "0.602095", "0.5962229", "0.59568995", "0.58549404", "0.5850209", "0.5802794", "0.579359", "0.5774934", "0.5733052", "0.5723241", "0.57167006", "0.5706896", "0.56632316", "0.56481344", "0.56185275", "0.5596971", "0.5544368", "0.5531167", "0.5512605", "0.54932016", "0.5488942", "0.5469108", "0.54660255", "0.5450038", "0.544818", "0.5440871", "0.5439846", "0.54283744", "0.54136455", "0.5394211", "0.5391585", "0.5382298", "0.53615105", "0.53578615", "0.5352785", "0.5345721", "0.5332631", "0.5331126", "0.5328607", "0.5323409", "0.53229237", "0.5311549", "0.5304599", "0.52954555", "0.528138", "0.5250882", "0.5247518", "0.52400964", "0.52261966", "0.52072024", "0.52057827", "0.52022153", "0.51991147", "0.5181749", "0.5179375", "0.5168939", "0.5166622", "0.5163889", "0.5148517", "0.51458454", "0.514384", "0.51399434", "0.51345557", "0.5133245", "0.51322246", "0.5117195", "0.51077783", "0.5106765", "0.50991225", "0.5083317", "0.50818646", "0.5081559", "0.50766003", "0.50704336", "0.5068333", "0.5060607", "0.5043378", "0.5043378", "0.5040376", "0.5021153", "0.5016934", "0.50105745", "0.5006186", "0.5005868", "0.5005304", "0.5004441", "0.5001306", "0.49845484", "0.49708557", "0.49698246", "0.49567997" ]
0.80970097
0
Checks if the type of the field is `BOOLEAN`.
def boolean? type == "BOOLEAN" || type == "BOOL" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_boolean_type(field)\n if field.is_a?(TrueClass) || field.is_a?(FalseClass)\n return true\n else\n return false\n end\n end", "def boolean?\n @type == :boolean\n end", "def boolean?(column)\n column.type == :boolean\n end", "def boolean_type\n 'Boolean'\n end", "def is_boolean?\n column = NUMBER_TO_OBJECT_MAP[@object].columns.find { |col| col.name == @search_term }\n column && column.type == :boolean\n end", "def config_boolean_true?(boolean_field)\n data[boolean_field].to_i == 1\n end", "def boolean?\n !to_bool.nil?\n end", "def type_literal_generic_boolean(column)\n :boolean\n end", "def boolean?\n is_a?(::TrueClass) || is_a?(::FalseClass)\n end", "def boolean_field_registered?(name)\n return boolean_fields[name.to_s] != nil\n end", "def boolean?\n proc do |o|\n o.is_a? String and o.is_b?\n end\n end", "def boolean?\n !@arg[:boolValue].nil?\n end", "def typus_boolean(attribute = :default)\n options = read_model_config['fields']['options']\n\n boolean = if options && options['booleans'] && boolean = options['booleans'][attribute.to_s]\n boolean.is_a?(String) ? boolean.extract_settings : boolean\n else\n [\"True\", \"False\"]\n end\n\n [[boolean.first, \"true\"], [boolean.last, \"false\"]]\n end", "def boolean\n Util.from_bytes :boolean, value\n end", "def boolean_type?(resource)\n property = get_resource_property(resource, attribute_name)\n\n property ? property.load_as == TrueClass : false\n end", "def expect_boolean name, v\n v = true if v == \"true\"\n v = false if v == \"false\"\n expect_type name,\n v,\n \"boolean\",\n lambda{ [ true, false ].member?(v) }\n end", "def boolean?\n @kind == :true_kw || @kind == :false_kw\n end", "def boolean?\n !!(self =~ /\\A(true|false)\\z/i)\n end", "def true_string?(field)\n field == 'true' || field == true\n end", "def to_bool\n is_a?(::TrueClass) || self == :true || self == :yes || self == :on\n end", "def bool()\n val = _int32(\"bool\")\n\n case val\n when 0\n false\n when 1\n true\n else\n raise ArgumentError, \"Invalid value for bool: #{val}\"\n end\n end", "def schema_column_type(db_type)\n convert_tinyint_to_bool && db_type =~ /\\Atinyint\\(1\\)/ ? :boolean : super\n end", "def cast_to_boolean(input)\n ActiveRecord::Type::Boolean.new.type_cast_from_user(input)\n end", "def is_bool input\n !!input == input\nend", "def boolean_attribute?(name) \n BOOLEAN_ATTRIBUTES.include?(name.to_s)\n end", "def boolean(**props)\n transform(type: :boolean, **props) do |value|\n !!value\n end\n end", "def to_booly\n unless self.to_booly?\n raise TypeError.new(\"#{self} cannot be converted to TrueClass or FalseClass\")\n end\n\n return true if self == \"true\" || (self.to_f? && self.to_f > 0)\n false\n end", "def typus_boolean(attribute = 'default')\n boolean = Typus::Configuration.config[self.name]['fields']['options']['booleans'][attribute] rescue nil\n boolean = \"true, false\" if boolean.nil?\n return { :true => boolean.split(', ').first.humanize, \n :false => boolean.split(', ').last.humanize }\n end", "def to_boolean\n # SECURE: BNS 2012-10-09: But may behave oddly for multi-line input\n return true if self == true || self =~ (/^(true|t|yes|y|1)$/i)\n return false if self == false || self.nil? || self =~ (/^(false|f|no|n|0)$/i)\n fail ArgumentError, \"invalid value for Boolean: \\\"#{self}\\\"\"\n end", "def to_boolean\r\n\t !!(self.to_s =~ /^(true|t|yes|y|1)$/i)\r\n\tend", "def bool?(b)\n not ['true', 'false'].index(b.to_s).nil?\n end", "def wp_validate_boolean(var)\n return var if var.is_a?(FalseClass) || var.is_a?(TrueClass)\n\n return false if (var.is_a?(String) && 'false' == var.downcase)\n\n if var.blank? || var.to_f == 0.0\n false\n else\n true\n end\n end", "def bson_type\n Boolean::BSON_TYPE\n end", "def boolean?(obj)\n obj.instance_of?(FalseClass) or obj.instance_of?(TrueClass)\n end", "def type_literal_generic_trueclass(column)\n :boolean\n end", "def looks_like_boolean?(value)\n value.in?([true, false])\n end", "def to_bool str\r\n ActiveRecord::Type::Boolean.new.type_cast_from_user(str)\r\n end", "def booleanish_to_boolean(arguments, ddl)\n arguments.keys.each do |key|\n if ddl[:input].keys.include?(key)\n if ddl[:input][key][:type] == :boolean\n arguments[key] = true if arguments[key] == \"true\"\n arguments[key] = true if arguments[key] == \"yes\"\n arguments[key] = true if arguments[key] == \"1\"\n arguments[key] = false if arguments[key] == \"false\"\n arguments[key] = false if arguments[key] == \"no\"\n arguments[key] = false if arguments[key] == \"0\"\n end\n end\n end\n rescue\n true\n end", "def schema_column_type(db_type)\n Sequel::Mysql2.convert_tinyint_to_bool && db_type == 'tinyint(1)' ? :boolean : super\n end", "def to_bool\n return true if ['true', '1', 'yes', 'on', 't'].include? self\n return false if ['false', '0', 'no', 'off', 'f'].include? self\n return false\n end", "def to_boolean(val)\n val && (val.to_s.match(/(true|t|yes|y|1)$/i) != nil)\n end", "def is_bool(value) #method\n if value == 'verdadero' || value == 'falso'\n true\n else\n false\n end\n end", "def bool_property(name)\n val = property(name)\n (val && val == 'true')\n end", "def value_is_boolean?(string)\n return %w[true false yes no y n].include?(string.downcase)\n end", "def coerce_bool(value)\n case value\n when nil, false then false\n when Numeric then !value.zero?\n else\n true\n end\n end", "def schema_column_type(db_type)\n if convert_smallint_to_bool && db_type =~ /smallint/i \n :boolean\n else\n super\n end\n end", "def is_boolean()\n res = super(context,self)\n return res\n end", "def boolean(value)\n value ? true : false\n end", "def typus_boolean(attribute = :default)\n\n begin\n boolean = Typus::Configuration.config[name]['fields']['options']['booleans'][attribute.to_s]\n rescue\n boolean = 'true, false'\n end\n\n return nil if boolean.nil?\n\n hash = ActiveSupport::OrderedHash.new\n\n mapping = boolean.kind_of?(Array) ? boolean : boolean.extract_settings\n hash[:true], hash[:false] = mapping.first, mapping.last\n hash.map { |k, v| hash[k] = v.humanize }\n\n return hash\n\n end", "def type_bool!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 37 )\n\n\n\n type = TYPE_BOOL\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 213:12: 'bool'\n match( \"bool\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 37 )\n\n\n end", "def typecast_value_boolean(value)\n case value\n when false, 0, \"0\", /\\Af(alse)?\\z/i, /\\Ano?\\z/i\n false\n else\n blank_object?(value) ? nil : true\n end\n end", "def to_bool(strict = true)\n return false if blank? || self =~ /(false|f|no|n|0)$/i\n\n if strict\n return true if self =~ /(true|t|yes|y|1)$/i\n raise ArgumentError, \"invalid value for Boolean: \\\"#{self}\\\"\"\n else\n return true\n end\n end", "def boolean?( item )\n [true,false].include?( item )\n end", "def to_boolean(value)\n case value\n when :true, 'true'\n true\n else\n false\n end\n end", "def boolean(arg)\n case arg\n when 'true'\n 1\n when 'false'\n 0\n when nil\n 0\n end\n end", "def to_bool\n true\n end", "def to_bool\n return false if self.downcase == \"false\"\n return true\n end", "def schema_column_type(db_type)\n db_type =~ /\\Atinyint\\(1\\)/ ? :boolean : super\n end", "def attr_get_boolean(attr_type, strict = true)\n #This is a stub, used for indexing\n end", "def coerce_boolean(value, options = {})\n return nil if options[:allow_nil] && value.nil?\n !!value && !coerce_string(value).empty?\n end", "def to_bool\n str = if @target.respond_to?(:empty?)\n @target\n else\n @target.to_s\n end\n return @target != 0 if @target.is_a? Numeric\n return true if @target == true || str =~ /(true|t|yes|y)$/i\n bm = BlankMatcher.new(@target)\n return false if @target == false || bm.blank? || str =~ /(false|f|no|n)$/i\n raise(ArgumentError, \"invalid value for Boolean: \\\"#{@target}\\\"\")\n end", "def check(value)\n # We have to invert the values.\n if value == :true\n false\n else\n true\n end\n end", "def check(value)\n # We have to invert the values.\n if value == :true\n false\n else\n true\n end\n end", "def to_bool\n true\n end", "def boolean(name, options={})\n param(:boolean, name, options)\n end", "def to_bool(value)\n value.to_s.downcase == 'true' ? true : false\n end", "def has_booleans(*attrs)\n options = attrs.extract_options!\n attrs.each do |attr|\n\n attr_reader attr\n define_reader_with_options(attr,options) \n define_method(\"#{attr.to_s}=\") do |val|\n instance_variable_set(\"@#{attr}\", val.to_s.to_b)\n attributes[attr] = val\n val\n\n end\n\n define_method (\"#{attr.to_s}?\") do\n send(\"#{attr.to_s}\".to_sym).to_s.to_b\n end\n end\n end", "def to_boolean\n if ['true', 'True', 'TRUE', '1'].include?(self)\n return true\n else\n return false\n end\n end", "def coerce_boolean(value, options = {})\n return if options[:allow_nil] && (value.nil? || value == \"\")\n return false if value.to_s.strip == \"false\"\n !!value && !coerce_string(value, :allow_nil => false).strip.empty?\n end", "def boolean\n any(true, false)\n end", "def to_bool() true end", "def supports_is_true?\n false\n end", "def verify_boolean_param(param)\n if @options.include?(param) && ![true, false].include?(@options[param])\n raise WhmArgumentError.new(\"Boolean parameter must be \\\"true\\\" or \\\"false\\\": #{param}\")\n end\n end", "def get_boolean_field(field_name)\n\t\tend", "def convert_to_boolean(val)\n return val if val.is_a?(TrueClass) || val.is_a?(FalseClass)\n val = val.to_s.clean\n return nil if val.blank?\n if val.match?(/\\A(false|f|n|no)\\z/i)\n false\n elsif val.match?(/\\A(true|t|y|yes)\\z/i)\n true\n end\n end", "def assert_valid_boolean(name, value)\n if value != true && value != false\n raise ArgumentError, \"+#{name}+ should be true or false, but was #{value.inspect}\"\n end\n end", "def booleans!\n @boolean_params.each do |param|\n key = (param.is_a?(Array) ? param.first : param)\n verify_boolean_param(key)\n end\n end", "def bool_value(value)\n value = @filters[value] if value.is_a? Symbol\n ActiveRecord::Type::Boolean.new.cast(value)\n end", "def has_bool_state\n params.require(:state)\n if ! params[:state].in? [\"true\", \"false\"]\n head :bad_request\n end\n params[:state] = ActiveModel::Type::Boolean.new.cast(params[:state])\n end", "def check_type(validation:, key:, schema:)\n return false if !validation[:required] && schema.nil? # Optional and not here, dont check\n return false unless validation[:type]\n if validation[:type] == 'Boolean'\n return false unless !(schema.is_a?(TrueClass) || schema.is_a?(FalseClass) || schema.nil?)\n else\n return false unless !(schema.is_a?(validation[:type]) || schema.nil?)\n end\n\n error! key, \"supposed to be a #{validation[:type]} but was #{schema.class}\"\n true\n end", "def boolean cols\n decode_values :boolean, cols\n end", "def to_bool(value)\n ActiveModel::Type::Boolean.new.cast(value.to_s.strip)\n end", "def parse_bool(bool_param)\n bool_param.try(:to_bool) || (bool_param.try(:to_i) == 1)\n end", "def literal_true\n BOOL_TRUE\n end", "def value_to_boolean(value)\n if value.is_a?(String) && value.blank?\n nil\n else\n TRUE_VALUES.include?(value)\n end\n end", "def value_to_boolean(value)\n value = get_param(value) if value.is_a?(Symbol)\n ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value)\n end", "def boolean name, description: nil, mode: :nullable, policy_tags: nil\n record_check!\n\n add_field name, :boolean, description: description, mode: mode, policy_tags: policy_tags\n end", "def to_b\n return true if self =~ BOOLEAN_REGEX\n false\n end", "def get_boolean_value\n\t\tend", "def true_or_false?(value)\n case value\n when NilClass then false\n when TrueClass, FalseClass then value\n when String then\n if value =~ /^(false|true)$/i then\n !(value =~ /^true$/i).nil?\n else\n value.to_i != 0\n end\n else\n value.to_i != 0\n end\n end", "def to_bool(questionable_string)\n\tbool = true\n\tunless questionable_string == \"true\"\n\t\tbool = false\n\tend\n\tbool\nend", "def assert_boolean(boolean, message=nil)\n BooleanAssay.assert!(boolean, :message=>message)\n end", "def munge_boolean(value)\n case value\n when true, 'true', :true\n 'true'\n when false, 'false', :false\n 'false'\n else\n raise \"Invalid value for munge_boolean #{value}\"\n end\n end", "def to_bool(value, default = false)\n return default if value.nil?\n return value if value.is_a?(TrueClass) || value.is_a?(FalseClass)\n !!(value =~ /^(true|t|yes|y|1)$/i)\n end", "def boolean(name, option={})\n option[:is_a] = :boolean\n register_attribute_member(name, option)\n define_attribute_accessor(name, option)\n method = <<-EOS\n def #{name}?\n get_attribute(:#{name})\n end\nEOS\n class_eval(method, __FILE__, __LINE__)\n define_validations(name, option)\n end", "def boolean(*args, &block)\n args = [{ :using => Option, :default => false, :arity => 0}, *args]\n da = option(*args, &block)\n da.instance_eval do\n kind FalseClass, TrueClass\n from NilClass do\n false\n end\n from Numeric do |n|\n n == 0 ? false : true\n end\n from String do |s|\n case s\n when \"on\", \"true\", \"yes\", \"1\"\n true\n when \"off\", \"false\", \"no\", \"0\"\n false\n else\n raise Doodle::ValidationError, \"unknown value for boolean: #{s}\"\n end\n end\n end\n end", "def to_bool() false end", "def literal_false\n BOOL_FALSE\n end", "def to_boolean(string)\n string == 'true'\nend", "def true?\n self.eql?(true)\n end" ]
[ "0.8182188", "0.7985818", "0.790566", "0.76356053", "0.7247902", "0.7122026", "0.7076148", "0.7015558", "0.69802076", "0.69467354", "0.69068044", "0.6845731", "0.68139756", "0.6801363", "0.67474", "0.6743324", "0.673224", "0.6679746", "0.6620197", "0.6601278", "0.65994644", "0.65140885", "0.650897", "0.65024155", "0.65008193", "0.6496342", "0.6475656", "0.64464045", "0.64392036", "0.64189506", "0.6408169", "0.6405999", "0.63845843", "0.6358627", "0.63417006", "0.63362795", "0.63139343", "0.62833256", "0.6265422", "0.6265306", "0.62466943", "0.6243173", "0.62285465", "0.62284726", "0.62204635", "0.6189164", "0.6159998", "0.61234194", "0.61152154", "0.61123097", "0.61031675", "0.60981584", "0.60980695", "0.6093101", "0.6071094", "0.606644", "0.6057956", "0.60525274", "0.6030743", "0.6015798", "0.5984742", "0.5975048", "0.5970264", "0.59486175", "0.5948215", "0.59462655", "0.5944065", "0.59405214", "0.5938071", "0.59345037", "0.5933281", "0.5932771", "0.59294486", "0.592469", "0.59164774", "0.5906601", "0.58864653", "0.58854413", "0.5876211", "0.5869669", "0.5867578", "0.58496195", "0.58390296", "0.5838492", "0.58361626", "0.58287615", "0.5827287", "0.5824468", "0.5822779", "0.5819818", "0.5816414", "0.58163565", "0.58156145", "0.5813604", "0.5804776", "0.57905656", "0.57888275", "0.57868177", "0.57808846", "0.5780779" ]
0.8220208
0
Checks if the type of the field is `BYTES`.
def bytes? type == "BYTES" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bytes?(object)\n object.kind_of?(Fixnum) && object >= 0x00 && object <= 0xFF\n end", "def binary?\n t = @type.downcase\n !!((t =~ /binary/) || (t =~ /blob/))\n end", "def as_many_bytes_as?(other)\n type_id.abs >= other.type_id.abs # TODO: use possible_byte_sizes\n end", "def bytesize\n @field.bytesize\n end", "def value_type\n 'BINARY'\n end", "def field_to_binary(field_type, field_value)\n case field_type\n when \"boolean\"\n if field_value == \"true\"\n \"\\x01\".b\n elsif field_value == \"false\"\n \"\\x00\".b\n else\n raise \"Expected true/false, got #{field_value}\"\n end\n when \"float\"\n # Works with any of: \"123\", \"123.4\", \"123,4\"\n [field_value.gsub('\"', '').sub(\",\", \".\").to_f].pack(\"f\")\n when \"int\"\n [field_value.gsub('\"', '').to_i].pack(\"l\")\n when \"short\"\n [field_value.gsub('\"', '').to_i].pack(\"v\")\n when \"string\"\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value).unpack(\"U*\")\n else\n str = field_value.unpack(\"U*\")\n end\n [str.size].pack(\"v\") + str.pack(\"v*\")\n when \"optstring\"\n # this is really stupid\n if field_value == \"nil\"\n \"\\x00\"\n else\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value).unpack(\"U*\")\n else\n str = field_value.unpack(\"U*\")\n end\n \"\\x01\" + [str.size].pack(\"v\") + str.pack(\"v*\")\n end\n when /\\Ablob:(\\d+)/\n bloblen = $1.to_i\n if field_value =~ /\\A\".*\"\\z/\n str = eval(field_value)\n else\n str = eval('\"' + field_value + '\"')\n end\n raise \"Blob expected to have #{bloblen} bytes, had #{str.size}\" unless str.size == bloblen\n str\n else\n warn \"Unknown ft/fv #{field_type} #{field_value}\"\n \"x\"\n end\n end", "def binary?\n @kind == :binary\n end", "def binary?\n [:binary].include?(type)\n end", "def check_binary(obj)\n return unless RUBY_VERSION >= \"1.9\"\n\n case obj\n when Array\n obj.each { |item| check_utf8(item) }\n when Hash\n obj.each { |key, value|\n check_utf8(key)\n check_utf8(value)\n }\n when String\n obj.encoding.should eql(Encoding.find(\"binary\"))\n obj.valid_encoding?.should be_true\n else\n return\n end\n end", "def value_is_binary?(value) # :nodoc:\n value = value.to_s\n return true if value[0] == ?: or value[0] == ?<\n value.each_byte { |byte| return true if (byte < 32) || (byte > 126) }\n false\n end", "def type_conforms?(obj, field)\n true\n end", "def check_allowed_bytesize(v, max)\n end", "def needs_encoding?\n ![ :binary, :date, :datetime, :boolean, :float, :integer ].include?(type)\n end", "def binary?\n flag? Flags::ARBITRARY_BYTES\n end", "def binary_content?\n transfer_encoding && transfer_encoding == 'binary'\n end", "def is?(btype)\n type == btype\n end", "def needs_encoding?\n ![ :binary, :date, :datetime, :boolean, :float, :integer ].include?(type)\n end", "def bytesize_of(member)\n self.class.bytesize_of(member)\n end", "def is_match_data_type?(db_field, gw_field)\n result = true\n if gw_field.is_a? Hash\n gw_value = gw_field[\"value\"]\n else\n gw_value = gw_field\n end\n case db_field.value_data_type\n when :integer\n if gw_value.class != Fixnum\n result = false\n end\n when :float\n if gw_value.class != Float\n result = false\n end\n end\n unless result\n Rails.logger.warn \"[DeviceService][sync_with_latest_state] Data type not match\"\n Rails.logger.warn \"db_field data type: #{db_field.value_data_type.to_s}.\"\n Rails.logger.warn \"gw_field value: #{gw_value}.\"\n end\n result\n end", "def check_raw_value(value)\n check(value, {\n :type => :uint8,\n :count => (size < 1 ? 1 : size),\n :length => 1,\n :bit_length => 8,\n :sign => :unsigned,\n :default_value => 0,\n })\n end", "def message\n \"#{type.inspect} is not a valid binary type. \" +\n \"Please use one of #{BSON::Binary::SUBTYPES.keys.map(&:inspect).join(\", \")}.\"\n end", "def more_bytes_than?(other)\n possible_byte_sizes.min > other.possible_byte_sizes.max\n end", "def binary?\n @encoding == 'base64'\n end", "def is_binary(content_type)\n if content_type.nil?\n false\n else\n content_type = content_type.downcase\n !(content_type.start_with?(\"text/\") || content_type.include?(\"json\") || content_type.include?(\"xml\"))\n end\n end", "def cast_tinyint_integer?(field)\n field.length != 1\n end", "def bytes(value)\n if value.is_a?(String)\n value =~ /([\\d\\.]+)\\s*(\\w*)/i\n size = $1.to_f\n unit = $2.strip.upcase if $2\n power = case unit\n when \"B\", \"\" then 0\n when \"K\", \"KB\" then 1\n when \"M\", \"MB\" then 2\n when \"G\", \"GB\" then 3\n when \"T\", \"TB\" then 4\n else raise UnitError\n end\n factor = 1024**power\n (size*factor).round\n elsif value.is_a?(Float)\n value.round\n elsif value.is_a?(Integer)\n value\n else\n raise ArgumentError\n end\n end", "def raw_num_bytes\n @type.num_bytes\n end", "def binary_required?\n @binary_required\n end", "def binary?\n @binary\n end", "def byte_size()\n if @record and RECORD_INFO[@record.type].size > 0 then\n RECORD_INFO[@record.type].size * @value.length\n else\n sum = 0\n @value.each do |val|\n sum += (val.length % 2 == 0) ? val.length : val.length + 1\n end\n sum\n end\n end", "def bignumeric?\n type == \"BIGNUMERIC\"\n end", "def data_as_bytes\n raise \"subclass responsibility\"\n end", "def bytes; end", "def byte\n Util.from_bytes :byte, value\n end", "def verify_fields\n fbe_current_offset = 0\n\n byte0.fbe_offset = fbe_current_offset\n fbe_field_size = byte0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n byte1.fbe_offset = fbe_current_offset\n fbe_field_size = byte1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n byte2.fbe_offset = fbe_current_offset\n fbe_field_size = byte2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n byte3.fbe_offset = fbe_current_offset\n fbe_field_size = byte3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n byte4.fbe_offset = fbe_current_offset\n fbe_field_size = byte4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n byte5.fbe_offset = fbe_current_offset\n fbe_field_size = byte5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n char0.fbe_offset = fbe_current_offset\n fbe_field_size = char0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n char1.fbe_offset = fbe_current_offset\n fbe_field_size = char1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n char2.fbe_offset = fbe_current_offset\n fbe_field_size = char2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n char3.fbe_offset = fbe_current_offset\n fbe_field_size = char3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n char4.fbe_offset = fbe_current_offset\n fbe_field_size = char4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n char5.fbe_offset = fbe_current_offset\n fbe_field_size = char5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n wchar0.fbe_offset = fbe_current_offset\n fbe_field_size = wchar0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n wchar1.fbe_offset = fbe_current_offset\n fbe_field_size = wchar1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n wchar2.fbe_offset = fbe_current_offset\n fbe_field_size = wchar2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n wchar3.fbe_offset = fbe_current_offset\n fbe_field_size = wchar3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n wchar4.fbe_offset = fbe_current_offset\n fbe_field_size = wchar4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n wchar5.fbe_offset = fbe_current_offset\n fbe_field_size = wchar5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int8b0.fbe_offset = fbe_current_offset\n fbe_field_size = int8b0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int8b1.fbe_offset = fbe_current_offset\n fbe_field_size = int8b1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int8b2.fbe_offset = fbe_current_offset\n fbe_field_size = int8b2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int8b3.fbe_offset = fbe_current_offset\n fbe_field_size = int8b3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int8b4.fbe_offset = fbe_current_offset\n fbe_field_size = int8b4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int8b5.fbe_offset = fbe_current_offset\n fbe_field_size = int8b5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint8b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint8b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint8b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint8b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint8b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint8b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int16b0.fbe_offset = fbe_current_offset\n fbe_field_size = int16b0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int16b1.fbe_offset = fbe_current_offset\n fbe_field_size = int16b1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int16b2.fbe_offset = fbe_current_offset\n fbe_field_size = int16b2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int16b3.fbe_offset = fbe_current_offset\n fbe_field_size = int16b3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int16b4.fbe_offset = fbe_current_offset\n fbe_field_size = int16b4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int16b5.fbe_offset = fbe_current_offset\n fbe_field_size = int16b5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint16b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint16b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint16b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint16b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint16b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint16b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int32b0.fbe_offset = fbe_current_offset\n fbe_field_size = int32b0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int32b1.fbe_offset = fbe_current_offset\n fbe_field_size = int32b1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int32b2.fbe_offset = fbe_current_offset\n fbe_field_size = int32b2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int32b3.fbe_offset = fbe_current_offset\n fbe_field_size = int32b3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int32b4.fbe_offset = fbe_current_offset\n fbe_field_size = int32b4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int32b5.fbe_offset = fbe_current_offset\n fbe_field_size = int32b5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint32b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint32b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint32b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint32b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint32b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint32b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int64b0.fbe_offset = fbe_current_offset\n fbe_field_size = int64b0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int64b1.fbe_offset = fbe_current_offset\n fbe_field_size = int64b1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int64b2.fbe_offset = fbe_current_offset\n fbe_field_size = int64b2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int64b3.fbe_offset = fbe_current_offset\n fbe_field_size = int64b3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int64b4.fbe_offset = fbe_current_offset\n fbe_field_size = int64b4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int64b5.fbe_offset = fbe_current_offset\n fbe_field_size = int64b5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint64b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint64b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint64b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint64b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint64b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint64b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n # noinspection RubyUnnecessaryReturnValue\n fbe_current_offset\n end", "def binary?\n @format == 1\n end", "def get_bytes()\n @value\n end", "def short_binary_type; end", "def verify\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n return false\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)\n return false\n end\n\n (8 + @_model.verify) == fbe_struct_size\n end", "def verify\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n return false\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)\n return false\n end\n\n (8 + @_model.verify) == fbe_struct_size\n end", "def verify\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n return false\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)\n return false\n end\n\n (8 + @_model.verify) == fbe_struct_size\n end", "def verify\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n return false\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)\n return false\n end\n\n (8 + @_model.verify) == fbe_struct_size\n end", "def test_truth\r\n assert_kind_of Binary, @binary\r\n end", "def integer?(field)\n self.send(field).is_a? Integer\n end", "def type_of_field_in_database(class_name, field_name)\n all_fields = class_name.get_table_info\n all_fields.each do |field|\n if field[\"name\"] == field_name\n return field[\"type\"]\n end\n end\n false\n end", "def get_binary_field(field_name)\n\t\tend", "def attr_get_binary(attr_type, strict = true)\n #This is a stub, used for indexing\n end", "def verify_fields(fbe_struct_size)\n fbe_current_size = 4 + 4\n\n if (fbe_current_size + currency.fbe_size) > fbe_struct_size\n return true\n end\n unless currency.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += currency.fbe_size\n\n if (fbe_current_size + amount.fbe_size) > fbe_struct_size\n return true\n end\n unless amount.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += amount.fbe_size\n\n true\n end", "def bytes name, description: nil, mode: :nullable, policy_tags: nil, max_length: nil\n record_check!\n\n add_field name,\n :bytes,\n description: description,\n mode: mode,\n policy_tags: policy_tags,\n max_length: max_length\n end", "def verify_fields(fbe_struct_size)\n fbe_current_size = 4 + 4\n\n if (fbe_current_size + byte0.fbe_size) > fbe_struct_size\n return true\n end\n unless byte0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte0.fbe_size\n\n if (fbe_current_size + byte1.fbe_size) > fbe_struct_size\n return true\n end\n unless byte1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte1.fbe_size\n\n if (fbe_current_size + byte2.fbe_size) > fbe_struct_size\n return true\n end\n unless byte2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte2.fbe_size\n\n if (fbe_current_size + byte3.fbe_size) > fbe_struct_size\n return true\n end\n unless byte3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte3.fbe_size\n\n if (fbe_current_size + byte4.fbe_size) > fbe_struct_size\n return true\n end\n unless byte4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte4.fbe_size\n\n if (fbe_current_size + byte5.fbe_size) > fbe_struct_size\n return true\n end\n unless byte5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte5.fbe_size\n\n if (fbe_current_size + char0.fbe_size) > fbe_struct_size\n return true\n end\n unless char0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char0.fbe_size\n\n if (fbe_current_size + char1.fbe_size) > fbe_struct_size\n return true\n end\n unless char1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char1.fbe_size\n\n if (fbe_current_size + char2.fbe_size) > fbe_struct_size\n return true\n end\n unless char2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char2.fbe_size\n\n if (fbe_current_size + char3.fbe_size) > fbe_struct_size\n return true\n end\n unless char3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char3.fbe_size\n\n if (fbe_current_size + char4.fbe_size) > fbe_struct_size\n return true\n end\n unless char4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char4.fbe_size\n\n if (fbe_current_size + char5.fbe_size) > fbe_struct_size\n return true\n end\n unless char5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char5.fbe_size\n\n if (fbe_current_size + wchar0.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar0.fbe_size\n\n if (fbe_current_size + wchar1.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar1.fbe_size\n\n if (fbe_current_size + wchar2.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar2.fbe_size\n\n if (fbe_current_size + wchar3.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar3.fbe_size\n\n if (fbe_current_size + wchar4.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar4.fbe_size\n\n if (fbe_current_size + wchar5.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar5.fbe_size\n\n if (fbe_current_size + int8b0.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b0.fbe_size\n\n if (fbe_current_size + int8b1.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b1.fbe_size\n\n if (fbe_current_size + int8b2.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b2.fbe_size\n\n if (fbe_current_size + int8b3.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b3.fbe_size\n\n if (fbe_current_size + int8b4.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b4.fbe_size\n\n if (fbe_current_size + int8b5.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b5.fbe_size\n\n if (fbe_current_size + uint8b0.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b0.fbe_size\n\n if (fbe_current_size + uint8b1.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b1.fbe_size\n\n if (fbe_current_size + uint8b2.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b2.fbe_size\n\n if (fbe_current_size + uint8b3.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b3.fbe_size\n\n if (fbe_current_size + uint8b4.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b4.fbe_size\n\n if (fbe_current_size + uint8b5.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b5.fbe_size\n\n if (fbe_current_size + int16b0.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b0.fbe_size\n\n if (fbe_current_size + int16b1.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b1.fbe_size\n\n if (fbe_current_size + int16b2.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b2.fbe_size\n\n if (fbe_current_size + int16b3.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b3.fbe_size\n\n if (fbe_current_size + int16b4.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b4.fbe_size\n\n if (fbe_current_size + int16b5.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b5.fbe_size\n\n if (fbe_current_size + uint16b0.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b0.fbe_size\n\n if (fbe_current_size + uint16b1.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b1.fbe_size\n\n if (fbe_current_size + uint16b2.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b2.fbe_size\n\n if (fbe_current_size + uint16b3.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b3.fbe_size\n\n if (fbe_current_size + uint16b4.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b4.fbe_size\n\n if (fbe_current_size + uint16b5.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b5.fbe_size\n\n if (fbe_current_size + int32b0.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b0.fbe_size\n\n if (fbe_current_size + int32b1.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b1.fbe_size\n\n if (fbe_current_size + int32b2.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b2.fbe_size\n\n if (fbe_current_size + int32b3.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b3.fbe_size\n\n if (fbe_current_size + int32b4.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b4.fbe_size\n\n if (fbe_current_size + int32b5.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b5.fbe_size\n\n if (fbe_current_size + uint32b0.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b0.fbe_size\n\n if (fbe_current_size + uint32b1.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b1.fbe_size\n\n if (fbe_current_size + uint32b2.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b2.fbe_size\n\n if (fbe_current_size + uint32b3.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b3.fbe_size\n\n if (fbe_current_size + uint32b4.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b4.fbe_size\n\n if (fbe_current_size + uint32b5.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b5.fbe_size\n\n if (fbe_current_size + int64b0.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b0.fbe_size\n\n if (fbe_current_size + int64b1.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b1.fbe_size\n\n if (fbe_current_size + int64b2.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b2.fbe_size\n\n if (fbe_current_size + int64b3.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b3.fbe_size\n\n if (fbe_current_size + int64b4.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b4.fbe_size\n\n if (fbe_current_size + int64b5.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b5.fbe_size\n\n if (fbe_current_size + uint64b0.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b0.fbe_size\n\n if (fbe_current_size + uint64b1.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b1.fbe_size\n\n if (fbe_current_size + uint64b2.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b2.fbe_size\n\n if (fbe_current_size + uint64b3.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b3.fbe_size\n\n if (fbe_current_size + uint64b4.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b4.fbe_size\n\n if (fbe_current_size + uint64b5.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b5.fbe_size\n\n true\n end", "def in_binary\n Bases.val(self).in_binary\n end", "def validate_key_bytes(key_bytes); end", "def binary?\n BINARY_ENCODINGS.include?(encoding)\n end", "def string?\n data_type == String\n end", "def binary?\n @binary\n end", "def detect_digest_class(bytes)\n DIGEST_SIZES[bytes.bytesize]\n end", "def detect_digest_class(bytes)\n DIGEST_SIZES[bytes.bytesize]\n end", "def binary?\n false\n end", "def each_byte\n return to_enum(:each_byte) unless block_given?\n @field.bytes.each{ |byte| yield byte }\n end", "def test_packing_byte\n assert_equal (-1), RubyVolt::DataType::Byte.testpacking(-1)\n assert_nil RubyVolt::DataType::Byte.testpacking(nil)\n end", "def verify_fields(fbe_struct_size)\n fbe_current_size = 4 + 4\n\n if (fbe_current_size + id.fbe_size) > fbe_struct_size\n return true\n end\n unless id.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += id.fbe_size\n\n if (fbe_current_size + symbol.fbe_size) > fbe_struct_size\n return true\n end\n unless symbol.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += symbol.fbe_size\n\n if (fbe_current_size + side.fbe_size) > fbe_struct_size\n return true\n end\n unless side.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += side.fbe_size\n\n if (fbe_current_size + type.fbe_size) > fbe_struct_size\n return true\n end\n unless type.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += type.fbe_size\n\n if (fbe_current_size + price.fbe_size) > fbe_struct_size\n return true\n end\n unless price.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += price.fbe_size\n\n if (fbe_current_size + volume.fbe_size) > fbe_struct_size\n return true\n end\n unless volume.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += volume.fbe_size\n\n true\n end", "def byte_size()\n @value.length * 4\n end", "def byte_size()\n @value.length * 4\n end", "def size\n if self.class.const_defined?(:BYTESIZE)\n self.class.const_get(:BYTESIZE)\n else\n raise NotImplementedError.new(\"#{self.class}#size\")\n end\n end", "def bytesize(string)\n string.respond_to?(:bytesize) ? string.bytesize : string.length\n end", "def verify(fbe_verify_type = true)\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return true\n end\n\n fbe_struct_offset = read_uint32(fbe_offset)\n if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)\n return false\n end\n\n fbe_struct_size = read_uint32(fbe_struct_offset)\n if fbe_struct_size < (4 + 4)\n return false\n end\n\n fbe_struct_type = read_uint32(fbe_struct_offset + 4)\n if fbe_verify_type && (fbe_struct_type != fbe_type)\n return false\n end\n\n @_buffer.shift(fbe_struct_offset)\n fbe_result = verify_fields(fbe_struct_size)\n @_buffer.unshift(fbe_struct_offset)\n fbe_result\n end", "def verify(fbe_verify_type = true)\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return true\n end\n\n fbe_struct_offset = read_uint32(fbe_offset)\n if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)\n return false\n end\n\n fbe_struct_size = read_uint32(fbe_struct_offset)\n if fbe_struct_size < (4 + 4)\n return false\n end\n\n fbe_struct_type = read_uint32(fbe_struct_offset + 4)\n if fbe_verify_type && (fbe_struct_type != fbe_type)\n return false\n end\n\n @_buffer.shift(fbe_struct_offset)\n fbe_result = verify_fields(fbe_struct_size)\n @_buffer.unshift(fbe_struct_offset)\n fbe_result\n end", "def verify(fbe_verify_type = true)\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return true\n end\n\n fbe_struct_offset = read_uint32(fbe_offset)\n if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)\n return false\n end\n\n fbe_struct_size = read_uint32(fbe_struct_offset)\n if fbe_struct_size < (4 + 4)\n return false\n end\n\n fbe_struct_type = read_uint32(fbe_struct_offset + 4)\n if fbe_verify_type && (fbe_struct_type != fbe_type)\n return false\n end\n\n @_buffer.shift(fbe_struct_offset)\n fbe_result = verify_fields(fbe_struct_size)\n @_buffer.unshift(fbe_struct_offset)\n fbe_result\n end", "def verify(fbe_verify_type = true)\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return true\n end\n\n fbe_struct_offset = read_uint32(fbe_offset)\n if (fbe_struct_offset == 0) || ((@_buffer.offset + fbe_struct_offset + 4 + 4) > @_buffer.size)\n return false\n end\n\n fbe_struct_size = read_uint32(fbe_struct_offset)\n if fbe_struct_size < (4 + 4)\n return false\n end\n\n fbe_struct_type = read_uint32(fbe_struct_offset + 4)\n if fbe_verify_type && (fbe_struct_type != fbe_type)\n return false\n end\n\n @_buffer.shift(fbe_struct_offset)\n fbe_result = verify_fields(fbe_struct_size)\n @_buffer.unshift(fbe_struct_offset)\n fbe_result\n end", "def as_bytes\n raise NotImplementedError\n end", "def validates_column_content_length\n self.class.columns.each do |column|\n check_and_validate_content_length(column) if column_of_type_string_or_text?(column)\n end\n end", "def is_tipo_b?\n self.tipo.eql?('B')\n end", "def can_be?(btype)\n backend_types.keys.include?(btype)\n end", "def valid?\r\n @bytes.same_bytes_as?(CAFE_BABE)\r\n end", "def integer_dtype?\n [:byte, :int8, :int16, :int32, :int64].include?(self.dtype)\n end", "def bytesize\n not_implemented\n end", "def determine_dataype(value)\n return validate_field(value)\n end", "def byte_length\n @byte_length ||= ECDSA.byte_length(field.prime)\n end", "def validate_checksum?\n self[:checksum] !~ /time/\n end", "def binary? # :nodoc:\n false\n end", "def integer?\n type == \"INTEGER\" || type == \"INT64\"\n end", "def bytes\n self\n end", "def var_bytes(val)\n val = val.to_s\n\n raise ArgumentError, \"var_bytes() cannot encode data longer \" +\n \"than 2**32-1 bytes\" \\\n unless val.length <= 2**32-1\n\n # While strings are still byte sequences, this is the same as a\n # string\n self.string(val)\n end", "def is_ruby_value_type(object)\r\n [String, Fixnum, Bignum, Time, Number, Float].include?(object.class)\r\n end", "def byte_format=(text)\n @struct_internal_format = text\n\n true\n end", "def data_len_bytes()\n 1\n end", "def bytes()\n #This is a stub, used for indexing\n end", "def type_of?(type)\n type.raw_type == raw_type\n end", "def supports_type? type\n if type.is_a? Class\n type.to_packed\n elsif type.is_a? Array\n return type.detect{|obj| not supports_type? obj }.nil?\n else\n type.class.to_packed\n end\n return true\n rescue NoMethodError\n return false\n end", "def check_null_byte(v)\n end", "def verify_fields\n fbe_current_offset = 0\n\n id.fbe_offset = fbe_current_offset\n fbe_field_size = id.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n symbol.fbe_offset = fbe_current_offset\n fbe_field_size = symbol.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n side.fbe_offset = fbe_current_offset\n fbe_field_size = side.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n type.fbe_offset = fbe_current_offset\n fbe_field_size = type.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n price.fbe_offset = fbe_current_offset\n fbe_field_size = price.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n volume.fbe_offset = fbe_current_offset\n fbe_field_size = volume.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n # noinspection RubyUnnecessaryReturnValue\n fbe_current_offset\n end", "def type_literal_generic_file(column)\n :bytea\n end", "def __typedeaf_valid_type?(value, type)\n return value.is_a? type\n end", "def attr_get_sb8(attr_type, strict = true)\n #This is a stub, used for indexing\n end", "def primitive_type_is_basic?(attr_details)\n WashoutBuilder::Type::BASIC_TYPES.include?(attr_details[:primitive].to_s.downcase)\n end", "def to_bytes(*args)\n messages = to_messages(*args)\n if !messages.nil?\n messages.map(&:to_bytes).flatten\n elsif args.all? { |arg| bytes?(arg)}\n args\n end\n end", "def buffer_valid?\r\n @buffer.is_a?(String)\r\n end", "def unserializable_attribute?(attr_name, column)\n @attributes[attr_name] && column.send(:type) == :text && @attributes[attr_name].is_a?(String) && self.class.serialized_attributes[attr_name]\n end", "def same_byte_length?(hash1, hash2)\n hash1.to_s.length == hash2.to_s.length\n end", "def bytesize\n case value\n when NilClass\n 0\n when String\n @value.bytesize\n else\n @s ||= Marshal.dump(@value).bytesize\n end\n end" ]
[ "0.65713304", "0.6396643", "0.6071401", "0.6001402", "0.5939501", "0.59050196", "0.5901824", "0.5715024", "0.56709874", "0.5662601", "0.5643503", "0.5616308", "0.56033313", "0.5599911", "0.55633765", "0.55584276", "0.5554243", "0.55297375", "0.55066544", "0.5505588", "0.5490346", "0.54840654", "0.54768646", "0.5449984", "0.542537", "0.5424087", "0.53631824", "0.53436035", "0.53291285", "0.5323461", "0.5311139", "0.53094566", "0.5302026", "0.530108", "0.5278581", "0.5271797", "0.52617526", "0.524402", "0.52422416", "0.52422416", "0.52422416", "0.52422416", "0.5239212", "0.5239134", "0.5225067", "0.52171034", "0.5215742", "0.520016", "0.51970255", "0.51930416", "0.5172544", "0.5169182", "0.5145644", "0.5106087", "0.5100449", "0.50893164", "0.50893164", "0.5087863", "0.50837237", "0.5077748", "0.50693417", "0.50654215", "0.50654215", "0.506286", "0.5061892", "0.5037981", "0.5037981", "0.5037981", "0.5037981", "0.5030182", "0.5029658", "0.50142336", "0.5010001", "0.49919927", "0.498682", "0.49771717", "0.4966319", "0.4964978", "0.49622518", "0.4954397", "0.49527583", "0.4952095", "0.49493942", "0.4948334", "0.4946669", "0.49377576", "0.4934566", "0.493374", "0.49221817", "0.4907859", "0.4904733", "0.48986393", "0.4884733", "0.48816255", "0.4875626", "0.48726192", "0.48613837", "0.48600584", "0.48456246", "0.48444137" ]
0.807143
0