congress_forms 0.1.16 → 0.1.17

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
- SHA1:
3
- metadata.gz: bec84ca4b2d40192518755713f3e8b866e07950e
4
- data.tar.gz: 8baf974b874830242ac8d13fa7c8f942a0cd28da
2
+ SHA256:
3
+ metadata.gz: 535d4f04be205c842bc82fb2cdf7aa91b875f2b8e4929ea37ee9fe4740231201
4
+ data.tar.gz: c661dc86d5250d53cb0ad7bf78ee83cc287c6bb5cf72edd651ee3c43d1f052d1
5
5
  SHA512:
6
- metadata.gz: b0b0cd02f523cb73fdecbe9e4afbba9149cf9aaf3633aa0eb3c6d58079417d93283467258907d011f5e26cf929a238fad8061e0c07ff200a08c9c15bfe0833c7
7
- data.tar.gz: 04623bc1499a864e7df263afda95b3fb508f72e5b03cd23745fc4b9e6e7ade835f24715abadd0affe7901e9e4c7a65e06b5296e7c5e935d3db0fcc4909637d86
6
+ metadata.gz: 398168518ade5fc838a83b64333468ddd77ce1daf76e715b46c8c3d1c97091a65dde04407c04c62c6df8fe70d58a4d30e7ca6fa3df706f46a8c6c095e1306139
7
+ data.tar.gz: d440b5178f2162683503dcde1c9f1e9c8588308dd06fe9bca9512823d4888a9b518eeb7551bf589917e838636f30fee2e913dbad0e74fbbea8ae8fe82aa7f53f
data/bin/congress_forms CHANGED
@@ -88,13 +88,17 @@ form.required_params.each do |param|
88
88
  end
89
89
  end
90
90
 
91
- begin
92
- form.fill(params, submit: options[:submit])
93
- rescue Exception => e
94
- if options[:debug]
95
- require "pry"
96
- binding.pry
97
- else
98
- raise e
91
+ if options[:debug]
92
+ isubmit = form.actions.find_index(&:submit?) || 0
93
+
94
+ debug = CongressForms::Actions::Yield.new do
95
+ puts "fill paused before submit. press return to continue."
96
+ $stdin.gets
99
97
  end
98
+
99
+ form.actions.insert(isubmit, debug)
100
100
  end
101
+
102
+ puts
103
+
104
+ form.fill(params, validate_only: !!!options[:submit])
@@ -164,5 +164,16 @@ module CongressForms
164
164
  browser.driver.evaluate_script(value)
165
165
  end
166
166
  end
167
+
168
+ class Yield < Base
169
+ def initialize(*args, &block)
170
+ @block = block
171
+ super
172
+ end
173
+
174
+ def perform(browser, params={})
175
+ @block.call
176
+ end
177
+ end
167
178
  end
168
179
  end
@@ -17,7 +17,7 @@ module CongressForms
17
17
  nil
18
18
  end
19
19
 
20
- if cwc_client&.office_supported?(form_id)
20
+ if (cwc_client&.office_supported?(form_id) rescue nil)
21
21
  CwcForm.new(form_id)
22
22
  else
23
23
  content, timestamp = repo.find("members/#{form_id}.yaml")
@@ -1,3 +1,3 @@
1
1
  module CongressForms
2
- VERSION = "0.1.16"
2
+ VERSION = "0.1.17"
3
3
  end
@@ -91,6 +91,8 @@ module CongressForms
91
91
  def log(message)
92
92
  if defined?(Rails)
93
93
  Rails.logger.debug(message)
94
+ elsif ENV["HEADLESS"] == "0"
95
+ warn message
94
96
  end
95
97
 
96
98
  if defined?(Raven)
@@ -64,7 +64,6 @@ module CongressForms
64
64
  autoload :WebForm, "congress_forms/web_form"
65
65
  autoload :CwcForm, "congress_forms/cwc_form"
66
66
  autoload :Actions, "congress_forms/actions"
67
- autoload :UnsupportedAction, "congress_forms/actions"
68
67
 
69
68
  autoload :Repo, "congress_forms/repo"
70
69
 
data/lib/cwc/client.rb CHANGED
@@ -161,9 +161,9 @@ module Cwc
161
161
 
162
162
  def offices
163
163
  if options[:host] =~ %r{^https://cwc.house.gov}
164
- Cwc::OfficeCodes.map{ |code| Office.new(code) }
164
+ Cwc::OfficeCodes.map{ |code| Office.new(code) }
165
165
  else
166
- response = get action("/v2/offices")
166
+ response = get action("/offices")
167
167
  JSON.parse(response.body).map{ |code| Office.new(code) }
168
168
  end
169
169
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: congress_forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Woo
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-18 00:00:00.000000000 Z
11
+ date: 2023-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -122,7 +122,7 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '2.0'
125
- description:
125
+ description:
126
126
  email:
127
127
  - peterw@eff.org
128
128
  executables:
@@ -163,7 +163,7 @@ homepage: https://github.com/efforg/congress_forms
163
163
  licenses:
164
164
  - GPL-3.0
165
165
  metadata: {}
166
- post_install_message:
166
+ post_install_message:
167
167
  rdoc_options: []
168
168
  require_paths:
169
169
  - lib
@@ -179,9 +179,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  requirements: []
182
- rubyforge_project:
183
- rubygems_version: 2.5.1
184
- signing_key:
182
+ rubygems_version: 3.1.6
183
+ signing_key:
185
184
  specification_version: 4
186
185
  summary: "..."
187
186
  test_files: []