Skip to content

Commit

Permalink
Merge pull request #1006 from sul-dlss/refactor-response-method-names
Browse files Browse the repository at this point in the history
Rename methods to indicate different responses
  • Loading branch information
cbeer authored Nov 3, 2023
2 parents edfac11 + fcecd3d commit 42ddfdb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/services/media_authentication_json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def initialize(user:, media:, auth_url:, ability:)
end

def as_json(*)
return stanford_or_location_restricted_json if location_grants_access? && stanford_grants_access?
return location_only_restricted_json if location_grants_access?
return stanford_only_restricted_json if stanford_grants_access?
return stanford_or_location_response if location_grants_access? && stanford_grants_access?
return location_only_response if location_grants_access?
return stanford_only_response if stanford_grants_access?

{}
end
Expand All @@ -23,19 +23,19 @@ def as_json(*)

attr_reader :auth_url, :media, :user, :ability

def location_only_restricted_json
def location_only_response
{
status: [:location_restricted]
}
end

def stanford_only_restricted_json
def stanford_only_response
{
status: [:stanford_restricted]
}.merge(login_service)
end

def stanford_or_location_restricted_json
def stanford_or_location_response
{
status: [
:stanford_restricted,
Expand Down

0 comments on commit 42ddfdb

Please sign in to comment.