travel_time 0.7.1 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8619a3e6ff8d9ce035fc6555fe3e30a2999a50f3256bc4255d78908c2b907b0
4
- data.tar.gz: 27fe8e9eb8a094fe7754b96127c50472b97ab6b3df27ea4da5e281bd4167ce1c
3
+ metadata.gz: 91279926b05e377d9d73d3f98be36f2db93a734e69d63a282f387fdb7bb6cc4c
4
+ data.tar.gz: 9447eae966f88cbc91e5a3b710f3110ad70b2053e74c1140cb1338b7e81bd9bf
5
5
  SHA512:
6
- metadata.gz: a86808588adb53628e88bcc812d6bc43526a2abc23c3e777883bd7c5c6a3ab93999117fa01cfec44d7080777d6dfd65dff15411dba53b2eb76a35bcbe2314a2f
7
- data.tar.gz: '0398e615010b5919ef70dcbfa410226a92c0dd95ed72e99a6127261f302cb9bca12ecd8392c4f4b6b87043e9309cdc92bdab2e4f13dc955ab71ef05f438dff8e'
6
+ metadata.gz: 1ceda4f7bfc94edbaee9680c66f2d415ffba96e0b53e29096f40f852ca0bd5c9ace69f75c21047b5ce4443ccd09866a384ebd9ae4daf12af61114a7dda6d4465
7
+ data.tar.gz: 3d32c9ec52c3805db9956fdc6335f094571d83b96876471784c57a2aa75dca060f222a4b29774875020c7c8c74956d13cda09a18e592d1d5fc542e05562189b4
data/README.md CHANGED
@@ -355,6 +355,10 @@ Body attributes:
355
355
  * transport: Transportation type (string) or Transportation object.
356
356
  * traveltime: Time limit.
357
357
  * with_distance: (Optional) If true, returns distances in addition to travel times.
358
+ * request_type: (Optional) Specifies the request type - either `TravelTime::ProtoUtils::ONE_TO_MANY` (default) or `TravelTime::ProtoUtils::MANY_TO_ONE`.
359
+
360
+ #### One-to-Many (default)
361
+ Search from a single origin to multiple destinations:
358
362
 
359
363
  ```ruby
360
364
  origin = {
@@ -373,7 +377,33 @@ response = client.time_filter_fast_proto(
373
377
  destinations: destinations,
374
378
  transport: 'driving+ferry',
375
379
  traveltime: 7200,
376
- with_distance: true # To also get distances, optional
380
+ with_distance: true, # To also get distances, optional
381
+ request_type: TravelTime::ProtoUtils::ONE_TO_MANY # Optional
382
+ )
383
+ puts(response.body)
384
+ ```
385
+
386
+ #### Many-to-One
387
+ Search from multiple origins to a single destination:
388
+
389
+ ```ruby
390
+ arrival = {
391
+ lat: 51.508930,
392
+ lng: -0.131387,
393
+ }
394
+
395
+ origins = [
396
+ { lat: 51.508824, lng: -0.167093 },
397
+ { lat: 51.536067, lng: -0.153596 }
398
+ ]
399
+
400
+ response = client.time_filter_fast_proto(
401
+ country: 'UK',
402
+ origin: arrival, # arrival/destination point
403
+ destinations: origins, # departure/origin points
404
+ transport: 'public_transport',
405
+ traveltime: 3600,
406
+ request_type: TravelTime::ProtoUtils::MANY_TO_ONE
377
407
  )
378
408
  puts(response.body)
379
409
  ```
