mux_ruby 1.9.0 → 2.0.0.pre.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (268) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/Gemfile.lock +26 -37
  4. data/README.md +36 -13
  5. data/docs/AbridgedVideoView.md +33 -13
  6. data/docs/Asset.md +57 -26
  7. data/docs/AssetErrors.md +15 -4
  8. data/docs/AssetMaster.md +15 -4
  9. data/docs/AssetNonStandardInputReasons.md +29 -11
  10. data/docs/AssetRecordingTimes.md +15 -4
  11. data/docs/AssetResponse.md +13 -3
  12. data/docs/AssetStaticRenditions.md +15 -4
  13. data/docs/AssetStaticRenditionsFiles.md +23 -8
  14. data/docs/AssetsApi.md +387 -160
  15. data/docs/BreakdownValue.md +21 -7
  16. data/docs/CreateAssetRequest.md +27 -10
  17. data/docs/CreateLiveStreamRequest.md +25 -9
  18. data/docs/CreatePlaybackIDRequest.md +13 -3
  19. data/docs/CreatePlaybackIDResponse.md +13 -3
  20. data/docs/CreateSimulcastTargetRequest.md +17 -5
  21. data/docs/CreateTrackRequest.md +25 -9
  22. data/docs/CreateTrackResponse.md +13 -3
  23. data/docs/CreateUploadRequest.md +19 -6
  24. data/docs/DeliveryReport.md +27 -9
  25. data/docs/DeliveryUsageApi.md +40 -22
  26. data/docs/DimensionValue.md +15 -4
  27. data/docs/DimensionsApi.md +72 -34
  28. data/docs/DirectUploadsApi.md +131 -56
  29. data/docs/DisableLiveStreamResponse.md +13 -3
  30. data/docs/EnableLiveStreamResponse.md +13 -3
  31. data/docs/Error.md +27 -10
  32. data/docs/ErrorsApi.md +37 -19
  33. data/docs/ExportsApi.md +32 -13
  34. data/docs/FilterValue.md +15 -4
  35. data/docs/FiltersApi.md +71 -33
  36. data/docs/GetAssetInputInfoResponse.md +13 -3
  37. data/docs/GetAssetOrLiveStreamIdResponse.md +13 -3
  38. data/docs/GetAssetOrLiveStreamIdResponseData.md +17 -5
  39. data/docs/GetAssetOrLiveStreamIdResponseDataObject.md +15 -4
  40. data/docs/GetAssetPlaybackIDResponse.md +13 -3
  41. data/docs/GetMetricTimeseriesDataResponse.md +17 -5
  42. data/docs/GetOverallValuesResponse.md +17 -5
  43. data/docs/GetRealTimeBreakdownResponse.md +17 -5
  44. data/docs/GetRealTimeHistogramTimeseriesResponse.md +19 -6
  45. data/docs/GetRealTimeHistogramTimeseriesResponseMeta.md +13 -3
  46. data/docs/GetRealTimeTimeseriesResponse.md +17 -5
  47. data/docs/Incident.md +53 -23
  48. data/docs/IncidentBreakdown.md +17 -5
  49. data/docs/IncidentNotification.md +17 -5
  50. data/docs/IncidentNotificationRule.md +21 -7
  51. data/docs/IncidentResponse.md +15 -4
  52. data/docs/IncidentsApi.md +115 -59
  53. data/docs/InputFile.md +15 -4
  54. data/docs/InputInfo.md +15 -4
  55. data/docs/InputSettings.md +31 -12
  56. data/docs/InputSettingsOverlaySettings.md +25 -9
  57. data/docs/InputTrack.md +29 -11
  58. data/docs/Insight.md +23 -8
  59. data/docs/ListAllMetricValuesResponse.md +17 -5
  60. data/docs/ListAssetsResponse.md +13 -3
  61. data/docs/ListBreakdownValuesResponse.md +17 -5
  62. data/docs/ListDeliveryUsageResponse.md +19 -6
  63. data/docs/ListDimensionValuesResponse.md +17 -5
  64. data/docs/ListDimensionsResponse.md +17 -5
  65. data/docs/ListErrorsResponse.md +17 -5
  66. data/docs/ListExportsResponse.md +17 -5
  67. data/docs/ListFilterValuesResponse.md +17 -5
  68. data/docs/ListFiltersResponse.md +17 -5
  69. data/docs/ListFiltersResponseData.md +15 -4
  70. data/docs/ListIncidentsResponse.md +17 -5
  71. data/docs/ListInsightsResponse.md +17 -5
  72. data/docs/ListLiveStreamsResponse.md +13 -3
  73. data/docs/ListRealTimeDimensionsResponse.md +17 -5
  74. data/docs/ListRealTimeDimensionsResponseData.md +15 -4
  75. data/docs/ListRealTimeMetricsResponse.md +17 -5
  76. data/docs/ListRelatedIncidentsResponse.md +17 -5
  77. data/docs/ListSigningKeysResponse.md +13 -3
  78. data/docs/ListUploadsResponse.md +13 -3
  79. data/docs/ListVideoViewsResponse.md +17 -5
  80. data/docs/LiveStream.md +37 -15
  81. data/docs/LiveStreamResponse.md +13 -3
  82. data/docs/LiveStreamsApi.md +418 -170
  83. data/docs/Metric.md +21 -7
  84. data/docs/MetricsApi.md +206 -112
  85. data/docs/NotificationRule.md +17 -5
  86. data/docs/OverallValues.md +19 -6
  87. data/docs/PlaybackID.md +15 -4
  88. data/docs/PlaybackIDApi.md +34 -16
  89. data/docs/PlaybackPolicy.md +10 -2
  90. data/docs/RealTimeApi.md +172 -76
  91. data/docs/RealTimeBreakdownValue.md +21 -7
  92. data/docs/RealTimeHistogramTimeseriesBucket.md +15 -4
  93. data/docs/RealTimeHistogramTimeseriesBucketValues.md +15 -4
  94. data/docs/RealTimeHistogramTimeseriesDatapoint.md +25 -9
  95. data/docs/RealTimeTimeseriesDatapoint.md +17 -5
  96. data/docs/Score.md +23 -8
  97. data/docs/SignalLiveStreamCompleteResponse.md +13 -3
  98. data/docs/SigningKey.md +17 -5
  99. data/docs/SigningKeyResponse.md +13 -3
  100. data/docs/SimulcastTarget.md +21 -7
  101. data/docs/SimulcastTargetResponse.md +13 -3
  102. data/docs/Track.md +37 -15
  103. data/docs/URLSigningKeysApi.md +127 -51
  104. data/docs/UpdateAssetMP4SupportRequest.md +13 -3
  105. data/docs/UpdateAssetMasterAccessRequest.md +13 -3
  106. data/docs/Upload.md +29 -11
  107. data/docs/UploadError.md +15 -4
  108. data/docs/UploadResponse.md +13 -3
  109. data/docs/VideoView.md +235 -114
  110. data/docs/VideoViewEvent.md +19 -6
  111. data/docs/VideoViewResponse.md +15 -4
  112. data/docs/VideoViewsApi.md +76 -39
  113. data/gen/.gitignore +7 -0
  114. data/gen/Makefile +31 -0
  115. data/gen/generator-config.json +11 -0
  116. data/gen/openapitools.json +7 -0
  117. data/gen/package.json +17 -0
  118. data/gen/templates/Gemfile.mustache +11 -0
  119. data/gen/templates/README.mustache +158 -0
  120. data/gen/templates/Rakefile.mustache +10 -0
  121. data/gen/templates/api.mustache +206 -0
  122. data/gen/templates/api_client.mustache +264 -0
  123. data/gen/templates/api_client_faraday_partial.mustache +138 -0
  124. data/gen/templates/api_client_spec.mustache +220 -0
  125. data/gen/templates/api_client_typhoeus_partial.mustache +183 -0
  126. data/gen/templates/api_doc.mustache +118 -0
  127. data/gen/templates/api_error.mustache +67 -0
  128. data/gen/templates/api_info.mustache +12 -0
  129. data/gen/templates/api_test.mustache +47 -0
  130. data/gen/templates/base_object.mustache +120 -0
  131. data/gen/templates/configuration.mustache +349 -0
  132. data/gen/templates/configuration_spec.mustache +34 -0
  133. data/gen/templates/configuration_tls_faraday_partial.mustache +29 -0
  134. data/gen/templates/configuration_tls_typhoeus_partial.mustache +34 -0
  135. data/gen/templates/gem.mustache +40 -0
  136. data/gen/templates/gemspec.mustache +35 -0
  137. data/gen/templates/gitignore.mustache +39 -0
  138. data/gen/templates/model.mustache +26 -0
  139. data/gen/templates/model_doc.mustache +12 -0
  140. data/gen/templates/model_test.mustache +77 -0
  141. data/gen/templates/partial_model_enum_class.mustache +20 -0
  142. data/gen/templates/partial_model_generic.mustache +371 -0
  143. data/gen/templates/partial_model_generic_doc.mustache +28 -0
  144. data/gen/templates/partial_oneof_module.mustache +137 -0
  145. data/gen/templates/partial_oneof_module_doc.mustache +92 -0
  146. data/gen/templates/rspec.mustache +2 -0
  147. data/gen/templates/rubocop.mustache +148 -0
  148. data/gen/templates/spec_helper.mustache +103 -0
  149. data/gen/templates/version.mustache +7 -0
  150. data/gen/yarn.lock +1878 -0
  151. data/lib/mux_ruby.rb +9 -2
  152. data/lib/mux_ruby/api/assets_api.rb +279 -150
  153. data/lib/mux_ruby/api/delivery_usage_api.rb +28 -12
  154. data/lib/mux_ruby/api/dimensions_api.rb +55 -29
  155. data/lib/mux_ruby/api/direct_uploads_api.rb +90 -44
  156. data/lib/mux_ruby/api/errors_api.rb +32 -16
  157. data/lib/mux_ruby/api/exports_api.rb +28 -12
  158. data/lib/mux_ruby/api/filters_api.rb +53 -27
  159. data/lib/mux_ruby/api/incidents_api.rb +88 -46
  160. data/lib/mux_ruby/api/live_streams_api.rb +299 -157
  161. data/lib/mux_ruby/api/metrics_api.rb +175 -104
  162. data/lib/mux_ruby/api/playback_id_api.rb +31 -15
  163. data/lib/mux_ruby/api/real_time_api.rb +139 -77
  164. data/lib/mux_ruby/api/url_signing_keys_api.rb +89 -42
  165. data/lib/mux_ruby/api/video_views_api.rb +56 -29
  166. data/lib/mux_ruby/api_client.rb +94 -79
  167. data/lib/mux_ruby/api_error.rb +35 -7
  168. data/lib/mux_ruby/configuration.rb +50 -14
  169. data/lib/mux_ruby/models/abridged_video_view.rb +58 -24
  170. data/lib/mux_ruby/models/asset.rb +88 -61
  171. data/lib/mux_ruby/models/asset_errors.rb +50 -15
  172. data/lib/mux_ruby/models/asset_master.rb +52 -17
  173. data/lib/mux_ruby/models/asset_non_standard_input_reasons.rb +70 -35
  174. data/lib/mux_ruby/models/asset_recording_times.rb +50 -16
  175. data/lib/mux_ruby/models/asset_response.rb +48 -14
  176. data/lib/mux_ruby/models/asset_static_renditions.rb +53 -17
  177. data/lib/mux_ruby/models/asset_static_renditions_files.rb +58 -23
  178. data/lib/mux_ruby/models/breakdown_value.rb +52 -18
  179. data/lib/mux_ruby/models/create_asset_request.rb +64 -30
  180. data/lib/mux_ruby/models/create_live_stream_request.rb +57 -22
  181. data/lib/mux_ruby/models/create_playback_id_request.rb +48 -14
  182. data/lib/mux_ruby/models/create_playback_id_response.rb +48 -14
  183. data/lib/mux_ruby/models/create_simulcast_target_request.rb +50 -16
  184. data/lib/mux_ruby/models/create_track_request.rb +59 -25
  185. data/lib/mux_ruby/models/create_track_response.rb +48 -14
  186. data/lib/mux_ruby/models/create_upload_request.rb +52 -18
  187. data/lib/mux_ruby/models/delivery_report.rb +106 -21
  188. data/lib/mux_ruby/models/dimension_value.rb +49 -15
  189. data/lib/mux_ruby/models/disable_live_stream_response.rb +48 -14
  190. data/lib/mux_ruby/models/enable_live_stream_response.rb +48 -14
  191. data/lib/mux_ruby/models/error.rb +63 -21
  192. data/lib/mux_ruby/models/filter_value.rb +49 -15
  193. data/lib/mux_ruby/models/get_asset_input_info_response.rb +48 -14
  194. data/lib/mux_ruby/models/get_asset_or_live_stream_id_response.rb +48 -14
  195. data/lib/mux_ruby/models/get_asset_or_live_stream_id_response_data.rb +50 -16
  196. data/lib/mux_ruby/models/get_asset_or_live_stream_id_response_data_object.rb +51 -17
  197. data/lib/mux_ruby/models/get_asset_playback_id_response.rb +48 -14
  198. data/lib/mux_ruby/models/get_metric_timeseries_data_response.rb +50 -16
  199. data/lib/mux_ruby/models/get_overall_values_response.rb +50 -16
  200. data/lib/mux_ruby/models/get_real_time_breakdown_response.rb +50 -16
  201. data/lib/mux_ruby/models/get_real_time_histogram_timeseries_response.rb +51 -17
  202. data/lib/mux_ruby/models/get_real_time_histogram_timeseries_response_meta.rb +48 -14
  203. data/lib/mux_ruby/models/get_real_time_timeseries_response.rb +50 -16
  204. data/lib/mux_ruby/models/incident.rb +68 -34
  205. data/lib/mux_ruby/models/incident_breakdown.rb +50 -16
  206. data/lib/mux_ruby/models/incident_notification.rb +50 -16
  207. data/lib/mux_ruby/models/incident_notification_rule.rb +52 -18
  208. data/lib/mux_ruby/models/incident_response.rb +49 -15
  209. data/lib/mux_ruby/models/input_file.rb +49 -15
  210. data/lib/mux_ruby/models/input_info.rb +49 -15
  211. data/lib/mux_ruby/models/input_settings.rb +64 -30
  212. data/lib/mux_ruby/models/input_settings_overlay_settings.rb +58 -24
  213. data/lib/mux_ruby/models/input_track.rb +56 -22
  214. data/lib/mux_ruby/models/insight.rb +53 -19
  215. data/lib/mux_ruby/models/list_all_metric_values_response.rb +50 -16
  216. data/lib/mux_ruby/models/list_assets_response.rb +48 -14
  217. data/lib/mux_ruby/models/list_breakdown_values_response.rb +50 -16
  218. data/lib/mux_ruby/models/list_delivery_usage_response.rb +51 -17
  219. data/lib/mux_ruby/models/list_dimension_values_response.rb +50 -16
  220. data/lib/mux_ruby/models/list_dimensions_response.rb +50 -16
  221. data/lib/mux_ruby/models/list_errors_response.rb +50 -16
  222. data/lib/mux_ruby/models/list_exports_response.rb +50 -16
  223. data/lib/mux_ruby/models/list_filter_values_response.rb +50 -16
  224. data/lib/mux_ruby/models/list_filters_response.rb +50 -16
  225. data/lib/mux_ruby/models/list_filters_response_data.rb +49 -15
  226. data/lib/mux_ruby/models/list_incidents_response.rb +50 -16
  227. data/lib/mux_ruby/models/list_insights_response.rb +50 -16
  228. data/lib/mux_ruby/models/list_live_streams_response.rb +48 -14
  229. data/lib/mux_ruby/models/list_real_time_dimensions_response.rb +50 -16
  230. data/lib/mux_ruby/models/list_real_time_dimensions_response_data.rb +49 -15
  231. data/lib/mux_ruby/models/list_real_time_metrics_response.rb +50 -16
  232. data/lib/mux_ruby/models/list_related_incidents_response.rb +50 -16
  233. data/lib/mux_ruby/models/list_signing_keys_response.rb +48 -14
  234. data/lib/mux_ruby/models/list_uploads_response.rb +48 -14
  235. data/lib/mux_ruby/models/list_video_views_response.rb +50 -16
  236. data/lib/mux_ruby/models/live_stream.rb +110 -28
  237. data/lib/mux_ruby/models/live_stream_response.rb +48 -14
  238. data/lib/mux_ruby/models/metric.rb +52 -18
  239. data/lib/mux_ruby/models/notification_rule.rb +50 -16
  240. data/lib/mux_ruby/models/overall_values.rb +51 -17
  241. data/lib/mux_ruby/models/playback_id.rb +49 -15
  242. data/lib/mux_ruby/models/playback_policy.rb +12 -6
  243. data/lib/mux_ruby/models/real_time_breakdown_value.rb +52 -18
  244. data/lib/mux_ruby/models/real_time_histogram_timeseries_bucket.rb +50 -16
  245. data/lib/mux_ruby/models/real_time_histogram_timeseries_bucket_values.rb +49 -15
  246. data/lib/mux_ruby/models/real_time_histogram_timeseries_datapoint.rb +54 -20
  247. data/lib/mux_ruby/models/real_time_timeseries_datapoint.rb +50 -16
  248. data/lib/mux_ruby/models/score.rb +53 -19
  249. data/lib/mux_ruby/models/signal_live_stream_complete_response.rb +48 -14
  250. data/lib/mux_ruby/models/signing_key.rb +53 -16
  251. data/lib/mux_ruby/models/signing_key_response.rb +48 -14
  252. data/lib/mux_ruby/models/simulcast_target.rb +54 -20
  253. data/lib/mux_ruby/models/simulcast_target_response.rb +48 -14
  254. data/lib/mux_ruby/models/track.rb +67 -33
  255. data/lib/mux_ruby/models/update_asset_master_access_request.rb +50 -16
  256. data/lib/mux_ruby/models/update_asset_mp4_support_request.rb +50 -16
  257. data/lib/mux_ruby/models/upload.rb +61 -25
  258. data/lib/mux_ruby/models/upload_error.rb +51 -15
  259. data/lib/mux_ruby/models/upload_response.rb +48 -14
  260. data/lib/mux_ruby/models/video_view.rb +166 -132
  261. data/lib/mux_ruby/models/video_view_event.rb +51 -17
  262. data/lib/mux_ruby/models/video_view_response.rb +49 -15
  263. data/lib/mux_ruby/version.rb +10 -3
  264. data/mux_ruby.gemspec +15 -17
  265. data/spec/api_client_spec.rb +10 -3
  266. data/spec/configuration_spec.rb +9 -2
  267. data/spec/spec_helper.rb +9 -2
  268. metadata +139 -242
@@ -0,0 +1,34 @@
1
+ =begin
2
+ {{> api_info}}
3
+ =end
4
+
5
+ require 'spec_helper'
6
+
7
+ describe {{moduleName}}::Configuration do
8
+ let(:config) { {{moduleName}}::Configuration.default }
9
+
10
+ before(:each) do
11
+ # uncomment below to setup host and base_path
12
+ # require 'URI'
13
+ # uri = URI.parse("{{{basePath}}}")
14
+ # {{moduleName}}.configure do |c|
15
+ # c.host = uri.host
16
+ # c.base_path = uri.path
17
+ # end
18
+ end
19
+
20
+ describe '#base_url' do
21
+ it 'should have the default value' do
22
+ # uncomment below to test default value of the base path
23
+ # expect(config.base_url).to eq("{{{basePath}}}")
24
+ end
25
+
26
+ it 'should remove trailing slashes' do
27
+ [nil, '', '/', '//'].each do |base_path|
28
+ config.base_path = base_path
29
+ # uncomment below to test trailing slashes
30
+ # expect(config.base_url).to eq("{{{basePath}}}")
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,29 @@
1
+ ### TLS/SSL setting
2
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
3
+ # Default to true.
4
+ #
5
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
6
+ #
7
+ # @return [true, false]
8
+ attr_accessor :ssl_verify
9
+
10
+ ### TLS/SSL setting
11
+ # Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
12
+ #
13
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
14
+ #
15
+ attr_accessor :ssl_verify_mode
16
+
17
+ ### TLS/SSL setting
18
+ # Set this to customize the certificate file to verify the peer.
19
+ #
20
+ # @return [String] the path to the certificate file
21
+ attr_accessor :ssl_ca_file
22
+
23
+ ### TLS/SSL setting
24
+ # Client certificate file (for client certificate)
25
+ attr_accessor :ssl_client_cert
26
+
27
+ ### TLS/SSL setting
28
+ # Client private key file (for client certificate)
29
+ attr_accessor :ssl_client_key
@@ -0,0 +1,34 @@
1
+ ### TLS/SSL setting
2
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
3
+ # Default to true.
4
+ #
5
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
6
+ #
7
+ # @return [true, false]
8
+ attr_accessor :verify_ssl
9
+
10
+ ### TLS/SSL setting
11
+ # Set this to false to skip verifying SSL host name
12
+ # Default to true.
13
+ #
14
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
15
+ #
16
+ # @return [true, false]
17
+ attr_accessor :verify_ssl_host
18
+
19
+ ### TLS/SSL setting
20
+ # Set this to customize the certificate file to verify the peer.
21
+ #
22
+ # @return [String] the path to the certificate file
23
+ #
24
+ # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
25
+ # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
26
+ attr_accessor :ssl_ca_cert
27
+
28
+ ### TLS/SSL setting
29
+ # Client certificate file (for client certificate)
30
+ attr_accessor :cert_file
31
+
32
+ ### TLS/SSL setting
33
+ # Client private key file (for client certificate)
34
+ attr_accessor :key_file
@@ -0,0 +1,40 @@
1
+ =begin
2
+ {{> api_info}}
3
+ =end
4
+
5
+ # Common files
6
+ require '{{gemName}}/api_client'
7
+ require '{{gemName}}/api_error'
8
+ require '{{gemName}}/version'
9
+ require '{{gemName}}/configuration'
10
+
11
+ # Models
12
+ {{#models}}
13
+ {{#model}}
14
+ require '{{gemName}}/{{modelPackage}}/{{classFilename}}'{{/model}}
15
+ {{/models}}
16
+
17
+ # APIs
18
+ {{#apiInfo}}
19
+ {{#apis}}
20
+ require '{{importPath}}'
21
+ {{/apis}}
22
+ {{/apiInfo}}
23
+
24
+ module {{moduleName}}
25
+ class << self
26
+ # Customize default settings for the SDK using block.
27
+ # {{moduleName}}.configure do |config|
28
+ # config.username = "xxx"
29
+ # config.password = "xxx"
30
+ # end
31
+ # If no block given, return the default Configuration object.
32
+ def configure
33
+ if block_given?
34
+ yield(Configuration.default)
35
+ else
36
+ Configuration.default
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,35 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ =begin
4
+ {{> api_info}}
5
+ =end
6
+
7
+ $:.push File.expand_path("../lib", __FILE__)
8
+ require "{{gemName}}/version"
9
+
10
+ Gem::Specification.new do |s|
11
+ s.name = "{{gemName}}{{^gemName}}{{{appName}}}{{/gemName}}"
12
+ s.version = {{moduleName}}::VERSION
13
+ s.platform = Gem::Platform::RUBY
14
+ s.authors = ["{{gemAuthor}}{{^gemAuthor}}OpenAPI-Generator{{/gemAuthor}}"]
15
+ s.email = ["{{gemAuthorEmail}}{{^gemAuthorEmail}}{{infoEmail}}{{/gemAuthorEmail}}"]
16
+ s.homepage = "{{gemHomepage}}{{^gemHomepage}}https://openapi-generator.tech{{/gemHomepage}}"
17
+ s.summary = "{{gemSummary}}{{^gemSummary}}{{{appName}}} Ruby Gem{{/gemSummary}}"
18
+ s.description = "{{gemDescription}}{{^gemDescription}}{{{appDescription}}}{{^appDescription}}{{{appName}}} Ruby Gem{{/appDescription}}{{/gemDescription}}"
19
+ s.license = "{{{gemLicense}}}{{^gemLicense}}Unlicense{{/gemLicense}}"
20
+ s.required_ruby_version = "{{{gemRequiredRubyVersion}}}{{^gemRequiredRubyVersion}}>= 2.4{{/gemRequiredRubyVersion}}"
21
+
22
+ {{#isFaraday}}
23
+ s.add_runtime_dependency 'faraday', '~> 1.0', '>= 1.0.1'
24
+ {{/isFaraday}}
25
+ {{^isFaraday}}
26
+ s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
27
+ {{/isFaraday}}
28
+
29
+ s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
30
+
31
+ s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
32
+ s.test_files = `find spec/*`.split("\n")
33
+ s.executables = []
34
+ s.require_paths = ["lib"]
35
+ end
@@ -0,0 +1,39 @@
1
+ # Generated by: https://openapi-generator.tech
2
+ #
3
+
4
+ *.gem
5
+ *.rbc
6
+ /.config
7
+ /coverage/
8
+ /InstalledFiles
9
+ /pkg/
10
+ /spec/reports/
11
+ /spec/examples.txt
12
+ /test/tmp/
13
+ /test/version_tmp/
14
+ /tmp/
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+
21
+ ## Documentation cache and generated files:
22
+ /.yardoc/
23
+ /_yardoc/
24
+ /doc/
25
+ /rdoc/
26
+
27
+ ## Environment normalization:
28
+ /.bundle/
29
+ /vendor/bundle
30
+ /lib/bundler/man/
31
+
32
+ # for a library or gem, you might want to ignore these files since the code is
33
+ # intended to run in multiple environments; otherwise, check them in:
34
+ # Gemfile.lock
35
+ # .ruby-version
36
+ # .ruby-gemset
37
+
38
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
39
+ .rvmrc
@@ -0,0 +1,26 @@
1
+ =begin
2
+ {{> api_info}}
3
+ =end
4
+
5
+ require 'date'
6
+ require 'time'
7
+
8
+ module {{moduleName}}
9
+ {{#models}}
10
+ {{#model}}
11
+ {{#isEnum}}
12
+ {{>partial_model_enum_class}}
13
+ {{/isEnum}}
14
+ {{^isEnum}}
15
+ {{#oneOf}}
16
+ {{#-first}}
17
+ {{>partial_oneof_module}}
18
+ {{/-first}}
19
+ {{/oneOf}}
20
+ {{^oneOf}}
21
+ {{>partial_model_generic}}
22
+ {{/oneOf}}
23
+ {{/isEnum}}
24
+ {{/model}}
25
+ {{/models}}
26
+ end
@@ -0,0 +1,12 @@
1
+ {{#models}}
2
+ {{#model}}
3
+ {{#oneOf}}
4
+ {{#-first}}
5
+ {{>partial_oneof_module_doc}}
6
+ {{/-first}}
7
+ {{/oneOf}}
8
+ {{^oneOf}}
9
+ {{>partial_model_generic_doc}}
10
+ {{/oneOf}}
11
+ {{/model}}
12
+ {{/models}}
@@ -0,0 +1,77 @@
1
+ =begin
2
+ {{> api_info}}
3
+ =end
4
+
5
+ require 'spec_helper'
6
+ require 'json'
7
+ require 'date'
8
+
9
+ # Unit tests for {{moduleName}}::{{classname}}
10
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
11
+ # Please update as you see appropriate
12
+ {{#models}}
13
+ {{#model}}
14
+ describe {{moduleName}}::{{classname}} do
15
+ {{^oneOf}}
16
+ let(:instance) { {{moduleName}}::{{classname}}.new }
17
+
18
+ describe 'test an instance of {{classname}}' do
19
+ it 'should create an instance of {{classname}}' do
20
+ expect(instance).to be_instance_of({{moduleName}}::{{classname}})
21
+ end
22
+ end
23
+ {{#vars}}
24
+ describe 'test attribute "{{{name}}}"' do
25
+ it 'should work' do
26
+ {{#isEnum}}
27
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
28
+ # validator = Petstore::EnumTest::EnumAttributeValidator.new('{{{dataType}}}', [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}])
29
+ # validator.allowable_values.each do |value|
30
+ # expect { instance.{{name}} = value }.not_to raise_error
31
+ # end
32
+ {{/isEnum}}
33
+ {{^isEnum}}
34
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
35
+ {{/isEnum}}
36
+ end
37
+ end
38
+
39
+ {{/vars}}
40
+ {{/oneOf}}
41
+ {{#oneOf}}
42
+ {{#-first}}
43
+ describe '.openapi_one_of' do
44
+ it 'lists the items referenced in the oneOf array' do
45
+ expect(described_class.openapi_one_of).to_not be_empty
46
+ end
47
+ end
48
+
49
+ {{#discriminator}}
50
+ {{#propertyName}}
51
+ describe '.openapi_discriminator_name' do
52
+ it 'returns the value of the "discriminator" property' do
53
+ expect(described_class.openapi_discriminator_name).to_not be_empty
54
+ end
55
+ end
56
+
57
+ {{/propertyName}}
58
+ {{#mappedModels}}
59
+ {{#-first}}
60
+ describe '.openapi_discriminator_mapping' do
61
+ it 'returns the key/values of the "mapping" property' do
62
+ expect(described_class.openapi_discriminator_mapping.values.sort).to eq(described_class.openapi_one_of.sort)
63
+ end
64
+ end
65
+
66
+ {{/-first}}
67
+ {{/mappedModels}}
68
+ {{/discriminator}}
69
+ describe '.build' do
70
+ it 'returns the correct model' do
71
+ end
72
+ end
73
+ {{/-first}}
74
+ {{/oneOf}}
75
+ end
76
+ {{/model}}
77
+ {{/models}}
@@ -0,0 +1,20 @@
1
+ class {{classname}}{{#allowableValues}}{{#enumVars}}
2
+ {{{name}}} = {{{value}}}.freeze{{/enumVars}}
3
+
4
+ {{/allowableValues}}
5
+ # Builds the enum from string
6
+ # @param [String] The enum value in the form of the string
7
+ # @return [String] The enum value
8
+ def self.build_from_hash(value)
9
+ new.build_from_hash(value)
10
+ end
11
+
12
+ # Builds the enum from string
13
+ # @param [String] The enum value in the form of the string
14
+ # @return [String] The enum value
15
+ def build_from_hash(value)
16
+ constantValues = {{classname}}.constants.select { |c| {{classname}}::const_get(c) == value }
17
+ raise "Invalid ENUM value #{value} for class #{{{classname}}}" if constantValues.empty?
18
+ value
19
+ end
20
+ end
@@ -0,0 +1,371 @@
1
+ {{#description}}
2
+ # {{{description}}}
3
+ {{/description}}
4
+ class {{classname}}{{#parent}} < {{{.}}}{{/parent}}
5
+ {{#vars}}
6
+ {{#description}}
7
+ # {{{description}}}
8
+ {{/description}}
9
+ attr_accessor :{{{name}}}
10
+
11
+ {{/vars}}
12
+ {{#hasEnums}}
13
+ class EnumAttributeValidator
14
+ attr_reader :datatype
15
+ attr_reader :allowable_values
16
+
17
+ def initialize(datatype, allowable_values)
18
+ @allowable_values = allowable_values.map do |value|
19
+ case datatype.to_s
20
+ when /Integer/i
21
+ value.to_i
22
+ when /Float/i
23
+ value.to_f
24
+ else
25
+ value
26
+ end
27
+ end
28
+ end
29
+
30
+ def valid?(value)
31
+ !value || allowable_values.include?(value)
32
+ end
33
+ end
34
+
35
+ {{/hasEnums}}
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ {{#vars}}
40
+ :'{{{name}}}' => :'{{{baseName}}}'{{^-last}},{{/-last}}
41
+ {{/vars}}
42
+ }
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about{{#parent}}, including the ones defined in its parent(s){{/parent}}
46
+ def self.acceptable_attributes
47
+ {{^parent}}
48
+ attribute_map.values
49
+ {{/parent}}
50
+ {{#parent}}
51
+ attribute_map.values.concat(superclass.acceptable_attributes)
52
+ {{/parent}}
53
+ end
54
+
55
+ # Attribute type mapping.
56
+ def self.openapi_types
57
+ {
58
+ {{#vars}}
59
+ :'{{{name}}}' => :'{{{dataType}}}'{{^-last}},{{/-last}}
60
+ {{/vars}}
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ {{#vars}}
68
+ {{#isNullable}}
69
+ :'{{{name}}}'{{^-last}},{{/-last}}
70
+ {{/isNullable}}
71
+ {{/vars}}
72
+ ])
73
+ end
74
+
75
+ {{#anyOf}}
76
+ {{#-first}}
77
+ # List of class defined in anyOf (OpenAPI v3)
78
+ def self.openapi_any_of
79
+ [
80
+ {{/-first}}
81
+ :'{{{.}}}'{{^-last}},{{/-last}}
82
+ {{#-last}}
83
+ ]
84
+ end
85
+
86
+ {{/-last}}
87
+ {{/anyOf}}
88
+ {{#allOf}}
89
+ {{#-first}}
90
+ # List of class defined in allOf (OpenAPI v3)
91
+ def self.openapi_all_of
92
+ [
93
+ {{/-first}}
94
+ :'{{{.}}}'{{^-last}},{{/-last}}
95
+ {{#-last}}
96
+ ]
97
+ end
98
+
99
+ {{/-last}}
100
+ {{/allOf}}
101
+ {{#discriminator}}
102
+ {{#propertyName}}
103
+ # discriminator's property name in OpenAPI v3
104
+ def self.openapi_discriminator_name
105
+ :'{{{.}}}'
106
+ end
107
+
108
+ {{/propertyName}}
109
+ {{/discriminator}}
110
+ # Initializes the object
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ def initialize(attributes = {})
113
+ if (!attributes.is_a?(Hash))
114
+ fail ArgumentError, "The input argument (attributes) must be a hash in `{{{moduleName}}}::{{{classname}}}` initialize method"
115
+ end
116
+
117
+ # check to see if the attribute exists and convert string to symbol for hash key
118
+ attributes = attributes.each_with_object({}) { |(k, v), h|
119
+ if (!self.class.attribute_map.key?(k.to_sym))
120
+ fail ArgumentError, "`#{k}` is not a valid attribute in `{{{moduleName}}}::{{{classname}}}`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
121
+ end
122
+ h[k.to_sym] = v
123
+ }
124
+ {{#parent}}
125
+
126
+ # call parent's initialize
127
+ super(attributes)
128
+ {{/parent}}
129
+ {{#vars}}
130
+
131
+ if attributes.key?(:'{{{name}}}')
132
+ {{#isArray}}
133
+ if (value = attributes[:'{{{name}}}']).is_a?(Array)
134
+ self.{{{name}}} = value
135
+ end
136
+ {{/isArray}}
137
+ {{#isMap}}
138
+ if (value = attributes[:'{{{name}}}']).is_a?(Hash)
139
+ self.{{{name}}} = value
140
+ end
141
+ {{/isMap}}
142
+ {{^isContainer}}
143
+ self.{{{name}}} = attributes[:'{{{name}}}']
144
+ {{/isContainer}}
145
+ {{#defaultValue}}
146
+ else
147
+ self.{{{name}}} = {{{defaultValue}}}
148
+ {{/defaultValue}}
149
+ end
150
+ {{/vars}}
151
+ end
152
+
153
+ # Show invalid properties with the reasons. Usually used together with valid?
154
+ # @return Array for valid properties with the reasons
155
+ def list_invalid_properties
156
+ invalid_properties = {{^parent}}Array.new{{/parent}}{{#parent}}super{{/parent}}
157
+ {{#vars}}
158
+ {{^isNullable}}
159
+ {{#required}}
160
+ if @{{{name}}}.nil?
161
+ invalid_properties.push('invalid value for "{{{name}}}", {{{name}}} cannot be nil.')
162
+ end
163
+
164
+ {{/required}}
165
+ {{/isNullable}}
166
+ {{#hasValidation}}
167
+ {{#maxLength}}
168
+ if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length > {{{maxLength}}}
169
+ invalid_properties.push('invalid value for "{{{name}}}", the character length must be smaller than or equal to {{{maxLength}}}.')
170
+ end
171
+
172
+ {{/maxLength}}
173
+ {{#minLength}}
174
+ if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length < {{{minLength}}}
175
+ invalid_properties.push('invalid value for "{{{name}}}", the character length must be great than or equal to {{{minLength}}}.')
176
+ end
177
+
178
+ {{/minLength}}
179
+ {{#maximum}}
180
+ if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}}
181
+ invalid_properties.push('invalid value for "{{{name}}}", must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}.')
182
+ end
183
+
184
+ {{/maximum}}
185
+ {{#minimum}}
186
+ if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}}
187
+ invalid_properties.push('invalid value for "{{{name}}}", must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}.')
188
+ end
189
+
190
+ {{/minimum}}
191
+ {{#pattern}}
192
+ pattern = Regexp.new({{{pattern}}})
193
+ if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} !~ pattern
194
+ invalid_properties.push("invalid value for \"{{{name}}}\", must conform to the pattern #{pattern}.")
195
+ end
196
+
197
+ {{/pattern}}
198
+ {{#maxItems}}
199
+ if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length > {{{maxItems}}}
200
+ invalid_properties.push('invalid value for "{{{name}}}", number of items must be less than or equal to {{{maxItems}}}.'
201
+ end
202
+
203
+ {{/maxItems}}
204
+ {{#minItems}}
205
+ if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length < {{{minItems}}}
206
+ invalid_properties.push('invalid value for "{{{name}}}", number of items must be greater than or equal to {{{minItems}}}.'
207
+ end
208
+
209
+ {{/minItems}}
210
+ {{/hasValidation}}
211
+ {{/vars}}
212
+ invalid_properties
213
+ end
214
+
215
+ # Check to see if the all the properties in the model are valid
216
+ # @return true if the model is valid
217
+ def valid?
218
+ {{#vars}}
219
+ {{^isNullable}}
220
+ {{#required}}
221
+ return false if @{{{name}}}.nil?
222
+ {{/required}}
223
+ {{/isNullable}}
224
+ {{#isEnum}}
225
+ {{^isContainer}}
226
+ {{{name}}}_validator = EnumAttributeValidator.new('{{{dataType}}}', [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}])
227
+ return false unless {{{name}}}_validator.valid?(@{{{name}}})
228
+ {{/isContainer}}
229
+ {{/isEnum}}
230
+ {{#hasValidation}}
231
+ {{#maxLength}}
232
+ return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length > {{{maxLength}}}
233
+ {{/maxLength}}
234
+ {{#minLength}}
235
+ return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length < {{{minLength}}}
236
+ {{/minLength}}
237
+ {{#maximum}}
238
+ return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}}
239
+ {{/maximum}}
240
+ {{#minimum}}
241
+ return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}}
242
+ {{/minimum}}
243
+ {{#pattern}}
244
+ return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} !~ Regexp.new({{{pattern}}})
245
+ {{/pattern}}
246
+ {{#maxItems}}
247
+ return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length > {{{maxItems}}}
248
+ {{/maxItems}}
249
+ {{#minItems}}
250
+ return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length < {{{minItems}}}
251
+ {{/minItems}}
252
+ {{/hasValidation}}
253
+ {{/vars}}
254
+ {{#anyOf}}
255
+ {{#-first}}
256
+ _any_of_found = false
257
+ self.class.openapi_any_of.each do |_class|
258
+ _any_of = {{moduleName}}.const_get(_class).build_from_hash(self.to_hash)
259
+ if _any_of.valid?
260
+ _any_of_found = true
261
+ end
262
+ end
263
+
264
+ if !_any_of_found
265
+ return false
266
+ end
267
+
268
+ {{/-first}}
269
+ {{/anyOf}}
270
+ true{{#parent}} && super{{/parent}}
271
+ end
272
+
273
+ {{#vars}}
274
+ {{#isEnum}}
275
+ {{^isContainer}}
276
+ # Custom attribute writer method checking allowed values (enum).
277
+ # @param [Object] {{{name}}} Object to be assigned
278
+ def {{{name}}}=({{{name}}})
279
+ validator = EnumAttributeValidator.new('{{{dataType}}}', [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}])
280
+ unless validator.valid?({{{name}}})
281
+ fail ArgumentError, "invalid value for \"{{{name}}}\", must be one of #{validator.allowable_values}."
282
+ end
283
+ @{{{name}}} = {{{name}}}
284
+ end
285
+
286
+ {{/isContainer}}
287
+ {{/isEnum}}
288
+ {{^isEnum}}
289
+ {{#hasValidation}}
290
+ # Custom attribute writer method with validation
291
+ # @param [Object] {{{name}}} Value to be assigned
292
+ def {{{name}}}=({{{name}}})
293
+ {{^isNullable}}
294
+ {{#required}}
295
+ if {{{name}}}.nil?
296
+ fail ArgumentError, '{{{name}}} cannot be nil'
297
+ end
298
+
299
+ {{/required}}
300
+ {{/isNullable}}
301
+ {{#maxLength}}
302
+ if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.to_s.length > {{{maxLength}}}
303
+ fail ArgumentError, 'invalid value for "{{{name}}}", the character length must be smaller than or equal to {{{maxLength}}}.'
304
+ end
305
+
306
+ {{/maxLength}}
307
+ {{#minLength}}
308
+ if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.to_s.length < {{{minLength}}}
309
+ fail ArgumentError, 'invalid value for "{{{name}}}", the character length must be great than or equal to {{{minLength}}}.'
310
+ end
311
+
312
+ {{/minLength}}
313
+ {{#maximum}}
314
+ if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}}
315
+ fail ArgumentError, 'invalid value for "{{{name}}}", must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}.'
316
+ end
317
+
318
+ {{/maximum}}
319
+ {{#minimum}}
320
+ if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}}
321
+ fail ArgumentError, 'invalid value for "{{{name}}}", must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}.'
322
+ end
323
+
324
+ {{/minimum}}
325
+ {{#pattern}}
326
+ pattern = Regexp.new({{{pattern}}})
327
+ if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}} !~ pattern
328
+ fail ArgumentError, "invalid value for \"{{{name}}}\", must conform to the pattern #{pattern}."
329
+ end
330
+
331
+ {{/pattern}}
332
+ {{#maxItems}}
333
+ if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.length > {{{maxItems}}}
334
+ fail ArgumentError, 'invalid value for "{{{name}}}", number of items must be less than or equal to {{{maxItems}}}.'
335
+ end
336
+
337
+ {{/maxItems}}
338
+ {{#minItems}}
339
+ if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.length < {{{minItems}}}
340
+ fail ArgumentError, 'invalid value for "{{{name}}}", number of items must be greater than or equal to {{{minItems}}}.'
341
+ end
342
+
343
+ {{/minItems}}
344
+ @{{{name}}} = {{{name}}}
345
+ end
346
+
347
+ {{/hasValidation}}
348
+ {{/isEnum}}
349
+ {{/vars}}
350
+ # Checks equality by comparing each attribute.
351
+ # @param [Object] Object to be compared
352
+ def ==(o)
353
+ return true if self.equal?(o)
354
+ self.class == o.class{{#vars}} &&
355
+ {{name}} == o.{{name}}{{/vars}}{{#parent}} && super(o){{/parent}}
356
+ end
357
+
358
+ # @see the `==` method
359
+ # @param [Object] Object to be compared
360
+ def eql?(o)
361
+ self == o
362
+ end
363
+
364
+ # Calculates hash code according to all attributes.
365
+ # @return [Integer] Hash code
366
+ def hash
367
+ [{{#vars}}{{name}}{{^-last}}, {{/-last}}{{/vars}}].hash
368
+ end
369
+
370
+ {{> base_object}}
371
+ end