Class: PigCI::Api::Reports
- Inherits:
-
PigCI::Api
- Object
- PigCI::Api
- PigCI::Api::Reports
- Defined in:
- lib/pig_ci/api/reports.rb
Instance Method Summary collapse
-
#initialize(reports: []) ⇒ Reports
constructor
A new instance of Reports.
- #share! ⇒ Object
Methods inherited from PigCI::Api
Constructor Details
#initialize(reports: []) ⇒ Reports
Returns a new instance of Reports.
2 3 4 |
# File 'lib/pig_ci/api/reports.rb', line 2 def initialize(reports: []) @reports = reports end |
Instance Method Details
#share! ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/pig_ci/api/reports.rb', line 6 def share! response = post_payload return if response.success? puts I18n.t('pig_ci.api.reports.error', error: JSON.parse(response.parsed_response || '{}')['error']) rescue JSON::ParserError => _e puts I18n.t('pig_ci.api.reports.api_error') rescue SocketError => e puts I18n.t('pig_ci.api.reports.error', error: e) rescue Net::OpenTimeout => e puts I18n.t('pig_ci.api.reports.error', error: e.inspect) end |