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.



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

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

Instance Method Details

#to_hObject



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

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