wolf_core 0.1.45 → 0.1.46

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90c1f8f955a6f904bd51d2ee8c728979342cdce86d656f1410486489192cd419
4
- data.tar.gz: 7b9ba63cef9b265c8942925a088e53406e75dd95cbebc6cada8c023ba7535c41
3
+ metadata.gz: 24a38fbd3bf0c7ea37e0dbc325fbf0bd60e919b407b78be15a304df8e0d32ae5
4
+ data.tar.gz: 493f91f7a744554a71431f7c8b0bd08ba4515c448d01607ac6b6f7567cc4eb93
5
5
  SHA512:
6
- metadata.gz: 71132fc6ff3d9695a7c6729d71a851fdd39383bd5c04f3605cc58f348bb5ae192343b29b81fc62ab0d76262eff43e2ad24467b8e36c6ee0889ecbc68abc5e0fd
7
- data.tar.gz: 73b0d496431e45270609aef6ad44a860e79b04520b943a5e6cab3640e2b125ff97888e3a9c08ec274eb92a996d229b516f188befe251cc3fde313ab29d78d407
6
+ metadata.gz: 7a32614d5b86c00d6deaf0c3615bd7b350cfa70d7f7336e5d242b8ffc7fbc7ddd439529701a5d687fbc69e3f3526f3ea466d3ce6e659660d881f189b8083ed63
7
+ data.tar.gz: a13c04ff70b497a9331b22bd948532bc0755270000b380b2d755904b7abfa97538d10b06ece2e84dde011b1b143ec6a2cf883a70fb1cf27802d0fd425bfd13c6
@@ -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,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "0.1.45"
4
+ VERSION = "0.1.46"
5
5
  end
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.45
4
+ version: 0.1.46
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-26 00:00:00.000000000 Z
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