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.



10
11
12
13
14
# File 'lib/clean_architecture/serializers/json_response_from_result.rb', line 10

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

Instance Method Details

#to_hObject



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

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