fastly 15.0.0 → 15.1.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.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +10 -3
  5. data/docs/DdosProtectionEvent.md +2 -0
  6. data/docs/DdosProtectionEventAllOf.md +2 -0
  7. data/docs/DdosProtectionRequestEnableMode.md +10 -0
  8. data/docs/DomainInspectorHistoricalApi.md +1 -1
  9. data/docs/DomainResearchApi.md +103 -0
  10. data/docs/DomainResearchResponseBodyEnable.md +12 -0
  11. data/docs/DomainResearchResponseCustomer.md +10 -0
  12. data/docs/DomainResearchResponseLinks.md +10 -0
  13. data/docs/DomainResearchResponseLinksLinks.md +10 -0
  14. data/docs/DomainResearchResponseProduct.md +10 -0
  15. data/docs/DomainResearchResponseProductProduct.md +11 -0
  16. data/docs/IamV1RoleResponse.md +1 -0
  17. data/docs/InlineResponse20010.md +2 -1
  18. data/docs/InlineResponse20011.md +10 -0
  19. data/docs/InlineResponse2006.md +1 -2
  20. data/docs/InlineResponse2007.md +1 -1
  21. data/docs/InlineResponse2008.md +1 -1
  22. data/docs/InlineResponse2009.md +1 -1
  23. data/docs/KvStoreApi.md +43 -4
  24. data/docs/KvStoreDetails.md +2 -0
  25. data/docs/KvStoreItemApi.md +2 -2
  26. data/docs/{KvStoreRequestCreate.md → KvStoreRequestCreateOrUpdate.md} +1 -1
  27. data/docs/MetricsPlatformApi.md +75 -0
  28. data/docs/NgwafRequestEnable.md +1 -0
  29. data/docs/Offer.md +12 -0
  30. data/docs/OfferAllOf.md +12 -0
  31. data/docs/OriginInspectorHistoricalApi.md +1 -1
  32. data/docs/PlatformMetadata.md +14 -0
  33. data/docs/PlatformMetricsResponse.md +11 -0
  34. data/docs/PlatformValues.md +25 -0
  35. data/docs/ProductDdosProtectionApi.md +3 -1
  36. data/docs/ProductDomainResearchApi.md +115 -0
  37. data/docs/RealtimeEntryAggregated.md +4 -0
  38. data/docs/RealtimeMeasurements.md +4 -0
  39. data/docs/Results.md +4 -0
  40. data/docs/SecretStoreApi.md +2 -2
  41. data/docs/SecretStoreItemApi.md +2 -2
  42. data/docs/ServiceAuthorizationsApi.md +2 -2
  43. data/docs/Status.md +15 -0
  44. data/docs/StatusAllOf.md +15 -0
  45. data/docs/Suggestion.md +13 -0
  46. data/docs/SuggestionAllOf.md +13 -0
  47. data/lib/fastly/api/domain_inspector_historical_api.rb +1 -1
  48. data/lib/fastly/api/domain_research_api.rb +163 -0
  49. data/lib/fastly/api/kv_store_api.rb +74 -6
  50. data/lib/fastly/api/kv_store_item_api.rb +3 -3
  51. data/lib/fastly/api/metrics_platform_api.rb +134 -0
  52. data/lib/fastly/api/origin_inspector_historical_api.rb +1 -1
  53. data/lib/fastly/api/product_ddos_protection_api.rb +10 -3
  54. data/lib/fastly/api/product_domain_research_api.rb +186 -0
  55. data/lib/fastly/api/secret_store_api.rb +3 -3
  56. data/lib/fastly/api/secret_store_item_api.rb +3 -3
  57. data/lib/fastly/api/service_authorizations_api.rb +3 -3
  58. data/lib/fastly/configuration.rb +42 -0
  59. data/lib/fastly/models/ddos_protection_event.rb +21 -1
  60. data/lib/fastly/models/ddos_protection_event_all_of.rb +21 -1
  61. data/lib/fastly/models/ddos_protection_request_enable_mode.rb +251 -0
  62. data/lib/fastly/models/domain_research_response_body_enable.rb +243 -0
  63. data/lib/fastly/models/domain_research_response_customer.rb +216 -0
  64. data/lib/fastly/models/domain_research_response_links.rb +216 -0
  65. data/lib/fastly/models/domain_research_response_links_links.rb +217 -0
  66. data/lib/fastly/models/domain_research_response_product.rb +216 -0
  67. data/lib/fastly/models/domain_research_response_product_product.rb +227 -0
  68. data/lib/fastly/models/iam_v1_role_response.rb +10 -1
  69. data/lib/fastly/models/inline_response20010.rb +13 -4
  70. data/lib/fastly/models/inline_response20011.rb +218 -0
  71. data/lib/fastly/models/inline_response2006.rb +8 -17
  72. data/lib/fastly/models/inline_response2007.rb +1 -1
  73. data/lib/fastly/models/inline_response2008.rb +1 -1
  74. data/lib/fastly/models/inline_response2009.rb +1 -1
  75. data/lib/fastly/models/kv_store_details.rb +24 -4
  76. data/lib/fastly/models/{kv_store_request_create.rb → kv_store_request_create_or_update.rb} +3 -3
  77. data/lib/fastly/models/ngwaf_request_enable.rb +14 -4
  78. data/lib/fastly/models/offer.rb +245 -0
  79. data/lib/fastly/models/offer_all_of.rb +237 -0
  80. data/lib/fastly/models/platform_metadata.rb +258 -0
  81. data/lib/fastly/models/platform_metrics_response.rb +228 -0
  82. data/lib/fastly/models/platform_values.rb +368 -0
  83. data/lib/fastly/models/realtime_entry_aggregated.rb +44 -4
  84. data/lib/fastly/models/realtime_measurements.rb +44 -4
  85. data/lib/fastly/models/results.rb +41 -1
  86. data/lib/fastly/models/status.rb +276 -0
  87. data/lib/fastly/models/status_all_of.rb +268 -0
  88. data/lib/fastly/models/suggestion.rb +255 -0
  89. data/lib/fastly/models/suggestion_all_of.rb +247 -0
  90. data/lib/fastly/version.rb +1 -1
  91. data/lib/fastly.rb +21 -1
  92. data/sig.json +1 -1
  93. metadata +44 -4
