emass_client 3.12.0 → 3.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +159 -129
- data/lib/emass_client/api/artifacts_api.rb +40 -48
- data/lib/emass_client/api/artifacts_export_api.rb +5 -5
- data/lib/emass_client/api/cac_api.rb +10 -10
- data/lib/emass_client/api/cloud_resource_results_api.rb +10 -10
- data/lib/emass_client/api/cmmc_assessment_dashboards_api.rb +314 -0
- data/lib/emass_client/api/cmmc_assessments_api.rb +5 -5
- data/lib/emass_client/api/coast_guard_system_fisma_metrics_dashboard_api.rb +95 -0
- data/lib/emass_client/api/container_scan_results_api.rb +10 -10
- data/lib/emass_client/api/controls_api.rb +17 -17
- data/lib/emass_client/api/device_scan_results_api.rb +112 -0
- data/lib/emass_client/api/hardware_baseline_api.rb +313 -0
- data/lib/emass_client/api/milestones_api.rb +15 -15
- data/lib/emass_client/api/organization_migration_status_dashboard_api.rb +95 -0
- data/lib/emass_client/api/pac_api.rb +10 -10
- data/lib/emass_client/api/poam_api.rb +40 -40
- data/lib/emass_client/api/registration_api.rb +5 -5
- data/lib/emass_client/api/software_baseline_api.rb +313 -0
- data/lib/emass_client/api/static_code_scans_api.rb +9 -9
- data/lib/emass_client/api/system_application_findings_dashboards_api.rb +168 -0
- data/lib/emass_client/api/{enterprise_artifacts_dashboards_api.rb → system_artifacts_dashboards_api.rb} +21 -21
- data/lib/emass_client/api/system_associations_dashboard_api.rb +8 -8
- data/lib/emass_client/api/system_atciatc_dashboard_api.rb +95 -0
- data/lib/emass_client/api/system_conmon_integration_status_dashboard_api.rb +8 -8
- data/lib/emass_client/api/system_connectivity_ccsd_dashboards_api.rb +168 -0
- data/lib/emass_client/api/system_critical_assets_dashboard_api.rb +95 -0
- data/lib/emass_client/api/system_device_findings_dashboards_api.rb +168 -0
- data/lib/emass_client/api/system_fisma_metrics_dashboard_api.rb +95 -0
- data/lib/emass_client/api/{hardware_baseline_dashboards_api.rb → system_hardware_dashboards_api.rb} +21 -21
- data/lib/emass_client/api/system_migration_status_dashboard_api.rb +95 -0
- data/lib/emass_client/api/{enterprise_poam_dashboards_api.rb → system_poam_dashboards_api.rb} +21 -21
- data/lib/emass_client/api/{ports_and_protocols_dashboards_api.rb → system_ports_protocols_dashboards_api.rb} +21 -21
- data/lib/emass_client/api/system_privacy_dashboard_api.rb +95 -0
- data/lib/emass_client/api/system_questionnaire_dashboards_api.rb +168 -0
- data/lib/emass_client/api/system_roles_api.rb +8 -8
- data/lib/emass_client/api/{enterprise_security_controls_dashboards_api.rb → system_security_controls_dashboards_api.rb} +31 -31
- data/lib/emass_client/api/{enterprise_sensor_based_hardware_resources_dashboards_api.rb → system_sensor_hardware_dashboards_api.rb} +21 -21
- data/lib/emass_client/api/{enterprise_sensor_based_software_resources_dashboards_api.rb → system_sensor_software_dashboards_api.rb} +29 -29
- data/lib/emass_client/api/{software_baseline_dashboards_api.rb → system_software_dashboards_api.rb} +21 -21
- data/lib/emass_client/api/system_status_dashboard_api.rb +8 -8
- data/lib/emass_client/api/{enterprise_terms_conditions_dashboards_api.rb → system_terms_conditions_dashboards_api.rb} +21 -21
- data/lib/emass_client/api/system_vulnerability_dashboard_api.rb +95 -0
- data/lib/emass_client/api/{enterprise_vulnerability_dashboards_api.rb → system_workflows_dashboards_api.rb} +53 -53
- data/lib/emass_client/api/systems_api.rb +16 -22
- data/lib/emass_client/api/test_api.rb +5 -5
- data/lib/emass_client/api/test_results_api.rb +10 -10
- data/lib/emass_client/api/{users_dashboard_api.rb → user_system_assignments_dashboard_api.rb} +13 -13
- data/lib/emass_client/api/va_system_dashboards_api.rb +679 -0
- data/lib/emass_client/api/vaombfisma_dashboard_api.rb +95 -0
- data/lib/emass_client/api/workflow_definitions_api.rb +9 -9
- data/lib/emass_client/api/workflow_instances_api.rb +14 -14
- data/lib/emass_client/api_client.rb +44 -31
- data/lib/emass_client/api_error.rb +4 -4
- data/lib/emass_client/configuration.rb +42 -12
- data/lib/emass_client/models/{response201.rb → api_rule_failed.rb} +17 -11
- data/lib/emass_client/models/{response490_meta.rb → api_rule_failed_meta.rb} +16 -10
- data/lib/emass_client/models/artifacts_ids.rb +221 -0
- data/lib/emass_client/models/artifacts_optional_fields.rb +298 -0
- data/lib/emass_client/models/artifacts_read_only_fields.rb +255 -0
- data/lib/emass_client/models/artifacts_request_delete_body_inner.rb +14 -8
- data/lib/emass_client/models/artifacts_required_fields.rb +252 -0
- data/lib/emass_client/models/artifacts_response_del.rb +14 -8
- data/lib/emass_client/models/artifacts_response_del_data_inner.rb +14 -8
- data/lib/emass_client/models/artifacts_response_get.rb +15 -9
- data/lib/emass_client/models/{artifacts_get.rb → artifacts_response_get_data_inner.rb} +78 -62
- data/lib/emass_client/models/artifacts_response_put_post.rb +14 -8
- data/lib/emass_client/models/artifacts_response_put_post_data_inner.rb +19 -13
- data/lib/emass_client/models/{response400.rb → bad_request.rb} +17 -11
- data/lib/emass_client/models/{response400_meta.rb → bad_request_meta.rb} +16 -10
- data/lib/emass_client/models/cac_get.rb +14 -8
- data/lib/emass_client/models/cac_response_get.rb +14 -8
- data/lib/emass_client/models/cac_response_post.rb +14 -8
- data/lib/emass_client/models/cac_response_post_data_inner.rb +19 -13
- data/lib/emass_client/models/cloud_resources_delete.rb +14 -8
- data/lib/emass_client/models/cloud_resources_delete_body_inner.rb +14 -8
- data/lib/emass_client/models/cloud_resources_post_delete.rb +19 -13
- data/lib/emass_client/models/cloud_resources_response_post.rb +14 -8
- data/lib/emass_client/models/cmmc_get.rb +84 -123
- data/lib/emass_client/models/cmmc_response_get.rb +14 -8
- data/lib/emass_client/models/connectivity_ccsd.rb +14 -8
- data/lib/emass_client/models/container_resources_delete_body_inner.rb +14 -8
- data/lib/emass_client/models/containers_resources_post_delete.rb +19 -13
- data/lib/emass_client/models/containers_response_delete.rb +14 -8
- data/lib/emass_client/models/containers_response_post.rb +14 -8
- data/lib/emass_client/models/controls_conditional_fields.rb +357 -0
- data/lib/emass_client/models/controls_ids.rb +221 -0
- data/lib/emass_client/models/controls_optional_fields.rb +471 -0
- data/lib/emass_client/models/controls_put.rb +19 -13
- data/lib/emass_client/models/controls_read_only_fields.rb +277 -0
- data/lib/emass_client/models/controls_required_fields.rb +295 -0
- data/lib/emass_client/models/controls_response_get.rb +15 -9
- data/lib/emass_client/models/{controls_get.rb → controls_response_get_data_inner.rb} +155 -138
- data/lib/emass_client/models/controls_response_put.rb +14 -8
- data/lib/emass_client/models/{response403.rb → created.rb} +17 -11
- data/lib/emass_client/models/{response201_meta.rb → created_meta.rb} +16 -10
- data/lib/emass_client/models/definition_transitions.rb +14 -8
- data/lib/emass_client/models/{poam_response_post.rb → device_scan_results_response_post.rb} +17 -11
- data/lib/emass_client/models/{success200_response_data_inner.rb → device_scan_results_response_post_data_inner.rb} +51 -16
- data/lib/emass_client/models/{response401.rb → forbidden.rb} +17 -11
- data/lib/emass_client/models/{response403_meta.rb → forbidden_meta.rb} +16 -10
- data/lib/emass_client/models/get_system_status_details200_response.rb +240 -0
- data/lib/emass_client/models/hw_baseline_conditional_fields.rb +244 -0
- data/lib/emass_client/models/hw_baseline_ids.rb +221 -0
- data/lib/emass_client/models/hw_baseline_optional_fields.rb +354 -0
- data/lib/emass_client/models/hw_baseline_read_only_fields.rb +222 -0
- data/lib/emass_client/models/hw_baseline_request_delete_body_inner.rb +220 -0
- data/lib/emass_client/models/hw_baseline_required_fields.rb +221 -0
- data/lib/emass_client/models/{poam_response_delete.rb → hw_baseline_response_delete.rb} +17 -11
- data/lib/emass_client/models/hw_baseline_response_delete_data_inner.rb +274 -0
- data/lib/emass_client/models/{dashboard_mock_response.rb → hw_baseline_response_get.rb} +18 -12
- data/lib/emass_client/models/hw_baseline_response_get_data_inner.rb +429 -0
- data/lib/emass_client/models/{success200_response.rb → hw_baseline_response_post_put.rb} +17 -11
- data/lib/emass_client/models/hw_baseline_response_post_put_data_inner.rb +274 -0
- data/lib/emass_client/models/{instances_transitions.rb → instance_transitions.rb} +16 -10
- data/lib/emass_client/models/internal_server_error.rb +220 -0
- data/lib/emass_client/models/{response500_meta.rb → internal_server_error_meta.rb} +16 -10
- data/lib/emass_client/models/length_required.rb +220 -0
- data/lib/emass_client/models/{response411_meta.rb → length_required_meta.rb} +16 -10
- data/lib/emass_client/models/method_not_allowed.rb +220 -0
- data/lib/emass_client/models/{response405_meta.rb → method_not_allowed_meta.rb} +16 -10
- data/lib/emass_client/models/milestone_response_delete.rb +14 -8
- data/lib/emass_client/models/milestone_response_get.rb +14 -8
- data/lib/emass_client/models/milestone_response_get_milestone.rb +14 -8
- data/lib/emass_client/models/milestone_response_post.rb +14 -8
- data/lib/emass_client/models/milestone_response_put.rb +14 -8
- data/lib/emass_client/models/milestones_fields.rb +222 -0
- data/lib/emass_client/models/milestones_get.rb +43 -15
- data/lib/emass_client/models/milestones_put_post_delete.rb +19 -13
- data/lib/emass_client/models/milestones_request_delete_body_inner.rb +14 -8
- data/lib/emass_client/models/milestones_required_post.rb +23 -40
- data/lib/emass_client/models/milestones_required_post_milestones_inner.rb +265 -0
- data/lib/emass_client/models/milestones_required_put.rb +23 -57
- data/lib/emass_client/models/{ssps.rb → milestones_required_put_milestones_inner.rb} +89 -35
- data/lib/emass_client/models/{response404.rb → not_found.rb} +16 -10
- data/lib/emass_client/models/pac_get.rb +30 -13
- data/lib/emass_client/models/pac_post.rb +19 -13
- data/lib/emass_client/models/pac_response_get.rb +14 -8
- data/lib/emass_client/models/pac_response_post.rb +14 -8
- data/lib/emass_client/models/{dashboard_mock_response_pagination.rb → pagination.rb} +35 -29
- data/lib/emass_client/models/poam_conditional_fields.rb +402 -0
- data/lib/emass_client/models/poam_ids.rb +241 -0
- data/lib/emass_client/models/poam_optional_fields.rb +409 -0
- data/lib/emass_client/models/poam_post_put_del.rb +19 -13
- data/lib/emass_client/models/poam_read_only_fields.rb +332 -0
- data/lib/emass_client/models/poam_request_delete_body_inner.rb +14 -8
- data/lib/emass_client/models/poam_required_fields.rb +305 -0
- data/lib/emass_client/models/poam_response_get_poams.rb +15 -9
- data/lib/emass_client/models/poam_response_get_poams_data.rb +824 -0
- data/lib/emass_client/models/poam_response_get_systems.rb +15 -9
- data/lib/emass_client/models/{poam_get.rb → poam_response_get_systems_data_inner.rb} +325 -365
- data/lib/emass_client/models/{poam_response_put.rb → poam_response_post_put_delete.rb} +16 -10
- data/lib/emass_client/models/register.rb +14 -8
- data/lib/emass_client/models/register_data.rb +14 -8
- data/lib/emass_client/models/register_user_request_post_body.rb +24 -8
- data/lib/emass_client/models/response200.rb +14 -8
- data/lib/emass_client/models/role_category.rb +14 -8
- data/lib/emass_client/models/roles.rb +14 -8
- data/lib/emass_client/models/stage.rb +14 -8
- data/lib/emass_client/models/static_code_application_post.rb +14 -8
- data/lib/emass_client/models/static_code_post.rb +19 -13
- data/lib/emass_client/models/static_code_request_post_body.rb +14 -8
- data/lib/emass_client/models/static_code_request_post_body_application.rb +14 -8
- data/lib/emass_client/models/static_code_response_post.rb +14 -8
- data/lib/emass_client/models/sw_baseline_conditional_fields.rb +222 -0
- data/lib/emass_client/models/sw_baseline_ids.rb +221 -0
- data/lib/emass_client/models/sw_baseline_optional_fields.rb +563 -0
- data/lib/emass_client/models/sw_baseline_read_only_fields.rb +222 -0
- data/lib/emass_client/models/sw_baseline_request_delete_body_inner.rb +220 -0
- data/lib/emass_client/models/sw_baseline_required_fields.rb +241 -0
- data/lib/emass_client/models/sw_baseline_response_delete.rb +231 -0
- data/lib/emass_client/models/sw_baseline_response_delete_data_inner.rb +274 -0
- data/lib/emass_client/models/sw_baseline_response_get.rb +240 -0
- data/lib/emass_client/models/sw_baseline_response_get_data_inner.rb +624 -0
- data/lib/emass_client/models/sw_baseline_response_post_put.rb +231 -0
- data/lib/emass_client/models/sw_baseline_response_post_put_data_inner.rb +274 -0
- data/lib/emass_client/models/system_response.rb +14 -8
- data/lib/emass_client/models/system_roles_category_response.rb +14 -8
- data/lib/emass_client/models/system_roles_response.rb +14 -8
- data/lib/emass_client/models/system_roles_response_data_inner.rb +14 -8
- data/lib/emass_client/models/systems.rb +708 -86
- data/lib/emass_client/models/systems_response.rb +14 -8
- data/lib/emass_client/models/test.rb +14 -8
- data/lib/emass_client/models/test_data.rb +14 -8
- data/lib/emass_client/models/test_results_get.rb +14 -8
- data/lib/emass_client/models/test_results_post.rb +19 -13
- data/lib/emass_client/models/test_results_response_get.rb +14 -8
- data/lib/emass_client/models/test_results_response_post.rb +14 -8
- data/lib/emass_client/models/unauthorized.rb +220 -0
- data/lib/emass_client/models/{response401_meta.rb → unauthorized_meta.rb} +16 -10
- data/lib/emass_client/models/users.rb +14 -8
- data/lib/emass_client/models/workflow_definition_get.rb +14 -8
- data/lib/emass_client/models/workflow_definition_response_get.rb +14 -8
- data/lib/emass_client/models/workflow_instance_get.rb +28 -11
- data/lib/emass_client/models/workflow_instance_response_get.rb +14 -8
- data/lib/emass_client/models/workflow_instances_response_get.rb +15 -9
- data/lib/emass_client/models/workflow_instances_response_get_pagination.rb +14 -8
- data/lib/emass_client/version.rb +5 -5
- data/lib/emass_client.rb +101 -52
- metadata +105 -56
- data/lib/emass_client/api/fisma_inventory_summary_dashboards_api.rb +0 -168
- data/lib/emass_client/api/privacy_compliance_dashboards_api.rb +0 -168
- data/lib/emass_client/api/system_a20_summary_dashboard_api.rb +0 -95
- data/lib/emass_client/api/system_aa_summary_dashboard_api.rb +0 -95
- data/lib/emass_client/api/system_pl109_reporting_summary_dashboard_api.rb +0 -95
- data/lib/emass_client/api/threat_risks_dashboards_api.rb +0 -241
- data/lib/emass_client/models/mock_object.rb +0 -338
- data/lib/emass_client/models/response405.rb +0 -214
- data/lib/emass_client/models/response411.rb +0 -214
- data/lib/emass_client/models/response490.rb +0 -214
- data/lib/emass_client/models/response500.rb +0 -214
- data/lib/emass_client/models/workflow_instances_get.rb +0 -337
@@ -0,0 +1,221 @@
|
|
1
|
+
=begin
|
2
|
+
#Enterprise Mission Assurance Support Service (eMASS)
|
3
|
+
|
4
|
+
#The eMASS Representational State Transfer (REST) Application Programming Interface (API) enables users to perform assessments and complete actions associated with system records. The eMASS API provides an interface for application to communicate eMASS Services. For information on how to register and use the eMASS API reference the [eMASS API Getting Started](eMASSGettingStarted.md). Additional information about eMASS can be obtain by contacting the National Industrial Security Program (NISP). Points of Contact are:
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3.22
|
7
|
+
Contact: disa.global.servicedesk.mbx.ma-ticket-request@mail.mil
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.12.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module EmassClient
|
17
|
+
class ControlsIds
|
18
|
+
# [Required] Unique eMASS system identifier.
|
19
|
+
attr_accessor :system_id
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'system_id' => :'systemId'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Returns attribute mapping this model knows about
|
29
|
+
def self.acceptable_attribute_map
|
30
|
+
attribute_map
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns all the JSON keys this model knows about
|
34
|
+
def self.acceptable_attributes
|
35
|
+
acceptable_attribute_map.values
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
:'system_id' => :'Integer'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# List of attributes with nullable: true
|
46
|
+
def self.openapi_nullable
|
47
|
+
Set.new([
|
48
|
+
])
|
49
|
+
end
|
50
|
+
|
51
|
+
# Initializes the object
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
53
|
+
def initialize(attributes = {})
|
54
|
+
if (!attributes.is_a?(Hash))
|
55
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `EmassClient::ControlsIds` initialize method"
|
56
|
+
end
|
57
|
+
|
58
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
59
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
60
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
61
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
62
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `EmassClient::ControlsIds`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
63
|
+
end
|
64
|
+
h[k.to_sym] = v
|
65
|
+
}
|
66
|
+
|
67
|
+
if attributes.key?(:'system_id')
|
68
|
+
self.system_id = attributes[:'system_id']
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
73
|
+
# @return Array for valid properties with the reasons
|
74
|
+
def list_invalid_properties
|
75
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
76
|
+
invalid_properties = Array.new
|
77
|
+
invalid_properties
|
78
|
+
end
|
79
|
+
|
80
|
+
# Check to see if the all the properties in the model are valid
|
81
|
+
# @return true if the model is valid
|
82
|
+
def valid?
|
83
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
84
|
+
true
|
85
|
+
end
|
86
|
+
|
87
|
+
# Checks equality by comparing each attribute.
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def ==(o)
|
90
|
+
return true if self.equal?(o)
|
91
|
+
self.class == o.class &&
|
92
|
+
system_id == o.system_id
|
93
|
+
end
|
94
|
+
|
95
|
+
# @see the `==` method
|
96
|
+
# @param [Object] Object to be compared
|
97
|
+
def eql?(o)
|
98
|
+
self == o
|
99
|
+
end
|
100
|
+
|
101
|
+
# Calculates hash code according to all attributes.
|
102
|
+
# @return [Integer] Hash code
|
103
|
+
def hash
|
104
|
+
[system_id].hash
|
105
|
+
end
|
106
|
+
|
107
|
+
# Builds the object from hash
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
+
# @return [Object] Returns the model itself
|
110
|
+
def self.build_from_hash(attributes)
|
111
|
+
return nil unless attributes.is_a?(Hash)
|
112
|
+
attributes = attributes.transform_keys(&:to_sym)
|
113
|
+
transformed_hash = {}
|
114
|
+
openapi_types.each_pair do |key, type|
|
115
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
116
|
+
transformed_hash["#{key}"] = nil
|
117
|
+
elsif type =~ /\AArray<(.*)>/i
|
118
|
+
# check to ensure the input is an array given that the attribute
|
119
|
+
# is documented as an array but the input is not
|
120
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
121
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
122
|
+
end
|
123
|
+
elsif !attributes[attribute_map[key]].nil?
|
124
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
125
|
+
end
|
126
|
+
end
|
127
|
+
new(transformed_hash)
|
128
|
+
end
|
129
|
+
|
130
|
+
# Deserializes the data based on type
|
131
|
+
# @param string type Data type
|
132
|
+
# @param string value Value to be deserialized
|
133
|
+
# @return [Object] Deserialized data
|
134
|
+
def self._deserialize(type, value)
|
135
|
+
case type.to_sym
|
136
|
+
when :Time
|
137
|
+
Time.parse(value)
|
138
|
+
when :Date
|
139
|
+
Date.parse(value)
|
140
|
+
when :String
|
141
|
+
value.to_s
|
142
|
+
when :Integer
|
143
|
+
value.to_i
|
144
|
+
when :Float
|
145
|
+
value.to_f
|
146
|
+
when :Boolean
|
147
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
148
|
+
true
|
149
|
+
else
|
150
|
+
false
|
151
|
+
end
|
152
|
+
when :Object
|
153
|
+
# generic object (usually a Hash), return directly
|
154
|
+
value
|
155
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
156
|
+
inner_type = Regexp.last_match[:inner_type]
|
157
|
+
value.map { |v| _deserialize(inner_type, v) }
|
158
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
159
|
+
k_type = Regexp.last_match[:k_type]
|
160
|
+
v_type = Regexp.last_match[:v_type]
|
161
|
+
{}.tap do |hash|
|
162
|
+
value.each do |k, v|
|
163
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
else # model
|
167
|
+
# models (e.g. Pet) or oneOf
|
168
|
+
klass = EmassClient.const_get(type)
|
169
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
# Returns the string representation of the object
|
174
|
+
# @return [String] String presentation of the object
|
175
|
+
def to_s
|
176
|
+
to_hash.to_s
|
177
|
+
end
|
178
|
+
|
179
|
+
# to_body is an alias to to_hash (backward compatibility)
|
180
|
+
# @return [Hash] Returns the object in the form of hash
|
181
|
+
def to_body
|
182
|
+
to_hash
|
183
|
+
end
|
184
|
+
|
185
|
+
# Returns the object in the form of hash
|
186
|
+
# @return [Hash] Returns the object in the form of hash
|
187
|
+
def to_hash
|
188
|
+
hash = {}
|
189
|
+
self.class.attribute_map.each_pair do |attr, param|
|
190
|
+
value = self.send(attr)
|
191
|
+
if value.nil?
|
192
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
193
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
194
|
+
end
|
195
|
+
|
196
|
+
hash[param] = _to_hash(value)
|
197
|
+
end
|
198
|
+
hash
|
199
|
+
end
|
200
|
+
|
201
|
+
# Outputs non-array value in the form of hash
|
202
|
+
# For object, use to_hash. Otherwise, just return the value
|
203
|
+
# @param [Object] value Any valid value
|
204
|
+
# @return [Hash] Returns the value in the form of hash
|
205
|
+
def _to_hash(value)
|
206
|
+
if value.is_a?(Array)
|
207
|
+
value.compact.map { |v| _to_hash(v) }
|
208
|
+
elsif value.is_a?(Hash)
|
209
|
+
{}.tap do |hash|
|
210
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
211
|
+
end
|
212
|
+
elsif value.respond_to? :to_hash
|
213
|
+
value.to_hash
|
214
|
+
else
|
215
|
+
value
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
@@ -0,0 +1,471 @@
|
|
1
|
+
=begin
|
2
|
+
#Enterprise Mission Assurance Support Service (eMASS)
|
3
|
+
|
4
|
+
#The eMASS Representational State Transfer (REST) Application Programming Interface (API) enables users to perform assessments and complete actions associated with system records. The eMASS API provides an interface for application to communicate eMASS Services. For information on how to register and use the eMASS API reference the [eMASS API Getting Started](eMASSGettingStarted.md). Additional information about eMASS can be obtain by contacting the National Industrial Security Program (NISP). Points of Contact are:
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v3.22
|
7
|
+
Contact: disa.global.servicedesk.mbx.ma-ticket-request@mail.mil
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.12.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module EmassClient
|
17
|
+
class ControlsOptionalFields
|
18
|
+
# [Optional] Implementation Status of the Security Control for the information system.
|
19
|
+
attr_accessor :implementation_status
|
20
|
+
|
21
|
+
# [Optional] Values include the following options (Very Low, Low, Moderate,High,Very High)
|
22
|
+
attr_accessor :severity
|
23
|
+
|
24
|
+
# [Optional] Include vulnerability summary. Character Limit = 2,000.
|
25
|
+
attr_accessor :vulnerabilty_summary
|
26
|
+
|
27
|
+
# [Optional] Include recommendations. Character Limit = 2,000.
|
28
|
+
attr_accessor :recommendations
|
29
|
+
|
30
|
+
# [Optional] Values include the following options (Very Low, Low, Moderate,High,Very High)
|
31
|
+
attr_accessor :relevance_of_threat
|
32
|
+
|
33
|
+
# [Optional] Values include the following options (Very Low, Low, Moderate,High,Very High)
|
34
|
+
attr_accessor :likelihood
|
35
|
+
|
36
|
+
# [Optional] Values include the following options (Very Low, Low, Moderate,High,Very High)
|
37
|
+
attr_accessor :impact
|
38
|
+
|
39
|
+
# [Optional] Include description of Security Control's impact.
|
40
|
+
attr_accessor :impact_description
|
41
|
+
|
42
|
+
# [Optional] Values include the following options (Very Low, Low, Moderate,High,Very High)
|
43
|
+
attr_accessor :residual_risk_level
|
44
|
+
|
45
|
+
# [Optional] Identifies the assessment method / combination that will determine if the security requirements are implemented correctly.
|
46
|
+
attr_accessor :test_method
|
47
|
+
|
48
|
+
# [Optional] Identify any mitigations in place for the Non-Compliant Security Control's vulnerabilities. Character Limit = 2,000.
|
49
|
+
attr_accessor :mitigations
|
50
|
+
|
51
|
+
# [Optional] If the Financial Management (Navy) overlay is applied to the system, this field appears and can be populated. Character Limit = 2,000. Navy only.
|
52
|
+
attr_accessor :application_layer
|
53
|
+
|
54
|
+
# [Optional] If the Financial Management (Navy) overlay is applied to the system, this field appears and can be populated. Navy only.
|
55
|
+
attr_accessor :database_layer
|
56
|
+
|
57
|
+
# [Optional] If the Financial Management (Navy) overlay is applied to the system, this field appears and can be populated. Navy only.
|
58
|
+
attr_accessor :operating_system_layer
|
59
|
+
|
60
|
+
class EnumAttributeValidator
|
61
|
+
attr_reader :datatype
|
62
|
+
attr_reader :allowable_values
|
63
|
+
|
64
|
+
def initialize(datatype, allowable_values)
|
65
|
+
@allowable_values = allowable_values.map do |value|
|
66
|
+
case datatype.to_s
|
67
|
+
when /Integer/i
|
68
|
+
value.to_i
|
69
|
+
when /Float/i
|
70
|
+
value.to_f
|
71
|
+
else
|
72
|
+
value
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def valid?(value)
|
78
|
+
!value || allowable_values.include?(value)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
83
|
+
def self.attribute_map
|
84
|
+
{
|
85
|
+
:'implementation_status' => :'implementationStatus',
|
86
|
+
:'severity' => :'severity',
|
87
|
+
:'vulnerabilty_summary' => :'vulnerabiltySummary',
|
88
|
+
:'recommendations' => :'recommendations',
|
89
|
+
:'relevance_of_threat' => :'relevanceOfThreat',
|
90
|
+
:'likelihood' => :'likelihood',
|
91
|
+
:'impact' => :'impact',
|
92
|
+
:'impact_description' => :'impactDescription',
|
93
|
+
:'residual_risk_level' => :'residualRiskLevel',
|
94
|
+
:'test_method' => :'testMethod',
|
95
|
+
:'mitigations' => :'mitigations',
|
96
|
+
:'application_layer' => :'applicationLayer',
|
97
|
+
:'database_layer' => :'databaseLayer',
|
98
|
+
:'operating_system_layer' => :'operatingSystemLayer'
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
102
|
+
# Returns attribute mapping this model knows about
|
103
|
+
def self.acceptable_attribute_map
|
104
|
+
attribute_map
|
105
|
+
end
|
106
|
+
|
107
|
+
# Returns all the JSON keys this model knows about
|
108
|
+
def self.acceptable_attributes
|
109
|
+
acceptable_attribute_map.values
|
110
|
+
end
|
111
|
+
|
112
|
+
# Attribute type mapping.
|
113
|
+
def self.openapi_types
|
114
|
+
{
|
115
|
+
:'implementation_status' => :'String',
|
116
|
+
:'severity' => :'String',
|
117
|
+
:'vulnerabilty_summary' => :'String',
|
118
|
+
:'recommendations' => :'String',
|
119
|
+
:'relevance_of_threat' => :'String',
|
120
|
+
:'likelihood' => :'String',
|
121
|
+
:'impact' => :'String',
|
122
|
+
:'impact_description' => :'String',
|
123
|
+
:'residual_risk_level' => :'String',
|
124
|
+
:'test_method' => :'String',
|
125
|
+
:'mitigations' => :'String',
|
126
|
+
:'application_layer' => :'String',
|
127
|
+
:'database_layer' => :'String',
|
128
|
+
:'operating_system_layer' => :'String'
|
129
|
+
}
|
130
|
+
end
|
131
|
+
|
132
|
+
# List of attributes with nullable: true
|
133
|
+
def self.openapi_nullable
|
134
|
+
Set.new([
|
135
|
+
:'implementation_status',
|
136
|
+
:'severity',
|
137
|
+
:'vulnerabilty_summary',
|
138
|
+
:'recommendations',
|
139
|
+
:'relevance_of_threat',
|
140
|
+
:'likelihood',
|
141
|
+
:'impact',
|
142
|
+
:'impact_description',
|
143
|
+
:'residual_risk_level',
|
144
|
+
:'test_method',
|
145
|
+
:'mitigations',
|
146
|
+
:'application_layer',
|
147
|
+
:'database_layer',
|
148
|
+
:'operating_system_layer'
|
149
|
+
])
|
150
|
+
end
|
151
|
+
|
152
|
+
# Initializes the object
|
153
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
154
|
+
def initialize(attributes = {})
|
155
|
+
if (!attributes.is_a?(Hash))
|
156
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `EmassClient::ControlsOptionalFields` initialize method"
|
157
|
+
end
|
158
|
+
|
159
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
160
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
161
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
162
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
163
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `EmassClient::ControlsOptionalFields`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
164
|
+
end
|
165
|
+
h[k.to_sym] = v
|
166
|
+
}
|
167
|
+
|
168
|
+
if attributes.key?(:'implementation_status')
|
169
|
+
self.implementation_status = attributes[:'implementation_status']
|
170
|
+
end
|
171
|
+
|
172
|
+
if attributes.key?(:'severity')
|
173
|
+
self.severity = attributes[:'severity']
|
174
|
+
end
|
175
|
+
|
176
|
+
if attributes.key?(:'vulnerabilty_summary')
|
177
|
+
self.vulnerabilty_summary = attributes[:'vulnerabilty_summary']
|
178
|
+
end
|
179
|
+
|
180
|
+
if attributes.key?(:'recommendations')
|
181
|
+
self.recommendations = attributes[:'recommendations']
|
182
|
+
end
|
183
|
+
|
184
|
+
if attributes.key?(:'relevance_of_threat')
|
185
|
+
self.relevance_of_threat = attributes[:'relevance_of_threat']
|
186
|
+
end
|
187
|
+
|
188
|
+
if attributes.key?(:'likelihood')
|
189
|
+
self.likelihood = attributes[:'likelihood']
|
190
|
+
end
|
191
|
+
|
192
|
+
if attributes.key?(:'impact')
|
193
|
+
self.impact = attributes[:'impact']
|
194
|
+
end
|
195
|
+
|
196
|
+
if attributes.key?(:'impact_description')
|
197
|
+
self.impact_description = attributes[:'impact_description']
|
198
|
+
end
|
199
|
+
|
200
|
+
if attributes.key?(:'residual_risk_level')
|
201
|
+
self.residual_risk_level = attributes[:'residual_risk_level']
|
202
|
+
end
|
203
|
+
|
204
|
+
if attributes.key?(:'test_method')
|
205
|
+
self.test_method = attributes[:'test_method']
|
206
|
+
end
|
207
|
+
|
208
|
+
if attributes.key?(:'mitigations')
|
209
|
+
self.mitigations = attributes[:'mitigations']
|
210
|
+
end
|
211
|
+
|
212
|
+
if attributes.key?(:'application_layer')
|
213
|
+
self.application_layer = attributes[:'application_layer']
|
214
|
+
end
|
215
|
+
|
216
|
+
if attributes.key?(:'database_layer')
|
217
|
+
self.database_layer = attributes[:'database_layer']
|
218
|
+
end
|
219
|
+
|
220
|
+
if attributes.key?(:'operating_system_layer')
|
221
|
+
self.operating_system_layer = attributes[:'operating_system_layer']
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
226
|
+
# @return Array for valid properties with the reasons
|
227
|
+
def list_invalid_properties
|
228
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
229
|
+
invalid_properties = Array.new
|
230
|
+
invalid_properties
|
231
|
+
end
|
232
|
+
|
233
|
+
# Check to see if the all the properties in the model are valid
|
234
|
+
# @return true if the model is valid
|
235
|
+
def valid?
|
236
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
237
|
+
implementation_status_validator = EnumAttributeValidator.new('String', ["Planned", "Implemented", "Inherited", "Not Applicable", "Manually Inherited", "unknown_default_open_api"])
|
238
|
+
return false unless implementation_status_validator.valid?(@implementation_status)
|
239
|
+
severity_validator = EnumAttributeValidator.new('String', ["Very Low", "Low", "Moderate", "High", "Very High", "unknown_default_open_api"])
|
240
|
+
return false unless severity_validator.valid?(@severity)
|
241
|
+
relevance_of_threat_validator = EnumAttributeValidator.new('String', ["Very Low", "Low", "Moderate", "High", "Very High", "unknown_default_open_api"])
|
242
|
+
return false unless relevance_of_threat_validator.valid?(@relevance_of_threat)
|
243
|
+
likelihood_validator = EnumAttributeValidator.new('String', ["Very Low", "Low", "Moderate", "High", "Very High", "unknown_default_open_api"])
|
244
|
+
return false unless likelihood_validator.valid?(@likelihood)
|
245
|
+
impact_validator = EnumAttributeValidator.new('String', ["Very Low", "Low", "Moderate", "High", "Very High", "unknown_default_open_api"])
|
246
|
+
return false unless impact_validator.valid?(@impact)
|
247
|
+
residual_risk_level_validator = EnumAttributeValidator.new('String', ["Very Low", "Low", "Moderate", "High", "Very High", "unknown_default_open_api"])
|
248
|
+
return false unless residual_risk_level_validator.valid?(@residual_risk_level)
|
249
|
+
test_method_validator = EnumAttributeValidator.new('String', ["Test", "Interview", "Examine", "Test, Interview", "Test, Examine", "Interview, Examine", "Test, Interview, Examine", "unknown_default_open_api"])
|
250
|
+
return false unless test_method_validator.valid?(@test_method)
|
251
|
+
true
|
252
|
+
end
|
253
|
+
|
254
|
+
# Custom attribute writer method checking allowed values (enum).
|
255
|
+
# @param [Object] implementation_status Object to be assigned
|
256
|
+
def implementation_status=(implementation_status)
|
257
|
+
validator = EnumAttributeValidator.new('String', ["Planned", "Implemented", "Inherited", "Not Applicable", "Manually Inherited", "unknown_default_open_api"])
|
258
|
+
unless validator.valid?(implementation_status)
|
259
|
+
fail ArgumentError, "invalid value for \"implementation_status\", must be one of #{validator.allowable_values}."
|
260
|
+
end
|
261
|
+
@implementation_status = implementation_status
|
262
|
+
end
|
263
|
+
|
264
|
+
# Custom attribute writer method checking allowed values (enum).
|
265
|
+
# @param [Object] severity Object to be assigned
|
266
|
+
def severity=(severity)
|
267
|
+
validator = EnumAttributeValidator.new('String', ["Very Low", "Low", "Moderate", "High", "Very High", "unknown_default_open_api"])
|
268
|
+
unless validator.valid?(severity)
|
269
|
+
fail ArgumentError, "invalid value for \"severity\", must be one of #{validator.allowable_values}."
|
270
|
+
end
|
271
|
+
@severity = severity
|
272
|
+
end
|
273
|
+
|
274
|
+
# Custom attribute writer method checking allowed values (enum).
|
275
|
+
# @param [Object] relevance_of_threat Object to be assigned
|
276
|
+
def relevance_of_threat=(relevance_of_threat)
|
277
|
+
validator = EnumAttributeValidator.new('String', ["Very Low", "Low", "Moderate", "High", "Very High", "unknown_default_open_api"])
|
278
|
+
unless validator.valid?(relevance_of_threat)
|
279
|
+
fail ArgumentError, "invalid value for \"relevance_of_threat\", must be one of #{validator.allowable_values}."
|
280
|
+
end
|
281
|
+
@relevance_of_threat = relevance_of_threat
|
282
|
+
end
|
283
|
+
|
284
|
+
# Custom attribute writer method checking allowed values (enum).
|
285
|
+
# @param [Object] likelihood Object to be assigned
|
286
|
+
def likelihood=(likelihood)
|
287
|
+
validator = EnumAttributeValidator.new('String', ["Very Low", "Low", "Moderate", "High", "Very High", "unknown_default_open_api"])
|
288
|
+
unless validator.valid?(likelihood)
|
289
|
+
fail ArgumentError, "invalid value for \"likelihood\", must be one of #{validator.allowable_values}."
|
290
|
+
end
|
291
|
+
@likelihood = likelihood
|
292
|
+
end
|
293
|
+
|
294
|
+
# Custom attribute writer method checking allowed values (enum).
|
295
|
+
# @param [Object] impact Object to be assigned
|
296
|
+
def impact=(impact)
|
297
|
+
validator = EnumAttributeValidator.new('String', ["Very Low", "Low", "Moderate", "High", "Very High", "unknown_default_open_api"])
|
298
|
+
unless validator.valid?(impact)
|
299
|
+
fail ArgumentError, "invalid value for \"impact\", must be one of #{validator.allowable_values}."
|
300
|
+
end
|
301
|
+
@impact = impact
|
302
|
+
end
|
303
|
+
|
304
|
+
# Custom attribute writer method checking allowed values (enum).
|
305
|
+
# @param [Object] residual_risk_level Object to be assigned
|
306
|
+
def residual_risk_level=(residual_risk_level)
|
307
|
+
validator = EnumAttributeValidator.new('String', ["Very Low", "Low", "Moderate", "High", "Very High", "unknown_default_open_api"])
|
308
|
+
unless validator.valid?(residual_risk_level)
|
309
|
+
fail ArgumentError, "invalid value for \"residual_risk_level\", must be one of #{validator.allowable_values}."
|
310
|
+
end
|
311
|
+
@residual_risk_level = residual_risk_level
|
312
|
+
end
|
313
|
+
|
314
|
+
# Custom attribute writer method checking allowed values (enum).
|
315
|
+
# @param [Object] test_method Object to be assigned
|
316
|
+
def test_method=(test_method)
|
317
|
+
validator = EnumAttributeValidator.new('String', ["Test", "Interview", "Examine", "Test, Interview", "Test, Examine", "Interview, Examine", "Test, Interview, Examine", "unknown_default_open_api"])
|
318
|
+
unless validator.valid?(test_method)
|
319
|
+
fail ArgumentError, "invalid value for \"test_method\", must be one of #{validator.allowable_values}."
|
320
|
+
end
|
321
|
+
@test_method = test_method
|
322
|
+
end
|
323
|
+
|
324
|
+
# Checks equality by comparing each attribute.
|
325
|
+
# @param [Object] Object to be compared
|
326
|
+
def ==(o)
|
327
|
+
return true if self.equal?(o)
|
328
|
+
self.class == o.class &&
|
329
|
+
implementation_status == o.implementation_status &&
|
330
|
+
severity == o.severity &&
|
331
|
+
vulnerabilty_summary == o.vulnerabilty_summary &&
|
332
|
+
recommendations == o.recommendations &&
|
333
|
+
relevance_of_threat == o.relevance_of_threat &&
|
334
|
+
likelihood == o.likelihood &&
|
335
|
+
impact == o.impact &&
|
336
|
+
impact_description == o.impact_description &&
|
337
|
+
residual_risk_level == o.residual_risk_level &&
|
338
|
+
test_method == o.test_method &&
|
339
|
+
mitigations == o.mitigations &&
|
340
|
+
application_layer == o.application_layer &&
|
341
|
+
database_layer == o.database_layer &&
|
342
|
+
operating_system_layer == o.operating_system_layer
|
343
|
+
end
|
344
|
+
|
345
|
+
# @see the `==` method
|
346
|
+
# @param [Object] Object to be compared
|
347
|
+
def eql?(o)
|
348
|
+
self == o
|
349
|
+
end
|
350
|
+
|
351
|
+
# Calculates hash code according to all attributes.
|
352
|
+
# @return [Integer] Hash code
|
353
|
+
def hash
|
354
|
+
[implementation_status, severity, vulnerabilty_summary, recommendations, relevance_of_threat, likelihood, impact, impact_description, residual_risk_level, test_method, mitigations, application_layer, database_layer, operating_system_layer].hash
|
355
|
+
end
|
356
|
+
|
357
|
+
# Builds the object from hash
|
358
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
359
|
+
# @return [Object] Returns the model itself
|
360
|
+
def self.build_from_hash(attributes)
|
361
|
+
return nil unless attributes.is_a?(Hash)
|
362
|
+
attributes = attributes.transform_keys(&:to_sym)
|
363
|
+
transformed_hash = {}
|
364
|
+
openapi_types.each_pair do |key, type|
|
365
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
366
|
+
transformed_hash["#{key}"] = nil
|
367
|
+
elsif type =~ /\AArray<(.*)>/i
|
368
|
+
# check to ensure the input is an array given that the attribute
|
369
|
+
# is documented as an array but the input is not
|
370
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
371
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
372
|
+
end
|
373
|
+
elsif !attributes[attribute_map[key]].nil?
|
374
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
375
|
+
end
|
376
|
+
end
|
377
|
+
new(transformed_hash)
|
378
|
+
end
|
379
|
+
|
380
|
+
# Deserializes the data based on type
|
381
|
+
# @param string type Data type
|
382
|
+
# @param string value Value to be deserialized
|
383
|
+
# @return [Object] Deserialized data
|
384
|
+
def self._deserialize(type, value)
|
385
|
+
case type.to_sym
|
386
|
+
when :Time
|
387
|
+
Time.parse(value)
|
388
|
+
when :Date
|
389
|
+
Date.parse(value)
|
390
|
+
when :String
|
391
|
+
value.to_s
|
392
|
+
when :Integer
|
393
|
+
value.to_i
|
394
|
+
when :Float
|
395
|
+
value.to_f
|
396
|
+
when :Boolean
|
397
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
398
|
+
true
|
399
|
+
else
|
400
|
+
false
|
401
|
+
end
|
402
|
+
when :Object
|
403
|
+
# generic object (usually a Hash), return directly
|
404
|
+
value
|
405
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
406
|
+
inner_type = Regexp.last_match[:inner_type]
|
407
|
+
value.map { |v| _deserialize(inner_type, v) }
|
408
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
409
|
+
k_type = Regexp.last_match[:k_type]
|
410
|
+
v_type = Regexp.last_match[:v_type]
|
411
|
+
{}.tap do |hash|
|
412
|
+
value.each do |k, v|
|
413
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
414
|
+
end
|
415
|
+
end
|
416
|
+
else # model
|
417
|
+
# models (e.g. Pet) or oneOf
|
418
|
+
klass = EmassClient.const_get(type)
|
419
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
# Returns the string representation of the object
|
424
|
+
# @return [String] String presentation of the object
|
425
|
+
def to_s
|
426
|
+
to_hash.to_s
|
427
|
+
end
|
428
|
+
|
429
|
+
# to_body is an alias to to_hash (backward compatibility)
|
430
|
+
# @return [Hash] Returns the object in the form of hash
|
431
|
+
def to_body
|
432
|
+
to_hash
|
433
|
+
end
|
434
|
+
|
435
|
+
# Returns the object in the form of hash
|
436
|
+
# @return [Hash] Returns the object in the form of hash
|
437
|
+
def to_hash
|
438
|
+
hash = {}
|
439
|
+
self.class.attribute_map.each_pair do |attr, param|
|
440
|
+
value = self.send(attr)
|
441
|
+
if value.nil?
|
442
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
443
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
444
|
+
end
|
445
|
+
|
446
|
+
hash[param] = _to_hash(value)
|
447
|
+
end
|
448
|
+
hash
|
449
|
+
end
|
450
|
+
|
451
|
+
# Outputs non-array value in the form of hash
|
452
|
+
# For object, use to_hash. Otherwise, just return the value
|
453
|
+
# @param [Object] value Any valid value
|
454
|
+
# @return [Hash] Returns the value in the form of hash
|
455
|
+
def _to_hash(value)
|
456
|
+
if value.is_a?(Array)
|
457
|
+
value.compact.map { |v| _to_hash(v) }
|
458
|
+
elsif value.is_a?(Hash)
|
459
|
+
{}.tap do |hash|
|
460
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
461
|
+
end
|
462
|
+
elsif value.respond_to? :to_hash
|
463
|
+
value.to_hash
|
464
|
+
else
|
465
|
+
value
|
466
|
+
end
|
467
|
+
end
|
468
|
+
|
469
|
+
end
|
470
|
+
|
471
|
+
end
|