congress_forms 0.1.2 → 0.1.3

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
2
  SHA1:
3
- metadata.gz: 85cf0c5a2d1e3b221e7674267da900b5eb66be99
4
- data.tar.gz: cea9f9f04b41c702ff8345f3a58a94dc08b2f52d
3
+ metadata.gz: 874826c61da50fac5258d6824dca5b1a473060d1
4
+ data.tar.gz: 364d2d5fe226a42f2e4d9defa5029141502e80b6
5
5
  SHA512:
6
- metadata.gz: 6bfec00df54bf57b544fb32078f32e25d5250d914826b8e67b7fd48931bd85db830bdfd9fc3d568da5785ff2ec68243bad33076dc8e52dd66e057c47359ad02e
7
- data.tar.gz: 9082fb873f2a9a33402a31a98b1d11876d036f6c2766d20f26a71a84025a85065e8758b7961dec9b72d30b3b3139f11f7523ce79564f6f8d588ab03d3103c245
6
+ metadata.gz: 5523d19a1921d14c59d63afaa31cdd4ca4b5f2a831ea11a549fd30aa76f5e2728fc6bc4fc1a406cb27001ca0f0e927345788ae6b4cc5a4117d72cf6a11c29eea
7
+ data.tar.gz: 7968b52057002d803df56ce7fdb0e3abd707d3bbd368e5138d24a4b02b3d5c7df206e91ac3adbc79719ef1207b6fd7648319a050799a03e92d42be414bb486f1
data/README.md CHANGED
@@ -104,7 +104,7 @@ A `git pull` is performed every now and then in this direcory, to keep the form
104
104
  CongressForms.auto_update_contact_congress = false
105
105
  ```
106
106
 
107
- House messages are submitted through the [Communicating with Congress](https://www.house.gov/doing-business-with-the-house/communicating-with-congress-cwc) API. To send messages to the House of Representatives, You will need to complete the vendor application process, then configure the API client with
107
+ House messages are submitted through the [Communicating with Congress](https://www.house.gov/doing-business-with-the-house/communicating-with-congress-cwc) API. To send messages to the House, you will need to complete the vendor application process, then configure the API client with
108
108
 
109
109
  ```ruby
110
110
  Cwc::Client.configure(
@@ -1,3 +1,3 @@
1
1
  module CongressForms
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -63,6 +63,8 @@ module CongressForms
63
63
  log("#{bioguide} fill")
64
64
 
65
65
  actions.each do |action|
66
+ log(action.inspect)
67
+
66
68
  break if action.submit? && validate_only
67
69
 
68
70
  action.perform(browser, values)
@@ -75,10 +77,7 @@ module CongressForms
75
77
  error = Error.new(e.message)
76
78
  error.set_backtrace(e.backtrace)
77
79
 
78
- if screenshot = ENV["CONGRESS_FORMS_SCREENSHOT_LOCATION"]
79
- error.screenshot = "#{screenshot}/#{SecureRandom.hex(16)}.png"
80
- browser.save_screenshot(error.screenshot, full: true)
81
- end
80
+ attach_screenshot(browser, error)
82
81
 
83
82
  raise error
84
83
  end
@@ -98,5 +97,17 @@ module CongressForms
98
97
  Raven.context.extra[:fill_log] << message << "\n"
99
98
  end
100
99
  end
100
+
101
+ def attach_screenshot(browser, error)
102
+ if dir = ENV["CONGRESS_FORMS_SCREENSHOT_LOCATION"]
103
+ random = SecureRandom.hex(16)
104
+ stamp = Time.now.strftime("%Y-%m-%d_%H:%M:%S")
105
+
106
+ path = "#{dir}/#{bioguide}/#{stamp}_#{random}.png"
107
+ FileUtils.mkdir_p(File.dirname(path))
108
+
109
+ browser.save_screenshot(error.screenshot, full: true)
110
+ end
111
+ end
101
112
  end
102
113
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: congress_forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Woo