Sha256: 3762084328382aae5c53b8f59be4be9d26d3a4c4738b3889877ad3d0bf303f88

Contents?: true

Size: 962 Bytes

Versions: 4

Compression:

Stored size: 962 Bytes

Contents

# encoding: utf-8
# This file is distributed under New Relic"s license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

require 'grape'

class GrapeTestApiError < StandardError; end
class GrapeTestApi < Grape::API
  # namespace, group, resource, and resources all do the same thing.
  # They are aliases for namespace.

  get :self_destruct do
    raise GrapeTestApiError.new("I'm sorry Dave, I'm afraid I can't do that.")
  end

  namespace :grape_ape do
    get do
      'List grape apes!'
    end

    get 'renamed' do
      ::NewRelic::Agent.set_transaction_name("RenamedTxn")
      'Totally renamed it.'
    end

    get ':id' do
      'Show grape ape!'
    end
  end

  resource :grape_ape do
    post do
      'Create grape ape!'
    end
  end

  resources :grape_ape do
    put ':id' do
      'Update grape ape!'
    end
  end

  group :grape_ape do
    delete ':id' do
      'Destroy grape ape!'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
newrelic_rpm-3.11.2.286 test/multiverse/suites/grape/grape_test_api.rb
newrelic_rpm-3.11.1.284 test/multiverse/suites/grape/grape_test_api.rb
newrelic_rpm-3.11.0.283 test/multiverse/suites/grape/grape_test_api.rb
newrelic_rpm-3.10.0.279 test/multiverse/suites/grape/grape_test_api.rb