Skip to content

Commit

Permalink
update create request class names (#749)
Browse files Browse the repository at this point in the history
Co-authored-by: Robert-Anthony Lee-Faison <[email protected]>
  • Loading branch information
Seanwarren77 and leefaisonr authored May 30, 2024
1 parent a3b5b9c commit 7d2ca80
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module Mediaflux
module Http
class CreateCollectionQuotaRequest < Request
class QuotaCreateCollectionRequest < Request
attr_reader :name, :collection, :allocation

# Constructor
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions app/models/project_mediaflux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions lib/tasks/authorization.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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" }
Expand Down

0 comments on commit 7d2ca80

Please sign in to comment.