Class: JsonApiResource::Connections::ServerConnection
- Inherits:
-
Multiconnect::Connection::Base
- Object
- Multiconnect::Connection::Base
- JsonApiResource::Connections::ServerConnection
- Defined in:
- lib/json_api_resource/connections/server_connection.rb
Instance Method Summary collapse
Instance Method Details
#report_error(e) ⇒ Object
6 7 8 |
# File 'lib/json_api_resource/connections/server_connection.rb', line 6 def report_error( e ) error_notifier.notify( self, e ) if error_notifier.present? end |
#request(action, *args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/json_api_resource/connections/server_connection.rb', line 10 def request( action, *args ) client_args = args.deep_dup result = self.client.send action, *client_args if result.is_a? JsonApiClient::Scope result = result.all end result rescue JsonApiClient::Errors::NotFound => e result = JsonApiClient::ResultSet.new result. = {status: 404} result.errors = ActiveModel::Errors.new(result) result.errors.add("RecordNotFound", e.) result end |