fastly 8.0.1 → 8.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +198 -130
  3. data/Gemfile.lock +1 -1
  4. data/README.md +13 -7
  5. data/docs/{ErrorResponse.md → AutomationTokenErrorResponse.md} +1 -1
  6. data/docs/AutomationTokensApi.md +2 -2
  7. data/docs/Backend.md +1 -1
  8. data/docs/BackendApi.md +4 -4
  9. data/docs/BackendResponse.md +1 -1
  10. data/docs/BillingInvoicesApi.md +96 -0
  11. data/docs/Director.md +1 -1
  12. data/docs/DirectorApi.md +2 -2
  13. data/docs/DirectorResponse.md +1 -1
  14. data/docs/DomainInspectorHistoricalApi.md +4 -4
  15. data/docs/DomainInspectorRealtimeEntry.md +1 -1
  16. data/docs/Error.md +13 -0
  17. data/docs/ErrorResponseData.md +11 -0
  18. data/docs/Invoice.md +18 -0
  19. data/docs/InvoiceResponse.md +18 -0
  20. data/docs/Invoicelineitems.md +18 -0
  21. data/docs/KvStoreApi.md +1 -1
  22. data/docs/ListInvoicesResponse.md +11 -0
  23. data/docs/Listinvoices.md +11 -0
  24. data/docs/LoggingScalyrAdditional.md +1 -1
  25. data/docs/LoggingScalyrApi.md +4 -4
  26. data/docs/LoggingScalyrResponse.md +1 -1
  27. data/docs/Metadata.md +13 -0
  28. data/docs/OriginInspectorHistoricalApi.md +4 -4
  29. data/docs/OriginInspectorRealtimeEntry.md +1 -1
  30. data/docs/PoolAdditional.md +1 -1
  31. data/docs/PoolApi.md +4 -4
  32. data/docs/PoolResponse.md +1 -1
  33. data/docs/PoolResponsePost.md +1 -1
  34. data/docs/Pop.md +2 -2
  35. data/docs/PublishApi.md +1 -1
  36. data/docs/RealtimeEntry.md +1 -1
  37. data/docs/Results.md +2 -0
  38. data/docs/SecretStoreApi.md +4 -2
  39. data/docs/SecretStoreItemApi.md +2 -2
  40. data/docs/ServiceDetail.md +1 -1
  41. data/docs/ServiceListResponse.md +2 -2
  42. data/docs/ServiceListResponseAllOf.md +2 -2
  43. data/docs/ServiceResponse.md +1 -1
  44. data/docs/ServiceResponseAllOf.md +1 -1
  45. data/docs/TlsConfigurationResponseAttributes.md +1 -1
  46. data/docs/TlsConfigurationResponseAttributesAllOf.md +1 -1
  47. data/docs/TlsCsr.md +10 -0
  48. data/docs/TlsCsrData.md +12 -0
  49. data/docs/TlsCsrDataAttributes.md +20 -0
  50. data/docs/TlsCsrErrorResponse.md +10 -0
  51. data/docs/TlsCsrResponse.md +10 -0
  52. data/docs/TlsCsrResponseAttributes.md +10 -0
  53. data/docs/TlsCsrResponseData.md +13 -0
  54. data/docs/TlsCsrsApi.md +52 -0
  55. data/docs/TlsSubscriptionResponseAttributes.md +1 -0
  56. data/docs/TlsSubscriptionResponseAttributesAllOf.md +1 -0
  57. data/docs/TokensApi.md +1 -1
  58. data/docs/TypeTlsCsr.md +9 -0
  59. data/docs/VclApi.md +1 -1
  60. data/docs/WafActiveRulesApi.md +1 -1
  61. data/lib/fastly/api/automation_tokens_api.rb +3 -3
  62. data/lib/fastly/api/backend_api.rb +4 -4
  63. data/lib/fastly/api/billing_invoices_api.rb +151 -0
  64. data/lib/fastly/api/director_api.rb +2 -2
  65. data/lib/fastly/api/domain_inspector_historical_api.rb +4 -4
  66. data/lib/fastly/api/kv_store_api.rb +2 -2
  67. data/lib/fastly/api/logging_scalyr_api.rb +4 -4
  68. data/lib/fastly/api/origin_inspector_historical_api.rb +4 -4
  69. data/lib/fastly/api/pool_api.rb +4 -4
  70. data/lib/fastly/api/publish_api.rb +2 -2
  71. data/lib/fastly/api/secret_store_api.rb +5 -2
  72. data/lib/fastly/api/secret_store_item_api.rb +2 -2
  73. data/lib/fastly/api/tls_csrs_api.rb +83 -0
  74. data/lib/fastly/api/tokens_api.rb +2 -2
  75. data/lib/fastly/api/vcl_api.rb +2 -2
  76. data/lib/fastly/api/waf_active_rules_api.rb +2 -2
  77. data/lib/fastly/configuration.rb +18 -0
  78. data/lib/fastly/models/{error_response.rb → automation_token_error_response.rb} +3 -3
  79. data/lib/fastly/models/backend.rb +1 -1
  80. data/lib/fastly/models/backend_response.rb +1 -1
  81. data/lib/fastly/models/director.rb +1 -1
  82. data/lib/fastly/models/director_response.rb +1 -1
  83. data/lib/fastly/models/domain_inspector_realtime_entry.rb +1 -1
  84. data/lib/fastly/models/error.rb +243 -0
  85. data/lib/fastly/models/error_response_data.rb +225 -0
  86. data/lib/fastly/models/event_attributes.rb +2 -2
  87. data/lib/fastly/models/invoice.rb +298 -0
  88. data/lib/fastly/models/invoice_response.rb +305 -0
  89. data/lib/fastly/models/invoicelineitems.rb +297 -0
  90. data/lib/fastly/models/list_invoices_response.rb +234 -0
  91. data/lib/fastly/models/listinvoices.rb +227 -0
  92. data/lib/fastly/models/logging_scalyr_additional.rb +1 -1
  93. data/lib/fastly/models/logging_scalyr_response.rb +1 -1
  94. data/lib/fastly/models/metadata.rb +250 -0
  95. data/lib/fastly/models/origin_inspector_realtime_entry.rb +1 -1
  96. data/lib/fastly/models/pool_additional.rb +1 -1
  97. data/lib/fastly/models/pool_response.rb +1 -1
  98. data/lib/fastly/models/pool_response_post.rb +1 -1
  99. data/lib/fastly/models/pop.rb +2 -2
  100. data/lib/fastly/models/realtime_entry.rb +1 -1
  101. data/lib/fastly/models/relationship_tls_certificate.rb +1 -1
  102. data/lib/fastly/models/relationship_tls_configuration.rb +1 -1
  103. data/lib/fastly/models/results.rb +21 -1
  104. data/lib/fastly/models/service_detail.rb +1 -1
  105. data/lib/fastly/models/service_list_response.rb +2 -2
  106. data/lib/fastly/models/service_list_response_all_of.rb +2 -2
  107. data/lib/fastly/models/service_response.rb +1 -1
  108. data/lib/fastly/models/service_response_all_of.rb +1 -1
  109. data/lib/fastly/models/tls_configuration_response_attributes.rb +1 -1
  110. data/lib/fastly/models/tls_configuration_response_attributes_all_of.rb +1 -1
  111. data/lib/fastly/models/tls_csr.rb +216 -0
  112. data/lib/fastly/models/tls_csr_data.rb +236 -0
  113. data/lib/fastly/models/tls_csr_data_attributes.rb +358 -0
  114. data/lib/fastly/models/tls_csr_error_response.rb +218 -0
  115. data/lib/fastly/models/tls_csr_response.rb +216 -0
  116. data/lib/fastly/models/tls_csr_response_attributes.rb +217 -0
  117. data/lib/fastly/models/tls_csr_response_data.rb +245 -0
  118. data/lib/fastly/models/tls_subscription_data_attributes.rb +2 -2
  119. data/lib/fastly/models/tls_subscription_response_attributes.rb +14 -4
  120. data/lib/fastly/models/tls_subscription_response_attributes_all_of.rb +14 -4
  121. data/lib/fastly/models/type_tls_csr.rb +34 -0
  122. data/lib/fastly/version.rb +1 -1
  123. data/lib/fastly.rb +19 -1
  124. data/sig.json +1 -1
  125. metadata +40 -4
