wolf_core 0.1.45 → 0.1.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wolf_core/application/barton/parsing.rb +49 -0
- data/lib/wolf_core/utils/file_utils.rb +8 -2
- data/lib/wolf_core/version.rb +1 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 2d50df908eb73594298247664b0ba46f33a2a8ada9562ae7d8fd952158398c4a
         | 
| 4 | 
            +
              data.tar.gz: 9e2c95b958350dab98f0d497e3157c7d784a60b138019f54b170f8e9e1ea8569
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: bd35e27e31da3b43cbe8cb7701a1516d8fe99c0f2daae0d2e4ca037d546e014f7bfd1dd95b7a31aa1ca227197598e10ba5a51263e05149ce854e2ec1cf613280
         | 
| 7 | 
            +
              data.tar.gz: f5b3fe115024162a70ed46b433db963ceb959890df8ee13f84b54c348ef1b9ecf77e056b293853e12e421e328cc678c3d96d6c20732c2b9f4a46eaf2148d676e
         | 
| @@ -0,0 +1,49 @@ | |
| 1 | 
            +
            module WolfCore
         | 
| 2 | 
            +
              module Barton
         | 
| 3 | 
            +
                module Parsing
         | 
| 4 | 
            +
                  def split_address(address_string)
         | 
| 5 | 
            +
                    address_string ||= ''
         | 
| 6 | 
            +
                    address = { street: nil, city: nil, state: nil, zip: nil }
         | 
| 7 | 
            +
                    city_and_state_regex_found = false
         | 
| 8 | 
            +
              
         | 
| 9 | 
            +
                    city_and_state_regex = /\b([A-Za-z\s]+),\s*([A-Za-z]{2})\b/
         | 
| 10 | 
            +
                    zip_regex = /\b\d{5}(?:-\d{4})?\b/
         | 
| 11 | 
            +
                    street_regex = /\A([^,]+)/
         | 
| 12 | 
            +
                    state_regex = /\b[A-Za-z]{2}\b/
         | 
| 13 | 
            +
                    city_regex = /\b[a-zA-Z0-9\s]{2,}\b/
         | 
| 14 | 
            +
              
         | 
| 15 | 
            +
                    if match_data = address_string.match(city_and_state_regex)
         | 
| 16 | 
            +
                      address[:city] = match_data[1].strip
         | 
| 17 | 
            +
                      address[:state] = match_data[2].strip
         | 
| 18 | 
            +
                      address_string.sub!(city_and_state_regex, '')
         | 
| 19 | 
            +
                      city_and_state_regex_found = true
         | 
| 20 | 
            +
                    end
         | 
| 21 | 
            +
              
         | 
| 22 | 
            +
                    if zip_match = address_string.match(zip_regex)
         | 
| 23 | 
            +
                      address[:zip] = zip_match[0].strip
         | 
| 24 | 
            +
                      address_string.sub!(zip_regex, '')
         | 
| 25 | 
            +
                    end
         | 
| 26 | 
            +
                    
         | 
| 27 | 
            +
                    if street_match = address_string.match(street_regex)
         | 
| 28 | 
            +
                      address[:street] = street_match[0].strip
         | 
| 29 | 
            +
                      address[:street] = nil if address[:street].empty?
         | 
| 30 | 
            +
                      address_string.sub!(street_regex, '')
         | 
| 31 | 
            +
                    end
         | 
| 32 | 
            +
              
         | 
| 33 | 
            +
                    return address if city_and_state_regex_found
         | 
| 34 | 
            +
              
         | 
| 35 | 
            +
                    if state_match = address_string.match(state_regex)
         | 
| 36 | 
            +
                      address[:state] = state_match[0].strip
         | 
| 37 | 
            +
                      address_string.sub!(state_regex, '')
         | 
| 38 | 
            +
                    end
         | 
| 39 | 
            +
              
         | 
| 40 | 
            +
                    if city_match = address_string.match(city_regex)
         | 
| 41 | 
            +
                      address[:city] = city_match[0].strip
         | 
| 42 | 
            +
                      address_string.sub!(city_regex, '')
         | 
| 43 | 
            +
                    end
         | 
| 44 | 
            +
              
         | 
| 45 | 
            +
                    return address
         | 
| 46 | 
            +
                  end
         | 
| 47 | 
            +
                end
         | 
| 48 | 
            +
              end
         | 
| 49 | 
            +
            end
         | 
| @@ -1,5 +1,9 @@ | |
| 1 | 
            +
            require_relative 'logging_utils'
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            module WolfCore
         | 
| 2 4 | 
             
              module FileUtils
         | 
| 5 | 
            +
                extend WolfCore::LoggingUtils
         | 
| 6 | 
            +
             | 
| 3 7 | 
             
                module_function
         | 
| 4 8 |  | 
| 5 9 | 
             
                def require_relative_folder(*folders)
         | 
| @@ -14,8 +18,10 @@ module WolfCore | |
| 14 18 | 
             
                    missing_files = []
         | 
| 15 19 | 
             
                    files_to_require.each do |file|
         | 
| 16 20 | 
             
                      begin
         | 
| 21 | 
            +
                        log_object "Requiring file: #{file}"
         | 
| 17 22 | 
             
                        require_relative file
         | 
| 18 23 | 
             
                      rescue NameError
         | 
| 24 | 
            +
                        log_object "Error requiring file: #{file}"
         | 
| 19 25 | 
             
                        missing_files << file
         | 
| 20 26 | 
             
                      end
         | 
| 21 27 | 
             
                    end
         | 
| @@ -27,10 +33,10 @@ module WolfCore | |
| 27 33 | 
             
                  files_to_delete = Dir.glob(pattern)
         | 
| 28 34 | 
             
                  files_to_delete.each do |file|
         | 
| 29 35 | 
             
                    File.delete(file)
         | 
| 30 | 
            -
                     | 
| 36 | 
            +
                    log_object "File deleted: #{file}"
         | 
| 31 37 | 
             
                  end
         | 
| 32 38 |  | 
| 33 | 
            -
                   | 
| 39 | 
            +
                  log_object "File Deleting Process Finished! (#{files_to_delete.size} files deleted)"
         | 
| 34 40 | 
             
                end
         | 
| 35 41 | 
             
              end
         | 
| 36 42 | 
             
            end
         | 
    
        data/lib/wolf_core/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: wolf_core
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.47
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Javier Roncallo
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024-07- | 
| 11 | 
            +
            date: 2024-07-30 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: httparty
         | 
| @@ -62,6 +62,7 @@ files: | |
| 62 62 | 
             
            - lib/wolf_core.rb
         | 
| 63 63 | 
             
            - lib/wolf_core/application/application_service.rb
         | 
| 64 64 | 
             
            - lib/wolf_core/application/barton/mappings.rb
         | 
| 65 | 
            +
            - lib/wolf_core/application/barton/parsing.rb
         | 
| 65 66 | 
             
            - lib/wolf_core/application/barton/routing.rb
         | 
| 66 67 | 
             
            - lib/wolf_core/application/exception_operations.rb
         | 
| 67 68 | 
             
            - lib/wolf_core/application/salesforce_oauth_service.rb
         |