@@ -19,6 +19,12 @@ module Fastly
19
19
  # A human-readable name for the event.
20
20
  attr_accessor :name
21
21
 
22
+ # Number of requests classified as non-attack traffic for an event.
23
+ attr_accessor :requests_allowed
24
+
25
+ # Number of requests classified as DDoS attack traffic for an event.
26
+ attr_accessor :requests_detected
27
+
22
28
  # Alphanumeric string identifying the customer.
23
29
  attr_accessor :customer_id
24
30
 
@@ -36,6 +42,8 @@ module Fastly
36
42
  {
37
43
  :'id' => :'id',
38
44
  :'name' => :'name',
45
+ :'requests_allowed' => :'requests_allowed',
46
+ :'requests_detected' => :'requests_detected',
39
47
  :'customer_id' => :'customer_id',
40
48
  :'service_id' => :'service_id',
41
49
  :'started_at' => :'started_at',
@@ -53,6 +61,8 @@ module Fastly
53
61
  {
54
62
  :'id' => :'String',
55
63
  :'name' => :'String',
64
+ :'requests_allowed' => :'Integer',
65
+ :'requests_detected' => :'Integer',
56
66
  :'customer_id' => :'String',
57
67
  :'service_id' => :'String',
58
68
  :'started_at' => :'Time',
@@ -91,6 +101,14 @@ module Fastly
91
101
  self.name = attributes[:'name']
92
102
  end
93
103
 
104
+ if attributes.key?(:'requests_allowed')
105
+ self.requests_allowed = attributes[:'requests_allowed']
106
+ end
107
+
108
+ if attributes.key?(:'requests_detected')
109
+ self.requests_detected = attributes[:'requests_detected']
110
+ end
111
+
94
112
  if attributes.key?(:'customer_id')
95
113
  self.customer_id = attributes[:'customer_id']
96
114
  end
@@ -128,6 +146,8 @@ module Fastly
128
146
  self.class == o.class &&
129
147
  id == o.id &&
130
148
  name == o.name &&
149
+ requests_allowed == o.requests_allowed &&
150
+ requests_detected == o.requests_detected &&
131
151
  customer_id == o.customer_id &&
132
152
  service_id == o.service_id &&
133
153
  started_at == o.started_at &&
@@ -143,7 +163,7 @@ module Fastly
143
163
  # Calculates hash code according to all attributes.
144
164
  # @return [Integer] Hash code
145
165
  def hash
146
- [id, name, customer_id, service_id, started_at, ended_at].hash
166
+ [id, name, requests_allowed, requests_detected, customer_id, service_id, started_at, ended_at].hash
147
167
  end
148
168
 
149
169
  # Builds the object from hash
@@ -0,0 +1,251 @@
1
+ =begin
2
+ #Fastly API
3
+
4
+ #Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: oss@fastly.com
8
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module Fastly
15
+ class DdosProtectionRequestEnableMode
16
+ # Operation mode
17
+ attr_accessor :mode
18
+
19
+ class EnumAttributeValidator
20
+ attr_reader :datatype
21
+ attr_reader :allowable_values
22
+
23
+ def initialize(datatype, allowable_values)
24
+ @allowable_values = allowable_values.map do |value|
25
+ case datatype.to_s
26
+ when /Integer/i
27
+ value.to_i
28
+ when /Float/i
29
+ value.to_f
30
+ else
31
+ value
32
+ end
33
+ end
34
+ end
35
+
36
+ def valid?(value)
37
+ !value || allowable_values.include?(value)
38
+ end
39
+ end
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'mode' => :'mode'
45
+ }
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.fastly_types
55
+ {
56
+ :'mode' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.fastly_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DdosProtectionRequestEnableMode` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!self.class.attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DdosProtectionRequestEnableMode`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'mode')
82
+ self.mode = attributes[:'mode']
83
+ end
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ invalid_properties = Array.new
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ mode_validator = EnumAttributeValidator.new('String', ["false", "log", "block"])
97
+ return false unless mode_validator.valid?(@mode)
98
+ true
99
+ end
100
+
101
+ # Custom attribute writer method checking allowed values (enum).
102
+ # @param [Object] mode Object to be assigned
103
+ def mode=(mode)
104
+ validator = EnumAttributeValidator.new('String', ["false", "log", "block"])
105
+ unless validator.valid?(mode)
106
+ fail ArgumentError, "invalid value for \"mode\", must be one of #{validator.allowable_values}."
107
+ end
108
+ @mode = mode
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(o)
114
+ return true if self.equal?(o)
115
+ self.class == o.class &&
116
+ mode == o.mode
117
+ end
118
+
119
+ # @see the `==` method
120
+ # @param [Object] Object to be compared
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculates hash code according to all attributes.
126
+ # @return [Integer] Hash code
127
+ def hash
128
+ [mode].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def self.build_from_hash(attributes)
135
+ new.build_from_hash(attributes)
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def build_from_hash(attributes)
142
+ return nil unless attributes.is_a?(Hash)
143
+ self.class.fastly_types.each_pair do |key, type|
144
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
145
+ self.send("#{key}=", nil)
146
+ elsif type =~ /\AArray<(.*)>/i
147
+ # check to ensure the input is an array given that the attribute
148
+ # is documented as an array but the input is not
149
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
150
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
151
+ end
152
+ elsif !attributes[self.class.attribute_map[key]].nil?
153
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
154
+ end
155
+ end
156
+
157
+ self
158
+ end
159
+
160
+ # Deserializes the data based on type
161
+ # @param string type Data type
162
+ # @param string value Value to be deserialized
163
+ # @return [Object] Deserialized data
164
+ def _deserialize(type, value)
165
+ case type.to_sym
166
+ when :Time
167
+ Time.parse(value)
168
+ when :Date
169
+ Date.parse(value)
170
+ when :String
171
+ value.to_s
172
+ when :Integer
173
+ value.to_i
174
+ when :Float
175
+ value.to_f
176
+ when :Boolean
177
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
178
+ true
179
+ else
180
+ false
181
+ end
182
+ when :Object
183
+ # generic object (usually a Hash), return directly
184
+ value
185
+ when /\AArray<(?<inner_type>.+)>\z/
186
+ inner_type = Regexp.last_match[:inner_type]
187
+ value.map { |v| _deserialize(inner_type, v) }
188
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
189
+ k_type = Regexp.last_match[:k_type]
190
+ v_type = Regexp.last_match[:v_type]
191
+ {}.tap do |hash|
192
+ value.each do |k, v|
193
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
194
+ end
195
+ end
196
+ else # model
197
+ # models (e.g. Pet) or oneOf
198
+ klass = Fastly.const_get(type)
199
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
200
+ end
201
+ end
202
+
203
+ # Returns the string representation of the object
204
+ # @return [String] String presentation of the object
205
+ def to_s
206
+ to_hash.to_s
207
+ end
208
+
209
+ # to_body is an alias to to_hash (backward compatibility)
210
+ # @return [Hash] Returns the object in the form of hash
211
+ def to_body
212
+ to_hash
213
+ end
214
+
215
+ # Returns the object in the form of hash
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_hash
218
+ hash = {}
219
+ self.class.attribute_map.each_pair do |attr, param|
220
+ value = self.send(attr)
221
+ if value.nil?
222
+ is_nullable = self.class.fastly_nullable.include?(attr)
223
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
224
+ end
225
+
226
+ hash[param] = _to_hash(value)
227
+ end
228
+ hash
229
+ end
230
+
231
+ # Outputs non-array value in the form of hash
232
+ # For object, use to_hash. Otherwise, just return the value
233
+ # @param [Object] value Any valid value
234
+ # @return [Hash] Returns the value in the form of hash
235
+ def _to_hash(value)
236
+ if value.is_a?(Array)
237
+ value.compact.map { |v| _to_hash(v) }
238
+ elsif value.is_a?(Hash)
239
+ {}.tap do |hash|
240
+ value.each { |k, v| hash[k] = _to_hash(v) }
241
+ end
242
+ elsif value.respond_to? :to_hash
243
+ value.to_hash
244
+ else
245
+ value
246
+ end
247
+ end
248
+
249
+ end
250
+
251
+ end
@@ -0,0 +1,243 @@
1
+ =begin
2
+ #Fastly API
3
+
4
+ #Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: oss@fastly.com
8
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module Fastly
15
+ class DomainResearchResponseBodyEnable
16
+ attr_accessor :product
17
+
18
+ attr_accessor :customer
19
+
20
+ attr_accessor :_links
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'product' => :'product',
26
+ :'customer' => :'customer',
27
+ :'_links' => :'_links'
28
+ }
29
+ end
30
+
31
+ # Returns all the JSON keys this model knows about
32
+ def self.acceptable_attributes
33
+ attribute_map.values
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.fastly_types
38
+ {
39
+ :'product' => :'DomainResearchResponseProductProduct',
40
+ :'customer' => :'AiAcceleratorResponseCustomerCustomer',
41
+ :'_links' => :'DomainResearchResponseLinksLinks'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.fastly_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # List of class defined in allOf (OpenAPI v3)
52
+ def self.fastly_all_of
53
+ [
54
+ :'DomainResearchResponseCustomer',
55
+ :'DomainResearchResponseLinks',
56
+ :'DomainResearchResponseProduct'
57
+ ]
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DomainResearchResponseBodyEnable` initialize method"
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!self.class.attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DomainResearchResponseBodyEnable`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
74
+
75
+ if attributes.key?(:'product')
76
+ self.product = attributes[:'product']
77
+ end
78
+
79
+ if attributes.key?(:'customer')
80
+ self.customer = attributes[:'customer']
81
+ end
82
+
83
+ if attributes.key?(:'_links')
84
+ self._links = attributes[:'_links']
85
+ end
86
+ end
87
+
88
+ # Show invalid properties with the reasons. Usually used together with valid?
89
+ # @return Array for valid properties with the reasons
90
+ def list_invalid_properties
91
+ invalid_properties = Array.new
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ true
99
+ end
100
+
101
+ # Checks equality by comparing each attribute.
102
+ # @param [Object] Object to be compared
103
+ def ==(o)
104
+ return true if self.equal?(o)
105
+ self.class == o.class &&
106
+ product == o.product &&
107
+ customer == o.customer &&
108
+ _links == o._links
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [product, customer, _links].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ new.build_from_hash(attributes)
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ self.class.fastly_types.each_pair do |key, type|
136
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
137
+ self.send("#{key}=", nil)
138
+ elsif type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
143
+ end
144
+ elsif !attributes[self.class.attribute_map[key]].nil?
145
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
+ end
147
+ end
148
+
149
+ self
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def _deserialize(type, value)
157
+ case type.to_sym
158
+ when :Time
159
+ Time.parse(value)
160
+ when :Date
161
+ Date.parse(value)
162
+ when :String
163
+ value.to_s
164
+ when :Integer
165
+ value.to_i
166
+ when :Float
167
+ value.to_f
168
+ when :Boolean
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
170
+ true
171
+ else
172
+ false
173
+ end
174
+ when :Object
175
+ # generic object (usually a Hash), return directly
176
+ value
177
+ when /\AArray<(?<inner_type>.+)>\z/
178
+ inner_type = Regexp.last_match[:inner_type]
179
+ value.map { |v| _deserialize(inner_type, v) }
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
181
+ k_type = Regexp.last_match[:k_type]
182
+ v_type = Regexp.last_match[:v_type]
183
+ {}.tap do |hash|
184
+ value.each do |k, v|
185
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
186
+ end
187
+ end
188
+ else # model
189
+ # models (e.g. Pet) or oneOf
190
+ klass = Fastly.const_get(type)
191
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.fastly_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ # Outputs non-array value in the form of hash
224
+ # For object, use to_hash. Otherwise, just return the value
225
+ # @param [Object] value Any valid value
226
+ # @return [Hash] Returns the value in the form of hash
227
+ def _to_hash(value)
228
+ if value.is_a?(Array)
229
+ value.compact.map { |v| _to_hash(v) }
230
+ elsif value.is_a?(Hash)
231
+ {}.tap do |hash|
232
+ value.each { |k, v| hash[k] = _to_hash(v) }
233
+ end
234
+ elsif value.respond_to? :to_hash
235
+ value.to_hash
236
+ else
237
+ value
238
+ end
239
+ end
240
+
241
+ end
242
+
243
+ end