@@ -0,0 +1,297 @@
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://developer.fastly.com/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 Invoicelineitems
16
+ # Invoice line item transaction name.
17
+ attr_accessor :description
18
+
19
+ # Billed amount for line item.
20
+ attr_accessor :amount
21
+
22
+ # Discount coupon associated with the invoice for any account or service credits.
23
+ attr_accessor :credit_coupon_code
24
+
25
+ # Price per unit.
26
+ attr_accessor :rate
27
+
28
+ # Total number of units of usage.
29
+ attr_accessor :units
30
+
31
+ # The name of the product.
32
+ attr_accessor :product_name
33
+
34
+ # The broader classification of the product (e.g., `Compute` or `Full-Site Delivery`).
35
+ attr_accessor :product_group
36
+
37
+ # The geographical area applicable for regionally based products.
38
+ attr_accessor :region
39
+
40
+ # The unit of measure (e.g., `requests` or `bandwidth`).
41
+ attr_accessor :usage_type
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'description' => :'description',
47
+ :'amount' => :'amount',
48
+ :'credit_coupon_code' => :'credit_coupon_code',
49
+ :'rate' => :'rate',
50
+ :'units' => :'units',
51
+ :'product_name' => :'ProductName',
52
+ :'product_group' => :'ProductGroup',
53
+ :'region' => :'Region',
54
+ :'usage_type' => :'UsageType'
55
+ }
56
+ end
57
+
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ attribute_map.values
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.fastly_types
65
+ {
66
+ :'description' => :'String',
67
+ :'amount' => :'Float',
68
+ :'credit_coupon_code' => :'String',
69
+ :'rate' => :'Float',
70
+ :'units' => :'Float',
71
+ :'product_name' => :'String',
72
+ :'product_group' => :'String',
73
+ :'region' => :'String',
74
+ :'usage_type' => :'String'
75
+ }
76
+ end
77
+
78
+ # List of attributes with nullable: true
79
+ def self.fastly_nullable
80
+ Set.new([
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::Invoicelineitems` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ attributes = attributes.each_with_object({}) { |(k, v), h|
93
+ if (!self.class.attribute_map.key?(k.to_sym))
94
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::Invoicelineitems`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
95
+ end
96
+ h[k.to_sym] = v
97
+ }
98
+
99
+ if attributes.key?(:'description')
100
+ self.description = attributes[:'description']
101
+ end
102
+
103
+ if attributes.key?(:'amount')
104
+ self.amount = attributes[:'amount']
105
+ end
106
+
107
+ if attributes.key?(:'credit_coupon_code')
108
+ self.credit_coupon_code = attributes[:'credit_coupon_code']
109
+ end
110
+
111
+ if attributes.key?(:'rate')
112
+ self.rate = attributes[:'rate']
113
+ end
114
+
115
+ if attributes.key?(:'units')
116
+ self.units = attributes[:'units']
117
+ end
118
+
119
+ if attributes.key?(:'product_name')
120
+ self.product_name = attributes[:'product_name']
121
+ end
122
+
123
+ if attributes.key?(:'product_group')
124
+ self.product_group = attributes[:'product_group']
125
+ end
126
+
127
+ if attributes.key?(:'region')
128
+ self.region = attributes[:'region']
129
+ end
130
+
131
+ if attributes.key?(:'usage_type')
132
+ self.usage_type = attributes[:'usage_type']
133
+ end
134
+ end
135
+
136
+ # Show invalid properties with the reasons. Usually used together with valid?
137
+ # @return Array for valid properties with the reasons
138
+ def list_invalid_properties
139
+ invalid_properties = Array.new
140
+ invalid_properties
141
+ end
142
+
143
+ # Check to see if the all the properties in the model are valid
144
+ # @return true if the model is valid
145
+ def valid?
146
+ true
147
+ end
148
+
149
+ # Checks equality by comparing each attribute.
150
+ # @param [Object] Object to be compared
151
+ def ==(o)
152
+ return true if self.equal?(o)
153
+ self.class == o.class &&
154
+ description == o.description &&
155
+ amount == o.amount &&
156
+ credit_coupon_code == o.credit_coupon_code &&
157
+ rate == o.rate &&
158
+ units == o.units &&
159
+ product_name == o.product_name &&
160
+ product_group == o.product_group &&
161
+ region == o.region &&
162
+ usage_type == o.usage_type
163
+ end
164
+
165
+ # @see the `==` method
166
+ # @param [Object] Object to be compared
167
+ def eql?(o)
168
+ self == o
169
+ end
170
+
171
+ # Calculates hash code according to all attributes.
172
+ # @return [Integer] Hash code
173
+ def hash
174
+ [description, amount, credit_coupon_code, rate, units, product_name, product_group, region, usage_type].hash
175
+ end
176
+
177
+ # Builds the object from hash
178
+ # @param [Hash] attributes Model attributes in the form of hash
179
+ # @return [Object] Returns the model itself
180
+ def self.build_from_hash(attributes)
181
+ new.build_from_hash(attributes)
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def build_from_hash(attributes)
188
+ return nil unless attributes.is_a?(Hash)
189
+ self.class.fastly_types.each_pair do |key, type|
190
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
191
+ self.send("#{key}=", nil)
192
+ elsif type =~ /\AArray<(.*)>/i
193
+ # check to ensure the input is an array given that the attribute
194
+ # is documented as an array but the input is not
195
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
196
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
197
+ end
198
+ elsif !attributes[self.class.attribute_map[key]].nil?
199
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
200
+ end
201
+ end
202
+
203
+ self
204
+ end
205
+
206
+ # Deserializes the data based on type
207
+ # @param string type Data type
208
+ # @param string value Value to be deserialized
209
+ # @return [Object] Deserialized data
210
+ def _deserialize(type, value)
211
+ case type.to_sym
212
+ when :Time
213
+ Time.parse(value)
214
+ when :Date
215
+ Date.parse(value)
216
+ when :String
217
+ value.to_s
218
+ when :Integer
219
+ value.to_i
220
+ when :Float
221
+ value.to_f
222
+ when :Boolean
223
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
224
+ true
225
+ else
226
+ false
227
+ end
228
+ when :Object
229
+ # generic object (usually a Hash), return directly
230
+ value
231
+ when /\AArray<(?<inner_type>.+)>\z/
232
+ inner_type = Regexp.last_match[:inner_type]
233
+ value.map { |v| _deserialize(inner_type, v) }
234
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
235
+ k_type = Regexp.last_match[:k_type]
236
+ v_type = Regexp.last_match[:v_type]
237
+ {}.tap do |hash|
238
+ value.each do |k, v|
239
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
240
+ end
241
+ end
242
+ else # model
243
+ # models (e.g. Pet) or oneOf
244
+ klass = Fastly.const_get(type)
245
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
246
+ end
247
+ end
248
+
249
+ # Returns the string representation of the object
250
+ # @return [String] String presentation of the object
251
+ def to_s
252
+ to_hash.to_s
253
+ end
254
+
255
+ # to_body is an alias to to_hash (backward compatibility)
256
+ # @return [Hash] Returns the object in the form of hash
257
+ def to_body
258
+ to_hash
259
+ end
260
+
261
+ # Returns the object in the form of hash
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_hash
264
+ hash = {}
265
+ self.class.attribute_map.each_pair do |attr, param|
266
+ value = self.send(attr)
267
+ if value.nil?
268
+ is_nullable = self.class.fastly_nullable.include?(attr)
269
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
270
+ end
271
+
272
+ hash[param] = _to_hash(value)
273
+ end
274
+ hash
275
+ end
276
+
277
+ # Outputs non-array value in the form of hash
278
+ # For object, use to_hash. Otherwise, just return the value
279
+ # @param [Object] value Any valid value
280
+ # @return [Hash] Returns the value in the form of hash
281
+ def _to_hash(value)
282
+ if value.is_a?(Array)
283
+ value.compact.map { |v| _to_hash(v) }
284
+ elsif value.is_a?(Hash)
285
+ {}.tap do |hash|
286
+ value.each { |k, v| hash[k] = _to_hash(v) }
287
+ end
288
+ elsif value.respond_to? :to_hash
289
+ value.to_hash
290
+ else
291
+ value
292
+ end
293
+ end
294
+
295
+ end
296
+
297
+ end
@@ -0,0 +1,234 @@
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://developer.fastly.com/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 ListInvoicesResponse
16
+ attr_accessor :data
17
+
18
+ attr_accessor :meta
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'data' => :'data',
24
+ :'meta' => :'meta'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.fastly_types
35
+ {
36
+ :'data' => :'Array<Invoice>',
37
+ :'meta' => :'Metadata'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.fastly_nullable
43
+ Set.new([
44
+ ])
45
+ end
46
+
47
+ # List of class defined in allOf (OpenAPI v3)
48
+ def self.fastly_all_of
49
+ [
50
+ :'Listinvoices'
51
+ ]
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ListInvoicesResponse` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ListInvoicesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'data')
70
+ if (value = attributes[:'data']).is_a?(Array)
71
+ self.data = value
72
+ end
73
+ end
74
+
75
+ if attributes.key?(:'meta')
76
+ self.meta = attributes[:'meta']
77
+ end
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properties with the reasons
82
+ def list_invalid_properties
83
+ invalid_properties = Array.new
84
+ invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ true
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ data == o.data &&
99
+ meta == o.meta
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(o)
105
+ self == o
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Integer] Hash code
110
+ def hash
111
+ [data, meta].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def self.build_from_hash(attributes)
118
+ new.build_from_hash(attributes)
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ self.class.fastly_types.each_pair do |key, type|
127
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
128
+ self.send("#{key}=", nil)
129
+ elsif type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ end
138
+ end
139
+
140
+ self
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def _deserialize(type, value)
148
+ case type.to_sym
149
+ when :Time
150
+ Time.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value.to_s
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :Boolean
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ # models (e.g. Pet) or oneOf
181
+ klass = Fastly.const_get(type)
182
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.fastly_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map { |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+
232
+ end
233
+
234
+ end