Class: CleanArchitecture::Serializers::JsonResponseFromResult

Inherits:
Object
  • Object
show all
Defined in:
lib/clean_architecture/serializers/json_response_from_result.rb

Instance Method Summary collapse

Constructor Details

#initialize(result, http_method, success_payload) ⇒ JsonResponseFromResult

Returns a new instance of JsonResponseFromResult.



12
13
14
15
16
# File 'lib/clean_architecture/serializers/json_response_from_result.rb', line 12

def initialize(result, http_method, success_payload)
  @result = result
  @http_method = http_method
  @success_payload = success_payload
end

Instance Method Details

#to_hObject



18
19
20
21
22
23
# File 'lib/clean_architecture/serializers/json_response_from_result.rb', line 18

def to_h
  {
    status: http_status_code,
    json: json
  }
end