Skip to content

Commit

Permalink
Merge pull request #265 from datacite/bug_index_provider_with-billing
Browse files Browse the repository at this point in the history
Bug index provider with billing
  • Loading branch information
kjgarza authored May 7, 2019
2 parents 55f5c13 + bd86d18 commit 6423eaa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/models/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ def as_indexed_json(options={})
"joined" => joined,
"twitter_handle" => twitter_handle,
"ror_id" => ror_id,
"billing_information" => billing_information,
"billing_information" => {
"address" => address,
"postCode" => post_code,
"state" => state,
"city" => city
},
"created" => created,
"updated" => updated,
"deleted_at" => deleted_at,
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/provider_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ProviderSerializer
end

attribute :billing_information, if: Proc.new { |object, params| params[:current_ability] && params[:current_ability].can?(:read_billing_information, object) == true } do |object|
object.billing_information.transform_keys!{ |key| key.to_s.camelcase(:lower) } if object.billing_information.present?
object.billing_information.present? ? object.billing_information.transform_keys!{ |key| key.to_s.camelcase(:lower) } : {}
end

attribute :twitter_handle, if: Proc.new { |object, params| params[:current_ability] && params[:current_ability].can?(:read_billing_information, object) == true } do |object|
Expand Down

0 comments on commit 6423eaa

Please sign in to comment.