Rename params

This commit is contained in:
Eugene Burmakin 2025-09-18 20:10:00 +02:00
parent 3fd7634657
commit ab765a4370
5 changed files with 22 additions and 20 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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,
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

View file

@ -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