@@ -499,6 +529,143 @@ response = client.routes(
499
529
  puts response.body
500
530
  ```
501
531
 
532
+ ### [H3](https://docs.traveltime.com/api/reference/h3)
533
+ Returns travel time statistics for H3 cells in catchment areas.
534
+
535
+ Body attributes:
536
+ * resolution: H3 resolution level (higher = more granular cells).
537
+ Limitations can be found [here](https://docs.traveltime.com/api/reference/h3#limits-of-resolution-and-traveltime).
538
+ * properties: Statistical properties to calculate for each H3 cell ('min', 'max', 'mean').
539
+ * departure_searches: Departure-based searches with specific departure times.
540
+ * arrival_searches: Arrival-based searches with specific arrival times.
541
+ * unions: Union operations combining multiple search results.
542
+ * intersections: Intersection operations finding overlapping areas.
543
+
544
+ ```ruby
545
+ require 'time'
546
+
547
+ departure_search = {
548
+ id: 'public transport from Trafalgar Square',
549
+ departure_time: Time.now.iso8601,
550
+ travel_time: 1800,
551
+ coords: { lat: 51.507609, lng: -0.128315 },
552
+ transportation: { type: 'public_transport' }
553
+ }
554
+
555
+ arrival_search = {
556
+ id: 'public transport to Hyde Park',
557
+ arrival_time: Time.now.iso8601,
558
+ travel_time: 1800,
559
+ coords: { lat: 51.508530, lng: -0.163925 },
560
+ transportation: { type: 'public_transport' }
561
+ }
562
+
563
+ response = client.h3(
564
+ resolution: 5,
565
+ properties: ['min', 'max', 'mean'],
566
+ departure_searches: [departure_search],
567
+ arrival_searches: [arrival_search]
568
+ )
569
+
570
+ puts response.body
571
+ ```
572
+
573
+ ### [H3 Fast](https://docs.traveltime.com/api/reference/h3-fast)
574
+ A high performance version of the H3 endpoint. Returns travel time statistics for H3 cells in catchment areas.
575
+
576
+ Body attributes:
577
+ * resolution: H3 resolution level (higher = more granular cells, allowed values differ based on `travel_time`.
578
+ Limitations can be found [here](https://docs.traveltime.com/api/reference/h3-fast#limits-of-resolution-and-traveltime).
579
+ * properties: Statistical properties to calculate for each H3 cell ('min', 'max', 'mean').
580
+ * arrival_searches: Arrival-based searches with specific arrival times.
581
+ * unions: Union operations combining multiple search results.
582
+ * intersections: Intersection operations finding overlapping areas.
583
+
584
+ ```ruby
585
+ require 'time'
586
+
587
+ arrival_search = {
588
+ one_to_many: [{
589
+ id: 'public transport from Trafalgar Square',
590
+ arrival_time_period: 'weekday_morning',
591
+ travel_time: 1800,
592
+ coords: { lat: 51.507609, lng: -0.128315 },
593
+ transportation: { type: 'public_transport' }
594
+ }]
595
+ }
596
+
597
+ response = client.h3_fast(
598
+ resolution: 5,
599
+ properties: ['min', 'max', 'mean'],
600
+ arrival_searches: arrival_search
601
+ )
602
+
603
+ puts response.body
604
+ ```
605
+
606
+ ### [Geohash](https://docs.traveltime.com/api/reference/geohash)
607
+ Returns travel times to geohash cells within travel time catchment areas.
608
+
609
+ Body attributes:
610
+ * resolution: Geohash resolution level (1-6).
611
+ * properties: Statistical properties to calculate for each geohash cell ('min', 'max', 'mean').
612
+ * departure_searches: Departure-based searches with specific departure times.
613
+ * arrival_searches: Arrival-based searches with specific arrival time.
614
+ * unions: Union operations combining multiple search results.
615
+ * intersections: Intersection operations finding overlapping areas.
616
+
617
+ ```ruby
618
+ require 'time'
619
+
620
+ departure_search = {
621
+ id: 'public transport from Trafalgar Square',
622
+ departure_time: Time.now.iso8601,
623
+ travel_time: 1800,
624
+ coords: { lat: 51.507609, lng: -0.128315 },
625
+ transportation: { type: 'public_transport' }
626
+ }
627
+
628
+ response = client.geohash(
629
+ resolution: 3,
630
+ properties: ['min', 'max', 'mean'],
631
+ departure_searches: [departure_search]
632
+ )
633
+
634
+ puts response.body
635
+ ```
636
+
637
+ ### [Geohash Fast](https://docs.traveltime.com/api/reference/geohash-fast)
638
+ A high performance version of the Geohash endpoint. Returns travel times to geohash cells within travel time catchment areas.
639
+
640
+ Body attributes:
641
+ * resolution: Geohash resolution level (1-6).
642
+ * properties: Statistical properties to calculate for each geohash cell ('min', 'max', 'mean').
643
+ * arrival_searches: Arrival-based searches with specific arrival times.
644
+ * unions: Union operations combining multiple search results.
645
+ * intersections: Intersection operations finding overlapping areas.
646
+
647
+ ```ruby
648
+ require 'time'
649
+
650
+ arrival_search = {
651
+ one_to_many: [{
652
+ id: 'public transport from Trafalgar Square',
653
+ arrival_time_period: 'weekday_morning',
654
+ travel_time: 1800,
655
+ coords: { lat: 51.507609, lng: -0.128315 },
656
+ transportation: { type: 'public_transport' }
657
+ }]
658
+ }
659
+
660
+ response = client.geohash_fast(
661
+ resolution: 3,
662
+ properties: ['min', 'max', 'mean'],
663
+ arrival_searches: arrival_search
664
+ )
665
+
666
+ puts response.body
667
+ ```
668
+
502
669
  ### [Geocoding (Search)](https://docs.traveltime.com/api/reference/geocoding-search)
503
670
  Match a query string to geographic coordinates.
504
671
 
@@ -672,11 +839,11 @@ This is optional, but enables you not installing gems to system directories.
672
839
 
673
840
  1. Install RVM: https://rvm.io/
674
841
  2. Optional gnome-terminal integration: https://rvm.io/integration/gnome-terminal
675
- 3. Install and set up Ruby with RVM:
842
+ 3. Install and set up Ruby with RVM (Ruby 3.2 or higher required):
676
843
  ```shell
677
- rvm install ruby-3.2.2
678
- rvm alias create default ruby-3.2.2
679
- rvm use ruby-3.2.2
844
+ rvm install ruby-3.3.8
845
+ rvm alias create default ruby-3.3.8
846
+ rvm use ruby-3.3.8
680
847
  rvm gemset create traveltime-sdk
681
848
  ```
682
849
 
@@ -711,6 +878,10 @@ If `.proto` files were changed, you can generate Ruby code like this:
711
878
  ```bash
712
879
  # For example, if current dir is project root
713
880
  protoc --proto_path=lib/travel_time/proto/source --ruby_out=lib lib/travel_time/proto/source/*.proto
881
+ ```
882
+
883
+ Use protoc matching the oldest google-protobuf runtime the gemspec allows (protoc v25.x for the 3.25 floor):
884
+ generated code only loads on runtimes from its own major version and the next one.
714
885
 
715
886
  ### Release
716
887
 
@@ -1,54 +1,34 @@
1
+ # frozen_string_literal: true
1
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
3
  # source: RequestsCommon.proto
3
4
 
4
5
  require 'google/protobuf'
5
6
 
6
- Google::Protobuf::DescriptorPool.generated_pool.build do
7
- add_file("RequestsCommon.proto", :syntax => :proto3) do
8
- add_message "com.igeolise.traveltime.rabbitmq.requests.Coords" do
9
- optional :lat, :float, 1
10
- optional :lng, :float, 2
11
- end
12
- add_message "com.igeolise.traveltime.rabbitmq.requests.Transportation" do
13
- optional :type, :enum, 1, "com.igeolise.traveltime.rabbitmq.requests.TransportationType"
14
- oneof :transportationDetails do
15
- optional :publicTransport, :message, 2, "com.igeolise.traveltime.rabbitmq.requests.PublicTransportDetails"
16
- optional :drivingAndPublicTransport, :message, 3, "com.igeolise.traveltime.rabbitmq.requests.DrivingAndPublicTransportDetails"
17
- end
18
- end
19
- add_message "com.igeolise.traveltime.rabbitmq.requests.PublicTransportDetails" do
20
- optional :walkingTimeToStation, :message, 1, "com.igeolise.traveltime.rabbitmq.requests.OptionalPositiveUInt32"
21
- end
22
- add_message "com.igeolise.traveltime.rabbitmq.requests.DrivingAndPublicTransportDetails" do
23
- optional :walkingTimeToStation, :message, 1, "com.igeolise.traveltime.rabbitmq.requests.OptionalPositiveUInt32"
24
- optional :drivingTimeToStation, :message, 2, "com.igeolise.traveltime.rabbitmq.requests.OptionalPositiveUInt32"
25
- optional :parkingTime, :message, 3, "com.igeolise.traveltime.rabbitmq.requests.OptionalNonNegativeUInt32"
26
- end
27
- add_message "com.igeolise.traveltime.rabbitmq.requests.OptionalPositiveUInt32" do
28
- optional :value, :uint32, 1
29
- end
30
- add_message "com.igeolise.traveltime.rabbitmq.requests.OptionalNonNegativeUInt32" do
31
- optional :value, :uint32, 1
32
- end
33
- add_enum "com.igeolise.traveltime.rabbitmq.requests.TransportationType" do
34
- value :PUBLIC_TRANSPORT, 0
35
- value :DRIVING, 1
36
- value :DRIVING_AND_PUBLIC_TRANSPORT, 2
37
- value :DRIVING_AND_FERRY, 3
38
- value :WALKING, 4
39
- value :WALKING_AND_FERRY, 7
40
- value :CYCLING, 5
41
- value :CYCLING_AND_FERRY, 6
42
- end
43
- add_enum "com.igeolise.traveltime.rabbitmq.requests.TimePeriod" do
44
- value :WEEKDAY_MORNING, 0
45
- end
46
- add_enum "com.igeolise.traveltime.rabbitmq.requests.CellPropertyType" do
47
- value :MEAN, 0
48
- value :MIN, 1
49
- value :MAX, 2
7
+
8
+ descriptor_data = "\n\x14RequestsCommon.proto\x12)com.igeolise.traveltime.rabbitmq.requests\"\"\n\x06\x43oords\x12\x0b\n\x03lat\x18\x01 \x01(\x02\x12\x0b\n\x03lng\x18\x02 \x01(\x02\"\xc6\x02\n\x0eTransportation\x12K\n\x04type\x18\x01 \x01(\x0e\x32=.com.igeolise.traveltime.rabbitmq.requests.TransportationType\x12\\\n\x0fpublicTransport\x18\x02 \x01(\x0b\x32\x41.com.igeolise.traveltime.rabbitmq.requests.PublicTransportDetailsH\x00\x12p\n\x19\x64rivingAndPublicTransport\x18\x03 \x01(\x0b\x32K.com.igeolise.traveltime.rabbitmq.requests.DrivingAndPublicTransportDetailsH\x00\x42\x17\n\x15transportationDetails\"y\n\x16PublicTransportDetails\x12_\n\x14walkingTimeToStation\x18\x01 \x01(\x0b\x32\x41.com.igeolise.traveltime.rabbitmq.requests.OptionalPositiveUInt32\"\xbf\x02\n DrivingAndPublicTransportDetails\x12_\n\x14walkingTimeToStation\x18\x01 \x01(\x0b\x32\x41.com.igeolise.traveltime.rabbitmq.requests.OptionalPositiveUInt32\x12_\n\x14\x64rivingTimeToStation\x18\x02 \x01(\x0b\x32\x41.com.igeolise.traveltime.rabbitmq.requests.OptionalPositiveUInt32\x12Y\n\x0bparkingTime\x18\x03 \x01(\x0b\x32\x44.com.igeolise.traveltime.rabbitmq.requests.OptionalNonNegativeUInt32\"\'\n\x16OptionalPositiveUInt32\x12\r\n\x05value\x18\x01 \x01(\r\"*\n\x19OptionalNonNegativeUInt32\x12\r\n\x05value\x18\x01 \x01(\r*\xb8\x01\n\x12TransportationType\x12\x14\n\x10PUBLIC_TRANSPORT\x10\x00\x12\x0b\n\x07\x44RIVING\x10\x01\x12 \n\x1c\x44RIVING_AND_PUBLIC_TRANSPORT\x10\x02\x12\x15\n\x11\x44RIVING_AND_FERRY\x10\x03\x12\x0b\n\x07WALKING\x10\x04\x12\x15\n\x11WALKING_AND_FERRY\x10\x07\x12\x0b\n\x07\x43YCLING\x10\x05\x12\x15\n\x11\x43YCLING_AND_FERRY\x10\x06*!\n\nTimePeriod\x12\x13\n\x0fWEEKDAY_MORNING\x10\x00*.\n\x10\x43\x65llPropertyType\x12\x08\n\x04MEAN\x10\x00\x12\x07\n\x03MIN\x10\x01\x12\x07\n\x03MAX\x10\x02\x62\x06proto3"
9
+
10
+ pool = Google::Protobuf::DescriptorPool.generated_pool
11
+
12
+ begin
13
+ pool.add_serialized_file(descriptor_data)
14
+ rescue TypeError
15
+ # Compatibility code: will be removed in the next major version.
16
+ require 'google/protobuf/descriptor_pb'
17
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
18
+ parsed.clear_dependency
19
+ serialized = parsed.class.encode(parsed)
20
+ file = pool.add_serialized_file(serialized)
21
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
22
+ imports = [
23
+ ]
24
+ imports.each do |type_name, expected_filename|
25
+ import_file = pool.lookup(type_name).file_descriptor
26
+ if import_file.name != expected_filename
27
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
50
28
  end
51
29
  end
30
+ warn "Each proto file must use a consistent fully-qualified name."
31
+ warn "This will become an error in the next major version."
52
32
  end
53
33
 
54
34
  module Com
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
3
  # source: TimeFilterFastRequest.proto
3
4
 
@@ -5,33 +6,32 @@ require 'google/protobuf'
5
6
 
6
7
  require 'RequestsCommon_pb'
7
8
 
8
- Google::Protobuf::DescriptorPool.generated_pool.build do
9
- add_file("TimeFilterFastRequest.proto", :syntax => :proto3) do
10
- add_message "com.igeolise.traveltime.rabbitmq.requests.TimeFilterFastRequest" do
11
- optional :oneToManyRequest, :message, 1, "com.igeolise.traveltime.rabbitmq.requests.TimeFilterFastRequest.OneToMany"
12
- optional :manyToOneRequest, :message, 2, "com.igeolise.traveltime.rabbitmq.requests.TimeFilterFastRequest.ManyToOne"
13
- end
14
- add_message "com.igeolise.traveltime.rabbitmq.requests.TimeFilterFastRequest.OneToMany" do
15
- optional :departureLocation, :message, 1, "com.igeolise.traveltime.rabbitmq.requests.Coords"
16
- repeated :locationDeltas, :sint32, 2
17
- optional :transportation, :message, 3, "com.igeolise.traveltime.rabbitmq.requests.Transportation"
18
- optional :arrivalTimePeriod, :enum, 4, "com.igeolise.traveltime.rabbitmq.requests.TimePeriod"
19
- optional :travelTime, :sint32, 5
20
- repeated :properties, :enum, 6, "com.igeolise.traveltime.rabbitmq.requests.TimeFilterFastRequest.Property"
21
- end
22
- add_message "com.igeolise.traveltime.rabbitmq.requests.TimeFilterFastRequest.ManyToOne" do
23
- optional :arrivalLocation, :message, 1, "com.igeolise.traveltime.rabbitmq.requests.Coords"
24
- repeated :locationDeltas, :sint32, 2
25
- optional :transportation, :message, 3, "com.igeolise.traveltime.rabbitmq.requests.Transportation"
26
- optional :arrivalTimePeriod, :enum, 4, "com.igeolise.traveltime.rabbitmq.requests.TimePeriod"
27
- optional :travelTime, :sint32, 5
28
- repeated :properties, :enum, 6, "com.igeolise.traveltime.rabbitmq.requests.TimeFilterFastRequest.Property"
29
- end
30
- add_enum "com.igeolise.traveltime.rabbitmq.requests.TimeFilterFastRequest.Property" do
31
- value :FARES, 0
32
- value :DISTANCES, 1
9
+
10
+ descriptor_data = "\n\x1bTimeFilterFastRequest.proto\x12)com.igeolise.traveltime.rabbitmq.requests\x1a\x14RequestsCommon.proto\"\x9f\x08\n\x15TimeFilterFastRequest\x12\x64\n\x10oneToManyRequest\x18\x01 \x01(\x0b\x32J.com.igeolise.traveltime.rabbitmq.requests.TimeFilterFastRequest.OneToMany\x12\x64\n\x10manyToOneRequest\x18\x02 \x01(\x0b\x32J.com.igeolise.traveltime.rabbitmq.requests.TimeFilterFastRequest.ManyToOne\x1a\x89\x03\n\tOneToMany\x12L\n\x11\x64\x65partureLocation\x18\x01 \x01(\x0b\x32\x31.com.igeolise.traveltime.rabbitmq.requests.Coords\x12\x16\n\x0elocationDeltas\x18\x02 \x03(\x11\x12Q\n\x0etransportation\x18\x03 \x01(\x0b\x32\x39.com.igeolise.traveltime.rabbitmq.requests.Transportation\x12P\n\x11\x61rrivalTimePeriod\x18\x04 \x01(\x0e\x32\x35.com.igeolise.traveltime.rabbitmq.requests.TimePeriod\x12\x12\n\ntravelTime\x18\x05 \x01(\x11\x12]\n\nproperties\x18\x06 \x03(\x0e\x32I.com.igeolise.traveltime.rabbitmq.requests.TimeFilterFastRequest.Property\x1a\x87\x03\n\tManyToOne\x12J\n\x0f\x61rrivalLocation\x18\x01 \x01(\x0b\x32\x31.com.igeolise.traveltime.rabbitmq.requests.Coords\x12\x16\n\x0elocationDeltas\x18\x02 \x03(\x11\x12Q\n\x0etransportation\x18\x03 \x01(\x0b\x32\x39.com.igeolise.traveltime.rabbitmq.requests.Transportation\x12P\n\x11\x61rrivalTimePeriod\x18\x04 \x01(\x0e\x32\x35.com.igeolise.traveltime.rabbitmq.requests.TimePeriod\x12\x12\n\ntravelTime\x18\x05 \x01(\x11\x12]\n\nproperties\x18\x06 \x03(\x0e\x32I.com.igeolise.traveltime.rabbitmq.requests.TimeFilterFastRequest.Property\"$\n\x08Property\x12\t\n\x05\x46\x41RES\x10\x00\x12\r\n\tDISTANCES\x10\x01\x62\x06proto3"
11
+
12
+ pool = Google::Protobuf::DescriptorPool.generated_pool
13
+
14
+ begin
15
+ pool.add_serialized_file(descriptor_data)
16
+ rescue TypeError
17
+ # Compatibility code: will be removed in the next major version.
18
+ require 'google/protobuf/descriptor_pb'
19
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
20
+ parsed.clear_dependency
21
+ serialized = parsed.class.encode(parsed)
22
+ file = pool.add_serialized_file(serialized)
23
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
24
+ imports = [
25
+ ["com.igeolise.traveltime.rabbitmq.requests.Coords", "RequestsCommon.proto"],
26
+ ]
27
+ imports.each do |type_name, expected_filename|
28
+ import_file = pool.lookup(type_name).file_descriptor
29
+ if import_file.name != expected_filename
30
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
33
31
  end
34
32
  end
33
+ warn "Each proto file must use a consistent fully-qualified name."
34
+ warn "This will become an error in the next major version."
35
35
  end
36
36
 
37
37
  module Com
@@ -1,41 +1,34 @@
1
+ # frozen_string_literal: true
1
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
3
  # source: TimeFilterFastResponse.proto
3
4
 
4
5
  require 'google/protobuf'
5
6
 
6
- Google::Protobuf::DescriptorPool.generated_pool.build do
7
- add_file("TimeFilterFastResponse.proto", :syntax => :proto3) do
8
- add_message "com.igeolise.traveltime.rabbitmq.responses.TimeFilterFastResponse" do
9
- optional :error, :message, 1, "com.igeolise.traveltime.rabbitmq.responses.TimeFilterFastResponse.Error"
10
- optional :properties, :message, 2, "com.igeolise.traveltime.rabbitmq.responses.TimeFilterFastResponse.Properties"
11
- end
12
- add_message "com.igeolise.traveltime.rabbitmq.responses.TimeFilterFastResponse.Properties" do
13
- repeated :travelTimes, :sint32, 1
14
- repeated :monthlyFares, :int32, 2
15
- repeated :distances, :int32, 3
16
- end
17
- add_message "com.igeolise.traveltime.rabbitmq.responses.TimeFilterFastResponse.Error" do
18
- optional :type, :enum, 1, "com.igeolise.traveltime.rabbitmq.responses.TimeFilterFastResponse.ErrorType"
19
- end
20
- add_enum "com.igeolise.traveltime.rabbitmq.responses.TimeFilterFastResponse.ErrorType" do
21
- value :UNKNOWN, 0
22
- value :ONE_TO_MANY_MUST_NOT_BE_NULL, 1
23
- value :SOURCE_MUST_NOT_BE_NULL, 2
24
- value :TRANSPORTATION_MUST_NOT_BE_NULL, 3
25
- value :SOURCE_NOT_IN_GEOMETRY, 4
26
- value :UNRECOGNIZED_TRANSPORTATION_MODE, 5
27
- value :TRAVEL_TIME_LIMIT_TOO_LOW, 6
28
- value :TRAVEL_TIME_LIMIT_TOO_HIGH, 7
29
- value :AUTH_ERROR_NO_USER_ID, 8
30
- value :SERVICE_MISMATCH_WRONG_TRANSPORTATION_MODE, 9
31
- value :SOURCE_OUT_OF_REACH, 10
32
- value :INTERLEAVED_DELTAS_INVALID_COORDINATE_PAIRS, 11
33
- value :DISTANCE_PROPERTY_NOT_SUPPORTED, 12
34
- value :BOTH_MANY_TO_ONE_AND_ONE_TO_MANY_CANNOT_BE_SENT, 13
35
- value :ONE_TO_MANY_OR_MANY_TO_ONE_MUST_NOT_BE_NULL, 14
36
- value :INVALID_PROTO_REQUEST, 15
7
+
8
+ descriptor_data = "\n\x1cTimeFilterFastResponse.proto\x12*com.igeolise.traveltime.rabbitmq.responses\"\x84\x08\n\x16TimeFilterFastResponse\x12[\n\x05\x65rror\x18\x01 \x01(\x0b\x32H.com.igeolise.traveltime.rabbitmq.responses.TimeFilterFastResponse.ErrorB\x02\x18\x01\x12\x61\n\nproperties\x18\x02 \x01(\x0b\x32M.com.igeolise.traveltime.rabbitmq.responses.TimeFilterFastResponse.Properties\x1aJ\n\nProperties\x12\x13\n\x0btravelTimes\x18\x01 \x03(\x11\x12\x14\n\x0cmonthlyFares\x18\x02 \x03(\x05\x12\x11\n\tdistances\x18\x03 \x03(\x05\x1a\x63\n\x05\x45rror\x12Z\n\x04type\x18\x01 \x01(\x0e\x32L.com.igeolise.traveltime.rabbitmq.responses.TimeFilterFastResponse.ErrorType\"\xf8\x04\n\tErrorType\x12\x0f\n\x07UNKNOWN\x10\x00\x1a\x02\x08\x01\x12$\n\x1cONE_TO_MANY_MUST_NOT_BE_NULL\x10\x01\x1a\x02\x08\x01\x12\x1f\n\x17SOURCE_MUST_NOT_BE_NULL\x10\x02\x1a\x02\x08\x01\x12\'\n\x1fTRANSPORTATION_MUST_NOT_BE_NULL\x10\x03\x1a\x02\x08\x01\x12\x1e\n\x16SOURCE_NOT_IN_GEOMETRY\x10\x04\x1a\x02\x08\x01\x12(\n UNRECOGNIZED_TRANSPORTATION_MODE\x10\x05\x1a\x02\x08\x01\x12!\n\x19TRAVEL_TIME_LIMIT_TOO_LOW\x10\x06\x1a\x02\x08\x01\x12\"\n\x1aTRAVEL_TIME_LIMIT_TOO_HIGH\x10\x07\x1a\x02\x08\x01\x12\x1d\n\x15\x41UTH_ERROR_NO_USER_ID\x10\x08\x1a\x02\x08\x01\x12\x32\n*SERVICE_MISMATCH_WRONG_TRANSPORTATION_MODE\x10\t\x1a\x02\x08\x01\x12\x1b\n\x13SOURCE_OUT_OF_REACH\x10\n\x1a\x02\x08\x01\x12\x33\n+INTERLEAVED_DELTAS_INVALID_COORDINATE_PAIRS\x10\x0b\x1a\x02\x08\x01\x12\'\n\x1f\x44ISTANCE_PROPERTY_NOT_SUPPORTED\x10\x0c\x1a\x02\x08\x01\x12\x37\n/BOTH_MANY_TO_ONE_AND_ONE_TO_MANY_CANNOT_BE_SENT\x10\r\x1a\x02\x08\x01\x12\x33\n+ONE_TO_MANY_OR_MANY_TO_ONE_MUST_NOT_BE_NULL\x10\x0e\x1a\x02\x08\x01\x12\x1d\n\x15INVALID_PROTO_REQUEST\x10\x0f\x1a\x02\x08\x01\x62\x06proto3"
9
+
10
+ pool = Google::Protobuf::DescriptorPool.generated_pool
11
+
12
+ begin
13
+ pool.add_serialized_file(descriptor_data)
14
+ rescue TypeError
15
+ # Compatibility code: will be removed in the next major version.
16
+ require 'google/protobuf/descriptor_pb'
17
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
18
+ parsed.clear_dependency
19
+ serialized = parsed.class.encode(parsed)
20
+ file = pool.add_serialized_file(serialized)
21
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
22
+ imports = [
23
+ ]
24
+ imports.each do |type_name, expected_filename|
25
+ import_file = pool.lookup(type_name).file_descriptor
26
+ if import_file.name != expected_filename
27
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
37
28
  end
38
29
  end
30
+ warn "Each proto file must use a consistent fully-qualified name."
31
+ warn "This will become an error in the next major version."
39
32
  end
40
33
 
41
34
  module Com
@@ -10,6 +10,7 @@ module TravelTime
10
10
  # The Client class provides the main interface to interact with the TravelTime API
11
11
  class Client # rubocop:disable Metrics/ClassLength
12
12
  extend Limiter::Mixin
13
+
13
14
  API_BASE_URL = 'https://api.traveltimeapp.com/v4/'
14
15
 
15
16
  attr_reader :connection, :proto_connection
@@ -143,12 +144,13 @@ module TravelTime
143
144
  perform_request { connection.post('time-filter/fast', payload) }
144
145
  end
145
146
 
146
- def time_filter_fast_proto(country:, origin:, destinations:, transport:, traveltime:, with_distance: false)
147
+ def time_filter_fast_proto(country:, origin:, destinations:, transport:, traveltime:, with_distance: false,
148
+ request_type: nil)
147
149
  transport_obj = Transport.new(transport)
148
- properties = if with_distance
149
- [Com::Igeolise::Traveltime::Rabbitmq::Requests::TimeFilterFastRequest::Property::DISTANCES]
150
- end
151
- message = ProtoUtils.make_proto_message(origin, destinations, transport_obj, traveltime, properties: properties)
150
+ distance_prop = Com::Igeolise::Traveltime::Rabbitmq::Requests::TimeFilterFastRequest::Property::DISTANCES
151
+ properties = with_distance ? [distance_prop] : nil
152
+ message = ProtoUtils.make_proto_message(origin, destinations, transport_obj, traveltime,
153
+ properties: properties, request_type: request_type)
152
154
  payload = ProtoUtils.encode_proto_message(message)
153
155
  perform_request_proto do
154
156
  proto_connection.post("http://proto.api.traveltimeapp.com/api/v3/#{country}/time-filter/fast/#{transport_obj.url_name}",
@@ -188,5 +190,52 @@ module TravelTime
188
190
  }.compact
189
191
  perform_request { connection.post('routes', payload) }
190
192
  end
193
+
194
+ def h3(resolution:, properties:, departure_searches: nil, arrival_searches: nil, unions: nil, intersections: nil)
195
+ payload = {
196
+ resolution: resolution,
197
+ properties: properties,
198
+ departure_searches: departure_searches,
199
+ arrival_searches: arrival_searches,
200
+ unions: unions,
201
+ intersections: intersections
202
+ }.compact
203
+ perform_request { connection.post('h3', payload) }
204
+ end
205
+
206
+ def h3_fast(resolution:, properties:, arrival_searches:, unions: nil, intersections: nil)
207
+ payload = {
208
+ resolution: resolution,
209
+ properties: properties,
210
+ arrival_searches: arrival_searches,
211
+ unions: unions,
212
+ intersections: intersections
213
+ }.compact
214
+ perform_request { connection.post('h3/fast', payload) }
215
+ end
216
+
217
+ def geohash(resolution:, properties:, departure_searches: nil, arrival_searches: nil, unions: nil,
218
+ intersections: nil)
219
+ payload = {
220
+ resolution: resolution,
221
+ properties: properties,
222
+ departure_searches: departure_searches,
223
+ arrival_searches: arrival_searches,
224
+ unions: unions,
225
+ intersections: intersections
226
+ }.compact
227
+ perform_request { connection.post('geohash', payload) }
228
+ end
229
+
230
+ def geohash_fast(resolution:, properties:, arrival_searches:, unions: nil, intersections: nil)
231
+ payload = {
232
+ resolution: resolution,
233
+ properties: properties,
234
+ arrival_searches: arrival_searches,
235
+ unions: unions,
236
+ intersections: intersections
237
+ }.compact
238
+ perform_request { connection.post('geohash/fast', payload) }
239
+ end
191
240
  end
192
241
  end
@@ -56,8 +56,7 @@ module TravelTime
56
56
  @details = {}
57
57
  else
58
58
  @type = transport_input[:type]
59
- # Ruby 3.0+ has #except which is a bit simpler, but using #reject for v2.7 compatibility
60
- @details = transport_input.reject { |k, _| k == :type }
59
+ @details = transport_input.except(:type)
61
60
  validate_details!
62
61
  end
63
62
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TravelTime
4
- VERSION = '0.7.1'
4
+ VERSION = '0.8.1'
5
5
  end
data/lib/utils.rb CHANGED
@@ -7,6 +7,10 @@ require 'TimeFilterFastResponse_pb'
7
7
  module TravelTime
8
8
  # Utilities for encoding/decoding protobuf requests
9
9
  class ProtoUtils
10
+ # Request type constants
11
+ ONE_TO_MANY = :one_to_many
12
+ MANY_TO_ONE = :many_to_one
13
+
10
14
  def self.encode_fixed_point(source, target)
11
15
  ((target - source) * 10.pow(5)).round
12
16
  end
@@ -32,12 +36,34 @@ module TravelTime
32
36
  )
33
37
  end
34
38
 
35
- def self.make_proto_message(origin, destinations, transport_obj, traveltime, properties: nil)
36
- Com::Igeolise::Traveltime::Rabbitmq::Requests::TimeFilterFastRequest.new(
37
- oneToManyRequest: make_one_to_many(origin, destinations, transport_obj, traveltime, properties)
39
+ def self.make_many_to_one(arrival, origins, transport_obj, traveltime, properties)
40
+ transportation = Com::Igeolise::Traveltime::Rabbitmq::Requests::Transportation.new
41
+ transport_obj.apply_to_proto(transportation)
42
+ Com::Igeolise::Traveltime::Rabbitmq::Requests::TimeFilterFastRequest::ManyToOne.new(
43
+ arrivalLocation: arrival,
44
+ locationDeltas: build_deltas(arrival, origins),
45
+ transportation: transportation,
46
+ arrivalTimePeriod: 0,
47
+ travelTime: traveltime,
48
+ properties: properties
38
49
  )
39
50
  end
40
51
 
52
+ def self.make_proto_message(origin, destinations, transport_obj, traveltime, properties: nil, request_type: nil)
53
+ request_type ||= ONE_TO_MANY
54
+ request = Com::Igeolise::Traveltime::Rabbitmq::Requests::TimeFilterFastRequest.new
55
+
56
+ if request_type == ONE_TO_MANY
57
+ request.oneToManyRequest = make_one_to_many(origin, destinations, transport_obj, traveltime, properties)
58
+ elsif request_type == MANY_TO_ONE
59
+ request.manyToOneRequest = make_many_to_one(origin, destinations, transport_obj, traveltime, properties)
60
+ else
61
+ raise ArgumentError, "Invalid request_type: #{request_type}. Must be ONE_TO_MANY or MANY_TO_ONE"
62
+ end
63
+
64
+ request
65
+ end
66
+
41
67
  def self.encode_proto_message(message)
42
68
  Com::Igeolise::Traveltime::Rabbitmq::Requests::TimeFilterFastRequest.encode(message)
43
69
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: travel_time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - TravelTime Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-28 00:00:00.000000000 Z
11
+ date: 2026-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.3.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.3.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: dry-configurable
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -48,36 +62,36 @@ dependencies:
48
62
  name: google-protobuf
49
63
  requirement: !ruby/object:Gem::Requirement
50
64
  requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '3.25'
54
65
  - - ">="
55
66
  - !ruby/object:Gem::Version
56
67
  version: 3.25.5
68
+ - - "<"
69
+ - !ruby/object:Gem::Version
70
+ version: '5.0'
57
71
  type: :runtime
58
72
  prerelease: false
59
73
  version_requirements: !ruby/object:Gem::Requirement
60
74
  requirements:
61
- - - "~>"
62
- - !ruby/object:Gem::Version
63
- version: '3.25'
64
75
  - - ">="
65
76
  - !ruby/object:Gem::Version
66
77
  version: 3.25.5
78
+ - - "<"
79
+ - !ruby/object:Gem::Version
80
+ version: '5.0'
67
81
  - !ruby/object:Gem::Dependency
68
82
  name: ruby-limiter
69
83
  requirement: !ruby/object:Gem::Requirement
70
84
  requirements:
71
85
  - - "~>"
72
86
  - !ruby/object:Gem::Version
73
- version: 2.2.2
87
+ version: 2.3.0
74
88
  type: :runtime
75
89
  prerelease: false
76
90
  version_requirements: !ruby/object:Gem::Requirement
77
91
  requirements:
78
92
  - - "~>"
79
93
  - !ruby/object:Gem::Version
80
- version: 2.2.2
94
+ version: 2.3.0
81
95
  description: TravelTime SDK for Ruby programming language
82
96
  email:
83
97
  - support@traveltime.com
@@ -121,14 +135,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
135
  requirements:
122
136
  - - ">="
123
137
  - !ruby/object:Gem::Version
124
- version: 2.7.0
138
+ version: 3.2.0
125
139
  required_rubygems_version: !ruby/object:Gem::Requirement
126
140
  requirements:
127
141
  - - ">="
128
142
  - !ruby/object:Gem::Version
129
143
  version: '0'
130
144
  requirements: []
131
- rubygems_version: 3.1.6
145
+ rubygems_version: 3.5.22
132
146
  signing_key:
133
147
  specification_version: 4
134
148
  summary: TravelTime SDK for Ruby programming language