contact_congress_parser 0.0.9 → 0.0.10
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 +10 -12
- data/lib/contact_congress_parser/action.rb +8 -3
- 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: 26448f830a6198af435b838a35006c086885ea2d
|
4
|
+
data.tar.gz: ef5bce36e76b38129e60c75cd878054caee76c99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ddc7d872dc59a9ef43f814d5230d67bcc55aec0fdd3b7f7d4bea43ae8090fb1093530aa255a4d5f78703a1ac230333fc73fd9248f3cb6e09db19cd500fc905d
|
7
|
+
data.tar.gz: 916c9e7afe25a23815413302ee11b91f55036618b28ea7561af7e926e256cdbf08901c698020a7cbcaafd99b0e6c69871d490ed990bbc7d1dda25ab6b99bbe94
|
data/README.md
CHANGED
@@ -1,24 +1,22 @@
|
|
1
1
|
# ContactCongressParser
|
2
2
|
|
3
|
-
|
3
|
+
Parses [contact-congress](https://github.com/unitedstates/contact-congress) [member files](https://github.com/unitedstates/contact-congress/tree/master/members) into ruby code runable with the [conformity](https://github.com/nhjk/conformity) gem.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
gem 'contact_congress_parser'
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
Or install it yourself as:
|
16
|
-
|
17
7
|
$ gem install contact_congress_parser
|
18
8
|
|
19
9
|
## Usage
|
20
10
|
|
21
|
-
|
11
|
+
```ruby
|
12
|
+
require 'contact_congress_parser'
|
13
|
+
|
14
|
+
member_file = File.read(path_to_member_file)
|
15
|
+
parsed_form = ContactCongressParser.parse_form(member_file)
|
16
|
+
|
17
|
+
require 'conformity'
|
18
|
+
form = eval(parsed_form) # runs! but you should probably write it to a file instead
|
19
|
+
```
|
22
20
|
|
23
21
|
## Contributing
|
24
22
|
|
@@ -32,7 +32,7 @@ module ContactCongressParser
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def fill_in_args
|
35
|
-
'"' + escape_quotes(@data['selector']) + '"' +
|
35
|
+
'"' + remove_css(escape_quotes(@data['selector'])) + '"' +
|
36
36
|
', with: ' +
|
37
37
|
field(@data['value'], required: @data['required'])
|
38
38
|
end
|
@@ -46,7 +46,7 @@ module ContactCongressParser
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def check_args
|
49
|
-
'"' + @data['selector'] + '"'
|
49
|
+
'"' + remove_css(@data['selector']) + '"'
|
50
50
|
end
|
51
51
|
|
52
52
|
def uncheck_args
|
@@ -54,7 +54,8 @@ module ContactCongressParser
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def click_on_args
|
57
|
-
|
57
|
+
to_click_on = remove_css(data['value'] || data['selector'])
|
58
|
+
'"' + to_click_on + '"'
|
58
59
|
end
|
59
60
|
|
60
61
|
private
|
@@ -69,5 +70,9 @@ module ContactCongressParser
|
|
69
70
|
def escape_quotes(str)
|
70
71
|
str.gsub('"', '\"')
|
71
72
|
end
|
73
|
+
|
74
|
+
def remove_css(str)
|
75
|
+
str[0] == "#" || str[0] == "." ? str[1..-1] : str
|
76
|
+
end
|
72
77
|
end
|
73
78
|
end
|
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.10
|
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-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|