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

Version Path
introspective_grape-0.6.1 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.5.7 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.5.6 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.5.5 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.5.4 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.5.2 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.5.0 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.4.3 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.4.2 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.4.1 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.4.0 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.3.9 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.3.7 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.3.6 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.3.5 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.3.3 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.3.2 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.3.1 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.3.0 spec/dummy/app/api/dummy/entities.rb
introspective_grape-0.2.9 spec/dummy/app/api/dummy/entities.rb