Sha256: bbaaf96c3a864b98523bdeb0dcb95a9565a29249f9aca120f453e2776b350d76
Contents?: true
Size: 403 Bytes
Versions: 2
Compression:
Stored size: 403 Bytes
Contents
module BrightcoveService class Base include ActiveModel::Validations def add_error(e) errors.add(:base, e.to_s) @result = { error: error_message(e) } end def error_message(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 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
brightcove_service-0.1.1 | lib/brightcove_service/base.rb |
brightcove_service-0.1.0 | lib/brightcove_service/base.rb |