Skip to content

Commit

Permalink
capture street-number for formatted billing address. datacite/bracco#341
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Feb 28, 2020
1 parent 113f562 commit 791021c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/controllers/export_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def organizations
accountType: provider.member_type_label,
generalContactEmail: provider.system_email,
groupEmail: provider.group_email,
billingStreetNumber: provider.billing_street_number,
billingStreet: provider.billing_address,
billingPostalCode: provider.billing_post_code,
billingCity: provider.billing_city,
Expand Down
9 changes: 8 additions & 1 deletion app/models/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ class Provider < ActiveRecord::Base
organization: { type: :text},
department: { type: :text},
city: { type: :text },
country: { type: :text },
country: { type: :keyword },
streetNumber: { type: :text },
address: { type: :text }}
indexes :technical_contact, type: :object, properties: {
email: { type: :text },
Expand Down Expand Up @@ -208,6 +209,7 @@ def as_indexed_json(options={})
"salesforce_id" => salesforce_id,
"globus_uuid" => globus_uuid,
"billing_information" => {
"streetNumber" => billing_street_number,
"address" => billing_address,
"organization" => billing_organization,
"department" => billing_department,
Expand Down Expand Up @@ -281,6 +283,7 @@ def csv
voting_contact_email: voting_contact_email,
voting_contact_given_name: voting_contact_given_name,
voting_contact_family_name: voting_contact_family_name,
billing_street_number: billing_street_number,
billing_address: billing_address,
billing_post_code: billing_post_code,
billing_city: billing_city,
Expand Down Expand Up @@ -388,6 +391,10 @@ def billing_organization
billing_information.fetch("organization",nil) if billing_information.present?
end

def billing_street_number
billing_information.fetch("street_number",nil) if billing_information.present?
end

def billing_address
billing_information.fetch("address",nil) if billing_information.present?
end
Expand Down

0 comments on commit 791021c

Please sign in to comment.