idx int64 0 24.9k | question stringlengths 68 4.14k | target stringlengths 9 749 |
|---|---|---|
19,500 | def new_project_from_template_menu puts "\n\n******************************************************************************************************************************************\n\n" puts " CREATE A NEW JUMPSTART PROJECT FROM AN EXISTING TEMPLATE\n\n" . purple puts " Type a number for the template that you want... | Displays options for the create a new jumpstart project from an existing template menu |
19,501 | def new_project_from_template_options input = gets . chomp . strip . downcase case when input . to_i <= JumpStart . existing_templates . count && input . to_i > 0 @template_name = JumpStart . existing_templates [ ( input . to_i - 1 ) ] check_project_name project = JumpStart :: Base . new ( [ @project_name , @template_n... | Captures user input for the create a new jumpstart project from an existing template menu and calls the appropriate method . When the input matches a template number a project will be created from that template |
19,502 | def new_template_menu puts "\n\n******************************************************************************************************************************************\n\n" puts " CREATE A NEW JUMPSTART TEMPLATE\n" . purple puts " Existing templates:\n" display_existing_templates puts "\n b" . yellow + " Back to ... | Displays output for the create a new jumpstart template menu |
19,503 | def new_template_options puts "\n Enter a unique name to create a new template, or enter an existing templates name (or number) to duplicate it." . yellow input = gets . chomp . strip case when input . downcase == "b" jumpstart_menu when input . downcase == "x" exit_normal when JumpStart . existing_templates . include... | Captures user input for create a new jumpstart template menu and calls the appropriate action . If the template name provided meets the methods requirements then a directory of that name containing a jumpstart_config dir and matching yaml file are created . |
19,504 | def set_default_template_menu puts "\n\n******************************************************************************************************************************************\n\n" puts " SELECT A DEFAULT JUMPSTART TEMPLATE\n" . purple display_existing_templates puts "\n b" . yellow + " Back to main menu.\n\n" put... | Displays output for the jumpstart default template options menu |
19,505 | def set_default_template_options input = gets . chomp . strip case when input . to_i <= JumpStart . existing_templates . count && input . to_i > 0 JumpStart . default_template_name = JumpStart . existing_templates [ ( input . to_i - 1 ) ] JumpStart . dump_jumpstart_setup_yaml puts " The default jumpstart template has ... | Sets the default template to be used by JumpStart and writes it to a YAML file . |
19,506 | def templates_dir_menu puts "\n\n******************************************************************************************************************************************\n\n" puts " JUMPSTART TEMPLATES DIRECTORY OPTIONS\n" . purple puts " The JumpStart template directory is currently: " + JumpStart . templates_path... | Displays output for the jumpstart templates directory options menu . |
19,507 | def templates_dir_options input = gets . chomp . strip . downcase case when input == "1" puts " Please enter the absolute path for the directory that you would like to contain your jumpstart templates." . yellow puts " e.g. /Users/your_name/projects/jumpstart_templates\n\n" set_templates_dir when input == "2" reset_t... | Captures user input for the jumpstart templates directory options menu and calls the appropriate method . |
19,508 | def set_templates_dir input = gets . chomp . strip root_path = input . sub ( / \/ \w \/ / , '' ) case when input . downcase == "b" jumpstart_menu when input . downcase == "x" exit_normal when File . directory? ( input ) puts "\n A directory of that name already exists, would you like to set it as your template directo... | Sets the path for templates to be used by JumpStart . Copies templates in the existing template dir to the new location . The folder specified must not exist yet but it s parent should . |
19,509 | def set_templates_dir_to_existing_dir ( dir ) input = gets . chomp . strip . downcase case when input == "b" jumpstart_menu when input == "x" exit_normal when input == "y" || input == "yes" JumpStart . templates_path = dir JumpStart . dump_jumpstart_setup_yaml puts "\n The directory " . green + dir . green_bold + " ha... | TOOD set_templates_dir_to_existing_dir Needs tests |
19,510 | def parse_template_dir @dir_list = [ ] file_list = [ ] @append_templates = [ ] @line_templates = [ ] @whole_templates = [ ] Find . find ( @template_path ) do | x | case when File . file? ( x ) && x !~ / \/ / then file_list << x . sub! ( @template_path , '' ) when File . directory? ( x ) && x !~ / \/ / then @dir_list <<... | Parses the contents of the |
19,511 | def populate_files_from_whole_templates @whole_templates . each { | x | FileUtils . cp ( FileUtils . join_paths ( @template_path , x ) , FileUtils . join_paths ( @install_path , @project_name , x ) ) } unless @whole_templates . nil? end | Create files from whole templates |
19,512 | def remove_unwanted_files file_array = [ ] root_path = FileUtils . join_paths ( @install_path , @project_name ) unless @config_file [ :remove_files ] . nil? @config_file [ :remove_files ] . each do | file | file_array << FileUtils . join_paths ( root_path , file ) end FileUtils . remove_files ( file_array ) end end | Removes files specified in templates YAML |
19,513 | def run_scripts_from_yaml ( script_name ) unless @config_file [ script_name ] . nil? || @config_file [ script_name ] . empty? begin Dir . chdir ( FileUtils . join_paths ( @install_path , @project_name ) ) @config_file [ script_name ] . each do | x | puts "\nExecuting command: #{x.green}" system "#{x}" end rescue puts "... | Runs additional scripts specified in YAML . Runs one set after the install command has executed another after the templates have been generated and a final time after string replacement |
19,514 | def check_for_strings_to_replace if @replace_strings . nil? || @replace_strings . empty? return false else puts "\nChecking for strings to replace inside files...\n\n" @replace_strings . each do | file | if file [ :target_path ] . nil? || file [ :symbols ] . nil? return false else puts "Target file: #{file[:target_path... | Looks for strings IN_CAPS that are specified for replacement in the templates YAML |
19,515 | def exit_with_success puts "\n\n Exiting JumpStart..." . purple puts "\n Success! " . green + @project_name . green_bold + " has been created at: " . green + FileUtils . join_paths ( @install_path , @project_name ) . green_bold + "\n\n" . green puts "*******************************************************************... | Exit after creating a project dumping current setup information to YAML |
19,516 | def save attributes = { sms_url : self . sms_url , voice_start : self . voice_start_url } unless self . number_id attributes [ :country ] = self . country end response = @client . post ( "/Numbers/#{self.number_id}" , attributes ) response . code == 200 end | Updates or allocates a number |
19,517 | def deallocate! response = @client . post ( "/Numbers/#{self.number_id}" , { active : "no" } ) self . set_paramaters ( Elk :: Util . parse_json ( response . body ) ) response . code == 200 end | Deallocates a number once deallocated a number cannot be used again ever! |
19,518 | def datetime_fmt ( dt ) if dt . blank? then '' else I18n . l ( dt , format : I18n . t ( 'edgarj.time.format' ) ) end end | Edgarj standard datetime format |
19,519 | def get_enum ( model , col ) col_name = col . name if model . const_defined? ( col_name . camelize , false ) enum = model . const_get ( col_name . camelize ) enum . is_a? ( Module ) ? enum : nil else nil end end | get enum Module . |
19,520 | def render ( template ) template . render ( config . variables . deep_merge ( options [ :globals ] ) , strict_variables : true ) . tap do if template . errors &. length &. positive? puts template . errors raise template . errors . map ( & :to_s ) . join ( '; ' ) end end end | Pipeline Renders a Liquid template |
19,521 | def parse ( post ) @raw = post . to_s for line in @raw . split ( '&' ) key , value = * line . scan ( %r{ \= } ) . flatten params [ key ] = CGI . unescape ( value ) end end | Take the posted data and move the relevant data into a hash |
19,522 | def add_conditional ( pConditional ) return nil unless pConditional . is_a? ( Languages :: ConditionalData ) pConditional . level = @currentLevel @basicStructure . push ( pConditional ) end | Add conditional to basicStructure |
19,523 | def add_repetition ( pRepetition ) return nil unless pRepetition . is_a? ( Languages :: RepetitionData ) pRepetition . level = @currentLevel @basicStructure . push ( pRepetition ) end | Add repetition to basicStructure |
19,524 | def add_block ( pBlock ) return nil unless pBlock . is_a? ( Languages :: BlockData ) pBlock . level = @currentLevel @basicStructure . push ( pBlock ) end | Add block to basicStructure |
19,525 | def symbol_conversion_algorithm = ( algorithm ) raise ( ArgumentError , "Missing symbol conversion algorithm" ) unless algorithm if algorithm . respond_to? ( :call ) @symbol_conversion_algorithm = algorithm else if algorithm == :default @symbol_conversion_algorithm = ALGORITHMS [ :lower_camelcase ] elsif ALGORITHMS . k... | Set default values initialize Method for setting global Symbol - to - string conversion algorithm |
19,526 | def find_course_location location_ids = [ ] if location_results_paginated? for page_number in 1 .. total_pages jump_to_page ( page_number ) location_ids += fetch_location_ids_from_current_page end else location_ids += fetch_location_ids_from_current_page end location_ids end | Get all locations of course |
19,527 | def define_rspec_tasks! require 'rspec/core/rake_task' namespace ( :spec ) do desc "Verify all RSpec examples for #{gemspec.name}" RSpec :: Core :: RakeTask . new ( :basic ) do | t | t . pattern = spec_pattern end desc "Verify all RSpec examples for #{gemspec.name} and output specdoc" RSpec :: Core :: RakeTask . new ( ... | Defines RSpec tasks |
19,528 | def define_tasks! define_test_tasks! if has_tests? define_rspec_tasks! if has_specs? namespace ( @task_namespace ) do desc "Updates the filelist in the gemspec file" task ( :manifest ) { manifest_task } desc "Builds the .gem package" task ( :build => :manifest ) { build_task } desc "Sets the version of the gem in the g... | Defines the rake tasks |
19,529 | def version_task update_gemspec ( :version , ENV [ 'VERSION' ] ) if ENV [ 'VERSION' ] update_gemspec ( :date , Date . today ) update_version_file ( gemspec . version ) update_version_constant ( gemspec . version ) end | Updates the version number in the gemspec file the VERSION constant in the main include file and the contents of the VERSION file . |
19,530 | def update_version_file ( version ) if File . exists? ( 'VERSION' ) File . open ( 'VERSION' , 'w' ) { | f | f << version . to_s } modified_files << 'VERSION' end end | Updates the VERSION file with the new version |
19,531 | def update_version_constant ( version ) if main_include && File . exist? ( main_include ) file_contents = File . read ( main_include ) if file_contents . sub! ( / \s \s \s \s / ) { $1 + version . to_s . inspect } File . open ( main_include , 'w' ) { | f | f << file_contents } modified_files << main_include end end end | Updates the VERSION constant in the main include file if it exists |
19,532 | def attributes = ( attrs ) attrs . each_pair do | name , value | field = schema . fields [ name . to_s ] || FieldDefinition . new ( name , :type => value . class ) setter = "#{name}=" . to_sym if respond_to? ( setter ) send ( setter , value ) else write_attribute ( field , value , self ) end end end | Set all the attributes at once . |
19,533 | def []= ( name , value ) field = schema . fields [ name . to_s ] || FieldDefinition . new ( name , :type => value . class ) write_attribute ( field , value , self ) end | Set a field from the schema with the specified name . |
19,534 | def reload object = self . id . present? ? persistence_class . where ( id : self . id ) . first_or_initialize : self serialize! object . attributes end | Gathers the persisted object from database and updates self with it s attributes . |
19,535 | def serialize! ( attributes ) unless attributes . nil? attributes . each do | key , value | key = "id" if key == "_id" self . send ( "#{key}=" , ( value . dup rescue value ) ) end end self . dup end | Updates attributes from self with the attributes from the parameters |
19,536 | def convert ( attribute = "id" ) klass = persistence_class object = klass . where ( attribute . to_sym => self . send ( attribute ) ) . first object ||= persistence_class . new attributes = self . attributes . select { | key , value | self . class . serialized_attributes . include? ( key . to_s ) } attributes . delete ... | Find related object on the database and updates it with attributes in self if it didn t find it on database it creates a new one . |
19,537 | def set_timestamps if self . errors . empty? self . created_at = DateTime . now . utc if self . respond_to? ( :created_at= ) && self . created_at . nil? self . updated_at = DateTime . now . utc if self . respond_to? ( :updated_at= ) end end | Updates created_at and updated_at |
19,538 | def set ( ns , element_name , value = "" , attributes = nil ) xpath = child_xpath ( ns , element_name ) @elem . elements . delete_all ( xpath ) add ( ns , element_name , value , attributes ) end | This method allows you to handle extra - element such as you can t represent with elements defined in Atom namespace . |
19,539 | def add ( ns , element_name , value , attributes = { } ) element = REXML :: Element . new ( element_name ) if ns . is_a? ( Namespace ) unless ns . prefix . nil? || ns . prefix . empty? element . name = "#{ns.prefix}:#{element_name}" element . add_namespace ns . prefix , ns . uri unless @ns == ns || @ns == ns . uri else... | Same as set but when a element - name confliction occurs append new element without overriding . |
19,540 | def get_object ( ns , element_name , ext_class ) elements = getlist ( ns , element_name ) return nil if elements . empty? ext_class . new ( :namespace => ns , :elem => elements . first ) end | Get indicated elements as an object of the class you passed as thrid argument . |
19,541 | def get_objects ( ns , element_name , ext_class ) elements = getlist ( ns , element_name ) return [ ] if elements . empty? elements . collect do | e | ext_class . new ( :namespace => ns , :elem => e ) end end | Get all indicated elements as an object of the class you passed as thrid argument . |
19,542 | def to_s ( * ) doc = REXML :: Document . new decl = REXML :: XMLDecl . new ( "1.0" , "utf-8" ) doc . add decl doc . add_element @elem doc . to_s end | Convert to XML - Document and return it as string |
19,543 | def child_xpath ( ns , element_name , attributes = nil ) ns_uri = ns . is_a? ( Namespace ) ? ns . uri : ns unless ! attributes . nil? && attributes . is_a? ( Hash ) "child::*[local-name()='#{element_name}' and namespace-uri()='#{ns_uri}']" else attr_str = attributes . collect { | key , val | "@#{key.to_s}='#{val}'" } .... | Get a xpath string to traverse child elements with namespace and name . |
19,544 | def get_media ( media_uri ) get_resource ( media_uri ) if @rc . instance_of? ( Atom :: Entry ) raise ResponseError , "Response is not Media Resource" end return @rc , @res . content_type end | Get media resource |
19,545 | def create_entry ( post_uri , entry , slug = nil ) unless entry . kind_of? ( Atom :: Entry ) entry = Atom :: Entry . new :stream => entry end service = @service_info . get ( post_uri ) unless entry . categories . all? { | c | service . allows_category? ( c ) } raise RequestError , "Forbidden Category" end create_resour... | Create new entry |
19,546 | def create_media ( media_uri , file_path , content_type , slug = nil ) file_path = Pathname . new ( file_path ) unless file_path . is_a? ( Pathname ) stream = file_path . open { | f | f . binmode ; f . read } service = @service_info . get ( media_uri ) if service . nil? raise RequestError , "Service information not fou... | Create new media resource |
19,547 | def update_media ( media_uri , file_path , content_type ) file_path = Pathname . new ( file_path ) unless file_path . is_a? ( Pathname ) stream = file_path . open { | f | f . binmode ; f . read } update_resource ( media_uri , stream , content_type ) end | Update media resource |
19,548 | def get_contents_except_resources ( uri , & block ) clear uri = URI . parse ( uri ) @req = Net :: HTTP :: Get . new uri . request_uri set_common_info ( @req ) @http_class . start ( uri . host , uri . port , :use_ssl => uri . scheme == 'https' ) do | http | @res = http . request ( @req ) case @res when Net :: HTTPOK blo... | Get contents for example service - document categories and feed . |
19,549 | def fetch_from_ttl ( ttl_file ) graph = RDF :: Turtle :: Reader . open ( ttl_file , prefixes : ROF :: OsfPrefixList . dup ) JSON :: LD :: API . fromRdf ( graph ) end | reads a ttl file and makes it a JSON - LD file that we can parse |
19,550 | def apply_previous_archived_version_if_applicable ( rels_ext ) pid = previously_archived_pid_finder . call ( archive_type , osf_project_identifier ) pid = ROF :: Utility . check_solr_for_previous ( config , osf_project_identifier ) if pid . nil? rels_ext [ 'pav:previousVersion' ] = pid if pid rels_ext end | For reference to the assumed RELS - EXT see the following spec in CurateND |
19,551 | def build_archive_record this_rof = { } this_rof [ 'owner' ] = project [ 'owner' ] this_rof [ 'type' ] = 'OsfArchive' this_rof [ 'rights' ] = map_rights this_rof [ 'rels-ext' ] = map_rels_ext this_rof [ 'metadata' ] = map_metadata this_rof [ 'files' ] = [ source_slug + '.tar.gz' ] this_rof end | Constructs OsfArchive Record from ttl_data data from the UI form and task config data |
19,552 | def map_creator creator = [ ] ttl_data [ 0 ] [ @osf_map [ 'hasContributor' ] ] . each do | contributor | ttl_data . each do | item | next unless item [ '@id' ] == contributor [ '@id' ] if item [ @osf_map [ 'isBibliographic' ] ] [ 0 ] [ '@value' ] == 'true' creator . push map_user_from_ttl ( item [ @osf_map [ 'hasUser' ... | sets the creator - needs to read another ttl for the User data only contrubutors with isBibliographic true are considered |
19,553 | def api_token api_token = @options [ :api_token ] || Git . get_config ( KEY_API_TOKEN , :inherited ) if api_token . blank? api_token = ask ( 'Pivotal API Token (found at https://www.pivotaltracker.com/profile): ' ) . strip Git . set_config ( KEY_API_TOKEN , api_token , :local ) unless api_token . blank? puts end api_to... | Returns the user s Pivotal Tracker API token . If this token has not been configured prompts the user for the value . The value is checked for in the _inherited_ Git configuration but is stored in the _global_ Git configuration so that it can be used across multiple repositories . |
19,554 | def project_id project_id = @options [ :project_id ] || Git . get_config ( KEY_PROJECT_ID , :inherited ) if project_id . empty? project_id = choose do | menu | menu . prompt = 'Choose project associated with this repository: ' PivotalTracker :: Project . all . sort_by { | project | project . name } . each do | project ... | Returns the Pivotal Tracker project id for this repository . If this id has not been configuration prompts the user for the value . The value is checked for in the _inherited_ Git configuration but is stored in the _local_ Git configuration so that it is specific to this repository . |
19,555 | def story return @story if @story story_id = Git . get_config ( KEY_STORY_ID , :branch ) if story_id . blank? && ( matchdata = / \- \/ \d \- /i . match ( Git . current_branch ) ) story_id = matchdata [ 1 ] Git . set_config ( KEY_STORY_ID , story_id , :branch ) unless story_id . blank? end if story_id . blank? story_id ... | Returns the story associated with the branch |
19,556 | def ask_github_password ( username = nil ) username ||= github_username print "Github password for #{username} (never stored): " if $stdin . tty? password = askpass puts '' password else $stdin . gets . chomp end rescue Interrupt abort end | special prompt that has hidden input |
19,557 | def execute_query ( query_name , payment_transaction ) query = query ( query_name ) begin request = query . create_request payment_transaction response = make_request request query . process_response payment_transaction , response rescue Exception => error handle_exception error , payment_transaction , response return ... | Executes payment API query |
19,558 | def process_paynet_easy_callback ( callback_response , payment_transaction ) begin callback ( callback_response . type ) . process_callback ( payment_transaction , callback_response ) rescue Exception => error handle_exception error , payment_transaction , callback_response return end handle_query_result payment_transa... | Executes payment gateway processor for PaynetEasy payment callback |
19,559 | def login ( un , pw ) response_body = Helper . auth_request un , pw auth_token = Hash [ * response_body . split . collect { | i | i . split ( '=' ) } . flatten ] [ 'Auth' ] raise InoreaderApi :: InoreaderApiError . new 'Bad Authentication' if auth_token . nil? auth_token rescue => e raise InoreaderApi :: InoreaderApiEr... | Authenticate to return authToken |
19,560 | def to_s ary = [ "\x00" , @buffer . dup , "\xff" ] ary . collect { | s | s . force_encoding ( 'UTF-8' ) if s . respond_to? ( :force_encoding ) } return ary . join end | Construct a WebSocket frame . |
19,561 | def add ( dn , attributes ) attributes = normalize_attributes ( attributes ) log_dispatch ( :add , dn , attributes ) adapter . add ( dn , attributes ) end | Performs an LDAP add . |
19,562 | def modify ( dn , attributes ) if attributes . kind_of? ( Hash ) attributes = normalize_attributes ( attributes ) else attributes = attributes . map do | ( action , key , values ) | [ action , Ldaptic . encode ( key ) , values . respond_to? ( :before_type_cast ) ? values . before_type_cast : [ values ] . flatten . comp... | Performs an LDAP modify . |
19,563 | def rename ( dn , new_rdn , delete_old , * args ) log_dispatch ( :rename , dn , new_rdn , delete_old , * args ) adapter . rename ( dn , new_rdn . to_str , delete_old , * args ) end | Performs an LDAP modrdn . |
19,564 | def compare ( dn , key , value ) log_dispatch ( :compare , dn , key , value ) adapter . compare ( dn , Ldaptic . encode ( key ) , Ldaptic . encode ( value ) ) end | Performs an LDAP compare . |
19,565 | def upload folder_path , filename , file , options = { } response = put ( "/#{folder_path}/files/#{filename}" , file . read , options ) end | Upload a file |
19,566 | def options { headers : { accept : :json , content_type : :json , accept_encoding : 'gzip ,deflate' , user_agent : "FreshdeskAPI API #{FreshdeskAPI::VERSION}" } , read_timeout : nil , open_timeout : nil , base_url : @base_url } . merge ( client_options ) end | Sets accept and user_agent headers and url |
19,567 | def create_request ( payment_transaction ) validate_payment_transaction payment_transaction request = payment_transaction_to_request payment_transaction request . api_method = @api_method request . end_point = payment_transaction . query_config . end_point request . gateway_url = payment_transaction . query_config . ga... | Create API gateway request from payment transaction data |
19,568 | def process_response ( payment_transaction , response ) if response . processing? || response . approved? validate = :validate_response_on_success update = :update_payment_transaction_on_success else validate = :validate_response_on_error update = :update_payment_transaction_on_error end begin send validate , payment_t... | Process API gateway response and update payment transaction |
19,569 | def validate_payment_transaction ( payment_transaction ) validate_query_config payment_transaction error_message = '' missed_fields = [ ] invalid_fields = [ ] request_fields_definition . each do | field_name , property_path , is_field_required , validation_rule | field_value = PropertyAccessor . get_value payment_trans... | Validates payment transaction before request constructing |
19,570 | def payment_transaction_to_request ( payment_transaction ) request_fields = { } request_fields_definition . each do | field_name , property_path , _ | field_value = PropertyAccessor . get_value payment_transaction , property_path if field_value request_fields [ field_name ] = field_value end end Request . new request_f... | Creates request from payment transaction |
19,571 | def validate_response_on_success ( payment_transaction , response ) if response . type != success_response_type raise ValidationError , "Response type '#{response.type}' does " + "not match success response type '#{success_response_type}'" end missed_fields = [ ] response_fields_definition . each do | field_name | miss... | Validates response before payment transaction updating if payment transaction is processing or approved |
19,572 | def validate_response_on_error ( payment_transaction , response ) unless [ success_response_type , 'error' , 'validation-error' ] . include? response . type raise ValidationError , "Unknown response type '#{response.type}'" end validate_client_id payment_transaction , response end | Validates response before payment transaction updating if payment transaction is not processing or approved |
19,573 | def update_payment_transaction_on_success ( payment_transaction , response ) payment_transaction . status = response . status set_paynet_id payment_transaction , response end | Updates payment transaction by query response data if payment transaction is processing or approved |
19,574 | def update_payment_transaction_on_error ( payment_transaction , response ) if response . declined? payment_transaction . status = response . status else payment_transaction . status = PaymentTransaction :: STATUS_ERROR end payment_transaction . add_error response . error set_paynet_id payment_transaction , response end | Updates payment transaction by query response data if payment transaction is not processing or approved |
19,575 | def validate_query_definition raise RuntimeError , 'You must configure @request_fields_definition' if request_fields_definition . empty? raise RuntimeError , 'You must configure @signature_definition' if signature_definition . empty? raise RuntimeError , 'You must configure @response_fields_definition' if response_fiel... | Validates query object definition |
19,576 | def validate_client_id ( payment_transaction , response ) payment_id = payment_transaction . payment . client_id response_id = response . payment_client_id if response_id && payment_id . to_s != response_id . to_s raise ValidationError , "Response client_id '#{response_id}' does not match Payment client_id '#{payment_i... | Check is payment transaction client order id and query response client order id equal or not . |
19,577 | def set_paynet_id ( payment_transaction , response ) if response . payment_paynet_id payment_transaction . payment . paynet_id = response . payment_paynet_id end end | Set PaynetEasy payment id to payment transaction Payment |
19,578 | def summary ( options = { } ) raise ArgumentError , 'You must provide a :cid option' if options [ :cid ] . nil? || options [ :cid ] . empty? options . merge! ( { :method => 'candSummary' } ) self . class . get ( "/" , :query => options ) end | Provides summary fundraising information for specified politician . |
19,579 | def contributors ( options = { } ) raise ArgumentError , 'You must provide a :cid option' if options [ :cid ] . nil? || options [ :cid ] . empty? options . merge! ( { :method => 'candContrib' } ) self . class . get ( "/" , :query => options ) end | Provides the top organizations contributing to specified politician . |
19,580 | def industries ( options = { } ) raise ArgumentError , 'You must provide a :cid option' if options [ :cid ] . nil? || options [ :cid ] . empty? options . merge! ( { :method => 'candIndustry' } ) self . class . get ( "/" , :query => options ) end | Provides the top industries contributing to a specified politician . |
19,581 | def contributions_by_industry ( options = { } ) raise ArgumentError , 'You must provide a :cid option' if options [ :cid ] . nil? || options [ :cid ] . empty? raise ArgumentError , 'You must provide a :ind option' if options [ :ind ] . nil? || options [ :ind ] . empty? options . merge! ( { :method => 'CandIndByInd' } )... | Provides total contributed to specified candidate from specified industry for specified cycle . |
19,582 | def sector ( options = { } ) raise ArgumentError , 'You must provide a :cid option' if options [ :cid ] . nil? || options [ :cid ] . empty? options . merge! ( { :method => 'candSector' } ) self . class . get ( "/" , :query => options ) end | Provides sector total of specified politician s receipts . |
19,583 | def by_industry ( options = { } ) raise ArgumentError , 'You must provide a :cmte option' if options [ :cmte ] . nil? || options [ :cmte ] . empty? raise ArgumentError , 'You must provide a :congno option' if options [ :congno ] . nil? || options [ :congno ] . empty? raise ArgumentError , 'You must provide a :indus opt... | Provides summary fundraising information for a specific committee industry and Congress number . |
19,584 | def get_orgs ( options = { } ) raise ArgumentError , 'You must provide a :org option' if options [ :org ] . nil? || options [ :org ] . empty? options . merge! ( { :method => 'getOrgs' } ) self . class . get ( "/" , :query => options ) end | Look up an organization by name . |
19,585 | def org_summary ( options = { } ) raise ArgumentError , 'You must provide a :id option' if options [ :id ] . nil? || options [ :id ] . empty? options . merge! ( { :method => 'orgSummary' } ) self . class . get ( "/" , :query => options ) end | Provides summary fundraising information for the specified organization id . |
19,586 | def path_for ( resource_name ) if resource_path = send ( "#{resource_name}_path" ) File . expand_path resource_path else File . join source_path , resource_name . to_s end end | Get a full expanded path for the given resource name . This is either set in the configuration or determined dynamically based on the name . |
19,587 | def get_first_char fname if File . exists? fname begin f = Zlib :: GzipReader . open fname rescue Zlib :: GzipFile :: Error f = File . open fname end begin first_char = f . each . peek [ 0 ] return first_char ensure f . close end else raise ParseFasta :: Error :: FileNotFoundError , "No such file or directory -- #{fnam... | Get the first char of the file whether it is gzip d or not . No need to rewind the stream afterwards . |
19,588 | def create_pullrequest options project = options . fetch ( :project ) params = { :base => options . fetch ( :base ) , :head => options . fetch ( :head ) } if options [ :issue ] params [ :issue ] = options [ :issue ] else params [ :title ] = options [ :title ] if options [ :title ] params [ :body ] = options [ :body ] i... | Returns parsed data from the new pull request . |
19,589 | def process if config_changed? Massimo :: UI . say 'massimo is reloading your site' @site . reload @site . process Massimo :: UI . say 'massimo has built your site' , :growl => true elsif changed? Massimo :: UI . say 'massimo has noticed a change' @site . process Massimo :: UI . say 'massimo has built your site' , :gro... | Processes the Site if any of the files have changed . |
19,590 | def draw_form_buttons ( options = { } ) content_tag ( :table ) do content_tag ( :tr ) do content_tag ( :td ) do tag ( :input , { type : 'button' , name : 'save' , onClick : '$("#_edgarj_form").submit()' , value : t ( 'edgarj.default.save' ) , class : '_edgarj_form_save' , } ) end + content_tag ( :td ) do button_for_js ... | Draw buttons for form . |
19,591 | def draw_field ( f , col , options = { } ) case col . type when :date draw_date ( f , col , options [ :date ] || { } ) when :datetime draw_datetime ( f , col , options [ :datetime ] || { } ) when :integer f . text_field ( col . name , options [ :integer ] ) else f . text_field ( col . name , options [ :text ] ) end end | draw default field for col . type |
19,592 | def draw_datetime ( f , col_or_sym , options = { } ) col_name = get_column_name ( col_or_sym ) f . text_field ( col_name , value : datetime_fmt ( f . object . send ( col_name ) ) ) end | draw calendar datetime select |
19,593 | def draw_address ( f , col_or_sym ) address_name = f . object . class . get_belongs_to_name ( col_or_sym ) render ( 'edgarj/address' , f : f , rec : f . object , address_name : address_name ) end | draw edgarj_address field |
19,594 | def draw_bitset ( f , col , bitset = nil , options = { } ) html = '' bitset = model . const_get ( col_name . to_s . camelize + 'Bitset' ) if ! bitset i = 0 id_array_var = sprintf ( '%s_%s_var' , f . object_name , col . name ) ids = [ ] for flag in bitset . constants do checkbox_id = sprintf ( '%s_%s_%d' , f . object_na... | draw bitset checkboxes . |
19,595 | def draw_enum ( f , col_or_sym , enum = nil , options = { } ) col_name = get_column_name ( col_or_sym ) enum = model . const_get ( col_name . to_s . camelize ) if ! enum sorted_elements = enum . constants . sort { | a , b | enum . const_get ( a ) <=> enum . const_get ( b ) } options_for_select = options . dup choice_1s... | draw enum selection . |
19,596 | def draw_checkbox ( f , id , flag , bitset , id_array_var ) val = f . object . send ( :flags ) || 0 flag_val = bitset . const_get ( flag ) tag ( :input , type : 'checkbox' , id : id , name : id , value : flag_val , onChange : "Edgarj.sum_bitset(#{id_array_var})" , checked : ( val & flag_val ) != 0 ) end | draw Edgarj flags specific checkbox |
19,597 | def find_col ( rec , sym ) rec . class . columns . detect { | c | c . name == sym . to_s } end | find column info from name |
19,598 | def button_for_js ( label , js , html_options = { } ) tag ( :input , { type : 'button' , value : label , onClick : js } . merge ( html_options ) ) end | replacement of button_to_function to avoid DEPRECATION WARNING . |
19,599 | def map_search_params ( search_params ) Hash [ search_params . map { | k , v | [ key_map [ k ] , v ] } ] end | This takes a hash of search parameters and modifies the hash to have the correct key types for the current RETS server |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.