Skip to content

Commit

Permalink
Merge pull request #1628 from senid231/admin-api-radius-rename
Browse files Browse the repository at this point in the history
admin api rename radius related endpoints
  • Loading branch information
dmitry-sinina authored Nov 25, 2024
2 parents 2b1a394 + 4f2f48a commit 8702475
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 40 deletions.

This file was deleted.

4 changes: 0 additions & 4 deletions app/controllers/api/rest/admin/auth_profiles_controller.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

class Api::Rest::Admin::RadiusAccountingProfilesController < Api::Rest::Admin::BaseController
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

class Api::Rest::Admin::RadiusAuthProfilesController < Api::Rest::Admin::BaseController
end
4 changes: 2 additions & 2 deletions app/resources/api/rest/admin/customers_auth_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class Api::Rest::Admin::CustomersAuthResource < BaseResource
has_one :dst_numberlist, class_name: 'Numberlist', always_include_linkage_data: true
has_one :src_numberlist, class_name: 'Numberlist', always_include_linkage_data: true
has_one :tag_action, class_name: 'TagAction', always_include_linkage_data: true
has_one :radius_auth_profile, class_name: 'AuthProfile', always_include_linkage_data: true
has_one :radius_accounting_profile, class_name: 'AccountingProfile', always_include_linkage_data: true
has_one :radius_auth_profile, class_name: 'RadiusAuthProfile', always_include_linkage_data: true
has_one :radius_accounting_profile, class_name: 'RadiusAccountingProfile', always_include_linkage_data: true
has_one :transport_protocol, class_name: 'TransportProtocol', always_include_linkage_data: true

filter :name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class Api::Rest::Admin::AccountingProfileResource < ::BaseResource
class Api::Rest::Admin::RadiusAccountingProfileResource < ::BaseResource
model_name 'Equipment::Radius::AccountingProfile'

attributes :name, :server, :port, :secret, :timeout, :attempts, :enable_start_accounting,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class Api::Rest::Admin::AuthProfileResource < ::BaseResource
class Api::Rest::Admin::RadiusAuthProfileResource < ::BaseResource
model_name 'Equipment::Radius::AuthProfile'

attributes :name, :server, :port, :secret, :reject_on_error, :timeout, :attempts
Expand Down
4 changes: 2 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ def dasherized_resources(name, options = {}, &block)
jsonapi_resources :registrations
jsonapi_resources :sip_options_probers

jsonapi_resources :accounting_profiles
jsonapi_resources :auth_profiles
jsonapi_resources :radius_accounting_profiles
jsonapi_resources :radius_auth_profiles

jsonapi_resources :areas
jsonapi_resources :area_prefixes
Expand Down
20 changes: 10 additions & 10 deletions spec/acceptance/rest/admin/api/accounting_profiles_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

require 'rspec_api_documentation/dsl'

RSpec.resource 'Accounting profiles' do
RSpec.resource 'Radius Accounting profiles' do
include_context :acceptance_admin_user
let(:type) { 'accounting-profiles' }
let(:type) { 'radius-accounting-profiles' }

required_params = %i[name server port secret timeout attempts]
optional_params = %i[enable-start-accounting enable-interim-accounting interim-accounting-interval enable-stop-accounting]

get '/api/rest/admin/accounting-profiles' do
jsonapi_filters Api::Rest::Admin::AccountingProfileResource._allowed_filters
get '/api/rest/admin/radius-accounting-profiles' do
jsonapi_filters Api::Rest::Admin::RadiusAccountingProfileResource._allowed_filters

before { create_list(:accounting_profile, 2) }

Expand All @@ -19,16 +19,16 @@
end
end

get '/api/rest/admin/accounting-profiles/:id' do
get '/api/rest/admin/radius-accounting-profiles/:id' do
let(:id) { create(:accounting_profile).id }

example_request 'get specific entry' do
expect(status).to eq(200)
end
end

post '/api/rest/admin/accounting-profiles' do
parameter :type, 'Resource type (accounting_profiles)', scope: :data, required: true
post '/api/rest/admin/radius-accounting-profiles' do
parameter :type, 'Resource type (radius-accounting-profiles)', scope: :data, required: true

jsonapi_attributes(required_params, optional_params)

