Class: NPSSurveys::ResponseSerializer

Inherits:
Object
  • Object
show all
Defined in:
app/serializers/nps_surveys/response_serializer.rb

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ResponseSerializer

Returns a new instance of ResponseSerializer.



3
4
5
# File 'app/serializers/nps_surveys/response_serializer.rb', line 3

def initialize(response)
  @response = response
end

Instance Method Details

#to_jsonObject



7
8
9
10
11
12
13
14
15
16
17
# File 'app/serializers/nps_surveys/response_serializer.rb', line 7

def to_json
  {
    id: @response.id,
    survey: @response.survey,
    feedback: @response.feedback,
    score: @response.score,
    user_id: @response.user_id,
    created_at: @response.created_at.to_i,
    updated_at: @response.updated_at.to_i
  }
end