From 7d2ca80d22debcfb4c0838dfd4635effbbeb2ed6 Mon Sep 17 00:00:00 2001 From: Sean Warren <114531465+Seanwarren77@users.noreply.github.com> Date: Thu, 30 May 2024 09:59:25 -0400 Subject: [PATCH] update create request class names (#749) Co-authored-by: Robert-Anthony Lee-Faison --- ...equest.rb => accumulator_create_collection_request.rb} | 2 +- ...uota_request.rb => quota_create_collection_request.rb} | 2 +- .../{create_token_request.rb => token_create_request.rb} | 2 +- app/models/project_mediaflux.rb | 6 +++--- lib/tasks/authorization.rake | 8 ++++---- ...c.rb => accumulator_create_collection_request_spec.rb} | 2 +- ...st_spec.rb => quota_create_collection_request_spec.rb} | 2 +- ...token_request_spec.rb => token_create_request_spec.rb} | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) rename app/models/mediaflux/http/{create_collection_accumulator_request.rb => accumulator_create_collection_request.rb} (96%) rename app/models/mediaflux/http/{create_collection_quota_request.rb => quota_create_collection_request.rb} (96%) rename app/models/mediaflux/http/{create_token_request.rb => token_create_request.rb} (95%) rename spec/models/mediaflux/http/{create_collection_accumulator_request_spec.rb => accumulator_create_collection_request_spec.rb} (95%) rename spec/models/mediaflux/http/{create_collection_quota_request_spec.rb => quota_create_collection_request_spec.rb} (95%) rename spec/models/mediaflux/http/{create_token_request_spec.rb => token_create_request_spec.rb} (94%) diff --git a/app/models/mediaflux/http/create_collection_accumulator_request.rb b/app/models/mediaflux/http/accumulator_create_collection_request.rb similarity index 96% rename from app/models/mediaflux/http/create_collection_accumulator_request.rb rename to app/models/mediaflux/http/accumulator_create_collection_request.rb index 90b782ee..a42d0dc2 100644 --- a/app/models/mediaflux/http/create_collection_accumulator_request.rb +++ b/app/models/mediaflux/http/accumulator_create_collection_request.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Mediaflux module Http - class CreateCollectionAccumulatorRequest < Request + class AccumulatorCreateCollectionRequest < Request attr_reader :namespace, :asset_name, :collection # Constructor diff --git a/app/models/mediaflux/http/create_collection_quota_request.rb b/app/models/mediaflux/http/quota_create_collection_request.rb similarity index 96% rename from app/models/mediaflux/http/create_collection_quota_request.rb rename to app/models/mediaflux/http/quota_create_collection_request.rb index f81ef52c..92451801 100644 --- a/app/models/mediaflux/http/create_collection_quota_request.rb +++ b/app/models/mediaflux/http/quota_create_collection_request.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Mediaflux module Http - class CreateCollectionQuotaRequest < Request + class QuotaCreateCollectionRequest < Request attr_reader :name, :collection, :allocation # Constructor diff --git a/app/models/mediaflux/http/create_token_request.rb b/app/models/mediaflux/http/token_create_request.rb similarity index 95% rename from app/models/mediaflux/http/create_token_request.rb rename to app/models/mediaflux/http/token_create_request.rb index b7ed9c9e..da1193d1 100644 --- a/app/models/mediaflux/http/create_token_request.rb +++ b/app/models/mediaflux/http/token_create_request.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Mediaflux module Http - class CreateTokenRequest < Request + class TokenCreateRequest < Request # Specifies the logon service within the Mediaflux API # @return [String] def self.service diff --git a/app/models/project_mediaflux.rb b/app/models/project_mediaflux.rb index 9308637f..65b9e8bd 100644 --- a/app/models/project_mediaflux.rb +++ b/app/models/project_mediaflux.rb @@ -62,14 +62,14 @@ def self.create!(project:, session_id:, xml_namespace: nil) # @param mediaflux_project_id [] the id of the project that needs accumulators # @param session_id [] the session id for the user who is currently authenticated to MediaFlux def self.create_accumulators(mediaflux_project_id:, session_id:) - accum_count = Mediaflux::Http::CreateCollectionAccumulatorRequest.new( + accum_count = Mediaflux::Http::AccumulatorCreateCollectionRequest.new( session_token: session_id, name: "accum-count", collection: mediaflux_project_id, type: "collection.asset.count" ) accum_count.resolve - accum_size = Mediaflux::Http::CreateCollectionAccumulatorRequest.new( + accum_size = Mediaflux::Http::AccumulatorCreateCollectionRequest.new( session_token: session_id, name: "accum-size", collection: mediaflux_project_id, @@ -81,7 +81,7 @@ def self.create_accumulators(mediaflux_project_id:, session_id:) def self.create_quota(project:, mediaflux_project_id:, session_id:) #TODO: SHOULD WE CREATE A PROJECT USING REQUESTED VALUES OR APPROVED VALUES? allocation = project.metadata_json["storage_capacity"]["size"]["requested"].to_s << " " << project.metadata_json["storage_capacity"]["unit"]["requested"] - quota_request = Mediaflux::Http::CreateCollectionQuotaRequest.new( + quota_request = Mediaflux::Http::QuotaCreateCollectionRequest.new( session_token: session_id, collection: mediaflux_project_id, allocation: allocation diff --git a/lib/tasks/authorization.rake b/lib/tasks/authorization.rake index f9ec014c..4f198b99 100644 --- a/lib/tasks/authorization.rake +++ b/lib/tasks/authorization.rake @@ -9,7 +9,7 @@ namespace :authorization do main_logon = Mediaflux::Http::LogonRequest.new main_logon.resolve time_action("1 New Token") do - create = Mediaflux::Http::CreateTokenRequest.new(domain: Mediaflux::Http::LogonRequest.mediaflux_domain, user: Mediaflux::Http::LogonRequest.mediaflux_user, + create = Mediaflux::Http::TokenCreateRequest.new(domain: Mediaflux::Http::LogonRequest.mediaflux_domain, user: Mediaflux::Http::LogonRequest.mediaflux_user, session_token: main_logon.session_token) identity_token = create.identity logon = Mediaflux::Http::LogonRequest.new(identity_token: identity_token) @@ -19,7 +19,7 @@ namespace :authorization do time_action("1000 New Tokens") do 1000.times do - create = Mediaflux::Http::CreateTokenRequest.new(domain: Mediaflux::Http::LogonRequest.mediaflux_domain, user: Mediaflux::Http::LogonRequest.mediaflux_user, + create = Mediaflux::Http::TokenCreateRequest.new(domain: Mediaflux::Http::LogonRequest.mediaflux_domain, user: Mediaflux::Http::LogonRequest.mediaflux_user, session_token: main_logon.session_token) identity_token = create.identity logon = Mediaflux::Http::LogonRequest.new(identity_token: identity_token) @@ -33,7 +33,7 @@ namespace :authorization do task by_existing_token: :environment do logon = Mediaflux::Http::LogonRequest.new logon.resolve - create = Mediaflux::Http::CreateTokenRequest.new(domain: Mediaflux::Http::LogonRequest.mediaflux_domain, user: Mediaflux::Http::LogonRequest.mediaflux_user, session_token: logon.session_token) + create = Mediaflux::Http::TokenCreateRequest.new(domain: Mediaflux::Http::LogonRequest.mediaflux_domain, user: Mediaflux::Http::LogonRequest.mediaflux_user, session_token: logon.session_token) identity_token = create.identity time_action("1 Existing Token") do logon = Mediaflux::Http::LogonRequest.new(identity_token: identity_token) @@ -98,7 +98,7 @@ namespace :authorization do task service_with_token: :environment do logon = Mediaflux::Http::LogonRequest.new logon.resolve - create = Mediaflux::Http::CreateTokenRequest.new(domain: Mediaflux::Http::LogonRequest.mediaflux_domain, user: Mediaflux::Http::LogonRequest.mediaflux_user, session_token: logon.session_token) + create = Mediaflux::Http::TokenCreateRequest.new(domain: Mediaflux::Http::LogonRequest.mediaflux_domain, user: Mediaflux::Http::LogonRequest.mediaflux_user, session_token: logon.session_token) identity_token = create.identity time_action("1 list namespaces with token") do sexec = Mediaflux::Http::ServiceExecuteRequest.new(session_token: logon.session_token, service_name: "asset.namespace.list", token: identity_token) diff --git a/spec/models/mediaflux/http/create_collection_accumulator_request_spec.rb b/spec/models/mediaflux/http/accumulator_create_collection_request_spec.rb similarity index 95% rename from spec/models/mediaflux/http/create_collection_accumulator_request_spec.rb rename to spec/models/mediaflux/http/accumulator_create_collection_request_spec.rb index cc5940f4..99b674f3 100644 --- a/spec/models/mediaflux/http/create_collection_accumulator_request_spec.rb +++ b/spec/models/mediaflux/http/accumulator_create_collection_request_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "rails_helper" -RSpec.describe Mediaflux::Http::CreateCollectionAccumulatorRequest, type: :model do +RSpec.describe Mediaflux::Http::AccumulatorCreateCollectionRequest, type: :model do let(:mediflux_url) { "http://mediaflux.example.com:8888/__mflux_svc__" } let(:create_response) do diff --git a/spec/models/mediaflux/http/create_collection_quota_request_spec.rb b/spec/models/mediaflux/http/quota_create_collection_request_spec.rb similarity index 95% rename from spec/models/mediaflux/http/create_collection_quota_request_spec.rb rename to spec/models/mediaflux/http/quota_create_collection_request_spec.rb index ac2d9fd6..c12234a8 100644 --- a/spec/models/mediaflux/http/create_collection_quota_request_spec.rb +++ b/spec/models/mediaflux/http/quota_create_collection_request_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "rails_helper" -RSpec.describe Mediaflux::Http::CreateCollectionQuotaRequest, type: :model do +RSpec.describe Mediaflux::Http::QuotaCreateCollectionRequest, type: :model do let(:mediaflux_url) { "http://mediaflux.example.com:8888/__mflux_svc__" } let(:create_response) do diff --git a/spec/models/mediaflux/http/create_token_request_spec.rb b/spec/models/mediaflux/http/token_create_request_spec.rb similarity index 94% rename from spec/models/mediaflux/http/create_token_request_spec.rb rename to spec/models/mediaflux/http/token_create_request_spec.rb index 25fa694d..24caffc3 100644 --- a/spec/models/mediaflux/http/create_token_request_spec.rb +++ b/spec/models/mediaflux/http/token_create_request_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "rails_helper" -RSpec.describe Mediaflux::Http::CreateTokenRequest, type: :model do +RSpec.describe Mediaflux::Http::TokenCreateRequest, type: :model do subject(:request) { described_class.new(session_token: session_token, domain: "example", user: "atest") } let(:session_token) { "test-session-token" }