contact_congress_parser 0.0.5 → 0.0.6
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/contact_congress_parser/field.rb +37 -2
- data/lib/contact_congress_parser/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bedac01b6c721845094a5cf42b7c66fb3297b36
|
4
|
+
data.tar.gz: f5d5b9c753f9943848b6f1e9e1a4fc63d0b62421
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e5acfd0f3a38131f339fdfb7f39ca5dc7a0264e44761acd9322c3b5f9f126e681cbe737e1534630843d58baded374505c23fcee59523ae06f3c60126e331d7b
|
7
|
+
data.tar.gz: c58407f68e87f6982433afeb355444cfbbabfcdafb2334c7fa3ae56b92dc0f407c2c64c71ef9a67cca43ca55c9046142fa8a786487163430958e647496d3eb0d
|
@@ -3,7 +3,7 @@ module ContactCongressParser
|
|
3
3
|
attr_reader :name, :field_options
|
4
4
|
|
5
5
|
def initialize(name, options=nil)
|
6
|
-
@name = name
|
6
|
+
@name = normalize_field_name(name)
|
7
7
|
@options = options
|
8
8
|
@field_options = opts_to_array(options[:options]) if options
|
9
9
|
@field_options = escape_opts_quotes(@field_options) if field_options
|
@@ -13,8 +13,43 @@ module ContactCongressParser
|
|
13
13
|
"field(\"#{name}\"#{options_str})"
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
16
|
private
|
17
|
+
def normalize_field_name(name)
|
18
|
+
if name[0] == '$'
|
19
|
+
case name
|
20
|
+
when '$ADDRESS_CITY' then 'City'
|
21
|
+
when '$ADDRESS_COUNTY' then 'County'
|
22
|
+
when '$ADDRESS_STATE_FULL' then 'State'
|
23
|
+
when '$ADDRESS_STATE_POSTAL_ABBREV' then 'State'
|
24
|
+
when '$ADDRESS_STREET' then 'Address'
|
25
|
+
when '$ADDRESS_STREET_2' then 'Address Cont.'
|
26
|
+
when '$ADDRESS_ZIP4' then 'ZIP 4'
|
27
|
+
when '$ADDRESS_ZIP5' then 'ZIP'
|
28
|
+
when '$ADDRESS_ZIP_PLUS_4' then 'ZIP+4'
|
29
|
+
when '$CAMPAIGN_UUID' then 'UUID'
|
30
|
+
when '$CAPTCHA_SOLUTION' then 'captcha'
|
31
|
+
when '$EMAIL' then 'Email Address'
|
32
|
+
when '$MESSAGE' then 'Message'
|
33
|
+
when '$NAME_FIRST' then 'First Name'
|
34
|
+
when '$NAME_FULL' then 'Name'
|
35
|
+
when '$NAME_LAST' then 'Last Name'
|
36
|
+
when '$NAME_PREFIX' then 'Title'
|
37
|
+
when '$NAME_SUFFIX' then 'Suffix'
|
38
|
+
when '$ORG_NAME' then 'Organization'
|
39
|
+
when '$ORG_URL' then 'Organization URL'
|
40
|
+
when '$PHONE' then 'Phone'
|
41
|
+
when '$PHONE_PARENTHESES' then 'Phone Parens'
|
42
|
+
when '$PHONE_WORK' then 'Work Phone'
|
43
|
+
when '$SUBJECT' then 'Subject'
|
44
|
+
when '$TOPIC' then 'Topic'
|
45
|
+
else
|
46
|
+
raise "#{name} not recognized"
|
47
|
+
end
|
48
|
+
else
|
49
|
+
name
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
18
53
|
def opts_to_array(opts)
|
19
54
|
case opts
|
20
55
|
when Array then opts
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contact_congress_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikias Kalpaxis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|