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.



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

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

Instance Method Details

#to_hObject



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

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