Skip to content

Commit

Permalink
member_type in correct format
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Mar 8, 2020
1 parent f95c791 commit 611257a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion app/controllers/export_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion spec/requests/exports_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 611257a

Please sign in to comment.