onebusaway-sdk 0.1.0.pre.alpha.206 → 0.1.0.pre.alpha.207
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 +4 -4
- data/README.md +32 -20
- data/lib/onebusaway-sdk/base_client.rb +41 -49
- data/lib/onebusaway-sdk/base_model.rb +489 -514
- data/lib/onebusaway-sdk/base_page.rb +35 -15
- data/lib/onebusaway-sdk/client.rb +1 -3
- data/lib/onebusaway-sdk/errors.rb +12 -17
- data/lib/onebusaway-sdk/extern.rb +1 -4
- data/lib/onebusaway-sdk/models/references.rb +0 -21
- data/lib/onebusaway-sdk/models/report_problem_with_stop_retrieve_params.rb +0 -21
- data/lib/onebusaway-sdk/models/report_problem_with_trip_retrieve_params.rb +0 -23
- data/lib/onebusaway-sdk/pooled_net_requester.rb +40 -46
- data/lib/onebusaway-sdk/request_options.rb +4 -11
- data/lib/onebusaway-sdk/resources/agencies_with_coverage.rb +0 -2
- data/lib/onebusaway-sdk/resources/agency.rb +0 -2
- data/lib/onebusaway-sdk/resources/arrival_and_departure.rb +0 -3
- data/lib/onebusaway-sdk/resources/block.rb +0 -2
- data/lib/onebusaway-sdk/resources/config.rb +0 -2
- data/lib/onebusaway-sdk/resources/current_time.rb +0 -2
- data/lib/onebusaway-sdk/resources/report_problem_with_stop.rb +0 -2
- data/lib/onebusaway-sdk/resources/report_problem_with_trip.rb +0 -2
- data/lib/onebusaway-sdk/resources/route.rb +0 -2
- data/lib/onebusaway-sdk/resources/route_ids_for_agency.rb +0 -2
- data/lib/onebusaway-sdk/resources/routes_for_agency.rb +0 -2
- data/lib/onebusaway-sdk/resources/routes_for_location.rb +0 -2
- data/lib/onebusaway-sdk/resources/schedule_for_route.rb +0 -2
- data/lib/onebusaway-sdk/resources/schedule_for_stop.rb +0 -2
- data/lib/onebusaway-sdk/resources/search_for_route.rb +0 -2
- data/lib/onebusaway-sdk/resources/search_for_stop.rb +0 -2
- data/lib/onebusaway-sdk/resources/shape.rb +0 -2
- data/lib/onebusaway-sdk/resources/stop.rb +0 -2
- data/lib/onebusaway-sdk/resources/stop_ids_for_agency.rb +0 -2
- data/lib/onebusaway-sdk/resources/stops_for_agency.rb +0 -2
- data/lib/onebusaway-sdk/resources/stops_for_location.rb +0 -2
- data/lib/onebusaway-sdk/resources/stops_for_route.rb +0 -2
- data/lib/onebusaway-sdk/resources/trip.rb +0 -2
- data/lib/onebusaway-sdk/resources/trip_details.rb +0 -2
- data/lib/onebusaway-sdk/resources/trip_for_vehicle.rb +0 -2
- data/lib/onebusaway-sdk/resources/trips_for_location.rb +0 -2
- data/lib/onebusaway-sdk/resources/trips_for_route.rb +0 -2
- data/lib/onebusaway-sdk/resources/vehicles_for_agency.rb +0 -2
- data/lib/onebusaway-sdk/util.rb +201 -118
- data/lib/onebusaway-sdk/version.rb +1 -1
- data/lib/onebusaway-sdk.rb +1 -0
- data/manifest.yaml +1 -0
- data/rbi/lib/onebusaway-sdk/base_client.rbi +46 -21
- data/rbi/lib/onebusaway-sdk/base_model.rbi +400 -256
- data/rbi/lib/onebusaway-sdk/base_page.rbi +3 -4
- data/rbi/lib/onebusaway-sdk/client.rbi +7 -2
- data/rbi/lib/onebusaway-sdk/errors.rbi +41 -8
- data/rbi/lib/onebusaway-sdk/extern.rbi +1 -1
- data/rbi/lib/onebusaway-sdk/models/agencies_with_coverage_list_params.rbi +5 -2
- data/rbi/lib/onebusaway-sdk/models/agencies_with_coverage_list_response.rbi +9 -6
- data/rbi/lib/onebusaway-sdk/models/agency_retrieve_params.rbi +5 -2
- data/rbi/lib/onebusaway-sdk/models/agency_retrieve_response.rbi +6 -6
- data/rbi/lib/onebusaway-sdk/models/arrival_and_departure_list_params.rbi +5 -2
- data/rbi/lib/onebusaway-sdk/models/arrival_and_departure_list_response.rbi +95 -14
- data/rbi/lib/onebusaway-sdk/models/arrival_and_departure_retrieve_params.rbi +2 -9
- data/rbi/lib/onebusaway-sdk/models/arrival_and_departure_retrieve_response.rbi +93 -12
- data/rbi/lib/onebusaway-sdk/models/block_retrieve_params.rbi +5 -2
- data/rbi/lib/onebusaway-sdk/models/block_retrieve_response.rbi +14 -20
- data/rbi/lib/onebusaway-sdk/models/config_retrieve_params.rbi +5 -2
- data/rbi/lib/onebusaway-sdk/models/config_retrieve_response.rbi +8 -14
- data/rbi/lib/onebusaway-sdk/models/current_time_retrieve_params.rbi +5 -2
- data/rbi/lib/onebusaway-sdk/models/current_time_retrieve_response.rbi +6 -6
- data/rbi/lib/onebusaway-sdk/models/references.rbi +60 -43
- data/rbi/lib/onebusaway-sdk/models/report_problem_with_stop_retrieve_params.rbi +10 -6
- data/rbi/lib/onebusaway-sdk/models/report_problem_with_trip_retrieve_params.rbi +15 -6
- data/rbi/lib/onebusaway-sdk/models/response_wrapper.rbi +4 -2
- data/rbi/lib/onebusaway-sdk/models/route_ids_for_agency_list_params.rbi +5 -2
- data/rbi/lib/onebusaway-sdk/models/route_ids_for_agency_list_response.rbi +4 -4
- data/rbi/lib/onebusaway-sdk/models/route_retrieve_params.rbi +5 -2
- data/rbi/lib/onebusaway-sdk/models/route_retrieve_response.rbi +6 -6
- data/rbi/lib/onebusaway-sdk/models/routes_for_agency_list_params.rbi +5 -2
- data/rbi/lib/onebusaway-sdk/models/routes_for_agency_list_response.rbi +6 -6
- data/rbi/lib/onebusaway-sdk/models/routes_for_location_list_params.rbi +2 -2
- data/rbi/lib/onebusaway-sdk/models/routes_for_location_list_response.rbi +6 -6
- data/rbi/lib/onebusaway-sdk/models/schedule_for_route_retrieve_params.rbi +5 -8
- data/rbi/lib/onebusaway-sdk/models/schedule_for_route_retrieve_response.rbi +19 -16
- data/rbi/lib/onebusaway-sdk/models/schedule_for_stop_retrieve_params.rbi +5 -8
- data/rbi/lib/onebusaway-sdk/models/schedule_for_stop_retrieve_response.rbi +14 -14
- data/rbi/lib/onebusaway-sdk/models/search_for_route_list_params.rbi +4 -2
- data/rbi/lib/onebusaway-sdk/models/search_for_route_list_response.rbi +6 -6
- data/rbi/lib/onebusaway-sdk/models/search_for_stop_list_params.rbi +4 -2
- data/rbi/lib/onebusaway-sdk/models/search_for_stop_list_response.rbi +6 -6
- data/rbi/lib/onebusaway-sdk/models/shape_retrieve_params.rbi +5 -2
- data/rbi/lib/onebusaway-sdk/models/shape_retrieve_response.rbi +7 -6
- data/rbi/lib/onebusaway-sdk/models/stop_ids_for_agency_list_params.rbi +5 -2
- data/rbi/lib/onebusaway-sdk/models/stop_ids_for_agency_list_response.rbi +4 -4
- data/rbi/lib/onebusaway-sdk/models/stop_retrieve_params.rbi +5 -2
- data/rbi/lib/onebusaway-sdk/models/stop_retrieve_response.rbi +6 -6
- data/rbi/lib/onebusaway-sdk/models/stops_for_agency_list_params.rbi +5 -2
- data/rbi/lib/onebusaway-sdk/models/stops_for_agency_list_response.rbi +4 -4
- data/rbi/lib/onebusaway-sdk/models/stops_for_location_list_params.rbi +6 -2
- data/rbi/lib/onebusaway-sdk/models/stops_for_location_list_response.rbi +6 -6
- data/rbi/lib/onebusaway-sdk/models/stops_for_route_list_params.rbi +4 -2
- data/rbi/lib/onebusaway-sdk/models/stops_for_route_list_response.rbi +14 -14
- data/rbi/lib/onebusaway-sdk/models/trip_detail_retrieve_params.rbi +10 -2
- data/rbi/lib/onebusaway-sdk/models/trip_detail_retrieve_response.rbi +54 -23
- data/rbi/lib/onebusaway-sdk/models/trip_for_vehicle_retrieve_params.rbi +9 -8
- data/rbi/lib/onebusaway-sdk/models/trip_for_vehicle_retrieve_response.rbi +54 -23
- data/rbi/lib/onebusaway-sdk/models/trip_retrieve_params.rbi +5 -2
- data/rbi/lib/onebusaway-sdk/models/trip_retrieve_response.rbi +6 -6
- data/rbi/lib/onebusaway-sdk/models/trips_for_location_list_params.rbi +12 -12
- data/rbi/lib/onebusaway-sdk/models/trips_for_location_list_response.rbi +56 -16
- data/rbi/lib/onebusaway-sdk/models/trips_for_route_list_params.rbi +6 -2
- data/rbi/lib/onebusaway-sdk/models/trips_for_route_list_response.rbi +54 -16
- data/rbi/lib/onebusaway-sdk/models/vehicles_for_agency_list_params.rbi +3 -2
- data/rbi/lib/onebusaway-sdk/models/vehicles_for_agency_list_response.rbi +52 -14
- data/rbi/lib/onebusaway-sdk/pooled_net_requester.rbi +28 -13
- data/rbi/lib/onebusaway-sdk/request_options.rbi +25 -2
- data/rbi/lib/onebusaway-sdk/resources/agencies_with_coverage.rbi +4 -2
- data/rbi/lib/onebusaway-sdk/resources/agency.rbi +8 -3
- data/rbi/lib/onebusaway-sdk/resources/arrival_and_departure.rbi +14 -3
- data/rbi/lib/onebusaway-sdk/resources/block.rbi +8 -3
- data/rbi/lib/onebusaway-sdk/resources/config.rbi +3 -2
- data/rbi/lib/onebusaway-sdk/resources/current_time.rbi +3 -2
- data/rbi/lib/onebusaway-sdk/resources/report_problem_with_stop.rbi +9 -2
- data/rbi/lib/onebusaway-sdk/resources/report_problem_with_trip.rbi +14 -2
- data/rbi/lib/onebusaway-sdk/resources/route.rbi +8 -3
- data/rbi/lib/onebusaway-sdk/resources/route_ids_for_agency.rbi +8 -3
- data/rbi/lib/onebusaway-sdk/resources/routes_for_agency.rbi +8 -3
- data/rbi/lib/onebusaway-sdk/resources/routes_for_location.rbi +3 -2
- data/rbi/lib/onebusaway-sdk/resources/schedule_for_route.rbi +11 -3
- data/rbi/lib/onebusaway-sdk/resources/schedule_for_stop.rbi +11 -3
- data/rbi/lib/onebusaway-sdk/resources/search_for_route.rbi +10 -3
- data/rbi/lib/onebusaway-sdk/resources/search_for_stop.rbi +10 -3
- data/rbi/lib/onebusaway-sdk/resources/shape.rbi +8 -3
- data/rbi/lib/onebusaway-sdk/resources/stop.rbi +8 -3
- data/rbi/lib/onebusaway-sdk/resources/stop_ids_for_agency.rbi +8 -3
- data/rbi/lib/onebusaway-sdk/resources/stops_for_agency.rbi +8 -3
- data/rbi/lib/onebusaway-sdk/resources/stops_for_location.rbi +16 -3
- data/rbi/lib/onebusaway-sdk/resources/stops_for_route.rbi +12 -3
- data/rbi/lib/onebusaway-sdk/resources/trip.rbi +8 -3
- data/rbi/lib/onebusaway-sdk/resources/trip_details.rbi +12 -2
- data/rbi/lib/onebusaway-sdk/resources/trip_for_vehicle.rbi +11 -2
- data/rbi/lib/onebusaway-sdk/resources/trips_for_location.rbi +12 -2
- data/rbi/lib/onebusaway-sdk/resources/trips_for_route.rbi +15 -3
- data/rbi/lib/onebusaway-sdk/resources/vehicles_for_agency.rbi +10 -3
- data/rbi/lib/onebusaway-sdk/util.rbi +207 -105
- data/rbi/lib/onebusaway-sdk/version.rbi +1 -1
- data/sig/onebusaway-sdk/base_client.rbs +6 -1
- data/sig/onebusaway-sdk/base_model.rbs +8 -6
- data/sig/onebusaway-sdk/base_page.rbs +1 -1
- data/sig/onebusaway-sdk/errors.rbs +4 -4
- data/sig/onebusaway-sdk/pooled_net_requester.rbs +11 -4
- data/sig/onebusaway-sdk/request_options.rbs +4 -0
- data/sig/onebusaway-sdk/util.rbs +33 -8
- data/sig/onebusaway-sdk/version.rbs +1 -1
- metadata +4 -4
@@ -1,19 +1,21 @@
|
|
1
1
|
# typed: strong
|
2
2
|
|
3
3
|
module OnebusawaySDK
|
4
|
+
# @api private
|
4
5
|
module Converter
|
5
|
-
abstract!
|
6
|
-
|
7
6
|
Input = T.type_alias { T.any(OnebusawaySDK::Converter, T::Class[T.anything]) }
|
8
7
|
|
8
|
+
# @api private
|
9
9
|
sig { overridable.params(value: T.anything).returns(T.anything) }
|
10
10
|
def coerce(value)
|
11
11
|
end
|
12
12
|
|
13
|
+
# @api private
|
13
14
|
sig { overridable.params(value: T.anything).returns(T.anything) }
|
14
15
|
def dump(value)
|
15
16
|
end
|
16
17
|
|
18
|
+
# @api private
|
17
19
|
sig do
|
18
20
|
overridable
|
19
21
|
.params(value: T.anything)
|
@@ -22,107 +24,171 @@ module OnebusawaySDK
|
|
22
24
|
def try_strict_coerce(value)
|
23
25
|
end
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
class << self
|
28
|
+
# @api private
|
29
|
+
sig do
|
30
|
+
params(
|
31
|
+
spec: T.any(
|
32
|
+
{
|
33
|
+
const: T.nilable(T.any(NilClass, T::Boolean, Integer, Float, Symbol)),
|
34
|
+
enum: T.nilable(T.proc.returns(OnebusawaySDK::Converter::Input)),
|
35
|
+
union: T.nilable(T.proc.returns(OnebusawaySDK::Converter::Input))
|
36
|
+
},
|
37
|
+
T.proc.returns(OnebusawaySDK::Converter::Input),
|
38
|
+
OnebusawaySDK::Converter::Input
|
39
|
+
)
|
35
40
|
)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
41
|
+
.returns(T.proc.returns(T.anything).void)
|
42
|
+
end
|
43
|
+
def self.type_info(spec)
|
44
|
+
end
|
45
|
+
|
46
|
+
# @api private
|
47
|
+
#
|
48
|
+
# Based on `target`, transform `value` into `target`, to the extent possible:
|
49
|
+
#
|
50
|
+
# 1. if the given `value` conforms to `target` already, return the given `value`
|
51
|
+
# 2. if it's possible and safe to convert the given `value` to `target`, then the
|
52
|
+
# converted value
|
53
|
+
# 3. otherwise, the given `value` unaltered
|
54
|
+
sig { params(target: OnebusawaySDK::Converter::Input, value: T.anything).returns(T.anything) }
|
55
|
+
def self.coerce(target, value)
|
56
|
+
end
|
57
|
+
|
58
|
+
# @api private
|
59
|
+
sig { params(target: OnebusawaySDK::Converter::Input, value: T.anything).returns(T.anything) }
|
60
|
+
def self.dump(target, value)
|
61
|
+
end
|
62
|
+
|
63
|
+
# @api private
|
64
|
+
#
|
65
|
+
# The underlying algorithm for computing maximal compatibility is subject to
|
66
|
+
# future improvements.
|
67
|
+
#
|
68
|
+
# Similar to `#.coerce`, used to determine the best union variant to decode into.
|
69
|
+
#
|
70
|
+
# 1. determine if strict-ish coercion is possible
|
71
|
+
# 2. return either result of successful coercion or if loose coercion is possible
|
72
|
+
# 3. return a score for recursively tallied count for fields that can be coerced
|
73
|
+
sig { params(target: OnebusawaySDK::Converter::Input, value: T.anything).returns(T.anything) }
|
74
|
+
def self.try_strict_coerce(target, value)
|
75
|
+
end
|
52
76
|
end
|
53
77
|
end
|
54
78
|
|
79
|
+
# @api private
|
80
|
+
#
|
81
|
+
# When we don't know what to expect for the value.
|
55
82
|
class Unknown
|
56
|
-
abstract!
|
57
|
-
|
58
83
|
extend OnebusawaySDK::Converter
|
59
84
|
|
60
|
-
|
85
|
+
abstract!
|
86
|
+
final!
|
87
|
+
|
88
|
+
sig(:final) { params(other: T.anything).returns(T::Boolean) }
|
61
89
|
def self.===(other)
|
62
90
|
end
|
63
91
|
|
64
|
-
sig { params(other: T.anything).returns(T::Boolean) }
|
92
|
+
sig(:final) { params(other: T.anything).returns(T::Boolean) }
|
65
93
|
def self.==(other)
|
66
94
|
end
|
67
95
|
|
68
|
-
|
69
|
-
|
70
|
-
|
96
|
+
class << self
|
97
|
+
# @api private
|
98
|
+
sig(:final) { override.params(value: T.anything).returns(T.anything) }
|
99
|
+
def coerce(value)
|
100
|
+
end
|
71
101
|
|
72
|
-
|
73
|
-
|
74
|
-
|
102
|
+
# @api private
|
103
|
+
sig(:final) { override.params(value: T.anything).returns(T.anything) }
|
104
|
+
def dump(value)
|
105
|
+
end
|
75
106
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
107
|
+
# @api private
|
108
|
+
sig(:final) do
|
109
|
+
override
|
110
|
+
.params(value: T.anything)
|
111
|
+
.returns(T.any([T::Boolean, T.anything, NilClass], [T::Boolean, T::Boolean, Integer]))
|
112
|
+
end
|
113
|
+
def try_strict_coerce(value)
|
114
|
+
end
|
82
115
|
end
|
83
116
|
end
|
84
117
|
|
118
|
+
# @api private
|
119
|
+
#
|
120
|
+
# Ruby has no Boolean class; this is something for models to refer to.
|
85
121
|
class BooleanModel
|
86
|
-
abstract!
|
87
|
-
|
88
122
|
extend OnebusawaySDK::Converter
|
89
123
|
|
90
|
-
|
124
|
+
abstract!
|
125
|
+
final!
|
126
|
+
|
127
|
+
sig(:final) { params(other: T.anything).returns(T::Boolean) }
|
91
128
|
def self.===(other)
|
92
129
|
end
|
93
130
|
|
94
|
-
sig { params(other: T.anything).returns(T::Boolean) }
|
131
|
+
sig(:final) { params(other: T.anything).returns(T::Boolean) }
|
95
132
|
def self.==(other)
|
96
133
|
end
|
97
134
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
.params(value: T.anything)
|
109
|
-
|
110
|
-
|
111
|
-
|
135
|
+
class << self
|
136
|
+
# @api private
|
137
|
+
sig(:final) do
|
138
|
+
override.params(value: T.any(T::Boolean, T.anything)).returns(T.any(T::Boolean, T.anything))
|
139
|
+
end
|
140
|
+
def coerce(value)
|
141
|
+
end
|
142
|
+
|
143
|
+
# @api private
|
144
|
+
sig(:final) do
|
145
|
+
override.params(value: T.any(T::Boolean, T.anything)).returns(T.any(T::Boolean, T.anything))
|
146
|
+
end
|
147
|
+
def dump(value)
|
148
|
+
end
|
149
|
+
|
150
|
+
# @api private
|
151
|
+
sig(:final) do
|
152
|
+
override
|
153
|
+
.params(value: T.anything)
|
154
|
+
.returns(T.any([T::Boolean, T.anything, NilClass], [T::Boolean, T::Boolean, Integer]))
|
155
|
+
end
|
156
|
+
def try_strict_coerce(value)
|
157
|
+
end
|
112
158
|
end
|
113
159
|
end
|
114
160
|
|
161
|
+
# @api private
|
162
|
+
#
|
163
|
+
# A value from among a specified list of options. OpenAPI enum values map to Ruby
|
164
|
+
# values in the SDK as follows:
|
165
|
+
#
|
166
|
+
# 1. boolean => true | false
|
167
|
+
# 2. integer => Integer
|
168
|
+
# 3. float => Float
|
169
|
+
# 4. string => Symbol
|
170
|
+
#
|
171
|
+
# We can therefore convert string values to Symbols, but can't convert other
|
172
|
+
# values safely.
|
115
173
|
class Enum
|
174
|
+
extend OnebusawaySDK::Converter
|
175
|
+
|
116
176
|
abstract!
|
117
177
|
|
118
|
-
|
178
|
+
Value = type_template(:out)
|
119
179
|
|
120
|
-
|
121
|
-
|
122
|
-
|
180
|
+
class << self
|
181
|
+
# All of the valid Symbol values for this enum.
|
182
|
+
sig { overridable.returns(T::Array[Value]) }
|
183
|
+
def values
|
184
|
+
end
|
123
185
|
|
124
|
-
|
125
|
-
|
186
|
+
# @api private
|
187
|
+
#
|
188
|
+
# Guard against thread safety issues by instantiating `@values`.
|
189
|
+
sig { void }
|
190
|
+
private def finalize!
|
191
|
+
end
|
126
192
|
end
|
127
193
|
|
128
194
|
sig { params(other: T.anything).returns(T::Boolean) }
|
@@ -133,61 +199,74 @@ module OnebusawaySDK
|
|
133
199
|
def self.==(other)
|
134
200
|
end
|
135
201
|
|
136
|
-
|
137
|
-
|
138
|
-
|
202
|
+
class << self
|
203
|
+
# @api private
|
204
|
+
sig { override.params(value: T.any(String, Symbol, T.anything)).returns(T.any(Symbol, T.anything)) }
|
205
|
+
def coerce(value)
|
206
|
+
end
|
139
207
|
|
140
|
-
|
141
|
-
|
142
|
-
|
208
|
+
# @api private
|
209
|
+
sig { override.params(value: T.any(Symbol, T.anything)).returns(T.any(Symbol, T.anything)) }
|
210
|
+
def dump(value)
|
211
|
+
end
|
143
212
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
213
|
+
# @api private
|
214
|
+
sig do
|
215
|
+
override
|
216
|
+
.params(value: T.anything)
|
217
|
+
.returns(T.any([T::Boolean, T.anything, NilClass], [T::Boolean, T::Boolean, Integer]))
|
218
|
+
end
|
219
|
+
def try_strict_coerce(value)
|
220
|
+
end
|
150
221
|
end
|
151
222
|
end
|
152
223
|
|
224
|
+
# @api private
|
153
225
|
class Union
|
154
|
-
abstract!
|
155
|
-
|
156
226
|
extend OnebusawaySDK::Converter
|
157
227
|
|
158
|
-
|
159
|
-
private_class_method def self.known_variants
|
160
|
-
end
|
161
|
-
|
162
|
-
sig { overridable.returns(T::Array[[T.nilable(Symbol), T.anything]]) }
|
163
|
-
private_class_method def self.variants
|
164
|
-
end
|
165
|
-
|
166
|
-
sig { params(property: Symbol).void }
|
167
|
-
private_class_method def self.discriminator(property)
|
168
|
-
end
|
228
|
+
abstract!
|
169
229
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
230
|
+
Variants = type_template(:out)
|
231
|
+
|
232
|
+
class << self
|
233
|
+
# @api private
|
234
|
+
#
|
235
|
+
# All of the specified variant info for this union.
|
236
|
+
sig { returns(T::Array[[T.nilable(Symbol), T.proc.returns(Variants)]]) }
|
237
|
+
private def known_variants
|
238
|
+
end
|
239
|
+
|
240
|
+
# @api private
|
241
|
+
sig { returns(T::Array[[T.nilable(Symbol), Variants]]) }
|
242
|
+
protected def derefed_variants
|
243
|
+
end
|
244
|
+
|
245
|
+
# All of the specified variants for this union.
|
246
|
+
sig { overridable.returns(T::Array[Variants]) }
|
247
|
+
def variants
|
248
|
+
end
|
249
|
+
|
250
|
+
# @api private
|
251
|
+
sig { params(property: Symbol).void }
|
252
|
+
private def discriminator(property)
|
253
|
+
end
|
254
|
+
|
255
|
+
# @api private
|
256
|
+
sig do
|
257
|
+
params(
|
258
|
+
key: T.any(Symbol, T::Hash[Symbol, T.anything], T.proc.returns(Variants), Variants),
|
259
|
+
spec: T.any(T::Hash[Symbol, T.anything], T.proc.returns(Variants), Variants)
|
182
260
|
)
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
end
|
261
|
+
.void
|
262
|
+
end
|
263
|
+
private def variant(key, spec = nil)
|
264
|
+
end
|
188
265
|
|
189
|
-
|
190
|
-
|
266
|
+
# @api private
|
267
|
+
sig { params(value: T.anything).returns(T.nilable(Variants)) }
|
268
|
+
private def resolve_variant(value)
|
269
|
+
end
|
191
270
|
end
|
192
271
|
|
193
272
|
sig { params(other: T.anything).returns(T::Boolean) }
|
@@ -198,37 +277,49 @@ module OnebusawaySDK
|
|
198
277
|
def self.==(other)
|
199
278
|
end
|
200
279
|
|
201
|
-
|
202
|
-
|
203
|
-
|
280
|
+
class << self
|
281
|
+
# @api private
|
282
|
+
sig { override.params(value: T.anything).returns(T.anything) }
|
283
|
+
def coerce(value)
|
284
|
+
end
|
204
285
|
|
205
|
-
|
206
|
-
|
207
|
-
|
286
|
+
# @api private
|
287
|
+
sig { override.params(value: T.anything).returns(T.anything) }
|
288
|
+
def dump(value)
|
289
|
+
end
|
208
290
|
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
291
|
+
# @api private
|
292
|
+
sig do
|
293
|
+
override
|
294
|
+
.params(value: T.anything)
|
295
|
+
.returns(T.any([T::Boolean, T.anything, NilClass], [T::Boolean, T::Boolean, Integer]))
|
296
|
+
end
|
297
|
+
def try_strict_coerce(value)
|
298
|
+
end
|
215
299
|
end
|
216
300
|
end
|
217
301
|
|
302
|
+
# @api private
|
303
|
+
#
|
304
|
+
# Array of items of a given type.
|
218
305
|
class ArrayOf
|
306
|
+
include OnebusawaySDK::Converter
|
307
|
+
|
219
308
|
abstract!
|
309
|
+
final!
|
220
310
|
|
221
|
-
|
311
|
+
Elem = type_member(:out)
|
222
312
|
|
223
|
-
sig { params(other: T.anything).returns(T::Boolean) }
|
313
|
+
sig(:final) { params(other: T.anything).returns(T::Boolean) }
|
224
314
|
def ===(other)
|
225
315
|
end
|
226
316
|
|
227
|
-
sig { params(other: T.anything).returns(T::Boolean) }
|
317
|
+
sig(:final) { params(other: T.anything).returns(T::Boolean) }
|
228
318
|
def ==(other)
|
229
319
|
end
|
230
320
|
|
231
|
-
|
321
|
+
# @api private
|
322
|
+
sig(:final) do
|
232
323
|
override
|
233
324
|
.params(value: T.any(T::Enumerable[T.anything], T.anything))
|
234
325
|
.returns(T.any(T::Array[T.anything], T.anything))
|
@@ -236,7 +327,8 @@ module OnebusawaySDK
|
|
236
327
|
def coerce(value)
|
237
328
|
end
|
238
329
|
|
239
|
-
|
330
|
+
# @api private
|
331
|
+
sig(:final) do
|
240
332
|
override
|
241
333
|
.params(value: T.any(T::Enumerable[T.anything], T.anything))
|
242
334
|
.returns(T.any(T::Array[T.anything], T.anything))
|
@@ -244,7 +336,8 @@ module OnebusawaySDK
|
|
244
336
|
def dump(value)
|
245
337
|
end
|
246
338
|
|
247
|
-
|
339
|
+
# @api private
|
340
|
+
sig(:final) do
|
248
341
|
override
|
249
342
|
.params(value: T.anything)
|
250
343
|
.returns(T.any([T::Boolean, T.anything, NilClass], [T::Boolean, T::Boolean, Integer]))
|
@@ -252,11 +345,13 @@ module OnebusawaySDK
|
|
252
345
|
def try_strict_coerce(value)
|
253
346
|
end
|
254
347
|
|
255
|
-
|
348
|
+
# @api private
|
349
|
+
sig(:final) { returns(Elem) }
|
256
350
|
protected def item_type
|
257
351
|
end
|
258
352
|
|
259
|
-
|
353
|
+
# @api private
|
354
|
+
sig(:final) do
|
260
355
|
params(
|
261
356
|
type_info: T.any(
|
262
357
|
T::Hash[Symbol, T.anything],
|
@@ -265,26 +360,33 @@ module OnebusawaySDK
|
|
265
360
|
),
|
266
361
|
spec: T::Hash[Symbol, T.anything]
|
267
362
|
)
|
268
|
-
.
|
363
|
+
.returns(T.attached_class)
|
269
364
|
end
|
270
|
-
def
|
365
|
+
def self.new(type_info, spec = {})
|
271
366
|
end
|
272
367
|
end
|
273
368
|
|
369
|
+
# @api private
|
370
|
+
#
|
371
|
+
# Hash of items of a given type.
|
274
372
|
class HashOf
|
373
|
+
include OnebusawaySDK::Converter
|
374
|
+
|
275
375
|
abstract!
|
376
|
+
final!
|
276
377
|
|
277
|
-
|
378
|
+
Elem = type_member(:out)
|
278
379
|
|
279
|
-
sig { params(other: T.anything).returns(T::Boolean) }
|
380
|
+
sig(:final) { params(other: T.anything).returns(T::Boolean) }
|
280
381
|
def ===(other)
|
281
382
|
end
|
282
383
|
|
283
|
-
sig { params(other: T.anything).returns(T::Boolean) }
|
384
|
+
sig(:final) { params(other: T.anything).returns(T::Boolean) }
|
284
385
|
def ==(other)
|
285
386
|
end
|
286
387
|
|
287
|
-
|
388
|
+
# @api private
|
389
|
+
sig(:final) do
|
288
390
|
override
|
289
391
|
.params(value: T.any(T::Hash[T.anything, T.anything], T.anything))
|
290
392
|
.returns(T.any(T::Hash[Symbol, T.anything], T.anything))
|
@@ -292,7 +394,8 @@ module OnebusawaySDK
|
|
292
394
|
def coerce(value)
|
293
395
|
end
|
294
396
|
|
295
|
-
|
397
|
+
# @api private
|
398
|
+
sig(:final) do
|
296
399
|
override
|
297
400
|
.params(value: T.any(T::Hash[T.anything, T.anything], T.anything))
|
298
401
|
.returns(T.any(T::Hash[Symbol, T.anything], T.anything))
|
@@ -300,7 +403,8 @@ module OnebusawaySDK
|
|
300
403
|
def dump(value)
|
301
404
|
end
|
302
405
|
|
303
|
-
|
406
|
+
# @api private
|
407
|
+
sig(:final) do
|
304
408
|
override
|
305
409
|
.params(value: T.anything)
|
306
410
|
.returns(T.any([T::Boolean, T.anything, NilClass], [T::Boolean, T::Boolean, Integer]))
|
@@ -308,11 +412,13 @@ module OnebusawaySDK
|
|
308
412
|
def try_strict_coerce(value)
|
309
413
|
end
|
310
414
|
|
311
|
-
|
415
|
+
# @api private
|
416
|
+
sig(:final) { returns(Elem) }
|
312
417
|
protected def item_type
|
313
418
|
end
|
314
419
|
|
315
|
-
|
420
|
+
# @api private
|
421
|
+
sig(:final) do
|
316
422
|
params(
|
317
423
|
type_info: T.any(
|
318
424
|
T::Hash[Symbol, T.anything],
|
@@ -321,138 +427,175 @@ module OnebusawaySDK
|
|
321
427
|
),
|
322
428
|
spec: T::Hash[Symbol, T.anything]
|
323
429
|
)
|
324
|
-
.
|
430
|
+
.returns(T.attached_class)
|
325
431
|
end
|
326
|
-
def
|
432
|
+
def self.new(type_info, spec = {})
|
327
433
|
end
|
328
434
|
end
|
329
435
|
|
330
436
|
class BaseModel
|
331
|
-
abstract!
|
332
|
-
|
333
437
|
extend OnebusawaySDK::Converter
|
334
438
|
|
439
|
+
abstract!
|
440
|
+
|
335
441
|
KnownFieldShape = T.type_alias { {mode: T.nilable(Symbol), required: T::Boolean} }
|
336
442
|
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
443
|
+
class << self
|
444
|
+
# @api private
|
445
|
+
#
|
446
|
+
# Assumes superclass fields are totally defined before fields are accessed /
|
447
|
+
# defined on subclasses.
|
448
|
+
sig do
|
449
|
+
returns(
|
450
|
+
T::Hash[
|
451
|
+
Symbol,
|
452
|
+
T.all(
|
453
|
+
OnebusawaySDK::BaseModel::KnownFieldShape,
|
454
|
+
{type_fn: T.proc.returns(OnebusawaySDK::Converter::Input)}
|
455
|
+
)
|
456
|
+
]
|
344
457
|
)
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
T.
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
458
|
+
end
|
459
|
+
def known_fields
|
460
|
+
end
|
461
|
+
|
462
|
+
# @api private
|
463
|
+
sig do
|
464
|
+
returns(
|
465
|
+
T::Hash[Symbol,
|
466
|
+
T.all(OnebusawaySDK::BaseModel::KnownFieldShape, {type: OnebusawaySDK::Converter::Input})]
|
467
|
+
)
|
468
|
+
end
|
469
|
+
def fields
|
470
|
+
end
|
471
|
+
|
472
|
+
# @api private
|
473
|
+
sig { returns(T::Hash[Symbol, T.proc.returns(T::Class[T.anything])]) }
|
474
|
+
def defaults
|
475
|
+
end
|
476
|
+
|
477
|
+
# @api private
|
478
|
+
sig do
|
479
|
+
params(
|
480
|
+
name_sym: Symbol,
|
481
|
+
required: T::Boolean,
|
482
|
+
type_info: T.any(
|
483
|
+
{
|
484
|
+
const: T.nilable(T.any(NilClass, T::Boolean, Integer, Float, Symbol)),
|
485
|
+
enum: T.nilable(T.proc.returns(OnebusawaySDK::Converter::Input)),
|
486
|
+
union: T.nilable(T.proc.returns(OnebusawaySDK::Converter::Input)),
|
487
|
+
api_name: Symbol,
|
488
|
+
nil?: T::Boolean
|
489
|
+
},
|
490
|
+
T.proc.returns(OnebusawaySDK::Converter::Input),
|
491
|
+
OnebusawaySDK::Converter::Input
|
492
|
+
),
|
493
|
+
spec: T::Hash[Symbol, T.anything]
|
494
|
+
)
|
495
|
+
.void
|
496
|
+
end
|
497
|
+
private def add_field(name_sym, required:, type_info:, spec:)
|
498
|
+
end
|
499
|
+
|
500
|
+
# @api private
|
501
|
+
sig do
|
502
|
+
params(
|
503
|
+
name_sym: Symbol,
|
504
|
+
type_info: T.any(
|
505
|
+
T::Hash[Symbol, T.anything],
|
506
|
+
T.proc.returns(OnebusawaySDK::Converter::Input),
|
507
|
+
OnebusawaySDK::Converter::Input
|
508
|
+
),
|
509
|
+
spec: T::Hash[Symbol, T.anything]
|
510
|
+
)
|
511
|
+
.void
|
512
|
+
end
|
513
|
+
def required(name_sym, type_info, spec = {})
|
514
|
+
end
|
515
|
+
|
516
|
+
# @api private
|
517
|
+
sig do
|
518
|
+
params(
|
519
|
+
name_sym: Symbol,
|
520
|
+
type_info: T.any(
|
521
|
+
T::Hash[Symbol, T.anything],
|
522
|
+
T.proc.returns(OnebusawaySDK::Converter::Input),
|
523
|
+
OnebusawaySDK::Converter::Input
|
524
|
+
),
|
525
|
+
spec: T::Hash[Symbol, T.anything]
|
526
|
+
)
|
527
|
+
.void
|
528
|
+
end
|
529
|
+
def optional(name_sym, type_info, spec = {})
|
530
|
+
end
|
531
|
+
|
532
|
+
# @api private
|
533
|
+
#
|
534
|
+
# `request_only` attributes not excluded from `.#coerce` when receiving responses
|
535
|
+
# even if well behaved servers should not send them
|
536
|
+
sig { params(blk: T.proc.void).void }
|
537
|
+
private def request_only(&blk)
|
538
|
+
end
|
539
|
+
|
540
|
+
# @api private
|
541
|
+
#
|
542
|
+
# `response_only` attributes are omitted from `.#dump` when making requests
|
543
|
+
sig { params(blk: T.proc.void).void }
|
544
|
+
private def response_only(&blk)
|
545
|
+
end
|
422
546
|
end
|
423
547
|
|
424
548
|
sig { params(other: T.anything).returns(T::Boolean) }
|
425
549
|
def ==(other)
|
426
550
|
end
|
427
551
|
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
552
|
+
class << self
|
553
|
+
# @api private
|
554
|
+
sig do
|
555
|
+
override
|
556
|
+
.params(value: T.any(OnebusawaySDK::BaseModel, T::Hash[T.anything, T.anything], T.anything))
|
557
|
+
.returns(T.any(T.attached_class, T.anything))
|
558
|
+
end
|
559
|
+
def coerce(value)
|
560
|
+
end
|
561
|
+
|
562
|
+
# @api private
|
563
|
+
sig do
|
564
|
+
override
|
565
|
+
.params(value: T.any(T.attached_class, T.anything))
|
566
|
+
.returns(T.any(T::Hash[T.anything, T.anything], T.anything))
|
567
|
+
end
|
568
|
+
def dump(value)
|
569
|
+
end
|
570
|
+
|
571
|
+
# @api private
|
572
|
+
sig do
|
573
|
+
override
|
574
|
+
.params(value: T.anything)
|
575
|
+
.returns(T.any([T::Boolean, T.anything, NilClass], [T::Boolean, T::Boolean, Integer]))
|
576
|
+
end
|
577
|
+
def try_strict_coerce(value)
|
578
|
+
end
|
579
|
+
end
|
580
|
+
|
581
|
+
# Returns the raw value associated with the given key, if found. Otherwise, nil is
|
582
|
+
# returned.
|
583
|
+
#
|
584
|
+
# It is valid to lookup keys that are not in the API spec, for example to access
|
585
|
+
# undocumented features. This method does not parse response data into
|
586
|
+
# higher-level types. Lookup by anything other than a Symbol is an ArgumentError.
|
452
587
|
sig { params(key: Symbol).returns(T.nilable(T.anything)) }
|
453
588
|
def [](key)
|
454
589
|
end
|
455
590
|
|
591
|
+
# Returns a Hash of the data underlying this object. O(1)
|
592
|
+
#
|
593
|
+
# Keys are Symbols and values are the raw values from the response. The return
|
594
|
+
# value indicates which values were ever set on the object. i.e. there will be a
|
595
|
+
# key in this hash if they ever were, even if the set value was nil.
|
596
|
+
#
|
597
|
+
# This method is not recursive. The returned value is shared by the object, so it
|
598
|
+
# should not be mutated.
|
456
599
|
sig { overridable.returns(T::Hash[Symbol, T.anything]) }
|
457
600
|
def to_h
|
458
601
|
end
|
@@ -463,8 +606,9 @@ module OnebusawaySDK
|
|
463
606
|
def deconstruct_keys(keys)
|
464
607
|
end
|
465
608
|
|
466
|
-
|
467
|
-
|
609
|
+
# Create a new instance of a model.
|
610
|
+
sig { params(data: T.any(T::Hash[Symbol, T.anything], T.self_type)).returns(T.attached_class) }
|
611
|
+
def self.new(data = {})
|
468
612
|
end
|
469
613
|
|
470
614
|
sig { returns(String) }
|