mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
Rename params
This commit is contained in:
parent
3fd7634657
commit
ab765a4370
5 changed files with 22 additions and 20 deletions
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
module Maps
|
||||
class H3HexagonRenderer
|
||||
def initialize(params:, current_api_user: nil)
|
||||
def initialize(params:, user: nil)
|
||||
@params = params
|
||||
@current_api_user = current_api_user
|
||||
@user = user
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
@ -18,12 +18,12 @@ module Maps
|
|||
|
||||
private
|
||||
|
||||
attr_reader :params, :current_api_user
|
||||
attr_reader :params, :user
|
||||
|
||||
def resolve_context
|
||||
Maps::HexagonContextResolver.call(
|
||||
params: params,
|
||||
current_api_user: current_api_user
|
||||
user: user
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ module Maps
|
|||
class HexagonContextResolver
|
||||
class SharedStatsNotFoundError < StandardError; end
|
||||
|
||||
def self.call(params:, current_api_user: nil)
|
||||
new(params: params, current_api_user: current_api_user).call
|
||||
def self.call(params:, user: nil)
|
||||
new(params: params, user: user).call
|
||||
end
|
||||
|
||||
def initialize(params:, current_api_user: nil)
|
||||
def initialize(params:, user: nil)
|
||||
@params = params
|
||||
@current_api_user = current_api_user
|
||||
@user = user
|
||||
end
|
||||
|
||||
def call
|
||||
|
|
@ -21,7 +21,7 @@ module Maps
|
|||
|
||||
private
|
||||
|
||||
attr_reader :params, :current_api_user
|
||||
attr_reader :params, :user
|
||||
|
||||
def public_sharing_request?
|
||||
params[:uuid].present?
|
||||
|
|
@ -46,7 +46,7 @@ module Maps
|
|||
|
||||
def resolve_authenticated_context
|
||||
{
|
||||
target_user: current_api_user,
|
||||
user: user,
|
||||
start_date: params[:start_date],
|
||||
end_date: params[:end_date],
|
||||
stat: nil
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ RSpec.describe Maps::BoundsCalculator do
|
|||
describe '.call' do
|
||||
subject(:calculate_bounds) do
|
||||
described_class.new(
|
||||
target_user: target_user,
|
||||
user: target_user,
|
||||
start_date: start_date,
|
||||
end_date: end_date
|
||||
).call
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ RSpec.describe Maps::HexagonContextResolver do
|
|||
subject(:resolve_context) do
|
||||
described_class.call(
|
||||
params: params,
|
||||
current_api_user: current_api_user
|
||||
user: current_api_user
|
||||
)
|
||||
end
|
||||
|
||||
|
|
@ -25,12 +25,14 @@ RSpec.describe Maps::HexagonContextResolver do
|
|||
it 'resolves authenticated context' do
|
||||
result = resolve_context
|
||||
|
||||
expect(result).to match({
|
||||
target_user: current_api_user,
|
||||
start_date: '2024-06-01T00:00:00Z',
|
||||
end_date: '2024-06-30T23:59:59Z',
|
||||
stat: nil
|
||||
})
|
||||
expect(result).to match(
|
||||
{
|
||||
user: current_api_user,
|
||||
start_date: '2024-06-01T00:00:00Z',
|
||||
end_date: '2024-06-30T23:59:59Z',
|
||||
stat: nil
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -99,4 +101,4 @@ RSpec.describe Maps::HexagonContextResolver do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ RSpec.describe Maps::HexagonRequestHandler do
|
|||
subject(:handle_request) do
|
||||
described_class.new(
|
||||
params: params,
|
||||
current_api_user: current_api_user
|
||||
user: current_api_user
|
||||
).call
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue