onebusaway-sdk 0.1.0.pre.alpha.205 → 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.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +32 -20
  3. data/lib/onebusaway-sdk/base_client.rb +63 -91
  4. data/lib/onebusaway-sdk/base_model.rb +489 -514
  5. data/lib/onebusaway-sdk/base_page.rb +35 -15
  6. data/lib/onebusaway-sdk/client.rb +1 -3
  7. data/lib/onebusaway-sdk/errors.rb +15 -19
  8. data/lib/onebusaway-sdk/extern.rb +1 -4
  9. data/lib/onebusaway-sdk/models/references.rb +0 -21
  10. data/lib/onebusaway-sdk/models/report_problem_with_stop_retrieve_params.rb +0 -21
  11. data/lib/onebusaway-sdk/models/report_problem_with_trip_retrieve_params.rb +0 -23
  12. data/lib/onebusaway-sdk/pooled_net_requester.rb +53 -54
  13. data/lib/onebusaway-sdk/request_options.rb +4 -11
  14. data/lib/onebusaway-sdk/resources/agencies_with_coverage.rb +0 -2
  15. data/lib/onebusaway-sdk/resources/agency.rb +0 -2
  16. data/lib/onebusaway-sdk/resources/arrival_and_departure.rb +0 -3
  17. data/lib/onebusaway-sdk/resources/block.rb +0 -2
  18. data/lib/onebusaway-sdk/resources/config.rb +0 -2
  19. data/lib/onebusaway-sdk/resources/current_time.rb +0 -2
  20. data/lib/onebusaway-sdk/resources/report_problem_with_stop.rb +0 -2
  21. data/lib/onebusaway-sdk/resources/report_problem_with_trip.rb +0 -2
  22. data/lib/onebusaway-sdk/resources/route.rb +0 -2
  23. data/lib/onebusaway-sdk/resources/route_ids_for_agency.rb +0 -2
  24. data/lib/onebusaway-sdk/resources/routes_for_agency.rb +0 -2
  25. data/lib/onebusaway-sdk/resources/routes_for_location.rb +0 -2
  26. data/lib/onebusaway-sdk/resources/schedule_for_route.rb +0 -2
  27. data/lib/onebusaway-sdk/resources/schedule_for_stop.rb +0 -2
  28. data/lib/onebusaway-sdk/resources/search_for_route.rb +0 -2
  29. data/lib/onebusaway-sdk/resources/search_for_stop.rb +0 -2
  30. data/lib/onebusaway-sdk/resources/shape.rb +0 -2
  31. data/lib/onebusaway-sdk/resources/stop.rb +0 -2
  32. data/lib/onebusaway-sdk/resources/stop_ids_for_agency.rb +0 -2
  33. data/lib/onebusaway-sdk/resources/stops_for_agency.rb +0 -2
  34. data/lib/onebusaway-sdk/resources/stops_for_location.rb +0 -2
  35. data/lib/onebusaway-sdk/resources/stops_for_route.rb +0 -2
  36. data/lib/onebusaway-sdk/resources/trip.rb +0 -2
  37. data/lib/onebusaway-sdk/resources/trip_details.rb +0 -2
  38. data/lib/onebusaway-sdk/resources/trip_for_vehicle.rb +0 -2
  39. data/lib/onebusaway-sdk/resources/trips_for_location.rb +0 -2
  40. data/lib/onebusaway-sdk/resources/trips_for_route.rb +0 -2
  41. data/lib/onebusaway-sdk/resources/vehicles_for_agency.rb +0 -2
  42. data/lib/onebusaway-sdk/util.rb +297 -96
  43. data/lib/onebusaway-sdk/version.rb +1 -1
  44. data/lib/onebusaway-sdk.rb +1 -0
  45. data/manifest.yaml +1 -0
  46. data/rbi/lib/onebusaway-sdk/base_client.rbi +52 -35
  47. data/rbi/lib/onebusaway-sdk/base_model.rbi +400 -256
  48. data/rbi/lib/onebusaway-sdk/base_page.rbi +3 -4
  49. data/rbi/lib/onebusaway-sdk/client.rbi +7 -2
  50. data/rbi/lib/onebusaway-sdk/errors.rbi +44 -10
  51. data/rbi/lib/onebusaway-sdk/extern.rbi +1 -1
  52. data/rbi/lib/onebusaway-sdk/models/agencies_with_coverage_list_params.rbi +5 -2
  53. data/rbi/lib/onebusaway-sdk/models/agencies_with_coverage_list_response.rbi +9 -6
  54. data/rbi/lib/onebusaway-sdk/models/agency_retrieve_params.rbi +5 -2
  55. data/rbi/lib/onebusaway-sdk/models/agency_retrieve_response.rbi +6 -6
  56. data/rbi/lib/onebusaway-sdk/models/arrival_and_departure_list_params.rbi +5 -2
  57. data/rbi/lib/onebusaway-sdk/models/arrival_and_departure_list_response.rbi +95 -14
  58. data/rbi/lib/onebusaway-sdk/models/arrival_and_departure_retrieve_params.rbi +2 -9
  59. data/rbi/lib/onebusaway-sdk/models/arrival_and_departure_retrieve_response.rbi +93 -12
  60. data/rbi/lib/onebusaway-sdk/models/block_retrieve_params.rbi +5 -2
  61. data/rbi/lib/onebusaway-sdk/models/block_retrieve_response.rbi +14 -20
  62. data/rbi/lib/onebusaway-sdk/models/config_retrieve_params.rbi +5 -2
  63. data/rbi/lib/onebusaway-sdk/models/config_retrieve_response.rbi +8 -14
  64. data/rbi/lib/onebusaway-sdk/models/current_time_retrieve_params.rbi +5 -2
  65. data/rbi/lib/onebusaway-sdk/models/current_time_retrieve_response.rbi +6 -6
  66. data/rbi/lib/onebusaway-sdk/models/references.rbi +60 -43
  67. data/rbi/lib/onebusaway-sdk/models/report_problem_with_stop_retrieve_params.rbi +10 -6
  68. data/rbi/lib/onebusaway-sdk/models/report_problem_with_trip_retrieve_params.rbi +15 -6
  69. data/rbi/lib/onebusaway-sdk/models/response_wrapper.rbi +4 -2
  70. data/rbi/lib/onebusaway-sdk/models/route_ids_for_agency_list_params.rbi +5 -2
  71. data/rbi/lib/onebusaway-sdk/models/route_ids_for_agency_list_response.rbi +4 -4
  72. data/rbi/lib/onebusaway-sdk/models/route_retrieve_params.rbi +5 -2
  73. data/rbi/lib/onebusaway-sdk/models/route_retrieve_response.rbi +6 -6
  74. data/rbi/lib/onebusaway-sdk/models/routes_for_agency_list_params.rbi +5 -2
  75. data/rbi/lib/onebusaway-sdk/models/routes_for_agency_list_response.rbi +6 -6
  76. data/rbi/lib/onebusaway-sdk/models/routes_for_location_list_params.rbi +2 -2
  77. data/rbi/lib/onebusaway-sdk/models/routes_for_location_list_response.rbi +6 -6
  78. data/rbi/lib/onebusaway-sdk/models/schedule_for_route_retrieve_params.rbi +5 -8
  79. data/rbi/lib/onebusaway-sdk/models/schedule_for_route_retrieve_response.rbi +19 -16
  80. data/rbi/lib/onebusaway-sdk/models/schedule_for_stop_retrieve_params.rbi +5 -8
  81. data/rbi/lib/onebusaway-sdk/models/schedule_for_stop_retrieve_response.rbi +14 -14
  82. data/rbi/lib/onebusaway-sdk/models/search_for_route_list_params.rbi +4 -2
  83. data/rbi/lib/onebusaway-sdk/models/search_for_route_list_response.rbi +6 -6
  84. data/rbi/lib/onebusaway-sdk/models/search_for_stop_list_params.rbi +4 -2
  85. data/rbi/lib/onebusaway-sdk/models/search_for_stop_list_response.rbi +6 -6
  86. data/rbi/lib/onebusaway-sdk/models/shape_retrieve_params.rbi +5 -2
  87. data/rbi/lib/onebusaway-sdk/models/shape_retrieve_response.rbi +7 -6
  88. data/rbi/lib/onebusaway-sdk/models/stop_ids_for_agency_list_params.rbi +5 -2
  89. data/rbi/lib/onebusaway-sdk/models/stop_ids_for_agency_list_response.rbi +4 -4
  90. data/rbi/lib/onebusaway-sdk/models/stop_retrieve_params.rbi +5 -2
  91. data/rbi/lib/onebusaway-sdk/models/stop_retrieve_response.rbi +6 -6
  92. data/rbi/lib/onebusaway-sdk/models/stops_for_agency_list_params.rbi +5 -2
  93. data/rbi/lib/onebusaway-sdk/models/stops_for_agency_list_response.rbi +4 -4
  94. data/rbi/lib/onebusaway-sdk/models/stops_for_location_list_params.rbi +6 -2
  95. data/rbi/lib/onebusaway-sdk/models/stops_for_location_list_response.rbi +6 -6
  96. data/rbi/lib/onebusaway-sdk/models/stops_for_route_list_params.rbi +4 -2
  97. data/rbi/lib/onebusaway-sdk/models/stops_for_route_list_response.rbi +14 -14
  98. data/rbi/lib/onebusaway-sdk/models/trip_detail_retrieve_params.rbi +10 -2
  99. data/rbi/lib/onebusaway-sdk/models/trip_detail_retrieve_response.rbi +54 -23
  100. data/rbi/lib/onebusaway-sdk/models/trip_for_vehicle_retrieve_params.rbi +9 -8
  101. data/rbi/lib/onebusaway-sdk/models/trip_for_vehicle_retrieve_response.rbi +54 -23
  102. data/rbi/lib/onebusaway-sdk/models/trip_retrieve_params.rbi +5 -2
  103. data/rbi/lib/onebusaway-sdk/models/trip_retrieve_response.rbi +6 -6
  104. data/rbi/lib/onebusaway-sdk/models/trips_for_location_list_params.rbi +12 -12
  105. data/rbi/lib/onebusaway-sdk/models/trips_for_location_list_response.rbi +56 -16
  106. data/rbi/lib/onebusaway-sdk/models/trips_for_route_list_params.rbi +6 -2
  107. data/rbi/lib/onebusaway-sdk/models/trips_for_route_list_response.rbi +54 -16
  108. data/rbi/lib/onebusaway-sdk/models/vehicles_for_agency_list_params.rbi +3 -2
  109. data/rbi/lib/onebusaway-sdk/models/vehicles_for_agency_list_response.rbi +52 -14
  110. data/rbi/lib/onebusaway-sdk/pooled_net_requester.rbi +28 -13
  111. data/rbi/lib/onebusaway-sdk/request_options.rbi +25 -2
  112. data/rbi/lib/onebusaway-sdk/resources/agencies_with_coverage.rbi +4 -2
  113. data/rbi/lib/onebusaway-sdk/resources/agency.rbi +8 -3
  114. data/rbi/lib/onebusaway-sdk/resources/arrival_and_departure.rbi +14 -3
  115. data/rbi/lib/onebusaway-sdk/resources/block.rbi +8 -3
  116. data/rbi/lib/onebusaway-sdk/resources/config.rbi +3 -2
  117. data/rbi/lib/onebusaway-sdk/resources/current_time.rbi +3 -2
  118. data/rbi/lib/onebusaway-sdk/resources/report_problem_with_stop.rbi +9 -2
  119. data/rbi/lib/onebusaway-sdk/resources/report_problem_with_trip.rbi +14 -2
  120. data/rbi/lib/onebusaway-sdk/resources/route.rbi +8 -3
  121. data/rbi/lib/onebusaway-sdk/resources/route_ids_for_agency.rbi +8 -3
  122. data/rbi/lib/onebusaway-sdk/resources/routes_for_agency.rbi +8 -3
  123. data/rbi/lib/onebusaway-sdk/resources/routes_for_location.rbi +3 -2
  124. data/rbi/lib/onebusaway-sdk/resources/schedule_for_route.rbi +11 -3
  125. data/rbi/lib/onebusaway-sdk/resources/schedule_for_stop.rbi +11 -3
  126. data/rbi/lib/onebusaway-sdk/resources/search_for_route.rbi +10 -3
  127. data/rbi/lib/onebusaway-sdk/resources/search_for_stop.rbi +10 -3
  128. data/rbi/lib/onebusaway-sdk/resources/shape.rbi +8 -3
  129. data/rbi/lib/onebusaway-sdk/resources/stop.rbi +8 -3
  130. data/rbi/lib/onebusaway-sdk/resources/stop_ids_for_agency.rbi +8 -3
  131. data/rbi/lib/onebusaway-sdk/resources/stops_for_agency.rbi +8 -3
  132. data/rbi/lib/onebusaway-sdk/resources/stops_for_location.rbi +16 -3
  133. data/rbi/lib/onebusaway-sdk/resources/stops_for_route.rbi +12 -3
  134. data/rbi/lib/onebusaway-sdk/resources/trip.rbi +8 -3
  135. data/rbi/lib/onebusaway-sdk/resources/trip_details.rbi +12 -2
  136. data/rbi/lib/onebusaway-sdk/resources/trip_for_vehicle.rbi +11 -2
  137. data/rbi/lib/onebusaway-sdk/resources/trips_for_location.rbi +12 -2
  138. data/rbi/lib/onebusaway-sdk/resources/trips_for_route.rbi +15 -3
  139. data/rbi/lib/onebusaway-sdk/resources/vehicles_for_agency.rbi +10 -3
  140. data/rbi/lib/onebusaway-sdk/util.rbi +214 -83
  141. data/rbi/lib/onebusaway-sdk/version.rbi +1 -1
  142. data/sig/onebusaway-sdk/base_client.rbs +9 -8
  143. data/sig/onebusaway-sdk/base_model.rbs +8 -6
  144. data/sig/onebusaway-sdk/base_page.rbs +1 -1
  145. data/sig/onebusaway-sdk/errors.rbs +6 -5
  146. data/sig/onebusaway-sdk/pooled_net_requester.rbs +11 -4
  147. data/sig/onebusaway-sdk/request_options.rbs +4 -0
  148. data/sig/onebusaway-sdk/util.rbs +46 -2
  149. data/sig/onebusaway-sdk/version.rbs +1 -1
  150. 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
