From 3f0c3a4989f128c7c9aced63ab4199fbd81eef3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serge=20H=C3=A4nni?= Date: Wed, 11 Feb 2026 15:06:32 +0100 Subject: [PATCH 1/2] Add reverse geocoding endpoint to operator API --- lib/ioki/apis/operator_api.rb | 7 ++ .../operator/geocoding_reverse_search.rb | 17 +++++ .../geocoding_reverse_search_result.rb | 73 +++++++++++++++++++ .../geocoding_reverse_search_results.rb | 18 +++++ spec/ioki/operator_api_spec.rb | 15 ++++ 5 files changed, 130 insertions(+) create mode 100644 lib/ioki/model/operator/geocoding_reverse_search.rb create mode 100644 lib/ioki/model/operator/geocoding_reverse_search_result.rb create mode 100644 lib/ioki/model/operator/geocoding_reverse_search_results.rb diff --git a/lib/ioki/apis/operator_api.rb b/lib/ioki/apis/operator_api.rb index 12696bbf..1ded5cad 100644 --- a/lib/ioki/apis/operator_api.rb +++ b/lib/ioki/apis/operator_api.rb @@ -637,6 +637,13 @@ class OperatorApi path: 'details', model_class: Ioki::Model::Operator::GeocodingSearchDetails ), + Endpoints::Create.new( + :geocoding_reverse_search, + base_path: [API_BASE_PATH, 'geocoding', 'reverse', 'products', :id], + path: 'search', + model_class: Ioki::Model::Operator::GeocodingReverseSearchResults, + outgoing_model_class: Ioki::Model::Operator::GeocodingReverseSearch + ), Endpoints::Index.new( :no_shows, base_path: [API_BASE_PATH, 'products', :id], diff --git a/lib/ioki/model/operator/geocoding_reverse_search.rb b/lib/ioki/model/operator/geocoding_reverse_search.rb new file mode 100644 index 00000000..6fbc00e1 --- /dev/null +++ b/lib/ioki/model/operator/geocoding_reverse_search.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Ioki + module Model + module Operator + class GeocodingReverseSearch < Base + attribute :lat, + on: :create, + type: :float + + attribute :lng, + on: :create, + type: :float + end + end + end +end diff --git a/lib/ioki/model/operator/geocoding_reverse_search_result.rb b/lib/ioki/model/operator/geocoding_reverse_search_result.rb new file mode 100644 index 00000000..5b5fa9ea --- /dev/null +++ b/lib/ioki/model/operator/geocoding_reverse_search_result.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +module Ioki + module Model + module Operator + class GeocodingReverseSearchResult < Base + attribute :type, + on: :read, + type: :string + + attribute :id, + on: :read, + type: :string + + attribute :vendor_id, + on: :read, + type: :string + + attribute :vendor, + on: :read, + type: :string + + attribute :vendor_type, + on: :read, + type: :string + + attribute :location_name, + on: :read, + type: :string + + attribute :formatted_address, + on: :read, + type: :string + + attribute :street_name, + on: :read, + type: :string + + attribute :street_number, + on: :read, + type: :string + + attribute :postal_code, + on: :read, + type: :string + + attribute :city, + on: :read, + type: :string + + attribute :county, + on: :read, + type: :string + + attribute :country, + on: :read, + type: :string + + attribute :lat, + on: :read, + type: :float + + attribute :lng, + on: :read, + type: :float + + attribute :result_type, + on: :read, + type: :string + end + end + end +end diff --git a/lib/ioki/model/operator/geocoding_reverse_search_results.rb b/lib/ioki/model/operator/geocoding_reverse_search_results.rb new file mode 100644 index 00000000..d2fbf67f --- /dev/null +++ b/lib/ioki/model/operator/geocoding_reverse_search_results.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Ioki + module Model + module Operator + class GeocodingReverseSearchResults < Base + attribute :type, + on: :read, + type: :string + + attribute :results, + on: :read, + type: :array, + class_name: 'Ioki::Model::Operator::GeocodingReverseSearchResult' + end + end + end +end diff --git a/spec/ioki/operator_api_spec.rb b/spec/ioki/operator_api_spec.rb index 88fed4dd..80b57aa9 100644 --- a/spec/ioki/operator_api_spec.rb +++ b/spec/ioki/operator_api_spec.rb @@ -2870,6 +2870,21 @@ end end + describe '#create_geocoding_reverse_search(id)' do + let(:geocoding_search) { Ioki::Model::Operator::GeocodingReverseSearch.new } + + it 'calls request on the client with expected params' do + expect(operator_client).to receive(:request) do |params| + expect(params[:url].to_s).to eq('operator/geocoding/reverse/products/0815/search') + expect(params[:method]).to eq(:post) + [result_with_data, full_response] + end + + expect(operator_client.create_geocoding_reverse_search('0815', geocoding_search, options)) + .to be_a(Ioki::Model::Operator::GeocodingReverseSearchResults) + end + end + describe '#no_show_acknowledge(product_id, no_show_id)' do it 'calls request on the client with expected params' do expect(operator_client).to receive(:request) do |params| From b1e9d11ca7e93be70a748c55e442fb193222c0a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serge=20H=C3=A4nni?= Date: Mon, 16 Feb 2026 13:53:48 +0100 Subject: [PATCH 2/2] Remove `reverse` namespace --- lib/ioki/apis/operator_api.rb | 4 ++-- spec/ioki/operator_api_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ioki/apis/operator_api.rb b/lib/ioki/apis/operator_api.rb index 1ded5cad..f28154a1 100644 --- a/lib/ioki/apis/operator_api.rb +++ b/lib/ioki/apis/operator_api.rb @@ -639,8 +639,8 @@ class OperatorApi ), Endpoints::Create.new( :geocoding_reverse_search, - base_path: [API_BASE_PATH, 'geocoding', 'reverse', 'products', :id], - path: 'search', + base_path: [API_BASE_PATH, 'geocoding', 'products', :id], + path: 'reverse_search', model_class: Ioki::Model::Operator::GeocodingReverseSearchResults, outgoing_model_class: Ioki::Model::Operator::GeocodingReverseSearch ), diff --git a/spec/ioki/operator_api_spec.rb b/spec/ioki/operator_api_spec.rb index 80b57aa9..392f4000 100644 --- a/spec/ioki/operator_api_spec.rb +++ b/spec/ioki/operator_api_spec.rb @@ -2875,7 +2875,7 @@ it 'calls request on the client with expected params' do expect(operator_client).to receive(:request) do |params| - expect(params[:url].to_s).to eq('operator/geocoding/reverse/products/0815/search') + expect(params[:url].to_s).to eq('operator/geocoding/products/0815/reverse_search') expect(params[:method]).to eq(:post) [result_with_data, full_response] end