azure_mgmt_cdn 0.2.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 +7 -0
- data/.rspec +3 -0
- data/LICENSE.txt +21 -0
- data/Rakefile +5 -0
- data/azure_mgmt_cdn.gemspec +34 -0
- data/lib/azure_mgmt_cdn.rb +77 -0
- data/lib/azure_mgmt_cdn/cdn_management_client.rb +87 -0
- data/lib/azure_mgmt_cdn/custom_domains.rb +482 -0
- data/lib/azure_mgmt_cdn/endpoints.rb +940 -0
- data/lib/azure_mgmt_cdn/models/check_name_availability_input.rb +66 -0
- data/lib/azure_mgmt_cdn/models/check_name_availability_output.rb +75 -0
- data/lib/azure_mgmt_cdn/models/custom_domain.rb +82 -0
- data/lib/azure_mgmt_cdn/models/custom_domain_list_result.rb +77 -0
- data/lib/azure_mgmt_cdn/models/custom_domain_parameters.rb +62 -0
- data/lib/azure_mgmt_cdn/models/custom_domain_properties.rb +84 -0
- data/lib/azure_mgmt_cdn/models/custom_domain_properties_parameters.rb +56 -0
- data/lib/azure_mgmt_cdn/models/custom_domain_resource_state.rb +17 -0
- data/lib/azure_mgmt_cdn/models/deep_created_origin.rb +72 -0
- data/lib/azure_mgmt_cdn/models/deep_created_origin_properties.rb +78 -0
- data/lib/azure_mgmt_cdn/models/endpoint.rb +95 -0
- data/lib/azure_mgmt_cdn/models/endpoint_create_parameters.rb +82 -0
- data/lib/azure_mgmt_cdn/models/endpoint_list_result.rb +76 -0
- data/lib/azure_mgmt_cdn/models/endpoint_properties.rb +197 -0
- data/lib/azure_mgmt_cdn/models/endpoint_properties_create_parameters.rb +160 -0
- data/lib/azure_mgmt_cdn/models/endpoint_properties_update_parameters.rb +127 -0
- data/lib/azure_mgmt_cdn/models/endpoint_resource_state.rb +20 -0
- data/lib/azure_mgmt_cdn/models/endpoint_update_parameters.rb +72 -0
- data/lib/azure_mgmt_cdn/models/error_response.rb +65 -0
- data/lib/azure_mgmt_cdn/models/load_parameters.rb +58 -0
- data/lib/azure_mgmt_cdn/models/operation.rb +71 -0
- data/lib/azure_mgmt_cdn/models/operation_display.rb +75 -0
- data/lib/azure_mgmt_cdn/models/operation_list_result.rb +77 -0
- data/lib/azure_mgmt_cdn/models/origin.rb +83 -0
- data/lib/azure_mgmt_cdn/models/origin_list_result.rb +76 -0
- data/lib/azure_mgmt_cdn/models/origin_parameters.rb +62 -0
- data/lib/azure_mgmt_cdn/models/origin_properties.rb +106 -0
- data/lib/azure_mgmt_cdn/models/origin_properties_parameters.rb +78 -0
- data/lib/azure_mgmt_cdn/models/origin_resource_state.rb +17 -0
- data/lib/azure_mgmt_cdn/models/profile.rb +95 -0
- data/lib/azure_mgmt_cdn/models/profile_create_parameters.rb +82 -0
- data/lib/azure_mgmt_cdn/models/profile_list_result.rb +76 -0
- data/lib/azure_mgmt_cdn/models/profile_properties.rb +90 -0
- data/lib/azure_mgmt_cdn/models/profile_properties_create_parameters.rb +63 -0
- data/lib/azure_mgmt_cdn/models/profile_resource_state.rb +18 -0
- data/lib/azure_mgmt_cdn/models/profile_update_parameters.rb +57 -0
- data/lib/azure_mgmt_cdn/models/provisioning_state.rb +17 -0
- data/lib/azure_mgmt_cdn/models/purge_parameters.rb +58 -0
- data/lib/azure_mgmt_cdn/models/query_string_caching_behavior.rb +18 -0
- data/lib/azure_mgmt_cdn/models/sku.rb +60 -0
- data/lib/azure_mgmt_cdn/models/sku_name.rb +16 -0
- data/lib/azure_mgmt_cdn/models/sso_uri.rb +56 -0
- data/lib/azure_mgmt_cdn/models/tracked_resource.rb +85 -0
- data/lib/azure_mgmt_cdn/models/validate_custom_domain_input.rb +56 -0
- data/lib/azure_mgmt_cdn/models/validate_custom_domain_output.rb +75 -0
- data/lib/azure_mgmt_cdn/module_definition.rb +8 -0
- data/lib/azure_mgmt_cdn/name_availability.rb +101 -0
- data/lib/azure_mgmt_cdn/operations.rb +87 -0
- data/lib/azure_mgmt_cdn/origins.rb +533 -0
- data/lib/azure_mgmt_cdn/profiles.rb +607 -0
- data/lib/azure_mgmt_cdn/version.rb +8 -0
- metadata +172 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::CDN
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Defines values for EndpointResourceState
|
10
|
+
#
|
11
|
+
module EndpointResourceState
|
12
|
+
Creating = "Creating"
|
13
|
+
Deleting = "Deleting"
|
14
|
+
Running = "Running"
|
15
|
+
Starting = "Starting"
|
16
|
+
Stopped = "Stopped"
|
17
|
+
Stopping = "Stopping"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::CDN
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Endpoint properties required for new endpoint creation
|
10
|
+
#
|
11
|
+
class EndpointUpdateParameters
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [Hash{String => String}] Endpoint tags
|
16
|
+
attr_accessor :tags
|
17
|
+
|
18
|
+
# @return [EndpointPropertiesUpdateParameters]
|
19
|
+
attr_accessor :properties
|
20
|
+
|
21
|
+
#
|
22
|
+
# Validate the object. Throws ValidationError if validation fails.
|
23
|
+
#
|
24
|
+
def validate
|
25
|
+
@tags.each{ |e| e.validate if e.respond_to?(:validate) } unless @tags.nil?
|
26
|
+
@properties.validate unless @properties.nil?
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
# Serializes given Model object into Ruby Hash.
|
31
|
+
# @param object Model object to serialize.
|
32
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
33
|
+
#
|
34
|
+
def self.serialize_object(object)
|
35
|
+
object.validate
|
36
|
+
output_object = {}
|
37
|
+
|
38
|
+
serialized_property = object.tags
|
39
|
+
output_object['tags'] = serialized_property unless serialized_property.nil?
|
40
|
+
|
41
|
+
serialized_property = object.properties
|
42
|
+
unless serialized_property.nil?
|
43
|
+
serialized_property = EndpointPropertiesUpdateParameters.serialize_object(serialized_property)
|
44
|
+
end
|
45
|
+
output_object['properties'] = serialized_property unless serialized_property.nil?
|
46
|
+
|
47
|
+
output_object
|
48
|
+
end
|
49
|
+
|
50
|
+
#
|
51
|
+
# Deserializes given Ruby Hash into Model object.
|
52
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
53
|
+
# @return [EndpointUpdateParameters] Deserialized object.
|
54
|
+
#
|
55
|
+
def self.deserialize_object(object)
|
56
|
+
return if object.nil?
|
57
|
+
output_object = EndpointUpdateParameters.new
|
58
|
+
|
59
|
+
deserialized_property = object['tags']
|
60
|
+
output_object.tags = deserialized_property
|
61
|
+
|
62
|
+
deserialized_property = object['properties']
|
63
|
+
unless deserialized_property.nil?
|
64
|
+
deserialized_property = EndpointPropertiesUpdateParameters.deserialize_object(deserialized_property)
|
65
|
+
end
|
66
|
+
output_object.properties = deserialized_property
|
67
|
+
|
68
|
+
output_object
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::CDN
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Model object.
|
10
|
+
#
|
11
|
+
class ErrorResponse
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [String] Error code
|
16
|
+
attr_accessor :code
|
17
|
+
|
18
|
+
# @return [String] Error message indicating why the operation failed
|
19
|
+
attr_accessor :message
|
20
|
+
|
21
|
+
#
|
22
|
+
# Validate the object. Throws ValidationError if validation fails.
|
23
|
+
#
|
24
|
+
def validate
|
25
|
+
# Nothing to validate
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# Serializes given Model object into Ruby Hash.
|
30
|
+
# @param object Model object to serialize.
|
31
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
32
|
+
#
|
33
|
+
def self.serialize_object(object)
|
34
|
+
object.validate
|
35
|
+
output_object = {}
|
36
|
+
|
37
|
+
serialized_property = object.code
|
38
|
+
output_object['code'] = serialized_property unless serialized_property.nil?
|
39
|
+
|
40
|
+
serialized_property = object.message
|
41
|
+
output_object['message'] = serialized_property unless serialized_property.nil?
|
42
|
+
|
43
|
+
output_object
|
44
|
+
end
|
45
|
+
|
46
|
+
#
|
47
|
+
# Deserializes given Ruby Hash into Model object.
|
48
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
49
|
+
# @return [ErrorResponse] Deserialized object.
|
50
|
+
#
|
51
|
+
def self.deserialize_object(object)
|
52
|
+
return if object.nil?
|
53
|
+
output_object = ErrorResponse.new
|
54
|
+
|
55
|
+
deserialized_property = object['code']
|
56
|
+
output_object.code = deserialized_property
|
57
|
+
|
58
|
+
deserialized_property = object['message']
|
59
|
+
output_object.message = deserialized_property
|
60
|
+
|
61
|
+
output_object
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::CDN
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Parameters required for endpoint load
|
10
|
+
#
|
11
|
+
class LoadParameters
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [Array<String>] The path to the content to be loaded, should
|
16
|
+
# describe a file path.
|
17
|
+
attr_accessor :content_paths
|
18
|
+
|
19
|
+
#
|
20
|
+
# Validate the object. Throws ValidationError if validation fails.
|
21
|
+
#
|
22
|
+
def validate
|
23
|
+
fail MsRest::ValidationError, 'property content_paths is nil' if @content_paths.nil?
|
24
|
+
@content_paths.each{ |e| e.validate if e.respond_to?(:validate) } unless @content_paths.nil?
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# Serializes given Model object into Ruby Hash.
|
29
|
+
# @param object Model object to serialize.
|
30
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
31
|
+
#
|
32
|
+
def self.serialize_object(object)
|
33
|
+
object.validate
|
34
|
+
output_object = {}
|
35
|
+
|
36
|
+
serialized_property = object.content_paths
|
37
|
+
output_object['contentPaths'] = serialized_property unless serialized_property.nil?
|
38
|
+
|
39
|
+
output_object
|
40
|
+
end
|
41
|
+
|
42
|
+
#
|
43
|
+
# Deserializes given Ruby Hash into Model object.
|
44
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
45
|
+
# @return [LoadParameters] Deserialized object.
|
46
|
+
#
|
47
|
+
def self.deserialize_object(object)
|
48
|
+
return if object.nil?
|
49
|
+
output_object = LoadParameters.new
|
50
|
+
|
51
|
+
deserialized_property = object['contentPaths']
|
52
|
+
output_object.content_paths = deserialized_property
|
53
|
+
|
54
|
+
output_object
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::CDN
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# CDN REST API operation
|
10
|
+
#
|
11
|
+
class Operation
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [String] Operation name: {provider}/{resource}/{operation}
|
16
|
+
attr_accessor :name
|
17
|
+
|
18
|
+
# @return [OperationDisplay]
|
19
|
+
attr_accessor :display
|
20
|
+
|
21
|
+
#
|
22
|
+
# Validate the object. Throws ValidationError if validation fails.
|
23
|
+
#
|
24
|
+
def validate
|
25
|
+
@display.validate unless @display.nil?
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# Serializes given Model object into Ruby Hash.
|
30
|
+
# @param object Model object to serialize.
|
31
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
32
|
+
#
|
33
|
+
def self.serialize_object(object)
|
34
|
+
object.validate
|
35
|
+
output_object = {}
|
36
|
+
|
37
|
+
serialized_property = object.name
|
38
|
+
output_object['name'] = serialized_property unless serialized_property.nil?
|
39
|
+
|
40
|
+
serialized_property = object.display
|
41
|
+
unless serialized_property.nil?
|
42
|
+
serialized_property = OperationDisplay.serialize_object(serialized_property)
|
43
|
+
end
|
44
|
+
output_object['display'] = serialized_property unless serialized_property.nil?
|
45
|
+
|
46
|
+
output_object
|
47
|
+
end
|
48
|
+
|
49
|
+
#
|
50
|
+
# Deserializes given Ruby Hash into Model object.
|
51
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
52
|
+
# @return [Operation] Deserialized object.
|
53
|
+
#
|
54
|
+
def self.deserialize_object(object)
|
55
|
+
return if object.nil?
|
56
|
+
output_object = Operation.new
|
57
|
+
|
58
|
+
deserialized_property = object['name']
|
59
|
+
output_object.name = deserialized_property
|
60
|
+
|
61
|
+
deserialized_property = object['display']
|
62
|
+
unless deserialized_property.nil?
|
63
|
+
deserialized_property = OperationDisplay.deserialize_object(deserialized_property)
|
64
|
+
end
|
65
|
+
output_object.display = deserialized_property
|
66
|
+
|
67
|
+
output_object
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::CDN
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Model object.
|
10
|
+
#
|
11
|
+
class OperationDisplay
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [String] Service provider: Microsoft.Cdn
|
16
|
+
attr_accessor :provider
|
17
|
+
|
18
|
+
# @return [String] Resource on which the operation is performed:
|
19
|
+
# profile, endpoint,.. etc
|
20
|
+
attr_accessor :resource
|
21
|
+
|
22
|
+
# @return [String] Operation type: read, write, delete,.. etc
|
23
|
+
attr_accessor :operation
|
24
|
+
|
25
|
+
#
|
26
|
+
# Validate the object. Throws ValidationError if validation fails.
|
27
|
+
#
|
28
|
+
def validate
|
29
|
+
# Nothing to validate
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# Serializes given Model object into Ruby Hash.
|
34
|
+
# @param object Model object to serialize.
|
35
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
36
|
+
#
|
37
|
+
def self.serialize_object(object)
|
38
|
+
object.validate
|
39
|
+
output_object = {}
|
40
|
+
|
41
|
+
serialized_property = object.provider
|
42
|
+
output_object['provider'] = serialized_property unless serialized_property.nil?
|
43
|
+
|
44
|
+
serialized_property = object.resource
|
45
|
+
output_object['resource'] = serialized_property unless serialized_property.nil?
|
46
|
+
|
47
|
+
serialized_property = object.operation
|
48
|
+
output_object['operation'] = serialized_property unless serialized_property.nil?
|
49
|
+
|
50
|
+
output_object
|
51
|
+
end
|
52
|
+
|
53
|
+
#
|
54
|
+
# Deserializes given Ruby Hash into Model object.
|
55
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
56
|
+
# @return [OperationDisplay] Deserialized object.
|
57
|
+
#
|
58
|
+
def self.deserialize_object(object)
|
59
|
+
return if object.nil?
|
60
|
+
output_object = OperationDisplay.new
|
61
|
+
|
62
|
+
deserialized_property = object['provider']
|
63
|
+
output_object.provider = deserialized_property
|
64
|
+
|
65
|
+
deserialized_property = object['resource']
|
66
|
+
output_object.resource = deserialized_property
|
67
|
+
|
68
|
+
deserialized_property = object['operation']
|
69
|
+
output_object.operation = deserialized_property
|
70
|
+
|
71
|
+
output_object
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::CDN
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Model object.
|
10
|
+
#
|
11
|
+
class OperationListResult
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [Array<Operation>] List of CDN operations within CDN resource
|
16
|
+
# provider.
|
17
|
+
attr_accessor :value
|
18
|
+
|
19
|
+
#
|
20
|
+
# Validate the object. Throws ValidationError if validation fails.
|
21
|
+
#
|
22
|
+
def validate
|
23
|
+
@value.each{ |e| e.validate if e.respond_to?(:validate) } unless @value.nil?
|
24
|
+
end
|
25
|
+
|
26
|
+
#
|
27
|
+
# Serializes given Model object into Ruby Hash.
|
28
|
+
# @param object Model object to serialize.
|
29
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
30
|
+
#
|
31
|
+
def self.serialize_object(object)
|
32
|
+
object.validate
|
33
|
+
output_object = {}
|
34
|
+
|
35
|
+
serialized_property = object.value
|
36
|
+
unless serialized_property.nil?
|
37
|
+
serializedArray = []
|
38
|
+
serialized_property.each do |element|
|
39
|
+
unless element.nil?
|
40
|
+
element = Operation.serialize_object(element)
|
41
|
+
end
|
42
|
+
serializedArray.push(element)
|
43
|
+
end
|
44
|
+
serialized_property = serializedArray
|
45
|
+
end
|
46
|
+
output_object['value'] = serialized_property unless serialized_property.nil?
|
47
|
+
|
48
|
+
output_object
|
49
|
+
end
|
50
|
+
|
51
|
+
#
|
52
|
+
# Deserializes given Ruby Hash into Model object.
|
53
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
54
|
+
# @return [OperationListResult] Deserialized object.
|
55
|
+
#
|
56
|
+
def self.deserialize_object(object)
|
57
|
+
return if object.nil?
|
58
|
+
output_object = OperationListResult.new
|
59
|
+
|
60
|
+
deserialized_property = object['value']
|
61
|
+
unless deserialized_property.nil?
|
62
|
+
deserialized_array = []
|
63
|
+
deserialized_property.each do |element1|
|
64
|
+
unless element1.nil?
|
65
|
+
element1 = Operation.deserialize_object(element1)
|
66
|
+
end
|
67
|
+
deserialized_array.push(element1)
|
68
|
+
end
|
69
|
+
deserialized_property = deserialized_array
|
70
|
+
end
|
71
|
+
output_object.value = deserialized_property
|
72
|
+
|
73
|
+
output_object
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::CDN
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# CDN Origin is the source of the content being delivered via CDN. When
|
10
|
+
# the edge nodes represented by an Endpoint do not have the requested
|
11
|
+
# content cached, they attempt to fetch it from one or more of the
|
12
|
+
# configured Origins.
|
13
|
+
#
|
14
|
+
class Origin < MsRestAzure::Resource
|
15
|
+
|
16
|
+
include MsRestAzure
|
17
|
+
|
18
|
+
# @return [OriginProperties]
|
19
|
+
attr_accessor :properties
|
20
|
+
|
21
|
+
#
|
22
|
+
# Validate the object. Throws ValidationError if validation fails.
|
23
|
+
#
|
24
|
+
def validate
|
25
|
+
@properties.validate unless @properties.nil?
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# Serializes given Model object into Ruby Hash.
|
30
|
+
# @param object Model object to serialize.
|
31
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
32
|
+
#
|
33
|
+
def self.serialize_object(object)
|
34
|
+
object.validate
|
35
|
+
output_object = {}
|
36
|
+
|
37
|
+
serialized_property = object.id
|
38
|
+
output_object['id'] = serialized_property unless serialized_property.nil?
|
39
|
+
|
40
|
+
serialized_property = object.name
|
41
|
+
output_object['name'] = serialized_property unless serialized_property.nil?
|
42
|
+
|
43
|
+
serialized_property = object.type
|
44
|
+
output_object['type'] = serialized_property unless serialized_property.nil?
|
45
|
+
|
46
|
+
serialized_property = object.properties
|
47
|
+
unless serialized_property.nil?
|
48
|
+
serialized_property = OriginProperties.serialize_object(serialized_property)
|
49
|
+
end
|
50
|
+
output_object['properties'] = serialized_property unless serialized_property.nil?
|
51
|
+
|
52
|
+
output_object
|
53
|
+
end
|
54
|
+
|
55
|
+
#
|
56
|
+
# Deserializes given Ruby Hash into Model object.
|
57
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
58
|
+
# @return [Origin] Deserialized object.
|
59
|
+
#
|
60
|
+
def self.deserialize_object(object)
|
61
|
+
return if object.nil?
|
62
|
+
output_object = Origin.new
|
63
|
+
|
64
|
+
deserialized_property = object['id']
|
65
|
+
output_object.id = deserialized_property
|
66
|
+
|
67
|
+
deserialized_property = object['name']
|
68
|
+
output_object.name = deserialized_property
|
69
|
+
|
70
|
+
deserialized_property = object['type']
|
71
|
+
output_object.type = deserialized_property
|
72
|
+
|
73
|
+
deserialized_property = object['properties']
|
74
|
+
unless deserialized_property.nil?
|
75
|
+
deserialized_property = OriginProperties.deserialize_object(deserialized_property)
|
76
|
+
end
|
77
|
+
output_object.properties = deserialized_property
|
78
|
+
|
79
|
+
output_object
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|