Class: RestPack::Service::Commands::Get

Inherits:
RestPack::Service::Command show all
Defined in:
lib/restpack_service/commands/get.rb

Instance Attribute Summary

Attributes inherited from RestPack::Service::Command

#response

Instance Method Summary collapse

Methods inherited from RestPack::Service::Command

#Model, #Serializer, #field_error, inherited, #init, #run, #service_error, #status, #valid?

Instance Method Details

#execute ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/restpack_service/commands/get.rb', line 4

def execute
  result = self.class.serializer_class.resource(inputs)

  if result[self.class.serializer_class.key].empty?
    status :not_found
  else
    result
  end
end