Expand All @@ -44,8 +44,8 @@
end
end

put '/api/rest/admin/accounting-profiles/:id' do
parameter :type, 'Resource type (accounting_profiles)', scope: :data, required: true
put '/api/rest/admin/radius-accounting-profiles/:id' do
parameter :type, 'Resource type (radius-accounting-profiles)', scope: :data, required: true
parameter :id, 'Accounting profile ID', scope: :data, required: true

jsonapi_attributes(required_params, optional_params)
Expand All @@ -58,7 +58,7 @@
end
end

delete '/api/rest/admin/accounting-profiles/:id' do
delete '/api/rest/admin/radius-accounting-profiles/:id' do
let(:id) { create(:accounting_profile).id }

example_request 'delete entry' do
Expand Down
20 changes: 10 additions & 10 deletions spec/acceptance/rest/admin/api/auth_profiles_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

require 'rspec_api_documentation/dsl'

RSpec.resource 'Auth profiles' do
RSpec.resource 'Radius Auth profiles' do
include_context :acceptance_admin_user
let(:type) { 'auth-profiles' }
let(:type) { 'radius-auth-profiles' }

required_params = %i[name server port secret timeout attempts]
optional_params = %i[enable-start-accounting enable-interim-accounting interim-accounting-interval enable-stop-accounting]

get '/api/rest/admin/auth-profiles' do
jsonapi_filters Api::Rest::Admin::AuthProfileResource._allowed_filters
get '/api/rest/admin/radius-auth-profiles' do
jsonapi_filters Api::Rest::Admin::RadiusAuthProfileResource._allowed_filters

before { create_list(:auth_profile, 2) }

Expand All @@ -19,16 +19,16 @@
end
end

get '/api/rest/admin/auth-profiles/:id' do
get '/api/rest/admin/radius-auth-profiles/:id' do
let(:id) { create(:auth_profile).id }

example_request 'get specific entry' do
expect(status).to eq(200)
end
end

post '/api/rest/admin/auth-profiles' do
parameter :type, 'Resource type (auth-profiles)', scope: :data, required: true
post '/api/rest/admin/radius-auth-profiles' do
parameter :type, 'Resource type (radius-auth-profiles)', scope: :data, required: true

jsonapi_attributes(required_params, optional_params)

Expand All @@ -44,8 +44,8 @@
end
end

put '/api/rest/admin/auth-profiles/:id' do
parameter :type, 'Resource type (auth-profiles)', scope: :data, required: true
put '/api/rest/admin/radius-auth-profiles/:id' do
parameter :type, 'Resource type (radius-auth-profiles)', scope: :data, required: true
parameter :id, 'Auth profile ID', scope: :data, required: true

jsonapi_attributes(required_params, optional_params)
Expand All @@ -58,7 +58,7 @@
end
end

delete '/api/rest/admin/auth-profiles/:id' do
delete '/api/rest/admin/radius-auth-profiles/:id' do
let(:id) { create(:auth_profile).id }

example_request 'delete entry' do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# frozen_string_literal: true

RSpec.describe Api::Rest::Admin::AccountingProfilesController, type: :request do
include_context :json_api_admin_helpers, type: :'accounting-profiles'
RSpec.describe Api::Rest::Admin::RadiusAccountingProfilesController, type: :request do
include_context :json_api_admin_helpers, type: :'radius-accounting-profiles'

describe 'GET /api/rest/admin/accounting-profiles' do
describe 'GET /api/rest/admin/radius-accounting-profiles' do
subject do
get json_api_request_path, params: nil, headers: json_api_request_headers
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# frozen_string_literal: true

RSpec.describe Api::Rest::Admin::AuthProfilesController, type: :request do
include_context :json_api_admin_helpers, type: :'auth-profiles'
RSpec.describe Api::Rest::Admin::RadiusAuthProfilesController, type: :request do
include_context :json_api_admin_helpers, type: :'radius-auth-profiles'

describe 'GET /api/rest/admin/auth-profiles' do
describe 'GET /api/rest/admin/radius-auth-profiles' do
subject do
get json_api_request_path, params: nil, headers: json_api_request_headers
end
Expand Down

0 comments on commit 8702475

Please sign in to comment.