- sig do
26
- params(
27
- spec: T.any(
28
- {
29
- const: T.nilable(T.any(NilClass, T::Boolean, Integer, Float, Symbol)),
30
- enum: T.nilable(T.proc.returns(OnebusawaySDK::Converter::Input)),
31
- union: T.nilable(T.proc.returns(OnebusawaySDK::Converter::Input))
32
- },
33
- T.proc.returns(OnebusawaySDK::Converter::Input),
34
- OnebusawaySDK::Converter::Input
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
- .returns(T.proc.returns(T.anything).void)
38
- end
39
- def self.type_info(spec)
40
- end
41
-
42
- sig { params(target: OnebusawaySDK::Converter::Input, value: T.anything).returns(T.anything) }
43
- def self.coerce(target, value)
44
- end
45
-
46
- sig { params(target: OnebusawaySDK::Converter::Input, value: T.anything).returns(T.anything) }
47
- def self.dump(target, value)
48
- end
49
-
50
- sig { params(target: OnebusawaySDK::Converter::Input, value: T.anything).returns(T.anything) }
51
- def self.try_strict_coerce(target, value)
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
- sig { params(other: T.anything).returns(T::Boolean) }
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
- sig { override.params(value: T.anything).returns(T.anything) }
69
- def self.coerce(value)
70
- end
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
- sig { override.params(value: T.anything).returns(T.anything) }
73
- def self.dump(value)
74
- end
102
+ # @api private
103
+ sig(:final) { override.params(value: T.anything).returns(T.anything) }
104
+ def dump(value)
105
+ end
75
106
 
76
- sig do
77
- override
78
- .params(value: T.anything)
79
- .returns(T.any([T::Boolean, T.anything, NilClass], [T::Boolean, T::Boolean, Integer]))
80
- end
81
- def self.try_strict_coerce(value)
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
- sig { params(other: T.anything).returns(T::Boolean) }
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
- sig { override.params(value: T.any(T::Boolean, T.anything)).returns(T.any(T::Boolean, T.anything)) }
99
- def self.coerce(value)
100
- end
101
-
102
- sig { override.params(value: T.any(T::Boolean, T.anything)).returns(T.any(T::Boolean, T.anything)) }
103
- def self.dump(value)
104
- end
105
-
106
- sig do
107
- override
108
- .params(value: T.anything)
109
- .returns(T.any([T::Boolean, T.anything, NilClass], [T::Boolean, T::Boolean, Integer]))
110
- end
111
- def self.try_strict_coerce(value)
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
- extend OnebusawaySDK::Converter
178
+ Value = type_template(:out)
119
179
 
120
- sig { overridable.returns(T::Array[T.any(NilClass, T::Boolean, Integer, Float, Symbol)]) }
121
- def self.values
122
- end
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
- sig { void }
125
- private_class_method def self.finalize!
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
- sig { override.params(value: T.any(String, Symbol, T.anything)).returns(T.any(Symbol, T.anything)) }
137
- def self.coerce(value)
138
- end
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
- sig { override.params(value: T.any(Symbol, T.anything)).returns(T.any(Symbol, T.anything)) }
141
- def self.dump(value)
142
- end
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
- sig do
145
- override
146
- .params(value: T.anything)
147
- .returns(T.any([T::Boolean, T.anything, NilClass], [T::Boolean, T::Boolean, Integer]))
148
- end
149
- def self.try_strict_coerce(value)
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
- sig { returns(T::Array[[T.nilable(Symbol), Proc]]) }
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
- sig do
171
- params(
172
- key: T.any(
173
- Symbol,
174
- T::Hash[Symbol, T.anything],
175
- T.proc.returns(OnebusawaySDK::Converter::Input),
176
- OnebusawaySDK::Converter::Input
177
- ),
178
- spec: T.any(
179
- T::Hash[Symbol, T.anything],
180
- T.proc.returns(OnebusawaySDK::Converter::Input),
181
- OnebusawaySDK::Converter::Input
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
- .void
185
- end
186
- private_class_method def self.variant(key, spec = nil)
187
- end
261
+ .void
262
+ end
263
+ private def variant(key, spec = nil)
264
+ end
188
265
 
189
- sig { params(value: T.anything).returns(T.nilable(OnebusawaySDK::Converter::Input)) }
190
- private_class_method def self.resolve_variant(value)
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
- sig { override.params(value: T.anything).returns(T.anything) }
202
- def self.coerce(value)
203
- end
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
- sig { override.params(value: T.anything).returns(T.anything) }
206
- def self.dump(value)
207
- end
286
+ # @api private
287
+ sig { override.params(value: T.anything).returns(T.anything) }
288
+ def dump(value)
289
+ end
208
290
 
209
- sig do
210
- override
211
- .params(value: T.anything)
212
- .returns(T.any([T::Boolean, T.anything, NilClass], [T::Boolean, T::Boolean, Integer]))
213
- end
214
- def self.try_strict_coerce(value)
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
- include OnebusawaySDK::Converter
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
- sig do
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
- sig do
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
- sig do
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
- sig { returns(OnebusawaySDK::Converter::Input) }
348
+ # @api private
349
+ sig(:final) { returns(Elem) }
256
350
  protected def item_type
257
351
  end
258
352
 
259
- sig do
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
- .void
363
+ .returns(T.attached_class)
269
364
  end
270
- def initialize(type_info, spec = {})
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
- include OnebusawaySDK::Converter
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
- sig do
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
- sig do
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
- sig do
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
- sig { returns(OnebusawaySDK::Converter::Input) }
415
+ # @api private
416
+ sig(:final) { returns(Elem) }
312
417
  protected def item_type
313
418
  end
314
419
 
315
- sig do
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
- .void
430
+ .returns(T.attached_class)
325
431
  end
326
- def initialize(type_info, spec = {})
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
- sig do
338
- returns(
339
- T::Hash[
340
- Symbol,
341
- T.all(
342
- OnebusawaySDK::BaseModel::KnownFieldShape,
343
- {type_fn: T.proc.returns(OnebusawaySDK::Converter::Input)}
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
- end
348
- def self.known_fields
349
- end
350
-
351
- sig do
352
- returns(
353
- T::Hash[Symbol,
354
- T.all(OnebusawaySDK::BaseModel::KnownFieldShape, {type: OnebusawaySDK::Converter::Input})]
355
- )
356
- end
357
- def self.fields
358
- end
359
-
360
- sig { returns(T::Hash[Symbol, T.proc.returns(T::Class[T.anything])]) }
361
- def self.defaults
362
- end
363
-
364
- sig do
365
- params(
366
- name_sym: Symbol,
367
- required: T::Boolean,
368
- type_info: T.any(
369
- {
370
- const: T.nilable(T.any(NilClass, T::Boolean, Integer, Float, Symbol)),
371
- enum: T.nilable(T.proc.returns(OnebusawaySDK::Converter::Input)),
372
- union: T.nilable(T.proc.returns(OnebusawaySDK::Converter::Input)),
373
- api_name: Symbol,
374
- nil?: T::Boolean
375
- },
376
- T.proc.returns(OnebusawaySDK::Converter::Input),
377
- OnebusawaySDK::Converter::Input
378
- ),
379
- spec: T::Hash[Symbol, T.anything]
380
- )
381
- .void
382
- end
383
- private_class_method def self.add_field(name_sym, required:, type_info:, spec:)
384
- end
385
-
386
- sig do
387
- params(
388
- name_sym: Symbol,
389
- type_info: T.any(
390
- T::Hash[Symbol, T.anything],
391
- T.proc.returns(OnebusawaySDK::Converter::Input),
392
- OnebusawaySDK::Converter::Input
393
- ),
394
- spec: T::Hash[Symbol, T.anything]
395
- )
396
- .void
397
- end
398
- def self.required(name_sym, type_info, spec = {})
399
- end
400
-
401
- sig do
402
- params(
403
- name_sym: Symbol,
404
- type_info: T.any(
405
- T::Hash[Symbol, T.anything],
406
- T.proc.returns(OnebusawaySDK::Converter::Input),
407
- OnebusawaySDK::Converter::Input
408
- ),
409
- spec: T::Hash[Symbol, T.anything]
410
- )
411
- .void
412
- end
413
- def self.optional(name_sym, type_info, spec = {})
414
- end
415
-
416
- sig { params(blk: T.proc.void).void }
417
- private_class_method def self.request_only(&blk)
418
- end
419
-
420
- sig { params(blk: T.proc.void).void }
421
- private_class_method def self.response_only(&blk)
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
- sig do
429
- override
430
- .params(value: T.any(OnebusawaySDK::BaseModel, T::Hash[T.anything, T.anything], T.anything))
431
- .returns(T.any(T.attached_class, T.anything))
432
- end
433
- def self.coerce(value)
434
- end
435
-
436
- sig do
437
- override
438
- .params(value: T.any(T.attached_class, T.anything))
439
- .returns(T.any(T::Hash[T.anything, T.anything], T.anything))
440
- end
441
- def self.dump(value)
442
- end
443
-
444
- sig do
445
- override
446
- .params(value: T.anything)
447
- .returns(T.any([T::Boolean, T.anything, NilClass], [T::Boolean, T::Boolean, Integer]))
448
- end
449
- def self.try_strict_coerce(value)
450
- end
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
- sig { params(data: T.any(T::Hash[Symbol, T.anything], T.self_type)).void }
467
- def initialize(data = {})
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) }