onebusaway-sdk 0.1.0.pre.alpha.203
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 +7 -0
- data/README.md +124 -0
- data/lib/onebusaway-sdk/base_client.rb +483 -0
- data/lib/onebusaway-sdk/base_model.rb +1188 -0
- data/lib/onebusaway-sdk/base_page.rb +40 -0
- data/lib/onebusaway-sdk/client.rb +181 -0
- data/lib/onebusaway-sdk/errors.rb +187 -0
- data/lib/onebusaway-sdk/extern.rb +10 -0
- data/lib/onebusaway-sdk/models/agencies_with_coverage_list_params.rb +18 -0
- data/lib/onebusaway-sdk/models/agencies_with_coverage_list_response.rb +84 -0
- data/lib/onebusaway-sdk/models/agency_retrieve_params.rb +18 -0
- data/lib/onebusaway-sdk/models/agency_retrieve_response.rb +151 -0
- data/lib/onebusaway-sdk/models/arrival_and_departure_list_params.rb +51 -0
- data/lib/onebusaway-sdk/models/arrival_and_departure_list_response.rb +767 -0
- data/lib/onebusaway-sdk/models/arrival_and_departure_retrieve_params.rb +60 -0
- data/lib/onebusaway-sdk/models/arrival_and_departure_retrieve_response.rb +751 -0
- data/lib/onebusaway-sdk/models/block_retrieve_params.rb +18 -0
- data/lib/onebusaway-sdk/models/block_retrieve_response.rb +205 -0
- data/lib/onebusaway-sdk/models/config_retrieve_params.rb +18 -0
- data/lib/onebusaway-sdk/models/config_retrieve_response.rb +331 -0
- data/lib/onebusaway-sdk/models/current_time_retrieve_params.rb +18 -0
- data/lib/onebusaway-sdk/models/current_time_retrieve_response.rb +67 -0
- data/lib/onebusaway-sdk/models/references.rb +1071 -0
- data/lib/onebusaway-sdk/models/report_problem_with_stop_retrieve_params.rb +117 -0
- data/lib/onebusaway-sdk/models/report_problem_with_trip_retrieve_params.rb +180 -0
- data/lib/onebusaway-sdk/models/response_wrapper.rb +37 -0
- data/lib/onebusaway-sdk/models/route_ids_for_agency_list_params.rb +18 -0
- data/lib/onebusaway-sdk/models/route_ids_for_agency_list_response.rb +45 -0
- data/lib/onebusaway-sdk/models/route_retrieve_params.rb +18 -0
- data/lib/onebusaway-sdk/models/route_retrieve_response.rb +149 -0
- data/lib/onebusaway-sdk/models/routes_for_agency_list_params.rb +18 -0
- data/lib/onebusaway-sdk/models/routes_for_agency_list_response.rb +156 -0
- data/lib/onebusaway-sdk/models/routes_for_location_list_params.rb +70 -0
- data/lib/onebusaway-sdk/models/routes_for_location_list_response.rb +162 -0
- data/lib/onebusaway-sdk/models/schedule_for_route_retrieve_params.rb +30 -0
- data/lib/onebusaway-sdk/models/schedule_for_route_retrieve_response.rb +453 -0
- data/lib/onebusaway-sdk/models/schedule_for_stop_retrieve_params.rb +30 -0
- data/lib/onebusaway-sdk/models/schedule_for_stop_retrieve_response.rb +244 -0
- data/lib/onebusaway-sdk/models/search_for_route_list_params.rb +36 -0
- data/lib/onebusaway-sdk/models/search_for_route_list_response.rb +166 -0
- data/lib/onebusaway-sdk/models/search_for_stop_list_params.rb +36 -0
- data/lib/onebusaway-sdk/models/search_for_stop_list_response.rb +161 -0
- data/lib/onebusaway-sdk/models/shape_retrieve_params.rb +18 -0
- data/lib/onebusaway-sdk/models/shape_retrieve_response.rb +70 -0
- data/lib/onebusaway-sdk/models/stop_ids_for_agency_list_params.rb +18 -0
- data/lib/onebusaway-sdk/models/stop_ids_for_agency_list_response.rb +45 -0
- data/lib/onebusaway-sdk/models/stop_retrieve_params.rb +18 -0
- data/lib/onebusaway-sdk/models/stop_retrieve_response.rb +144 -0
- data/lib/onebusaway-sdk/models/stops_for_agency_list_params.rb +18 -0
- data/lib/onebusaway-sdk/models/stops_for_agency_list_response.rb +146 -0
- data/lib/onebusaway-sdk/models/stops_for_location_list_params.rb +74 -0
- data/lib/onebusaway-sdk/models/stops_for_location_list_response.rb +161 -0
- data/lib/onebusaway-sdk/models/stops_for_route_list_params.rb +40 -0
- data/lib/onebusaway-sdk/models/stops_for_route_list_response.rb +253 -0
- data/lib/onebusaway-sdk/models/trip_detail_retrieve_params.rb +86 -0
- data/lib/onebusaway-sdk/models/trip_detail_retrieve_response.rb +561 -0
- data/lib/onebusaway-sdk/models/trip_for_vehicle_retrieve_params.rb +65 -0
- data/lib/onebusaway-sdk/models/trip_for_vehicle_retrieve_response.rb +561 -0
- data/lib/onebusaway-sdk/models/trip_retrieve_params.rb +18 -0
- data/lib/onebusaway-sdk/models/trip_retrieve_response.rb +160 -0
- data/lib/onebusaway-sdk/models/trips_for_location_list_params.rb +93 -0
- data/lib/onebusaway-sdk/models/trips_for_location_list_response.rb +572 -0
- data/lib/onebusaway-sdk/models/trips_for_route_list_params.rb +52 -0
- data/lib/onebusaway-sdk/models/trips_for_route_list_response.rb +559 -0
- data/lib/onebusaway-sdk/models/vehicles_for_agency_list_params.rb +29 -0
- data/lib/onebusaway-sdk/models/vehicles_for_agency_list_response.rb +529 -0
- data/lib/onebusaway-sdk/pooled_net_requester.rb +170 -0
- data/lib/onebusaway-sdk/request_options.rb +115 -0
- data/lib/onebusaway-sdk/resources/agencies_with_coverage.rb +31 -0
- data/lib/onebusaway-sdk/resources/agency.rb +32 -0
- data/lib/onebusaway-sdk/resources/arrival_and_departure.rb +71 -0
- data/lib/onebusaway-sdk/resources/block.rb +32 -0
- data/lib/onebusaway-sdk/resources/config.rb +30 -0
- data/lib/onebusaway-sdk/resources/current_time.rb +30 -0
- data/lib/onebusaway-sdk/resources/report_problem_with_stop.rb +44 -0
- data/lib/onebusaway-sdk/resources/report_problem_with_trip.rb +54 -0
- data/lib/onebusaway-sdk/resources/route.rb +32 -0
- data/lib/onebusaway-sdk/resources/route_ids_for_agency.rb +32 -0
- data/lib/onebusaway-sdk/resources/routes_for_agency.rb +32 -0
- data/lib/onebusaway-sdk/resources/routes_for_location.rb +44 -0
- data/lib/onebusaway-sdk/resources/schedule_for_route.rb +37 -0
- data/lib/onebusaway-sdk/resources/schedule_for_stop.rb +37 -0
- data/lib/onebusaway-sdk/resources/search_for_route.rb +36 -0
- data/lib/onebusaway-sdk/resources/search_for_stop.rb +36 -0
- data/lib/onebusaway-sdk/resources/shape.rb +32 -0
- data/lib/onebusaway-sdk/resources/stop.rb +32 -0
- data/lib/onebusaway-sdk/resources/stop_ids_for_agency.rb +32 -0
- data/lib/onebusaway-sdk/resources/stops_for_agency.rb +32 -0
- data/lib/onebusaway-sdk/resources/stops_for_location.rb +44 -0
- data/lib/onebusaway-sdk/resources/stops_for_route.rb +38 -0
- data/lib/onebusaway-sdk/resources/trip.rb +32 -0
- data/lib/onebusaway-sdk/resources/trip_details.rb +47 -0
- data/lib/onebusaway-sdk/resources/trip_for_vehicle.rb +45 -0
- data/lib/onebusaway-sdk/resources/trips_for_location.rb +48 -0
- data/lib/onebusaway-sdk/resources/trips_for_route.rb +41 -0
- data/lib/onebusaway-sdk/resources/vehicles_for_agency.rb +36 -0
- data/lib/onebusaway-sdk/util.rb +512 -0
- data/lib/onebusaway-sdk/version.rb +5 -0
- data/lib/onebusaway-sdk.rb +116 -0
- data/manifest.yaml +13 -0
- data/rbi/lib/onebusaway-sdk/base_client.rbi +162 -0
- data/rbi/lib/onebusaway-sdk/base_model.rbi +478 -0
- data/rbi/lib/onebusaway-sdk/base_page.rbi +39 -0
- data/rbi/lib/onebusaway-sdk/client.rbi +154 -0
- data/rbi/lib/onebusaway-sdk/errors.rbi +145 -0
- data/rbi/lib/onebusaway-sdk/extern.rbi +7 -0
- data/rbi/lib/onebusaway-sdk/models/agencies_with_coverage_list_params.rbi +18 -0
- data/rbi/lib/onebusaway-sdk/models/agencies_with_coverage_list_response.rbi +131 -0
- data/rbi/lib/onebusaway-sdk/models/agency_retrieve_params.rbi +18 -0
- data/rbi/lib/onebusaway-sdk/models/agency_retrieve_response.rbi +210 -0
- data/rbi/lib/onebusaway-sdk/models/arrival_and_departure_list_params.rbi +60 -0
- data/rbi/lib/onebusaway-sdk/models/arrival_and_departure_list_response.rbi +914 -0
- data/rbi/lib/onebusaway-sdk/models/arrival_and_departure_retrieve_params.rbi +87 -0
- data/rbi/lib/onebusaway-sdk/models/arrival_and_departure_retrieve_response.rbi +857 -0
- data/rbi/lib/onebusaway-sdk/models/block_retrieve_params.rbi +18 -0
- data/rbi/lib/onebusaway-sdk/models/block_retrieve_response.rbi +383 -0
- data/rbi/lib/onebusaway-sdk/models/config_retrieve_params.rbi +18 -0
- data/rbi/lib/onebusaway-sdk/models/config_retrieve_response.rbi +389 -0
- data/rbi/lib/onebusaway-sdk/models/current_time_retrieve_params.rbi +18 -0
- data/rbi/lib/onebusaway-sdk/models/current_time_retrieve_response.rbi +95 -0
- data/rbi/lib/onebusaway-sdk/models/references.rbi +1265 -0
- data/rbi/lib/onebusaway-sdk/models/report_problem_with_stop_retrieve_params.rbi +101 -0
- data/rbi/lib/onebusaway-sdk/models/report_problem_with_trip_retrieve_params.rbi +157 -0
- data/rbi/lib/onebusaway-sdk/models/response_wrapper.rbi +47 -0
- data/rbi/lib/onebusaway-sdk/models/route_ids_for_agency_list_params.rbi +18 -0
- data/rbi/lib/onebusaway-sdk/models/route_ids_for_agency_list_response.rbi +68 -0
- data/rbi/lib/onebusaway-sdk/models/route_retrieve_params.rbi +18 -0
- data/rbi/lib/onebusaway-sdk/models/route_retrieve_response.rbi +200 -0
- data/rbi/lib/onebusaway-sdk/models/routes_for_agency_list_params.rbi +18 -0
- data/rbi/lib/onebusaway-sdk/models/routes_for_agency_list_response.rbi +210 -0
- data/rbi/lib/onebusaway-sdk/models/routes_for_location_list_params.rbi +90 -0
- data/rbi/lib/onebusaway-sdk/models/routes_for_location_list_response.rbi +220 -0
- data/rbi/lib/onebusaway-sdk/models/schedule_for_route_retrieve_params.rbi +34 -0
- data/rbi/lib/onebusaway-sdk/models/schedule_for_route_retrieve_response.rbi +675 -0
- data/rbi/lib/onebusaway-sdk/models/schedule_for_stop_retrieve_params.rbi +34 -0
- data/rbi/lib/onebusaway-sdk/models/schedule_for_stop_retrieve_response.rbi +457 -0
- data/rbi/lib/onebusaway-sdk/models/search_for_route_list_params.rbi +43 -0
- data/rbi/lib/onebusaway-sdk/models/search_for_route_list_response.rbi +220 -0
- data/rbi/lib/onebusaway-sdk/models/search_for_stop_list_params.rbi +43 -0
- data/rbi/lib/onebusaway-sdk/models/search_for_stop_list_response.rbi +231 -0
- data/rbi/lib/onebusaway-sdk/models/shape_retrieve_params.rbi +18 -0
- data/rbi/lib/onebusaway-sdk/models/shape_retrieve_response.rbi +103 -0
- data/rbi/lib/onebusaway-sdk/models/stop_ids_for_agency_list_params.rbi +18 -0
- data/rbi/lib/onebusaway-sdk/models/stop_ids_for_agency_list_response.rbi +68 -0
- data/rbi/lib/onebusaway-sdk/models/stop_retrieve_params.rbi +18 -0
- data/rbi/lib/onebusaway-sdk/models/stop_retrieve_response.rbi +211 -0
- data/rbi/lib/onebusaway-sdk/models/stops_for_agency_list_params.rbi +18 -0
- data/rbi/lib/onebusaway-sdk/models/stops_for_agency_list_response.rbi +210 -0
- data/rbi/lib/onebusaway-sdk/models/stops_for_location_list_params.rbi +90 -0
- data/rbi/lib/onebusaway-sdk/models/stops_for_location_list_response.rbi +231 -0
- data/rbi/lib/onebusaway-sdk/models/stops_for_route_list_params.rbi +48 -0
- data/rbi/lib/onebusaway-sdk/models/stops_for_route_list_response.rbi +307 -0
- data/rbi/lib/onebusaway-sdk/models/trip_detail_retrieve_params.rbi +87 -0
- data/rbi/lib/onebusaway-sdk/models/trip_detail_retrieve_response.rbi +702 -0
- data/rbi/lib/onebusaway-sdk/models/trip_for_vehicle_retrieve_params.rbi +76 -0
- data/rbi/lib/onebusaway-sdk/models/trip_for_vehicle_retrieve_response.rbi +704 -0
- data/rbi/lib/onebusaway-sdk/models/trip_retrieve_params.rbi +18 -0
- data/rbi/lib/onebusaway-sdk/models/trip_retrieve_response.rbi +211 -0
- data/rbi/lib/onebusaway-sdk/models/trips_for_location_list_params.rbi +109 -0
- data/rbi/lib/onebusaway-sdk/models/trips_for_location_list_response.rbi +715 -0
- data/rbi/lib/onebusaway-sdk/models/trips_for_route_list_params.rbi +60 -0
- data/rbi/lib/onebusaway-sdk/models/trips_for_route_list_response.rbi +705 -0
- data/rbi/lib/onebusaway-sdk/models/vehicles_for_agency_list_params.rbi +35 -0
- data/rbi/lib/onebusaway-sdk/models/vehicles_for_agency_list_response.rbi +633 -0
- data/rbi/lib/onebusaway-sdk/pooled_net_requester.rbi +36 -0
- data/rbi/lib/onebusaway-sdk/request_options.rbi +84 -0
- data/rbi/lib/onebusaway-sdk/resources/agencies_with_coverage.rbi +18 -0
- data/rbi/lib/onebusaway-sdk/resources/agency.rbi +21 -0
- data/rbi/lib/onebusaway-sdk/resources/arrival_and_departure.rbi +47 -0
- data/rbi/lib/onebusaway-sdk/resources/block.rbi +21 -0
- data/rbi/lib/onebusaway-sdk/resources/config.rbi +18 -0
- data/rbi/lib/onebusaway-sdk/resources/current_time.rbi +18 -0
- data/rbi/lib/onebusaway-sdk/resources/report_problem_with_stop.rbi +34 -0
- data/rbi/lib/onebusaway-sdk/resources/report_problem_with_trip.rbi +44 -0
- data/rbi/lib/onebusaway-sdk/resources/route.rbi +21 -0
- data/rbi/lib/onebusaway-sdk/resources/route_ids_for_agency.rbi +21 -0
- data/rbi/lib/onebusaway-sdk/resources/routes_for_agency.rbi +21 -0
- data/rbi/lib/onebusaway-sdk/resources/routes_for_location.rbi +26 -0
- data/rbi/lib/onebusaway-sdk/resources/schedule_for_route.rbi +22 -0
- data/rbi/lib/onebusaway-sdk/resources/schedule_for_stop.rbi +22 -0
- data/rbi/lib/onebusaway-sdk/resources/search_for_route.rbi +22 -0
- data/rbi/lib/onebusaway-sdk/resources/search_for_stop.rbi +22 -0
- data/rbi/lib/onebusaway-sdk/resources/shape.rbi +21 -0
- data/rbi/lib/onebusaway-sdk/resources/stop.rbi +21 -0
- data/rbi/lib/onebusaway-sdk/resources/stop_ids_for_agency.rbi +21 -0
- data/rbi/lib/onebusaway-sdk/resources/stops_for_agency.rbi +21 -0
- data/rbi/lib/onebusaway-sdk/resources/stops_for_location.rbi +26 -0
- data/rbi/lib/onebusaway-sdk/resources/stops_for_route.rbi +23 -0
- data/rbi/lib/onebusaway-sdk/resources/trip.rbi +21 -0
- data/rbi/lib/onebusaway-sdk/resources/trip_details.rbi +34 -0
- data/rbi/lib/onebusaway-sdk/resources/trip_for_vehicle.rbi +32 -0
- data/rbi/lib/onebusaway-sdk/resources/trips_for_location.rbi +36 -0
- data/rbi/lib/onebusaway-sdk/resources/trips_for_route.rbi +24 -0
- data/rbi/lib/onebusaway-sdk/resources/vehicles_for_agency.rbi +22 -0
- data/rbi/lib/onebusaway-sdk/util.rbi +136 -0
- data/rbi/lib/onebusaway-sdk/version.rbi +5 -0
- data/sig/onebusaway-sdk/base_client.rbs +101 -0
- data/sig/onebusaway-sdk/base_model.rbs +244 -0
- data/sig/onebusaway-sdk/base_page.rbs +20 -0
- data/sig/onebusaway-sdk/client.rbs +80 -0
- data/sig/onebusaway-sdk/errors.rbs +98 -0
- data/sig/onebusaway-sdk/extern.rbs +4 -0
- data/sig/onebusaway-sdk/models/agencies_with_coverage_list_params.rbs +20 -0
- data/sig/onebusaway-sdk/models/agencies_with_coverage_list_response.rbs +85 -0
- data/sig/onebusaway-sdk/models/agency_retrieve_params.rbs +19 -0
- data/sig/onebusaway-sdk/models/agency_retrieve_response.rbs +115 -0
- data/sig/onebusaway-sdk/models/arrival_and_departure_list_params.rbs +38 -0
- data/sig/onebusaway-sdk/models/arrival_and_departure_list_response.rbs +447 -0
- data/sig/onebusaway-sdk/models/arrival_and_departure_retrieve_params.rbs +50 -0
- data/sig/onebusaway-sdk/models/arrival_and_departure_retrieve_response.rbs +427 -0
- data/sig/onebusaway-sdk/models/block_retrieve_params.rbs +19 -0
- data/sig/onebusaway-sdk/models/block_retrieve_response.rbs +201 -0
- data/sig/onebusaway-sdk/models/config_retrieve_params.rbs +19 -0
- data/sig/onebusaway-sdk/models/config_retrieve_response.rbs +227 -0
- data/sig/onebusaway-sdk/models/current_time_retrieve_params.rbs +19 -0
- data/sig/onebusaway-sdk/models/current_time_retrieve_response.rbs +64 -0
- data/sig/onebusaway-sdk/models/references.rbs +732 -0
- data/sig/onebusaway-sdk/models/report_problem_with_stop_retrieve_params.rbs +73 -0
- data/sig/onebusaway-sdk/models/report_problem_with_trip_retrieve_params.rbs +105 -0
- data/sig/onebusaway-sdk/models/response_wrapper.rbs +30 -0
- data/sig/onebusaway-sdk/models/route_ids_for_agency_list_params.rbs +20 -0
- data/sig/onebusaway-sdk/models/route_ids_for_agency_list_response.rbs +49 -0
- data/sig/onebusaway-sdk/models/route_retrieve_params.rbs +19 -0
- data/sig/onebusaway-sdk/models/route_retrieve_response.rbs +113 -0
- data/sig/onebusaway-sdk/models/routes_for_agency_list_params.rbs +20 -0
- data/sig/onebusaway-sdk/models/routes_for_agency_list_response.rbs +117 -0
- data/sig/onebusaway-sdk/models/routes_for_location_list_params.rbs +56 -0
- data/sig/onebusaway-sdk/models/routes_for_location_list_response.rbs +123 -0
- data/sig/onebusaway-sdk/models/schedule_for_route_retrieve_params.rbs +24 -0
- data/sig/onebusaway-sdk/models/schedule_for_route_retrieve_response.rbs +341 -0
- data/sig/onebusaway-sdk/models/schedule_for_stop_retrieve_params.rbs +24 -0
- data/sig/onebusaway-sdk/models/schedule_for_stop_retrieve_response.rbs +215 -0
- data/sig/onebusaway-sdk/models/search_for_route_list_params.rbs +30 -0
- data/sig/onebusaway-sdk/models/search_for_route_list_response.rbs +125 -0
- data/sig/onebusaway-sdk/models/search_for_stop_list_params.rbs +30 -0
- data/sig/onebusaway-sdk/models/search_for_stop_list_response.rbs +123 -0
- data/sig/onebusaway-sdk/models/shape_retrieve_params.rbs +19 -0
- data/sig/onebusaway-sdk/models/shape_retrieve_response.rbs +64 -0
- data/sig/onebusaway-sdk/models/stop_ids_for_agency_list_params.rbs +20 -0
- data/sig/onebusaway-sdk/models/stop_ids_for_agency_list_response.rbs +49 -0
- data/sig/onebusaway-sdk/models/stop_retrieve_params.rbs +19 -0
- data/sig/onebusaway-sdk/models/stop_retrieve_response.rbs +111 -0
- data/sig/onebusaway-sdk/models/stops_for_agency_list_params.rbs +19 -0
- data/sig/onebusaway-sdk/models/stops_for_agency_list_response.rbs +105 -0
- data/sig/onebusaway-sdk/models/stops_for_location_list_params.rbs +56 -0
- data/sig/onebusaway-sdk/models/stops_for_location_list_response.rbs +123 -0
- data/sig/onebusaway-sdk/models/stops_for_route_list_params.rbs +33 -0
- data/sig/onebusaway-sdk/models/stops_for_route_list_response.rbs +206 -0
- data/sig/onebusaway-sdk/models/trip_detail_retrieve_params.rbs +54 -0
- data/sig/onebusaway-sdk/models/trip_detail_retrieve_response.rbs +375 -0
- data/sig/onebusaway-sdk/models/trip_for_vehicle_retrieve_params.rbs +48 -0
- data/sig/onebusaway-sdk/models/trip_for_vehicle_retrieve_response.rbs +377 -0
- data/sig/onebusaway-sdk/models/trip_retrieve_params.rbs +19 -0
- data/sig/onebusaway-sdk/models/trip_retrieve_response.rbs +119 -0
- data/sig/onebusaway-sdk/models/trips_for_location_list_params.rbs +58 -0
- data/sig/onebusaway-sdk/models/trips_for_location_list_response.rbs +379 -0
- data/sig/onebusaway-sdk/models/trips_for_route_list_params.rbs +38 -0
- data/sig/onebusaway-sdk/models/trips_for_route_list_response.rbs +371 -0
- data/sig/onebusaway-sdk/models/vehicles_for_agency_list_params.rbs +24 -0
- data/sig/onebusaway-sdk/models/vehicles_for_agency_list_response.rbs +332 -0
- data/sig/onebusaway-sdk/pooled_net_requester.rbs +28 -0
- data/sig/onebusaway-sdk/request_options.rbs +42 -0
- data/sig/onebusaway-sdk/resources/agencies_with_coverage.rbs +16 -0
- data/sig/onebusaway-sdk/resources/agency.rbs +18 -0
- data/sig/onebusaway-sdk/resources/arrival_and_departure.rbs +37 -0
- data/sig/onebusaway-sdk/resources/block.rbs +18 -0
- data/sig/onebusaway-sdk/resources/config.rbs +16 -0
- data/sig/onebusaway-sdk/resources/current_time.rbs +16 -0
- data/sig/onebusaway-sdk/resources/report_problem_with_stop.rbs +23 -0
- data/sig/onebusaway-sdk/resources/report_problem_with_trip.rbs +28 -0
- data/sig/onebusaway-sdk/resources/route.rbs +18 -0
- data/sig/onebusaway-sdk/resources/route_ids_for_agency.rbs +18 -0
- data/sig/onebusaway-sdk/resources/routes_for_agency.rbs +18 -0
- data/sig/onebusaway-sdk/resources/routes_for_location.rbs +22 -0
- data/sig/onebusaway-sdk/resources/schedule_for_route.rbs +19 -0
- data/sig/onebusaway-sdk/resources/schedule_for_stop.rbs +19 -0
- data/sig/onebusaway-sdk/resources/search_for_route.rbs +18 -0
- data/sig/onebusaway-sdk/resources/search_for_stop.rbs +18 -0
- data/sig/onebusaway-sdk/resources/shape.rbs +18 -0
- data/sig/onebusaway-sdk/resources/stop.rbs +18 -0
- data/sig/onebusaway-sdk/resources/stop_ids_for_agency.rbs +18 -0
- data/sig/onebusaway-sdk/resources/stops_for_agency.rbs +18 -0
- data/sig/onebusaway-sdk/resources/stops_for_location.rbs +22 -0
- data/sig/onebusaway-sdk/resources/stops_for_route.rbs +20 -0
- data/sig/onebusaway-sdk/resources/trip.rbs +18 -0
- data/sig/onebusaway-sdk/resources/trip_details.rbs +23 -0
- data/sig/onebusaway-sdk/resources/trip_for_vehicle.rbs +22 -0
- data/sig/onebusaway-sdk/resources/trips_for_location.rbs +23 -0
- data/sig/onebusaway-sdk/resources/trips_for_route.rbs +21 -0
- data/sig/onebusaway-sdk/resources/vehicles_for_agency.rbs +19 -0
- data/sig/onebusaway-sdk/util.rbs +90 -0
- data/sig/onebusaway-sdk/version.rbs +3 -0
- metadata +350 -0
@@ -0,0 +1,1188 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OnebusawaySDK
|
4
|
+
# @private
|
5
|
+
#
|
6
|
+
# @abstract
|
7
|
+
#
|
8
|
+
module Converter
|
9
|
+
# rubocop:disable Lint/UnusedMethodArgument
|
10
|
+
|
11
|
+
# @private
|
12
|
+
#
|
13
|
+
# @param value [Object]
|
14
|
+
#
|
15
|
+
# @return [Object]
|
16
|
+
#
|
17
|
+
def coerce(value) = value
|
18
|
+
|
19
|
+
# @private
|
20
|
+
#
|
21
|
+
# @param value [Object]
|
22
|
+
#
|
23
|
+
# @return [Object]
|
24
|
+
#
|
25
|
+
def dump(value) = value
|
26
|
+
|
27
|
+
# @private
|
28
|
+
#
|
29
|
+
# @param value [Object]
|
30
|
+
#
|
31
|
+
# @return [Array(true, Object, nil), Array(false, Boolean, Integer)]
|
32
|
+
#
|
33
|
+
def try_strict_coerce(value) = (raise NotImplementedError)
|
34
|
+
|
35
|
+
# rubocop:enable Lint/UnusedMethodArgument
|
36
|
+
|
37
|
+
class << self
|
38
|
+
# @private
|
39
|
+
#
|
40
|
+
# @param spec [Hash{Symbol=>Object}, Proc, OnebusawaySDK::Converter, Class] .
|
41
|
+
#
|
42
|
+
# @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
|
43
|
+
#
|
44
|
+
# @option spec [Proc] :enum
|
45
|
+
#
|
46
|
+
# @option spec [Proc] :union
|
47
|
+
#
|
48
|
+
# @option spec [Boolean] :"nil?"
|
49
|
+
#
|
50
|
+
# @return [Proc]
|
51
|
+
#
|
52
|
+
def type_info(spec)
|
53
|
+
case spec
|
54
|
+
in Hash
|
55
|
+
type_info(spec.slice(:const, :enum, :union).first&.last)
|
56
|
+
in Proc
|
57
|
+
spec
|
58
|
+
in OnebusawaySDK::Converter | Class
|
59
|
+
-> { spec }
|
60
|
+
in true | false
|
61
|
+
-> { OnebusawaySDK::BooleanModel }
|
62
|
+
in NilClass | true | false | Symbol | Integer | Float
|
63
|
+
-> { spec.class }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# @private
|
68
|
+
#
|
69
|
+
# Based on `target`, transform `value` into `target`, to the extent possible:
|
70
|
+
#
|
71
|
+
# 1. if the given `value` conforms to `target` already, return the given `value`
|
72
|
+
# 2. if it's possible and safe to convert the given `value` to `target`, then the
|
73
|
+
# converted value
|
74
|
+
# 3. otherwise, the given `value` unaltered
|
75
|
+
#
|
76
|
+
# @param target [OnebusawaySDK::Converter, Class]
|
77
|
+
# @param value [Object]
|
78
|
+
#
|
79
|
+
# @return [Object]
|
80
|
+
#
|
81
|
+
def coerce(target, value)
|
82
|
+
case target
|
83
|
+
in OnebusawaySDK::Converter
|
84
|
+
target.coerce(value)
|
85
|
+
in Class
|
86
|
+
case target
|
87
|
+
in -> { _1 <= NilClass }
|
88
|
+
nil
|
89
|
+
in -> { _1 <= Integer }
|
90
|
+
value.is_a?(Numeric) ? Integer(value) : value
|
91
|
+
in -> { _1 <= Float }
|
92
|
+
value.is_a?(Numeric) ? Float(value) : value
|
93
|
+
in -> { _1 <= Symbol }
|
94
|
+
value.is_a?(String) ? value.to_sym : value
|
95
|
+
in -> { _1 <= String }
|
96
|
+
value.is_a?(Symbol) ? value.to_s : value
|
97
|
+
in -> { _1 <= Date || _1 <= Time }
|
98
|
+
value.is_a?(String) ? target.parse(value) : value
|
99
|
+
in -> { _1 <= IO }
|
100
|
+
value.is_a?(String) ? StringIO.new(value) : value
|
101
|
+
else
|
102
|
+
value
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# @private
|
108
|
+
#
|
109
|
+
# @param target [OnebusawaySDK::Converter, Class]
|
110
|
+
# @param value [Object]
|
111
|
+
#
|
112
|
+
# @return [Object]
|
113
|
+
#
|
114
|
+
def dump(target, value)
|
115
|
+
case target
|
116
|
+
in OnebusawaySDK::Converter
|
117
|
+
target.dump(value)
|
118
|
+
else
|
119
|
+
value
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
# @private
|
124
|
+
#
|
125
|
+
# The underlying algorithm for computing maximal compatibility is subject to
|
126
|
+
# future improvements.
|
127
|
+
#
|
128
|
+
# Similar to `#.coerce`, used to determine the best union variant to decode into.
|
129
|
+
#
|
130
|
+
# 1. determine if strict-ish coercion is possible
|
131
|
+
# 2. return either result of successful coercion or if loose coercion is possible
|
132
|
+
# 3. return a score for recursively tallied count for fields that can be coerced
|
133
|
+
#
|
134
|
+
# @param target [OnebusawaySDK::Converter, Class]
|
135
|
+
# @param value [Object]
|
136
|
+
#
|
137
|
+
# @return [Object]
|
138
|
+
#
|
139
|
+
def try_strict_coerce(target, value)
|
140
|
+
case target
|
141
|
+
in OnebusawaySDK::Converter
|
142
|
+
target.try_strict_coerce(value)
|
143
|
+
in Class
|
144
|
+
case [target, value]
|
145
|
+
in [-> { _1 <= NilClass }, _]
|
146
|
+
[true, nil, value.nil? ? 1 : 0]
|
147
|
+
in [-> { _1 <= Integer }, Numeric]
|
148
|
+
[true, Integer(value), 1]
|
149
|
+
in [-> { _1 <= Float }, Numeric]
|
150
|
+
[true, Float(value), 1]
|
151
|
+
in [-> { _1 <= Symbol }, String]
|
152
|
+
[true, value.to_sym, 1]
|
153
|
+
in [-> { _1 <= String }, Symbol]
|
154
|
+
[true, value.to_s, 1]
|
155
|
+
in [-> { _1 <= Date || _1 <= Time }, String]
|
156
|
+
Kernel.then do
|
157
|
+
[true, target.parse(value), 1]
|
158
|
+
rescue ArgumentError, Date::Error
|
159
|
+
[false, false, 0]
|
160
|
+
end
|
161
|
+
in [_, ^target]
|
162
|
+
[true, value, 1]
|
163
|
+
else
|
164
|
+
[false, false, 0]
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# @private
|
172
|
+
#
|
173
|
+
# @abstract
|
174
|
+
#
|
175
|
+
# When we don't know what to expect for the value.
|
176
|
+
class Unknown
|
177
|
+
extend OnebusawaySDK::Converter
|
178
|
+
|
179
|
+
# rubocop:disable Lint/UnusedMethodArgument
|
180
|
+
|
181
|
+
private_class_method :new
|
182
|
+
|
183
|
+
# @param other [Object]
|
184
|
+
#
|
185
|
+
# @return [Boolean]
|
186
|
+
#
|
187
|
+
def self.===(other) = true
|
188
|
+
|
189
|
+
# @param other [Object]
|
190
|
+
#
|
191
|
+
# @return [Boolean]
|
192
|
+
#
|
193
|
+
def self.==(other) = other.is_a?(Class) && other <= OnebusawaySDK::Unknown
|
194
|
+
|
195
|
+
# @!parse
|
196
|
+
# # @private
|
197
|
+
# #
|
198
|
+
# # @param value [Object]
|
199
|
+
# #
|
200
|
+
# # @return [Object]
|
201
|
+
# #
|
202
|
+
# def self.coerce(value) = super
|
203
|
+
|
204
|
+
# @!parse
|
205
|
+
# # @private
|
206
|
+
# #
|
207
|
+
# # @param value [Object]
|
208
|
+
# #
|
209
|
+
# # @return [Object]
|
210
|
+
# #
|
211
|
+
# def self.dump(value) = super
|
212
|
+
|
213
|
+
# @private
|
214
|
+
#
|
215
|
+
# @param value [Object]
|
216
|
+
#
|
217
|
+
# @return [Array(true, Object, nil), Array(false, Boolean, Integer)]
|
218
|
+
#
|
219
|
+
def self.try_strict_coerce(value)
|
220
|
+
# prevent unknown variant from being chosen during the first coercion pass
|
221
|
+
[false, true, 0]
|
222
|
+
end
|
223
|
+
|
224
|
+
# rubocop:enable Lint/UnusedMethodArgument
|
225
|
+
end
|
226
|
+
|
227
|
+
# @private
|
228
|
+
#
|
229
|
+
# @abstract
|
230
|
+
#
|
231
|
+
# Ruby has no Boolean class; this is something for models to refer to.
|
232
|
+
class BooleanModel
|
233
|
+
extend OnebusawaySDK::Converter
|
234
|
+
|
235
|
+
private_class_method :new
|
236
|
+
|
237
|
+
# @param other [Object]
|
238
|
+
#
|
239
|
+
# @return [Boolean]
|
240
|
+
#
|
241
|
+
def self.===(other) = other == true || other == false
|
242
|
+
|
243
|
+
# @param other [Object]
|
244
|
+
#
|
245
|
+
# @return [Boolean]
|
246
|
+
#
|
247
|
+
def self.==(other) = other.is_a?(Class) && other <= OnebusawaySDK::BooleanModel
|
248
|
+
|
249
|
+
# @!parse
|
250
|
+
# # @private
|
251
|
+
# #
|
252
|
+
# # @param value [Boolean, Object]
|
253
|
+
# #
|
254
|
+
# # @return [Boolean, Object]
|
255
|
+
# #
|
256
|
+
# def self.coerce(value) = super
|
257
|
+
|
258
|
+
# @!parse
|
259
|
+
# # @private
|
260
|
+
# #
|
261
|
+
# # @param value [Boolean, Object]
|
262
|
+
# #
|
263
|
+
# # @return [Boolean, Object]
|
264
|
+
# #
|
265
|
+
# def self.dump(value) = super
|
266
|
+
|
267
|
+
# @private
|
268
|
+
#
|
269
|
+
# @param value [Object]
|
270
|
+
#
|
271
|
+
# @return [Array(true, Object, nil), Array(false, Boolean, Integer)]
|
272
|
+
#
|
273
|
+
def self.try_strict_coerce(value)
|
274
|
+
case value
|
275
|
+
in true | false
|
276
|
+
[true, value, 1]
|
277
|
+
else
|
278
|
+
[false, false, 0]
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
# @private
|
284
|
+
#
|
285
|
+
# @abstract
|
286
|
+
#
|
287
|
+
# A value from among a specified list of options. OpenAPI enum values map to Ruby
|
288
|
+
# values in the SDK as follows:
|
289
|
+
#
|
290
|
+
# 1. boolean => true | false
|
291
|
+
# 2. integer => Integer
|
292
|
+
# 3. float => Float
|
293
|
+
# 4. string => Symbol
|
294
|
+
#
|
295
|
+
# We can therefore convert string values to Symbols, but can't convert other
|
296
|
+
# values safely.
|
297
|
+
class Enum
|
298
|
+
extend OnebusawaySDK::Converter
|
299
|
+
|
300
|
+
# All of the valid Symbol values for this enum.
|
301
|
+
#
|
302
|
+
# @return [Array<NilClass, Boolean, Integer, Float, Symbol>]
|
303
|
+
#
|
304
|
+
def self.values = (@values ||= constants.map { const_get(_1) })
|
305
|
+
|
306
|
+
# @private
|
307
|
+
#
|
308
|
+
# Guard against thread safety issues by instantiating `@values`.
|
309
|
+
#
|
310
|
+
private_class_method def self.finalize! = values
|
311
|
+
|
312
|
+
private_class_method :new
|
313
|
+
|
314
|
+
# @param other [Object]
|
315
|
+
#
|
316
|
+
# @return [Boolean]
|
317
|
+
#
|
318
|
+
def self.===(other) = values.include?(other)
|
319
|
+
|
320
|
+
# @param other [Object]
|
321
|
+
#
|
322
|
+
# @return [Boolean]
|
323
|
+
#
|
324
|
+
def self.==(other)
|
325
|
+
other.is_a?(Class) && other <= OnebusawaySDK::Enum && other.values.to_set == values.to_set
|
326
|
+
end
|
327
|
+
|
328
|
+
# @private
|
329
|
+
#
|
330
|
+
# @param value [String, Symbol, Object]
|
331
|
+
#
|
332
|
+
# @return [Symbol, Object]
|
333
|
+
#
|
334
|
+
def self.coerce(value) = (value.is_a?(String) ? value.to_sym : value)
|
335
|
+
|
336
|
+
# @!parse
|
337
|
+
# # @private
|
338
|
+
# #
|
339
|
+
# # @param value [Symbol, Object]
|
340
|
+
# #
|
341
|
+
# # @return [Symbol, Object]
|
342
|
+
# #
|
343
|
+
# def self.dump(value) = super
|
344
|
+
|
345
|
+
# @private
|
346
|
+
#
|
347
|
+
# @param value [Object]
|
348
|
+
#
|
349
|
+
# @return [Array(true, Object, nil), Array(false, Boolean, Integer)]
|
350
|
+
#
|
351
|
+
def self.try_strict_coerce(value)
|
352
|
+
return [true, value, 1] if values.include?(value)
|
353
|
+
|
354
|
+
case value
|
355
|
+
in String if values.include?(val = value.to_sym)
|
356
|
+
[true, val, 1]
|
357
|
+
else
|
358
|
+
case [value, values.first]
|
359
|
+
in [true | false, true | false] | [Integer, Integer] | [Symbol | String, Symbol]
|
360
|
+
[false, true, 0]
|
361
|
+
else
|
362
|
+
[false, false, 0]
|
363
|
+
end
|
364
|
+
end
|
365
|
+
end
|
366
|
+
end
|
367
|
+
|
368
|
+
# @private
|
369
|
+
#
|
370
|
+
# @abstract
|
371
|
+
#
|
372
|
+
class Union
|
373
|
+
extend OnebusawaySDK::Converter
|
374
|
+
|
375
|
+
# @private
|
376
|
+
#
|
377
|
+
# All of the specified variant info for this union.
|
378
|
+
#
|
379
|
+
# @return [Array<Array(Symbol, Proc)>]
|
380
|
+
#
|
381
|
+
private_class_method def self.known_variants = (@known_variants ||= [])
|
382
|
+
|
383
|
+
class << self
|
384
|
+
# @private
|
385
|
+
#
|
386
|
+
# All of the specified variants for this union.
|
387
|
+
#
|
388
|
+
# @return [Array<Array(Symbol, Object)>]
|
389
|
+
#
|
390
|
+
protected def variants
|
391
|
+
@known_variants.map { |key, variant_fn| [key, variant_fn.call] }
|
392
|
+
end
|
393
|
+
end
|
394
|
+
|
395
|
+
# @private
|
396
|
+
#
|
397
|
+
# @param property [Symbol]
|
398
|
+
#
|
399
|
+
private_class_method def self.discriminator(property)
|
400
|
+
case property
|
401
|
+
in Symbol
|
402
|
+
@discriminator = property
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
# @private
|
407
|
+
#
|
408
|
+
# @param key [Symbol, Hash{Symbol=>Object}, Proc, OnebusawaySDK::Converter, Class]
|
409
|
+
#
|
410
|
+
# @param spec [Hash{Symbol=>Object}, Proc, OnebusawaySDK::Converter, Class] .
|
411
|
+
#
|
412
|
+
# @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
|
413
|
+
#
|
414
|
+
# @option spec [Proc] :enum
|
415
|
+
#
|
416
|
+
# @option spec [Proc] :union
|
417
|
+
#
|
418
|
+
# @option spec [Boolean] :"nil?"
|
419
|
+
#
|
420
|
+
private_class_method def self.variant(key, spec = nil)
|
421
|
+
variant_info =
|
422
|
+
case key
|
423
|
+
in Symbol
|
424
|
+
[key, OnebusawaySDK::Converter.type_info(spec)]
|
425
|
+
in Proc | OnebusawaySDK::Converter | Class | Hash
|
426
|
+
[nil, OnebusawaySDK::Converter.type_info(key)]
|
427
|
+
end
|
428
|
+
|
429
|
+
known_variants << variant_info
|
430
|
+
end
|
431
|
+
|
432
|
+
# @private
|
433
|
+
#
|
434
|
+
# @param value [Object]
|
435
|
+
#
|
436
|
+
# @return [OnebusawaySDK::Converter, Class, nil]
|
437
|
+
#
|
438
|
+
private_class_method def self.resolve_variant(value)
|
439
|
+
case [@discriminator, value]
|
440
|
+
in [_, OnebusawaySDK::BaseModel]
|
441
|
+
value.class
|
442
|
+
in [Symbol, Hash]
|
443
|
+
key =
|
444
|
+
if value.key?(@discriminator)
|
445
|
+
value.fetch(@discriminator)
|
446
|
+
elsif value.key?((discriminator = @discriminator.to_s))
|
447
|
+
value.fetch(discriminator)
|
448
|
+
end
|
449
|
+
|
450
|
+
key = key.to_sym if key.is_a?(String)
|
451
|
+
_, resolved = known_variants.find { |k,| k == key }
|
452
|
+
resolved.nil? ? OnebusawaySDK::Unknown : resolved.call
|
453
|
+
else
|
454
|
+
nil
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
# rubocop:disable Style/HashEachMethods
|
459
|
+
# rubocop:disable Style/CaseEquality
|
460
|
+
|
461
|
+
private_class_method :new
|
462
|
+
|
463
|
+
# @param other [Object]
|
464
|
+
#
|
465
|
+
# @return [Boolean]
|
466
|
+
#
|
467
|
+
def self.===(other)
|
468
|
+
known_variants.any? do |_, variant_fn|
|
469
|
+
variant_fn.call === other
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
473
|
+
# @param other [Object]
|
474
|
+
#
|
475
|
+
# @return [Boolean]
|
476
|
+
#
|
477
|
+
def self.==(other)
|
478
|
+
other.is_a?(Class) && other <= OnebusawaySDK::Union && other.variants == variants
|
479
|
+
end
|
480
|
+
|
481
|
+
# @private
|
482
|
+
#
|
483
|
+
# @param value [Object]
|
484
|
+
#
|
485
|
+
# @return [Object]
|
486
|
+
#
|
487
|
+
def self.coerce(value)
|
488
|
+
if (variant = resolve_variant(value))
|
489
|
+
return OnebusawaySDK::Converter.coerce(variant, value)
|
490
|
+
end
|
491
|
+
|
492
|
+
matches = []
|
493
|
+
|
494
|
+
known_variants.each do |_, variant_fn|
|
495
|
+
variant = variant_fn.call
|
496
|
+
|
497
|
+
case OnebusawaySDK::Converter.try_strict_coerce(variant, value)
|
498
|
+
in [true, coerced, _]
|
499
|
+
return coerced
|
500
|
+
in [false, true, score]
|
501
|
+
matches << [score, variant]
|
502
|
+
in [false, false, _]
|
503
|
+
nil
|
504
|
+
end
|
505
|
+
end
|
506
|
+
|
507
|
+
_, variant = matches.sort! { _2.first <=> _1.first }.find { |score,| !score.zero? }
|
508
|
+
variant.nil? ? value : OnebusawaySDK::Converter.coerce(variant, value)
|
509
|
+
end
|
510
|
+
|
511
|
+
# @private
|
512
|
+
#
|
513
|
+
# @param value [Object]
|
514
|
+
#
|
515
|
+
# @return [Object]
|
516
|
+
#
|
517
|
+
def self.dump(value)
|
518
|
+
if (variant = resolve_variant(value))
|
519
|
+
return OnebusawaySDK::Converter.dump(variant, value)
|
520
|
+
end
|
521
|
+
|
522
|
+
known_variants.each do |_, variant_fn|
|
523
|
+
variant = variant_fn.call
|
524
|
+
if variant === value
|
525
|
+
return OnebusawaySDK::Converter.dump(variant, value)
|
526
|
+
end
|
527
|
+
end
|
528
|
+
value
|
529
|
+
end
|
530
|
+
|
531
|
+
# @private
|
532
|
+
#
|
533
|
+
# @param value [Object]
|
534
|
+
#
|
535
|
+
# @return [Array(true, Object, nil), Array(false, Boolean, Integer)]
|
536
|
+
#
|
537
|
+
def self.try_strict_coerce(value)
|
538
|
+
# TODO(ruby) this will result in super linear decoding behaviour for nested unions
|
539
|
+
# follow up with a decoding context that captures current strictness levels
|
540
|
+
if (variant = resolve_variant(value))
|
541
|
+
return Converter.try_strict_coerce(variant, value)
|
542
|
+
end
|
543
|
+
|
544
|
+
coercible = false
|
545
|
+
max_score = 0
|
546
|
+
|
547
|
+
known_variants.each do |_, variant_fn|
|
548
|
+
variant = variant_fn.call
|
549
|
+
|
550
|
+
case OnebusawaySDK::Converter.try_strict_coerce(variant, value)
|
551
|
+
in [true, coerced, score]
|
552
|
+
return [true, coerced, score]
|
553
|
+
in [false, true, score]
|
554
|
+
coercible = true
|
555
|
+
max_score = [max_score, score].max
|
556
|
+
in [false, false, _]
|
557
|
+
nil
|
558
|
+
end
|
559
|
+
end
|
560
|
+
|
561
|
+
[false, coercible, max_score]
|
562
|
+
end
|
563
|
+
|
564
|
+
# rubocop:enable Style/CaseEquality
|
565
|
+
# rubocop:enable Style/HashEachMethods
|
566
|
+
end
|
567
|
+
|
568
|
+
# @private
|
569
|
+
#
|
570
|
+
# @abstract
|
571
|
+
#
|
572
|
+
# Array of items of a given type.
|
573
|
+
class ArrayOf
|
574
|
+
include OnebusawaySDK::Converter
|
575
|
+
|
576
|
+
private_class_method :new
|
577
|
+
|
578
|
+
def self.[](...) = new(...)
|
579
|
+
|
580
|
+
# @param other [Object]
|
581
|
+
#
|
582
|
+
# @return [Boolean]
|
583
|
+
#
|
584
|
+
def ===(other)
|
585
|
+
type = item_type
|
586
|
+
case other
|
587
|
+
in Array
|
588
|
+
# rubocop:disable Style/CaseEquality
|
589
|
+
other.all? { type === _1 }
|
590
|
+
# rubocop:enable Style/CaseEquality
|
591
|
+
else
|
592
|
+
false
|
593
|
+
end
|
594
|
+
end
|
595
|
+
|
596
|
+
# @param other [Object]
|
597
|
+
#
|
598
|
+
# @return [Boolean]
|
599
|
+
#
|
600
|
+
def ==(other) = other.is_a?(OnebusawaySDK::ArrayOf) && other.item_type == item_type
|
601
|
+
|
602
|
+
# @private
|
603
|
+
#
|
604
|
+
# @param value [Enumerable, Object]
|
605
|
+
#
|
606
|
+
# @return [Array<Object>, Object]
|
607
|
+
#
|
608
|
+
def coerce(value)
|
609
|
+
type = item_type
|
610
|
+
case value
|
611
|
+
in Enumerable unless value.is_a?(Hash)
|
612
|
+
value.map { OnebusawaySDK::Converter.coerce(type, _1) }
|
613
|
+
else
|
614
|
+
value
|
615
|
+
end
|
616
|
+
end
|
617
|
+
|
618
|
+
# @private
|
619
|
+
#
|
620
|
+
# @param value [Enumerable, Object]
|
621
|
+
#
|
622
|
+
# @return [Array<Object>, Object]
|
623
|
+
#
|
624
|
+
def dump(value)
|
625
|
+
type = item_type
|
626
|
+
case value
|
627
|
+
in Enumerable unless value.is_a?(Hash)
|
628
|
+
value.map { OnebusawaySDK::Converter.dump(type, _1) }.to_a
|
629
|
+
else
|
630
|
+
value
|
631
|
+
end
|
632
|
+
end
|
633
|
+
|
634
|
+
# @private
|
635
|
+
#
|
636
|
+
# @param value [Object]
|
637
|
+
#
|
638
|
+
# @return [Array(true, Object, nil), Array(false, Boolean, Integer)]
|
639
|
+
#
|
640
|
+
def try_strict_coerce(value)
|
641
|
+
case value
|
642
|
+
in Array
|
643
|
+
type = item_type
|
644
|
+
great_success = true
|
645
|
+
tally = 0
|
646
|
+
|
647
|
+
mapped =
|
648
|
+
value.map do |item|
|
649
|
+
case OnebusawaySDK::Converter.try_strict_coerce(type, item)
|
650
|
+
in [true, coerced, score]
|
651
|
+
tally += score
|
652
|
+
coerced
|
653
|
+
in [false, true, score]
|
654
|
+
great_success = false
|
655
|
+
tally += score
|
656
|
+
item
|
657
|
+
in [false, false, _]
|
658
|
+
great_success &&= item.nil?
|
659
|
+
item
|
660
|
+
end
|
661
|
+
end
|
662
|
+
|
663
|
+
if great_success
|
664
|
+
[true, mapped, tally]
|
665
|
+
else
|
666
|
+
[false, true, tally]
|
667
|
+
end
|
668
|
+
else
|
669
|
+
[false, false, 0]
|
670
|
+
end
|
671
|
+
end
|
672
|
+
|
673
|
+
# @private
|
674
|
+
#
|
675
|
+
# @return [OnebusawaySDK::Converter, Class]
|
676
|
+
#
|
677
|
+
protected def item_type = @item_type_fn.call
|
678
|
+
|
679
|
+
# @private
|
680
|
+
#
|
681
|
+
# @param type_info [Hash{Symbol=>Object}, Proc, OnebusawaySDK::Converter, Class]
|
682
|
+
#
|
683
|
+
# @param spec [Hash{Symbol=>Object}] .
|
684
|
+
#
|
685
|
+
# @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
|
686
|
+
#
|
687
|
+
# @option spec [Proc] :enum
|
688
|
+
#
|
689
|
+
# @option spec [Proc] :union
|
690
|
+
#
|
691
|
+
# @option spec [Boolean] :"nil?"
|
692
|
+
#
|
693
|
+
def initialize(type_info, spec = {})
|
694
|
+
@item_type_fn = OnebusawaySDK::Converter.type_info(type_info || spec)
|
695
|
+
end
|
696
|
+
end
|
697
|
+
|
698
|
+
# @private
|
699
|
+
#
|
700
|
+
# @abstract
|
701
|
+
#
|
702
|
+
# Hash of items of a given type.
|
703
|
+
class HashOf
|
704
|
+
include OnebusawaySDK::Converter
|
705
|
+
|
706
|
+
private_class_method :new
|
707
|
+
|
708
|
+
def self.[](...) = new(...)
|
709
|
+
|
710
|
+
# @param other [Object]
|
711
|
+
#
|
712
|
+
# @return [Boolean]
|
713
|
+
#
|
714
|
+
def ===(other)
|
715
|
+
type = item_type
|
716
|
+
case other
|
717
|
+
in Hash
|
718
|
+
other.all? do |key, val|
|
719
|
+
case [key, val]
|
720
|
+
in [Symbol | String, ^type]
|
721
|
+
true
|
722
|
+
else
|
723
|
+
false
|
724
|
+
end
|
725
|
+
end
|
726
|
+
else
|
727
|
+
false
|
728
|
+
end
|
729
|
+
end
|
730
|
+
|
731
|
+
# @param other [Object]
|
732
|
+
#
|
733
|
+
# @return [Boolean]
|
734
|
+
#
|
735
|
+
def ==(other) = other.is_a?(OnebusawaySDK::HashOf) && other.item_type == item_type
|
736
|
+
|
737
|
+
# @private
|
738
|
+
#
|
739
|
+
# @param value [Hash{Object=>Object}, Object]
|
740
|
+
#
|
741
|
+
# @return [Hash{Symbol=>Object}, Object]
|
742
|
+
#
|
743
|
+
def coerce(value)
|
744
|
+
type = item_type
|
745
|
+
case value
|
746
|
+
in Hash
|
747
|
+
value.to_h do |key, val|
|
748
|
+
coerced = OnebusawaySDK::Converter.coerce(type, val)
|
749
|
+
[key.is_a?(String) ? key.to_sym : key, coerced]
|
750
|
+
end
|
751
|
+
else
|
752
|
+
value
|
753
|
+
end
|
754
|
+
end
|
755
|
+
|
756
|
+
# @private
|
757
|
+
#
|
758
|
+
# @param value [Hash{Object=>Object}, Object]
|
759
|
+
#
|
760
|
+
# @return [Hash{Symbol=>Object}, Object]
|
761
|
+
#
|
762
|
+
def dump(value)
|
763
|
+
type = item_type
|
764
|
+
case value
|
765
|
+
in Hash
|
766
|
+
value.transform_values do |val|
|
767
|
+
OnebusawaySDK::Converter.dump(type, val)
|
768
|
+
end
|
769
|
+
else
|
770
|
+
value
|
771
|
+
end
|
772
|
+
end
|
773
|
+
|
774
|
+
# @private
|
775
|
+
#
|
776
|
+
# @param value [Object]
|
777
|
+
#
|
778
|
+
# @return [Array(true, Object, nil), Array(false, Boolean, Integer)]
|
779
|
+
#
|
780
|
+
def try_strict_coerce(value)
|
781
|
+
case value
|
782
|
+
in Hash
|
783
|
+
type = item_type
|
784
|
+
great_success = true
|
785
|
+
tally = 0
|
786
|
+
|
787
|
+
mapped =
|
788
|
+
value.transform_values do |val|
|
789
|
+
case OnebusawaySDK::Converter.try_strict_coerce(type, val)
|
790
|
+
in [true, coerced, score]
|
791
|
+
tally += score
|
792
|
+
coerced
|
793
|
+
in [false, true, score]
|
794
|
+
great_success = false
|
795
|
+
tally += score
|
796
|
+
val
|
797
|
+
in [false, false, _]
|
798
|
+
great_success &&= val.nil?
|
799
|
+
val
|
800
|
+
end
|
801
|
+
end
|
802
|
+
|
803
|
+
if great_success
|
804
|
+
[true, mapped, tally]
|
805
|
+
else
|
806
|
+
[false, true, tally]
|
807
|
+
end
|
808
|
+
else
|
809
|
+
[false, false, 0]
|
810
|
+
end
|
811
|
+
end
|
812
|
+
|
813
|
+
# @private
|
814
|
+
#
|
815
|
+
# @return [OnebusawaySDK::Converter, Class]
|
816
|
+
#
|
817
|
+
protected def item_type = @item_type_fn.call
|
818
|
+
|
819
|
+
# @private
|
820
|
+
#
|
821
|
+
# @param type_info [Hash{Symbol=>Object}, Proc, OnebusawaySDK::Converter, Class]
|
822
|
+
#
|
823
|
+
# @param spec [Hash{Symbol=>Object}] .
|
824
|
+
#
|
825
|
+
# @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
|
826
|
+
#
|
827
|
+
# @option spec [Proc] :enum
|
828
|
+
#
|
829
|
+
# @option spec [Proc] :union
|
830
|
+
#
|
831
|
+
# @option spec [Boolean] :"nil?"
|
832
|
+
#
|
833
|
+
def initialize(type_info, spec = {})
|
834
|
+
@item_type_fn = OnebusawaySDK::Converter.type_info(type_info || spec)
|
835
|
+
end
|
836
|
+
end
|
837
|
+
|
838
|
+
# @private
|
839
|
+
#
|
840
|
+
# @abstract
|
841
|
+
#
|
842
|
+
class BaseModel
|
843
|
+
extend OnebusawaySDK::Converter
|
844
|
+
|
845
|
+
# @private
|
846
|
+
#
|
847
|
+
# Assumes superclass fields are totally defined before fields are accessed /
|
848
|
+
# defined on subclasses.
|
849
|
+
#
|
850
|
+
# @return [Hash{Symbol=>Hash{Symbol=>Object}}]
|
851
|
+
#
|
852
|
+
def self.known_fields
|
853
|
+
@known_fields ||= (self < OnebusawaySDK::BaseModel ? superclass.known_fields.dup : {})
|
854
|
+
end
|
855
|
+
|
856
|
+
class << self
|
857
|
+
# @private
|
858
|
+
#
|
859
|
+
# @return [Hash{Symbol=>Hash{Symbol=>Object}}]
|
860
|
+
#
|
861
|
+
def fields
|
862
|
+
known_fields.transform_values do |field|
|
863
|
+
{**field.except(:type_fn), type: field.fetch(:type_fn).call}
|
864
|
+
end
|
865
|
+
end
|
866
|
+
end
|
867
|
+
|
868
|
+
# @private
|
869
|
+
#
|
870
|
+
# @return [Hash{Symbol=>Proc}]
|
871
|
+
#
|
872
|
+
def self.defaults = (@defaults ||= {})
|
873
|
+
|
874
|
+
# @private
|
875
|
+
#
|
876
|
+
# @param name_sym [Symbol]
|
877
|
+
#
|
878
|
+
# @param required [Boolean]
|
879
|
+
#
|
880
|
+
# @param type_info [Hash{Symbol=>Object}, Proc, OnebusawaySDK::Converter, Class]
|
881
|
+
#
|
882
|
+
# @param spec [Hash{Symbol=>Object}] .
|
883
|
+
#
|
884
|
+
# @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
|
885
|
+
#
|
886
|
+
# @option spec [Proc] :enum
|
887
|
+
#
|
888
|
+
# @option spec [Proc] :union
|
889
|
+
#
|
890
|
+
# @option spec [Boolean] :"nil?"
|
891
|
+
#
|
892
|
+
private_class_method def self.add_field(name_sym, required:, type_info:, spec:)
|
893
|
+
type_fn, info =
|
894
|
+
case type_info
|
895
|
+
in Proc | Class | OnebusawaySDK::Converter
|
896
|
+
[OnebusawaySDK::Converter.type_info({**spec, union: type_info}), spec]
|
897
|
+
in Hash
|
898
|
+
[OnebusawaySDK::Converter.type_info(type_info), type_info]
|
899
|
+
end
|
900
|
+
|
901
|
+
fallback = info[:const]
|
902
|
+
defaults[name_sym] = fallback if required && !info[:nil?] && info.key?(:const)
|
903
|
+
|
904
|
+
key = info.fetch(:api_name, name_sym)
|
905
|
+
setter = "#{name_sym}="
|
906
|
+
|
907
|
+
if known_fields.key?(name_sym)
|
908
|
+
[name_sym, setter].each { undef_method(_1) }
|
909
|
+
end
|
910
|
+
|
911
|
+
known_fields[name_sym] = {mode: @mode, key: key, required: required, type_fn: type_fn}
|
912
|
+
|
913
|
+
define_method(setter) do |val|
|
914
|
+
@data[key] = val
|
915
|
+
end
|
916
|
+
|
917
|
+
define_method(name_sym) do
|
918
|
+
field_type = type_fn.call
|
919
|
+
value = @data.fetch(key) { self.class.defaults[key] }
|
920
|
+
OnebusawaySDK::Converter.coerce(field_type, value)
|
921
|
+
rescue StandardError
|
922
|
+
name = self.class.name.split("::").last
|
923
|
+
raise OnebusawaySDK::ConversionError.new(
|
924
|
+
"Failed to parse #{name}.#{name_sym} as #{field_type.inspect}. " \
|
925
|
+
"To get the unparsed API response, use #{name}[:#{key}]."
|
926
|
+
)
|
927
|
+
end
|
928
|
+
end
|
929
|
+
|
930
|
+
# @private
|
931
|
+
#
|
932
|
+
# @param name_sym [Symbol]
|
933
|
+
#
|
934
|
+
# @param type_info [Hash{Symbol=>Object}, Proc, OnebusawaySDK::Converter, Class]
|
935
|
+
#
|
936
|
+
# @param spec [Hash{Symbol=>Object}] .
|
937
|
+
#
|
938
|
+
# @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
|
939
|
+
#
|
940
|
+
# @option spec [Proc] :enum
|
941
|
+
#
|
942
|
+
# @option spec [Proc] :union
|
943
|
+
#
|
944
|
+
# @option spec [Boolean] :"nil?"
|
945
|
+
#
|
946
|
+
def self.required(name_sym, type_info, spec = {})
|
947
|
+
add_field(name_sym, required: true, type_info: type_info, spec: spec)
|
948
|
+
end
|
949
|
+
|
950
|
+
# @private
|
951
|
+
#
|
952
|
+
# @param name_sym [Symbol]
|
953
|
+
#
|
954
|
+
# @param type_info [Hash{Symbol=>Object}, Proc, OnebusawaySDK::Converter, Class]
|
955
|
+
#
|
956
|
+
# @param spec [Hash{Symbol=>Object}] .
|
957
|
+
#
|
958
|
+
# @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
|
959
|
+
#
|
960
|
+
# @option spec [Proc] :enum
|
961
|
+
#
|
962
|
+
# @option spec [Proc] :union
|
963
|
+
#
|
964
|
+
# @option spec [Boolean] :"nil?"
|
965
|
+
#
|
966
|
+
def self.optional(name_sym, type_info, spec = {})
|
967
|
+
add_field(name_sym, required: false, type_info: type_info, spec: spec)
|
968
|
+
end
|
969
|
+
|
970
|
+
# @private
|
971
|
+
#
|
972
|
+
# `request_only` attributes not excluded from `.#coerce` when receiving responses
|
973
|
+
# even if well behaved servers should not send them
|
974
|
+
#
|
975
|
+
# @param blk [Proc]
|
976
|
+
#
|
977
|
+
private_class_method def self.request_only(&blk)
|
978
|
+
@mode = :dump
|
979
|
+
blk.call
|
980
|
+
ensure
|
981
|
+
@mode = nil
|
982
|
+
end
|
983
|
+
|
984
|
+
# @private
|
985
|
+
#
|
986
|
+
# `response_only` attributes are omitted from `.#dump` when making requests
|
987
|
+
#
|
988
|
+
# @param blk [Proc]
|
989
|
+
#
|
990
|
+
private_class_method def self.response_only(&blk)
|
991
|
+
@mode = :coerce
|
992
|
+
blk.call
|
993
|
+
ensure
|
994
|
+
@mode = nil
|
995
|
+
end
|
996
|
+
|
997
|
+
# @param other [Object]
|
998
|
+
#
|
999
|
+
# @return [Boolean]
|
1000
|
+
#
|
1001
|
+
def ==(other)
|
1002
|
+
case other
|
1003
|
+
in OnebusawaySDK::BaseModel
|
1004
|
+
self.class.fields == other.class.fields && @data == other.to_h
|
1005
|
+
else
|
1006
|
+
false
|
1007
|
+
end
|
1008
|
+
end
|
1009
|
+
|
1010
|
+
# @private
|
1011
|
+
#
|
1012
|
+
# @param value [OnebusawaySDK::BaseModel, Hash{Object=>Object}, Object]
|
1013
|
+
#
|
1014
|
+
# @return [OnebusawaySDK::BaseModel, Object]
|
1015
|
+
#
|
1016
|
+
def self.coerce(value)
|
1017
|
+
case OnebusawaySDK::Util.coerce_hash(value)
|
1018
|
+
in Hash => coerced
|
1019
|
+
new(coerced)
|
1020
|
+
else
|
1021
|
+
value
|
1022
|
+
end
|
1023
|
+
end
|
1024
|
+
|
1025
|
+
# @private
|
1026
|
+
#
|
1027
|
+
# @param value [OnebusawaySDK::BaseModel, Object]
|
1028
|
+
#
|
1029
|
+
# @return [Hash{Object=>Object}, Object]
|
1030
|
+
#
|
1031
|
+
def self.dump(value)
|
1032
|
+
unless (coerced = OnebusawaySDK::Util.coerce_hash(value)).is_a?(Hash)
|
1033
|
+
return value
|
1034
|
+
end
|
1035
|
+
|
1036
|
+
values = coerced.filter_map do |key, val|
|
1037
|
+
name = key.to_sym
|
1038
|
+
case (field = known_fields[name])
|
1039
|
+
in nil
|
1040
|
+
[name, val]
|
1041
|
+
else
|
1042
|
+
mode, type_fn, api_name = field.fetch_values(:mode, :type_fn, :key)
|
1043
|
+
case mode
|
1044
|
+
in :coerce
|
1045
|
+
next
|
1046
|
+
else
|
1047
|
+
target = type_fn.call
|
1048
|
+
[api_name, OnebusawaySDK::Converter.dump(target, val)]
|
1049
|
+
end
|
1050
|
+
end
|
1051
|
+
end.to_h
|
1052
|
+
|
1053
|
+
defaults.each do |key, val|
|
1054
|
+
next if values.key?(key)
|
1055
|
+
|
1056
|
+
values[key] = val
|
1057
|
+
end
|
1058
|
+
|
1059
|
+
values
|
1060
|
+
end
|
1061
|
+
|
1062
|
+
# @private
|
1063
|
+
#
|
1064
|
+
# @param value [Object]
|
1065
|
+
#
|
1066
|
+
# @return [Array(true, Object, nil), Array(false, Boolean, Integer)]
|
1067
|
+
#
|
1068
|
+
def self.try_strict_coerce(value)
|
1069
|
+
case value
|
1070
|
+
in Hash | OnebusawaySDK::BaseModel
|
1071
|
+
value = value.to_h
|
1072
|
+
else
|
1073
|
+
return [false, false, 0]
|
1074
|
+
end
|
1075
|
+
|
1076
|
+
keys = value.keys.to_set
|
1077
|
+
great_success = true
|
1078
|
+
tally = 0
|
1079
|
+
acc = {}
|
1080
|
+
|
1081
|
+
known_fields.each_value do |field|
|
1082
|
+
mode, required, type_fn, api_name = field.fetch_values(:mode, :required, :type_fn, :key)
|
1083
|
+
keys.delete(api_name)
|
1084
|
+
|
1085
|
+
case [required && mode != :dump, value.key?(api_name)]
|
1086
|
+
in [_, true]
|
1087
|
+
target = type_fn.call
|
1088
|
+
item = value.fetch(api_name)
|
1089
|
+
case OnebusawaySDK::Converter.try_strict_coerce(target, item)
|
1090
|
+
in [true, coerced, score]
|
1091
|
+
tally += score
|
1092
|
+
acc[api_name] = coerced
|
1093
|
+
in [false, true, score]
|
1094
|
+
great_success = false
|
1095
|
+
tally += score
|
1096
|
+
acc[api_name] = item
|
1097
|
+
in [false, false, _]
|
1098
|
+
great_success &&= item.nil?
|
1099
|
+
end
|
1100
|
+
in [true, false]
|
1101
|
+
great_success = false
|
1102
|
+
in [false, false]
|
1103
|
+
nil
|
1104
|
+
end
|
1105
|
+
end
|
1106
|
+
|
1107
|
+
keys.each do |key|
|
1108
|
+
acc[key] = value.fetch(key)
|
1109
|
+
end
|
1110
|
+
|
1111
|
+
great_success ? [true, new(acc), tally] : [false, true, tally]
|
1112
|
+
end
|
1113
|
+
|
1114
|
+
# Returns the raw value associated with the given key, if found. Otherwise, nil is
|
1115
|
+
# returned.
|
1116
|
+
#
|
1117
|
+
# It is valid to lookup keys that are not in the API spec, for example to access
|
1118
|
+
# undocumented features. This method does not parse response data into
|
1119
|
+
# higher-level types. Lookup by anything other than a Symbol is an ArgumentError.
|
1120
|
+
#
|
1121
|
+
# @param key [Symbol]
|
1122
|
+
#
|
1123
|
+
# @return [Object, nil]
|
1124
|
+
#
|
1125
|
+
def [](key)
|
1126
|
+
unless key.instance_of?(Symbol)
|
1127
|
+
raise ArgumentError.new("Expected symbol key for lookup, got #{key.inspect}")
|
1128
|
+
end
|
1129
|
+
|
1130
|
+
@data[key]
|
1131
|
+
end
|
1132
|
+
|
1133
|
+
# Returns a Hash of the data underlying this object. O(1)
|
1134
|
+
#
|
1135
|
+
# Keys are Symbols and values are the raw values from the response. The return
|
1136
|
+
# value indicates which values were ever set on the object. i.e. there will be a
|
1137
|
+
# key in this hash if they ever were, even if the set value was nil.
|
1138
|
+
#
|
1139
|
+
# This method is not recursive. The returned value is shared by the object, so it
|
1140
|
+
# should not be mutated.
|
1141
|
+
#
|
1142
|
+
# @return [Hash{Symbol=>Object}]
|
1143
|
+
#
|
1144
|
+
def to_h = @data
|
1145
|
+
|
1146
|
+
alias_method :to_hash, :to_h
|
1147
|
+
|
1148
|
+
# @param keys [Array<Symbol>, nil]
|
1149
|
+
#
|
1150
|
+
# @return [Hash{Symbol=>Object}]
|
1151
|
+
#
|
1152
|
+
def deconstruct_keys(keys)
|
1153
|
+
(keys || self.class.known_fields.keys).filter_map do |k|
|
1154
|
+
unless self.class.known_fields.key?(k)
|
1155
|
+
next
|
1156
|
+
end
|
1157
|
+
|
1158
|
+
[k, method(k).call]
|
1159
|
+
end
|
1160
|
+
.to_h
|
1161
|
+
end
|
1162
|
+
|
1163
|
+
# Create a new instance of a model.
|
1164
|
+
#
|
1165
|
+
# @param data [Hash{Symbol=>Object}, OnebusawaySDK::BaseModel]
|
1166
|
+
#
|
1167
|
+
def initialize(data = {})
|
1168
|
+
case OnebusawaySDK::Util.coerce_hash(data)
|
1169
|
+
in Hash => coerced
|
1170
|
+
@data = coerced.transform_keys(&:to_sym)
|
1171
|
+
else
|
1172
|
+
raise ArgumentError.new("Expected a #{Hash} or #{OnebusawaySDK::BaseModel}, got #{data.inspect}")
|
1173
|
+
end
|
1174
|
+
end
|
1175
|
+
|
1176
|
+
# @return [String]
|
1177
|
+
#
|
1178
|
+
def to_s = @data.to_s
|
1179
|
+
|
1180
|
+
# @return [String]
|
1181
|
+
#
|
1182
|
+
def inspect
|
1183
|
+
"#<#{self.class.name}:0x#{object_id.to_s(16)} #{deconstruct_keys(nil).map do |k, v|
|
1184
|
+
"#{k}=#{v.inspect}"
|
1185
|
+
end.join(' ')}>"
|
1186
|
+
end
|
1187
|
+
end
|
1188
|
+
end
|