mux_ruby 1.6.0 → 2.0.0.pre.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -1
- data/Gemfile.lock +26 -37
- data/README.md +37 -13
- data/docs/AbridgedVideoView.md +33 -13
- data/docs/Asset.md +59 -23
- data/docs/AssetErrors.md +15 -4
- data/docs/AssetMaster.md +15 -4
- data/docs/AssetNonStandardInputReasons.md +34 -0
- data/docs/AssetRecordingTimes.md +20 -0
- data/docs/AssetResponse.md +13 -3
- data/docs/AssetStaticRenditions.md +15 -4
- data/docs/AssetStaticRenditionsFiles.md +23 -8
- data/docs/AssetsApi.md +396 -161
- data/docs/BreakdownValue.md +21 -7
- data/docs/CreateAssetRequest.md +27 -10
- data/docs/CreateLiveStreamRequest.md +27 -9
- data/docs/CreatePlaybackIDRequest.md +13 -3
- data/docs/CreatePlaybackIDResponse.md +13 -3
- data/docs/CreateSimulcastTargetRequest.md +17 -5
- data/docs/CreateTrackRequest.md +25 -9
- data/docs/CreateTrackResponse.md +13 -3
- data/docs/CreateUploadRequest.md +19 -6
- data/docs/DeliveryReport.md +27 -9
- data/docs/DeliveryUsageApi.md +41 -23
- data/docs/DimensionValue.md +20 -0
- data/docs/DimensionsApi.md +156 -0
- data/docs/DirectUploadsApi.md +131 -56
- data/docs/DisableLiveStreamResponse.md +18 -0
- data/docs/EnableLiveStreamResponse.md +18 -0
- data/docs/Error.md +27 -10
- data/docs/ErrorsApi.md +38 -20
- data/docs/ExportsApi.md +33 -14
- data/docs/FilterValue.md +15 -4
- data/docs/FiltersApi.md +73 -35
- data/docs/GetAssetInputInfoResponse.md +13 -3
- data/docs/GetAssetOrLiveStreamIdResponse.md +18 -0
- data/docs/GetAssetOrLiveStreamIdResponseData.md +22 -0
- data/docs/GetAssetOrLiveStreamIdResponseDataObject.md +20 -0
- data/docs/GetAssetPlaybackIDResponse.md +13 -3
- data/docs/GetMetricTimeseriesDataResponse.md +17 -5
- data/docs/GetOverallValuesResponse.md +17 -5
- data/docs/GetRealTimeBreakdownResponse.md +22 -0
- data/docs/GetRealTimeHistogramTimeseriesResponse.md +24 -0
- data/docs/GetRealTimeHistogramTimeseriesResponseMeta.md +18 -0
- data/docs/GetRealTimeTimeseriesResponse.md +22 -0
- data/docs/Incident.md +58 -0
- data/docs/IncidentBreakdown.md +22 -0
- data/docs/IncidentNotification.md +22 -0
- data/docs/IncidentNotificationRule.md +26 -0
- data/docs/IncidentResponse.md +20 -0
- data/docs/IncidentsApi.md +242 -0
- data/docs/InputFile.md +15 -4
- data/docs/InputInfo.md +15 -4
- data/docs/InputSettings.md +31 -10
- data/docs/InputSettingsOverlaySettings.md +25 -9
- data/docs/InputTrack.md +29 -11
- data/docs/Insight.md +23 -8
- data/docs/ListAllMetricValuesResponse.md +17 -5
- data/docs/ListAssetsResponse.md +13 -3
- data/docs/ListBreakdownValuesResponse.md +17 -5
- data/docs/ListDeliveryUsageResponse.md +19 -6
- data/docs/ListDimensionValuesResponse.md +22 -0
- data/docs/ListDimensionsResponse.md +22 -0
- data/docs/ListErrorsResponse.md +17 -5
- data/docs/ListExportsResponse.md +17 -5
- data/docs/ListFilterValuesResponse.md +17 -5
- data/docs/ListFiltersResponse.md +17 -5
- data/docs/ListFiltersResponseData.md +15 -4
- data/docs/ListIncidentsResponse.md +22 -0
- data/docs/ListInsightsResponse.md +17 -5
- data/docs/ListLiveStreamsResponse.md +13 -3
- data/docs/ListRealTimeDimensionsResponse.md +22 -0
- data/docs/ListRealTimeDimensionsResponseData.md +20 -0
- data/docs/ListRealTimeMetricsResponse.md +22 -0
- data/docs/ListRelatedIncidentsResponse.md +22 -0
- data/docs/ListSigningKeysResponse.md +13 -3
- data/docs/ListUploadsResponse.md +13 -3
- data/docs/ListVideoViewsResponse.md +17 -5
- data/docs/LiveStream.md +39 -15
- data/docs/LiveStreamResponse.md +13 -3
- data/docs/LiveStreamsApi.md +497 -145
- data/docs/Metric.md +21 -7
- data/docs/MetricsApi.md +211 -117
- data/docs/NotificationRule.md +22 -0
- data/docs/OverallValues.md +19 -6
- data/docs/PlaybackID.md +15 -4
- data/docs/PlaybackIDApi.md +78 -0
- data/docs/PlaybackPolicy.md +10 -2
- data/docs/RealTimeApi.md +376 -0
- data/docs/RealTimeBreakdownValue.md +26 -0
- data/docs/RealTimeHistogramTimeseriesBucket.md +20 -0
- data/docs/RealTimeHistogramTimeseriesBucketValues.md +20 -0
- data/docs/RealTimeHistogramTimeseriesDatapoint.md +30 -0
- data/docs/RealTimeTimeseriesDatapoint.md +22 -0
- data/docs/Score.md +23 -8
- data/docs/SignalLiveStreamCompleteResponse.md +13 -3
- data/docs/SigningKey.md +17 -5
- data/docs/SigningKeyResponse.md +13 -3
- data/docs/SimulcastTarget.md +21 -7
- data/docs/SimulcastTargetResponse.md +13 -3
- data/docs/Track.md +37 -15
- data/docs/URLSigningKeysApi.md +130 -54
- data/docs/UpdateAssetMP4SupportRequest.md +13 -3
- data/docs/UpdateAssetMasterAccessRequest.md +13 -3
- data/docs/Upload.md +29 -11
- data/docs/UploadError.md +15 -4
- data/docs/UploadResponse.md +13 -3
- data/docs/VideoView.md +251 -114
- data/docs/VideoViewEvent.md +19 -6
- data/docs/VideoViewResponse.md +15 -4
- data/docs/VideoViewsApi.md +78 -41
- data/examples/data/exercise-dimensions.rb +29 -0
- data/examples/data/exercise-incidents.rb +29 -0
- data/examples/data/exercise-realtime.rb +60 -0
- data/examples/video/exercise-assets.rb +21 -0
- data/examples/video/exercise-live-streams.rb +30 -0
- data/gen/.gitignore +7 -0
- data/gen/Makefile +31 -0
- data/gen/generator-config.json +11 -0
- data/gen/openapitools.json +7 -0
- data/gen/package.json +17 -0
- data/gen/templates/Gemfile.mustache +11 -0
- data/gen/templates/README.mustache +158 -0
- data/gen/templates/Rakefile.mustache +10 -0
- data/gen/templates/api.mustache +206 -0
- data/gen/templates/api_client.mustache +264 -0
- data/gen/templates/api_client_faraday_partial.mustache +138 -0
- data/gen/templates/api_client_spec.mustache +220 -0
- data/gen/templates/api_client_typhoeus_partial.mustache +183 -0
- data/gen/templates/api_doc.mustache +118 -0
- data/gen/templates/api_error.mustache +67 -0
- data/gen/templates/api_info.mustache +12 -0
- data/gen/templates/api_test.mustache +47 -0
- data/gen/templates/base_object.mustache +120 -0
- data/gen/templates/configuration.mustache +349 -0
- data/gen/templates/configuration_spec.mustache +34 -0
- data/gen/templates/configuration_tls_faraday_partial.mustache +29 -0
- data/gen/templates/configuration_tls_typhoeus_partial.mustache +34 -0
- data/gen/templates/gem.mustache +40 -0
- data/gen/templates/gemspec.mustache +35 -0
- data/gen/templates/gitignore.mustache +39 -0
- data/gen/templates/model.mustache +26 -0
- data/gen/templates/model_doc.mustache +12 -0
- data/gen/templates/model_test.mustache +77 -0
- data/gen/templates/partial_model_enum_class.mustache +20 -0
- data/gen/templates/partial_model_generic.mustache +371 -0
- data/gen/templates/partial_model_generic_doc.mustache +28 -0
- data/gen/templates/partial_oneof_module.mustache +137 -0
- data/gen/templates/partial_oneof_module_doc.mustache +92 -0
- data/gen/templates/rspec.mustache +2 -0
- data/gen/templates/rubocop.mustache +148 -0
- data/gen/templates/spec_helper.mustache +103 -0
- data/gen/templates/version.mustache +7 -0
- data/gen/yarn.lock +1878 -0
- data/lib/mux_ruby.rb +43 -2
- data/lib/mux_ruby/api/assets_api.rb +291 -152
- data/lib/mux_ruby/api/delivery_usage_api.rb +32 -16
- data/lib/mux_ruby/api/dimensions_api.rb +154 -0
- data/lib/mux_ruby/api/direct_uploads_api.rb +90 -44
- data/lib/mux_ruby/api/errors_api.rb +34 -18
- data/lib/mux_ruby/api/exports_api.rb +30 -14
- data/lib/mux_ruby/api/filters_api.rb +57 -31
- data/lib/mux_ruby/api/incidents_api.rb +259 -0
- data/lib/mux_ruby/api/live_streams_api.rb +381 -133
- data/lib/mux_ruby/api/metrics_api.rb +185 -114
- data/lib/mux_ruby/api/playback_id_api.rb +85 -0
- data/lib/mux_ruby/api/real_time_api.rb +373 -0
- data/lib/mux_ruby/api/url_signing_keys_api.rb +95 -48
- data/lib/mux_ruby/api/video_views_api.rb +60 -33
- data/lib/mux_ruby/api_client.rb +106 -91
- data/lib/mux_ruby/api_error.rb +35 -7
- data/lib/mux_ruby/configuration.rb +50 -14
- data/lib/mux_ruby/models/abridged_video_view.rb +58 -24
- data/lib/mux_ruby/models/asset.rb +157 -53
- data/lib/mux_ruby/models/asset_errors.rb +52 -15
- data/lib/mux_ruby/models/asset_master.rb +85 -15
- data/lib/mux_ruby/models/asset_non_standard_input_reasons.rb +370 -0
- data/lib/mux_ruby/models/asset_recording_times.rb +229 -0
- data/lib/mux_ruby/models/asset_response.rb +48 -14
- data/lib/mux_ruby/models/asset_static_renditions.rb +55 -19
- data/lib/mux_ruby/models/asset_static_renditions_files.rb +60 -25
- data/lib/mux_ruby/models/breakdown_value.rb +52 -18
- data/lib/mux_ruby/models/create_asset_request.rb +70 -30
- data/lib/mux_ruby/models/create_live_stream_request.rb +68 -23
- data/lib/mux_ruby/models/create_playback_id_request.rb +48 -14
- data/lib/mux_ruby/models/create_playback_id_response.rb +48 -14
- data/lib/mux_ruby/models/create_simulcast_target_request.rb +50 -16
- data/lib/mux_ruby/models/create_track_request.rb +65 -27
- data/lib/mux_ruby/models/create_track_response.rb +48 -14
- data/lib/mux_ruby/models/create_upload_request.rb +52 -18
- data/lib/mux_ruby/models/delivery_report.rb +106 -21
- data/lib/mux_ruby/models/dimension_value.rb +227 -0
- data/lib/mux_ruby/models/disable_live_stream_response.rb +218 -0
- data/lib/mux_ruby/models/enable_live_stream_response.rb +218 -0
- data/lib/mux_ruby/models/error.rb +63 -21
- data/lib/mux_ruby/models/filter_value.rb +49 -15
- data/lib/mux_ruby/models/get_asset_input_info_response.rb +48 -14
- data/lib/mux_ruby/models/get_asset_or_live_stream_id_response.rb +218 -0
- data/lib/mux_ruby/models/get_asset_or_live_stream_id_response_data.rb +237 -0
- data/lib/mux_ruby/models/get_asset_or_live_stream_id_response_data_object.rb +264 -0
- data/lib/mux_ruby/models/get_asset_playback_id_response.rb +48 -14
- data/lib/mux_ruby/models/get_metric_timeseries_data_response.rb +50 -16
- data/lib/mux_ruby/models/get_overall_values_response.rb +50 -16
- data/lib/mux_ruby/models/get_real_time_breakdown_response.rb +240 -0
- data/lib/mux_ruby/models/get_real_time_histogram_timeseries_response.rb +249 -0
- data/lib/mux_ruby/models/get_real_time_histogram_timeseries_response_meta.rb +220 -0
- data/lib/mux_ruby/models/get_real_time_timeseries_response.rb +240 -0
- data/lib/mux_ruby/models/incident.rb +404 -0
- data/lib/mux_ruby/models/incident_breakdown.rb +236 -0
- data/lib/mux_ruby/models/incident_notification.rb +236 -0
- data/lib/mux_ruby/models/incident_notification_rule.rb +256 -0
- data/lib/mux_ruby/models/incident_response.rb +229 -0
- data/lib/mux_ruby/models/input_file.rb +49 -15
- data/lib/mux_ruby/models/input_info.rb +49 -15
- data/lib/mux_ruby/models/input_settings.rb +91 -30
- data/lib/mux_ruby/models/input_settings_overlay_settings.rb +68 -26
- data/lib/mux_ruby/models/input_track.rb +56 -22
- data/lib/mux_ruby/models/insight.rb +53 -19
- data/lib/mux_ruby/models/list_all_metric_values_response.rb +50 -16
- data/lib/mux_ruby/models/list_assets_response.rb +48 -14
- data/lib/mux_ruby/models/list_breakdown_values_response.rb +50 -16
- data/lib/mux_ruby/models/list_delivery_usage_response.rb +51 -17
- data/lib/mux_ruby/models/list_dimension_values_response.rb +240 -0
- data/lib/mux_ruby/models/list_dimensions_response.rb +238 -0
- data/lib/mux_ruby/models/list_errors_response.rb +50 -16
- data/lib/mux_ruby/models/list_exports_response.rb +50 -16
- data/lib/mux_ruby/models/list_filter_values_response.rb +50 -16
- data/lib/mux_ruby/models/list_filters_response.rb +50 -16
- data/lib/mux_ruby/models/list_filters_response_data.rb +49 -15
- data/lib/mux_ruby/models/list_incidents_response.rb +240 -0
- data/lib/mux_ruby/models/list_insights_response.rb +50 -16
- data/lib/mux_ruby/models/list_live_streams_response.rb +48 -14
- data/lib/mux_ruby/models/list_real_time_dimensions_response.rb +240 -0
- data/lib/mux_ruby/models/list_real_time_dimensions_response_data.rb +227 -0
- data/lib/mux_ruby/models/list_real_time_metrics_response.rb +240 -0
- data/lib/mux_ruby/models/list_related_incidents_response.rb +240 -0
- data/lib/mux_ruby/models/list_signing_keys_response.rb +48 -14
- data/lib/mux_ruby/models/list_uploads_response.rb +48 -14
- data/lib/mux_ruby/models/list_video_views_response.rb +50 -16
- data/lib/mux_ruby/models/live_stream.rb +121 -29
- data/lib/mux_ruby/models/live_stream_response.rb +48 -14
- data/lib/mux_ruby/models/metric.rb +52 -18
- data/lib/mux_ruby/models/notification_rule.rb +236 -0
- data/lib/mux_ruby/models/overall_values.rb +51 -17
- data/lib/mux_ruby/models/playback_id.rb +50 -15
- data/lib/mux_ruby/models/playback_policy.rb +12 -6
- data/lib/mux_ruby/models/real_time_breakdown_value.rb +254 -0
- data/lib/mux_ruby/models/real_time_histogram_timeseries_bucket.rb +227 -0
- data/lib/mux_ruby/models/real_time_histogram_timeseries_bucket_values.rb +227 -0
- data/lib/mux_ruby/models/real_time_histogram_timeseries_datapoint.rb +274 -0
- data/lib/mux_ruby/models/real_time_timeseries_datapoint.rb +236 -0
- data/lib/mux_ruby/models/score.rb +53 -19
- data/lib/mux_ruby/models/signal_live_stream_complete_response.rb +48 -14
- data/lib/mux_ruby/models/signing_key.rb +53 -16
- data/lib/mux_ruby/models/signing_key_response.rb +48 -14
- data/lib/mux_ruby/models/simulcast_target.rb +55 -21
- data/lib/mux_ruby/models/simulcast_target_response.rb +48 -14
- data/lib/mux_ruby/models/track.rb +92 -33
- data/lib/mux_ruby/models/update_asset_master_access_request.rb +51 -17
- data/lib/mux_ruby/models/update_asset_mp4_support_request.rb +51 -17
- data/lib/mux_ruby/models/upload.rb +62 -26
- data/lib/mux_ruby/models/upload_error.rb +51 -15
- data/lib/mux_ruby/models/upload_response.rb +48 -14
- data/lib/mux_ruby/models/video_view.rb +242 -136
- data/lib/mux_ruby/models/video_view_event.rb +51 -17
- data/lib/mux_ruby/models/video_view_response.rb +49 -15
- data/lib/mux_ruby/version.rb +10 -3
- data/mux_ruby.gemspec +15 -15
- data/spec/api/assets_api_spec.rb +2 -0
- data/spec/api/dimensions_api_spec.rb +55 -0
- data/spec/api/filters_api_spec.rb +2 -2
- data/spec/api/incidents_api_spec.rb +73 -0
- data/spec/api/live_streams_api_spec.rb +24 -0
- data/spec/api/playback_id_api_spec.rb +40 -0
- data/spec/api/real_time_api_spec.rb +93 -0
- data/spec/api_client_spec.rb +10 -3
- data/spec/configuration_spec.rb +9 -2
- data/spec/models/asset_master_spec.rb +4 -0
- data/spec/models/asset_non_standard_input_reasons_spec.rb +98 -0
- data/spec/models/asset_recording_times_spec.rb +40 -0
- data/spec/models/asset_spec.rb +26 -0
- data/spec/models/dimension_value_spec.rb +40 -0
- data/spec/models/disable_live_stream_response_spec.rb +34 -0
- data/spec/models/enable_live_stream_response_spec.rb +34 -0
- data/spec/models/get_asset_or_live_stream_id_response_data_object_spec.rb +44 -0
- data/spec/models/get_asset_or_live_stream_id_response_data_spec.rb +46 -0
- data/spec/models/get_asset_or_live_stream_id_response_spec.rb +34 -0
- data/spec/models/get_real_time_breakdown_response_spec.rb +46 -0
- data/spec/models/get_real_time_histogram_timeseries_response_meta_spec.rb +34 -0
- data/spec/models/get_real_time_histogram_timeseries_response_spec.rb +52 -0
- data/spec/models/get_real_time_timeseries_response_spec.rb +46 -0
- data/spec/models/incident_breakdown_spec.rb +46 -0
- data/spec/models/incident_notification_rule_spec.rb +58 -0
- data/spec/models/incident_notification_spec.rb +46 -0
- data/spec/models/incident_response_spec.rb +40 -0
- data/spec/models/incident_spec.rb +154 -0
- data/spec/models/input_settings_spec.rb +12 -0
- data/spec/models/list_dimension_values_response_spec.rb +46 -0
- data/spec/models/list_dimensions_response_spec.rb +46 -0
- data/spec/models/list_incidents_response_spec.rb +46 -0
- data/spec/models/list_real_time_dimensions_response_data_spec.rb +40 -0
- data/spec/models/list_real_time_dimensions_response_spec.rb +46 -0
- data/spec/models/list_real_time_metrics_response_spec.rb +46 -0
- data/spec/models/list_related_incidents_response_spec.rb +46 -0
- data/spec/models/notification_rule_spec.rb +46 -0
- data/spec/models/real_time_breakdown_value_spec.rb +58 -0
- data/spec/models/real_time_histogram_timeseries_bucket_spec.rb +40 -0
- data/spec/models/real_time_histogram_timeseries_bucket_values_spec.rb +40 -0
- data/spec/models/real_time_histogram_timeseries_datapoint_spec.rb +70 -0
- data/spec/models/real_time_timeseries_datapoint_spec.rb +46 -0
- data/spec/models/track_spec.rb +4 -0
- data/spec/spec_helper.rb +9 -2
- metadata +246 -209
@@ -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,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
|