Class: ESM::Connection::Response

Inherits:
Object
  • Object
show all
Includes:
Concurrent::Concern::Obligation
Defined in:
lib/esm/connection/response.rb

Class Method Summary collapse

Class Method Details

.fulfilled(content) ⇒ self

Creates a new fulfilled response with the provided data

Parameters:

  • content (Object)

    The data to set as the value for the response

Returns:

  • (self)

    The fulfilled response



15
16
17
18
19
# File 'lib/esm/connection/response.rb', line 15

def self.fulfilled(content)
  response = new
  response.send(:set_state, true, content, nil)
  response
end

.rejected(reason) ⇒ self

Creates a new rejected response with the provided reason

Parameters:

  • reason (Object)

    The reason why the request failed

Returns:

  • (self)

    The fulfilled response



28
29
30
31
32
# File 'lib/esm/connection/response.rb', line 28

def self.rejected(reason)
  response = new
  response.send(:set_state, false, nil, reason)
  response
end