Class: BrightcoveService::Base
- Inherits:
-
Object
- Object
- BrightcoveService::Base
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/brightcove_service/base.rb
Instance Method Summary collapse
Instance Method Details
#add_error(e) ⇒ Object
5 6 7 8 |
# File 'lib/brightcove_service/base.rb', line 5 def add_error(e) errors.add(:base, e.to_s) @result = { error: (e) } end |
#error_message(e) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/brightcove_service/base.rb', line 10 def (e) error = JSON.parse(e.to_s) return error unless error.is_a?(Array) error.collect { |obj| obj['message'] }.join(', ') rescue JSON::ParserError return e end |