hackerone-client 0.14.0 → 0.14.1

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
  SHA256:
3
- metadata.gz: 6d4b1c014b6e1db5054e8f357a035fcd7280dfc7883fed91dc3a8ae379595591
4
- data.tar.gz: a7c73cd1930859cf4869dd582b0ee9b9386deabf0459332b1a8c6af70cf16d92
3
+ metadata.gz: 88603237218a28a4e4969d2d2e3f7e5cd80cb127f08a4e28281f782d4256b676
4
+ data.tar.gz: 0d043560be7894f9a4f6ddbb05a48b50ef9d23096b8f70620633f99b0bc3de3c
5
5
  SHA512:
6
- metadata.gz: 576b7efb77016dfa6ffbe2e9c73c887ebb2439ff048bcb0dc763786c93f5248a082b27fce8211206648252754f0f8566bd2981a8e9667fd3e73e122fbcc54b92
7
- data.tar.gz: 9906f890a07c6d6e717e1eda4f70e327eec345d30a88c91cb5953b47e3ab7f01e53212c8a640a37ebff41ddad31fd32641392e41edd3ce0a9ca4b2082600bcc9
6
+ metadata.gz: 9bea7771d2072ea159ef5eb4b482c80625b5df0927bbde0475782b2ec08279da43233800c5175814b5b9ebc2854f94a6f8535f32c98c6da147b7d4c6157cabfc
7
+ data.tar.gz: 44c4af87d1a9c58d57ba64f4ae1ceb3edf1f9036e5d0640aeb3665128fb812346252daba058e008dd27f1c3a26db3be5265fe51e007766d72aa5700ce9fdf65d
@@ -1,3 +1,7 @@
1
+ ## [0.14.1] - 2020-02-13
2
+
3
+ - [Add support for float values in API responses](https://github.com/oreoshake/hackerone-client/pull/44) (@rzhade3)
4
+
1
5
  ## [0.14.0] - 2019-10-28
2
6
 
3
7
  - [Add new swag API support](https://github.com/oreoshake/hackerone-client/pull/41) (@anglinb)
data/README.md CHANGED
@@ -91,6 +91,12 @@ HackerOne::Client.high_range = 2500...5000
91
91
  HackerOne::Client.critical_range = 5000...100_000_000
92
92
  ```
93
93
 
94
+ ### Configuration
95
+
96
+ In order to configure whether error handling is strict or lenient, set the `HACKERONE_CLIENT_LENIENT_MODE` variable.
97
+
98
+ Setting this variable will make the client try to absorb errors, like a malformed bounty or bonus amount. Not setting this variable will cause the client to raise errors.
99
+
94
100
  ## Contributing
95
101
 
96
102
  Bug reports and pull requests are welcome on GitHub at https://github.com/oreoshake/hackerone-client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@@ -24,6 +24,8 @@ module HackerOne
24
24
  DEFAULT_HIGH_RANGE = 2500...4999
25
25
  DEFAULT_CRITICAL_RANGE = 5000...100_000_000
26
26
 
27
+ LENIENT_MODE_ENV_VARIABLE = 'HACKERONE_CLIENT_LENIENT_MODE'
28
+
27
29
  class << self
28
30
  ATTRS = [:low_range, :medium_range, :high_range, :critical_range].freeze
29
31
  attr_accessor :program
@@ -29,12 +29,28 @@ module HackerOne
29
29
  class BountyAwarded < Activity
30
30
  def bounty_amount
31
31
  formatted_bounty_amount = attributes.bounty_amount || "0"
32
- formatted_bounty_amount.gsub(/[^\d]/, "").to_i
32
+ if ENV[HackerOne::Client::LENIENT_MODE_ENV_VARIABLE]
33
+ Float(formatted_bounty_amount) rescue 0
34
+ else
35
+ begin
36
+ Float(formatted_bounty_amount)
37
+ rescue ArgumentError
38
+ raise ArgumentError.new("Improperly formatted bounty amount")
39
+ end
40
+ end
33
41
  end
34
42
 
35
43
  def bonus_amount
36
44
  formatted_bonus_amount = attributes.bonus_amount || "0"
37
- formatted_bonus_amount.gsub(/[^\d]/, "").to_i
45
+ if ENV[HackerOne::Client::LENIENT_MODE_ENV_VARIABLE]
46
+ Float(formatted_bonus_amount) rescue 0
47
+ else
48
+ begin
49
+ Float(formatted_bonus_amount)
50
+ rescue ArgumentError
51
+ raise ArgumentError.new("Improperly formatted bonus amount")
52
+ end
53
+ end
38
54
  end
39
55
  end
40
56
 
@@ -1,5 +1,5 @@
1
1
  module Hackerone
2
2
  module Client
3
- VERSION = "0.14.0"
3
+ VERSION = "0.14.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hackerone-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil Matatall
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-28 00:00:00.000000000 Z
11
+ date: 2020-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  - !ruby/object:Gem::Version
195
195
  version: '0'
196
196
  requirements: []
197
- rubygems_version: 3.0.1
197
+ rubygems_version: 3.0.3
198
198
  signing_key:
199
199
  specification_version: 4
200
200
  summary: A limited client for the HackerOne API