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 +4 -4
- data/lib/wolf_core/application/barton/parsing.rb +49 -0
- 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: 24a38fbd3bf0c7ea37e0dbc325fbf0bd60e919b407b78be15a304df8e0d32ae5
|
4
|
+
data.tar.gz: 493f91f7a744554a71431f7c8b0bd08ba4515c448d01607ac6b6f7567cc4eb93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.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-
|
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
|