Class: LetItCrash::Reporters::Upload
- Inherits:
-
Object
- Object
- LetItCrash::Reporters::Upload
- Defined in:
- lib/letitcrash/reporters/upload.rb
Constant Summary collapse
- TOKEN_HEADER =
'X-LetItCrash-Token'
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(endpoint:, token:) ⇒ Upload
constructor
A new instance of Upload.
- #report(input) ⇒ Object
Constructor Details
#initialize(endpoint:, token:) ⇒ Upload
Returns a new instance of Upload.
18 19 20 21 |
# File 'lib/letitcrash/reporters/upload.rb', line 18 def initialize(endpoint:, token:) @endpoint = endpoint @token = token end |
Class Method Details
.from_env ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/letitcrash/reporters/upload.rb', line 10 def self.from_env endpoint = ENV.fetch( 'LETITCRASH_COVERAGE_ENDPOINT', 'https://notify.letitcrash.io/coverage/ruby', ) new(endpoint: endpoint, token: ENV.fetch('LETITCRASH_COVERAGE_TOKEN')) end |
Instance Method Details
#report(input) ⇒ Object
23 24 25 26 27 |
# File 'lib/letitcrash/reporters/upload.rb', line 23 def report(input) blockers_off RestClient.post(endpoint, input.to_json, headers) blockers_on end |