Sha256: 020b9f8939033222f6692e3c9600279a7eae21fdb0e9e1b5217a6445b1643740

Contents?: true

Size: 1.89 KB

Versions: 8

Compression:

Stored size: 1.89 KB

Contents

class ApiSpec::Spec

  endpoint 'Donations' do |donation|

    donation.method('Index') do |method|
      method.synopsis = 'Returns a list of donations'
      method.http_method = 'GET'
      method.uri = '/donations'

      method.parameter('__token') do |p|
        p.required = 'N'
        p.type = 'string'
        p.description = 'pagination token'
      end

      method.parameter('__nonce') do |p|
        p.required = 'N'
        p.type = 'string'
        p.description = 'pagination nonce'
      end

      method.parameter('limit') do |p|
        p.required = 'N'
        p.default = '10'
        p.type = 'int'
        p.description = 'maximum number of results to return'
      end
    end

    donation.method('Create') do |method|
      method.synopsis = 'Creates a donation with the provided data'
      method.http_method = 'POST'
      method.uri = '/donations'

      method.parameter('body') do |p|
        p.required = 'Y'
        p.default = '{}'
        p.type = 'json'
        p.description = 'a JSON representation of a donation'
      end
    end

    donation.method('Update') do |method|
      method.synopsis = 'Updates a donation with the provided data'
      method.http_method = 'PUT'
      method.uri = '/donations/:id'

      method.parameter('id') do |p|
        p.required = 'Y'
        p.type = 'int'
        p.description = "the donation's ID"
      end

      method.parameter('body') do |p|
        p.required = 'Y'
        p.default = '{}'
        p.type = 'json'
        p.description = 'JSON attributes for updating the donation'
      end
    end

    donation.method('Destroy') do |method|
      method.synopsis = 'Removes the donation with the matching ID'
      method.http_method = 'DELETE'
      method.uri = '/donations/:id'

      method.parameter('id') do |p|
        p.required = 'Y'
        p.type = 'int'
        p.description = "the donation's ID"
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
nationbuilder-rb-1.6.0 lib/api_spec/lib/api_spec/specs/donations.rb
nationbuilder-rb-1.5.0 lib/api_spec/lib/api_spec/specs/donations.rb
nationbuilder-rb-1.4.3 lib/api_spec/lib/api_spec/specs/donations.rb
nationbuilder-rb-1.4.2 lib/api_spec/lib/api_spec/specs/donations.rb
nationbuilder-rb-1.4.1 lib/api_spec/lib/api_spec/specs/donations.rb
nationbuilder-rb-1.3.9 lib/api_spec/lib/api_spec/specs/donations.rb
nationbuilder-rb-1.3.7 lib/api_spec/lib/api_spec/specs/donations.rb
nationbuilder-rb-1.3.6 lib/api_spec/lib/api_spec/specs/donations.rb