crm_formatter 2.62 → 2.63
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/README.md +21 -6
- data/Rakefile +8 -9
- data/lib/crm_formatter.rb +3 -4
- data/lib/crm_formatter/address.rb +0 -1
- data/lib/crm_formatter/proper.rb +0 -4
- data/lib/crm_formatter/tools.rb +1 -3
- data/lib/crm_formatter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bf4fa12e1f8f398363644a747c64838fa774c014d8f27d4514abd3471f7ce4f
|
4
|
+
data.tar.gz: 8a8c42530a244857442e77f7a150f5f2283729cb887cec1e786768fa362f1c1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8332654e5233d71ea626ee493725b6db48c919842e30bf73e039a4415742f63278dffa0b16fd40934aec8d1181db94e502e3047090af8a4b0c189be4f99c940e
|
7
|
+
data.tar.gz: 24a697fa5e03bf05c0efab0a5888fc231eac4db59787ac07bd2cc9549a109a67404f38d2106207c9682037aa8211c87833f344e0a5e46cbd733d6ea2fb60660e
|
data/README.md
CHANGED
@@ -42,17 +42,32 @@ format_propers(array_of_propers)
|
|
42
42
|
format_urls(array_of_urls)
|
43
43
|
```
|
44
44
|
|
45
|
-
|
45
|
+
1a. Format Proper String:
|
46
46
|
|
47
|
-
Use `
|
47
|
+
Use `format_proper` to format a string with proper nouns, such as (but not limited to):
|
48
48
|
|
49
|
-
Business Account
|
49
|
+
* Business Account Name (123 bmw-world => 123 BMW-World),
|
50
|
+
* Proper Name (adam john booth => Adam John Booth),
|
51
|
+
* Job Title (marketing director => Marketing Director),
|
52
|
+
* Article Title (the 15 most useful ruby methods => The 15 Most Useful Ruby Methods)
|
50
53
|
|
51
|
-
|
54
|
+
```
|
55
|
+
proper_string = 'the gmc and bmw-world of AUSTIN tx'
|
56
|
+
formatted_proper = CrmFormatter.format_proper(proper_string)
|
57
|
+
```
|
58
|
+
|
59
|
+
Result in Hash Format:
|
60
|
+
```
|
61
|
+
formatted_proper = {
|
62
|
+
:proper_status=>"formatted",
|
63
|
+
:proper=>"the gmc and bmw-world of AUSTIN tx",
|
64
|
+
:proper_f=>"The GMC and BMW-World of Austin TX"
|
65
|
+
}
|
66
|
+
```
|
52
67
|
|
53
|
-
|
68
|
+
1b. Format Array of Proper Strings:
|
54
69
|
|
55
|
-
|
70
|
+
Use `format_propers` to format an array of proper strings with proper nouns:
|
56
71
|
|
57
72
|
```
|
58
73
|
array_of_propers = [
|
data/Rakefile
CHANGED
@@ -4,7 +4,6 @@ require 'bundler/gem_tasks'
|
|
4
4
|
require 'rspec/core/rake_task'
|
5
5
|
require 'crm_formatter'
|
6
6
|
|
7
|
-
|
8
7
|
RSpec::Core::RakeTask.new(:spec)
|
9
8
|
task default: :spec
|
10
9
|
task test: :spec
|
@@ -18,7 +17,9 @@ task :console do
|
|
18
17
|
|
19
18
|
# formatted_data = format_with_report
|
20
19
|
# formatted_phones = format_phones
|
21
|
-
formatted_urls = format_urls
|
20
|
+
# formatted_urls = format_urls
|
21
|
+
formatted_proper = format_proper
|
22
|
+
# binding.pry
|
22
23
|
# formatted_propers = format_propers
|
23
24
|
# formatted_addresses = format_addresses
|
24
25
|
# binding.pry
|
@@ -26,6 +27,11 @@ task :console do
|
|
26
27
|
end
|
27
28
|
|
28
29
|
#############################################
|
30
|
+
def format_proper
|
31
|
+
proper_string = 'the gmc and bmw-world of AUSTIN tx'
|
32
|
+
formatted_proper = CrmFormatter.format_proper(proper_string)
|
33
|
+
end
|
34
|
+
|
29
35
|
def format_propers
|
30
36
|
array_of_propers = [
|
31
37
|
'the gmc and bmw-world of AUSTIN tx',
|
@@ -47,12 +53,9 @@ def format_propers
|
|
47
53
|
]
|
48
54
|
|
49
55
|
formatted_propers = CrmFormatter.format_propers(array_of_propers)
|
50
|
-
formatted_propers
|
51
56
|
end
|
52
57
|
#############################################
|
53
58
|
|
54
|
-
|
55
|
-
|
56
59
|
def format_addresses
|
57
60
|
array_of_addresses = [
|
58
61
|
{ street: '1234 EAST FAIR BOULEVARD', city: 'AUSTIN', state: 'TEXAS', zip: '78734' },
|
@@ -62,7 +65,6 @@ def format_addresses
|
|
62
65
|
formatted_addresses = CrmFormatter.format_addresses(array_of_addresses)
|
63
66
|
end
|
64
67
|
|
65
|
-
|
66
68
|
def format_phones
|
67
69
|
array_of_phones = %w[
|
68
70
|
555-457-4391 555-888-4391
|
@@ -73,8 +75,6 @@ def format_phones
|
|
73
75
|
formatted_phones = CrmFormatter.format_phones(array_of_phones)
|
74
76
|
end
|
75
77
|
|
76
|
-
|
77
|
-
|
78
78
|
def format_urls
|
79
79
|
array_of_urls = %w[
|
80
80
|
sample01.com/staff
|
@@ -94,7 +94,6 @@ def format_urls
|
|
94
94
|
formatted_urls = CrmFormatter.format_urls(array_of_urls)
|
95
95
|
end
|
96
96
|
|
97
|
-
|
98
97
|
def format_with_report
|
99
98
|
data = [{ row_id: '1', url: 'abcacura.com/twitter', act_name: "Stanley Chevrolet Kaufman\x99_\xCC", street: '825 East Fair Street', city: 'Kaufman', state: 'Texas', zip: '75142', phone: "555-457-4391\r\n" }]
|
100
99
|
|
data/lib/crm_formatter.rb
CHANGED
@@ -15,6 +15,9 @@ require 'pry'
|
|
15
15
|
# require 'crm_formatter/seed_criteria'
|
16
16
|
|
17
17
|
module CrmFormatter
|
18
|
+
def self.format_proper(string)
|
19
|
+
crmf_proper_hsh = CrmFormatter::Proper.new.format_proper(string)
|
20
|
+
end
|
18
21
|
|
19
22
|
## Takes array of proper strings, returns array of proper hashes.
|
20
23
|
def self.format_propers(array_of_propers)
|
@@ -26,7 +29,6 @@ module CrmFormatter
|
|
26
29
|
formatted_proper_hashes
|
27
30
|
end
|
28
31
|
|
29
|
-
|
30
32
|
## Takes array of address hashes, returns array of address hashes.
|
31
33
|
def self.format_addresses(array_of_addresses)
|
32
34
|
address_obj = CrmFormatter::Address.new
|
@@ -60,11 +62,8 @@ module CrmFormatter
|
|
60
62
|
end
|
61
63
|
end
|
62
64
|
|
63
|
-
|
64
|
-
|
65
65
|
def self.format_with_report(args={})
|
66
66
|
formatted_data = self::Wrap.new.run(args)
|
67
67
|
formatted_data
|
68
68
|
end
|
69
|
-
|
70
69
|
end
|
data/lib/crm_formatter/proper.rb
CHANGED
@@ -2,14 +2,11 @@
|
|
2
2
|
|
3
3
|
module CrmFormatter
|
4
4
|
class Proper
|
5
|
-
|
6
5
|
def format_proper(string)
|
7
6
|
str_hsh = { proper_status: nil, proper: string, proper_f: nil }
|
8
7
|
return str_hsh unless string.present?
|
9
8
|
str_hsh[:proper_f] = CrmFormatter::Tools.new.letter_case_check(string)
|
10
|
-
|
11
9
|
str_hsh = check_proper_status(str_hsh)
|
12
|
-
str_hsh
|
13
10
|
end
|
14
11
|
|
15
12
|
####### COMPARE ORIGINAL AND FORMATTED PROPER ######
|
@@ -21,6 +18,5 @@ module CrmFormatter
|
|
21
18
|
hsh[:proper_status] = status if status.present?
|
22
19
|
hsh
|
23
20
|
end
|
24
|
-
|
25
21
|
end
|
26
22
|
end
|
data/lib/crm_formatter/tools.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
module CrmFormatter
|
4
4
|
class Tools
|
5
|
-
|
6
5
|
def letter_case_check(str)
|
7
6
|
return unless str.present?
|
8
7
|
str = force_capitalize(str)
|
@@ -67,7 +66,7 @@ module CrmFormatter
|
|
67
66
|
end
|
68
67
|
|
69
68
|
def strip_squeeze(str)
|
70
|
-
str = str.squeeze(
|
69
|
+
str = str.squeeze(' ')
|
71
70
|
str = str.strip
|
72
71
|
end
|
73
72
|
|
@@ -83,6 +82,5 @@ module CrmFormatter
|
|
83
82
|
directions = %w[NE NW SE SW]
|
84
83
|
ups = [brands, professional, states, directions].flatten.uniq
|
85
84
|
end
|
86
|
-
|
87
85
|
end
|
88
86
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crm_formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '2.
|
4
|
+
version: '2.63'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Booth
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|