Module: JSONAPIonify::Api::Resource::Definitions::Helpers
- Defined in:
- lib/jsonapionify/api/resource/definitions/helpers.rb
Instance Method Summary collapse
Instance Method Details
#authentication(&block) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/jsonapionify/api/resource/definitions/helpers.rb', line 8 def authentication(&block) context :authentication, readonly: true, persisted: true do |context| OpenStruct.new.tap do |authentication_object| if instance_exec(context.request, authentication_object, &block) == false error_now :forbidden end end end before do |context| context.authentication end end |
#helper(name, &block) ⇒ Object
4 5 6 |
# File 'lib/jsonapionify/api/resource/definitions/helpers.rb', line 4 def helper(name, &block) define_method(name, &block) end |