Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/ioki/apis/operator_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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', 'products', :id],
path: 'reverse_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],
Expand Down
17 changes: 17 additions & 0 deletions lib/ioki/model/operator/geocoding_reverse_search.rb
Original file line number Diff line number Diff line change
@@ -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
73 changes: 73 additions & 0 deletions lib/ioki/model/operator/geocoding_reverse_search_result.rb
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions lib/ioki/model/operator/geocoding_reverse_search_results.rb
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions spec/ioki/operator_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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/products/0815/reverse_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|
Expand Down