Sha256: 16bad4ae253ab93880ac367673b4a07c0e3b5d692f5565c8b10eece7cdd4bbf3
Contents?: true
Size: 690 Bytes
Versions: 31
Compression:
Stored size: 690 Bytes
Contents
# Grape Entity monkey patch to ensure that all keys are exposed as camelCased instead of the actual Ruby snake_case names. # Note that the keys are not touched if the :as option is used, so # expose :some_name, :as => 'some_name' # will remain snake_cased #class Grape::Entity # protected # def self.key_for(attribute) # (exposures[attribute.to_sym][:as] || attribute).to_s.camelize(:lower).to_sym # end #end module Dummy::Entities # base class for entities class DummyEntity < Grape::Entity # common formatters can go here end # User entities class User < DummyEntity expose :id, :email, :first_name, :last_name, :avatar_url, :authentication_token end end
Version data entries
31 entries across 31 versions & 1 rubygems