diff --git a/app/controllers/export_controller.rb b/app/controllers/export_controller.rb index a87d8b653..69031155f 100644 --- a/app/controllers/export_controller.rb +++ b/app/controllers/export_controller.rb @@ -3,6 +3,15 @@ class ExportController < ApplicationController before_action :authenticate_user_with_basic_auth! + MEMBER_TYPES = { + "consortium" => "Consortium", + "consortium_organization" => "Consortium Organization", + "direct_member" => "Direct Member", + "member_only" => "Member Only", + "contractual_member" => "Contractual Member", + "registration_agency" => "DOI Registration Agency" + } + def contacts authorize! :export, :contacts @@ -149,7 +158,7 @@ def organizations region: provider.region, focusArea: provider.focus_area, sector: provider.organization_type, - accountType: provider.member_type, + accountType: export_member_type(provider.member_type), generalContactEmail: provider.system_email, groupEmail: provider.group_email, billingStreet: provider.billing_information.address, @@ -274,4 +283,8 @@ def repositories def export_date(date) DateTime.strptime(date, "%Y-%m-%dT%H:%M:%S").strftime("%d/%m/%YT%H:%M:%S.%3NUTC%:z") end + + def export_member_type(member_type) + MEMBER_TYPES[member_type] + end end diff --git a/spec/requests/exports_spec.rb b/spec/requests/exports_spec.rb index efaa430c8..ed19526fc 100644 --- a/spec/requests/exports_spec.rb +++ b/spec/requests/exports_spec.rb @@ -15,7 +15,7 @@ it 'returns organizations', vcr: false do get "/export/organizations", nil, admin_headers - puts last_response.body + expect(last_response.status).to eq(200) csv = last_response.body.lines expect(csv.length).to eq(3)