fastly 10.0.0 → 11.0.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 (100) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -1
  3. data/Gemfile.lock +1 -1
  4. data/README.md +2 -5
  5. data/docs/AutomationToken.md +1 -1
  6. data/docs/AutomationTokenCreateRequestAttributes.md +1 -1
  7. data/docs/AutomationTokenCreateResponse.md +4 -6
  8. data/docs/AutomationTokenCreateResponseAllOf.md +3 -3
  9. data/docs/AutomationTokenResponse.md +4 -6
  10. data/docs/AutomationTokenResponseAllOf.md +4 -4
  11. data/docs/BillingUsageMetricsApi.md +11 -9
  12. data/docs/ComputeAclListEntriesMeta.md +1 -1
  13. data/docs/Header.md +2 -0
  14. data/docs/HeaderApi.md +8 -8
  15. data/docs/KvStoreItemApi.md +4 -4
  16. data/docs/LoggingAzureblobAdditional.md +1 -1
  17. data/docs/LoggingAzureblobApi.md +4 -4
  18. data/docs/LoggingAzureblobResponse.md +1 -1
  19. data/docs/Results.md +7 -0
  20. data/docs/SnippetApi.md +2 -2
  21. data/docs/{SnippetResponseCommonAllOf.md → SnippetResponseAllOf.md} +1 -1
  22. data/docs/TlsBulkCertificatesApi.md +4 -0
  23. data/lib/fastly/api/automation_tokens_api.rb +6 -6
  24. data/lib/fastly/api/billing_usage_metrics_api.rb +11 -8
  25. data/lib/fastly/api/header_api.rb +8 -8
  26. data/lib/fastly/api/kv_store_item_api.rb +5 -5
  27. data/lib/fastly/api/logging_azureblob_api.rb +4 -4
  28. data/lib/fastly/api/snippet_api.rb +3 -3
  29. data/lib/fastly/api/tls_bulk_certificates_api.rb +6 -0
  30. data/lib/fastly/configuration.rb +0 -18
  31. data/lib/fastly/models/automation_token.rb +1 -1
  32. data/lib/fastly/models/automation_token_create_request_attributes.rb +1 -1
  33. data/lib/fastly/models/automation_token_create_response.rb +21 -43
  34. data/lib/fastly/models/automation_token_create_response_all_of.rb +13 -12
  35. data/lib/fastly/models/automation_token_response.rb +24 -46
  36. data/lib/fastly/models/automation_token_response_all_of.rb +11 -10
  37. data/lib/fastly/models/compute_acl_list_entries_meta.rb +1 -1
  38. data/lib/fastly/models/header.rb +26 -4
  39. data/lib/fastly/models/header_response.rb +0 -1
  40. data/lib/fastly/models/logging_azureblob_additional.rb +1 -1
  41. data/lib/fastly/models/logging_azureblob_response.rb +1 -1
  42. data/lib/fastly/models/results.rb +71 -1
  43. data/lib/fastly/models/schemas_snippet_response.rb +3 -2
  44. data/lib/fastly/models/snippet.rb +0 -8
  45. data/lib/fastly/models/snippet_response.rb +2 -1
  46. data/lib/fastly/models/{snippet_response_common_all_of.rb → snippet_response_all_of.rb} +3 -3
  47. data/lib/fastly/version.rb +1 -1
  48. data/lib/fastly.rb +1 -26
  49. data/sig.json +1 -1
  50. metadata +4 -54
  51. data/docs/Billing.md +0 -16
  52. data/docs/BillingApi.md +0 -139
  53. data/docs/BillingBandwidth.md +0 -11
  54. data/docs/BillingBandwidthTiers.md +0 -14
  55. data/docs/BillingEstimateInvoiceId.md +0 -10
  56. data/docs/BillingEstimateLines.md +0 -10
  57. data/docs/BillingEstimateLinesLineItems.md +0 -18
  58. data/docs/BillingEstimateResponse.md +0 -18
  59. data/docs/BillingInvoiceId.md +0 -10
  60. data/docs/BillingRegions.md +0 -13
  61. data/docs/BillingResponse.md +0 -18
  62. data/docs/BillingResponseItemItemsData.md +0 -10
  63. data/docs/BillingResponseLineItem.md +0 -29
  64. data/docs/BillingStatus.md +0 -11
  65. data/docs/BillingTotal.md +0 -25
  66. data/docs/BillingTotalExtras.md +0 -12
  67. data/docs/HeaderResponseAdditional.md +0 -11
  68. data/docs/LineItemData.md +0 -26
  69. data/docs/SchemasSnippetResponseCommon.md +0 -15
  70. data/docs/SnippetAllOf.md +0 -10
  71. data/docs/SnippetCommon.md +0 -13
  72. data/docs/SnippetResponseCommon.md +0 -15
  73. data/docs/SnippetResponsePost.md +0 -20
  74. data/docs/SnippetWithDynamicNumber.md +0 -14
  75. data/docs/SnippetWithDynamicNumberAllOf.md +0 -10
  76. data/lib/fastly/api/billing_api.rb +0 -229
  77. data/lib/fastly/models/billing.rb +0 -278
  78. data/lib/fastly/models/billing_bandwidth.rb +0 -227
  79. data/lib/fastly/models/billing_bandwidth_tiers.rb +0 -252
  80. data/lib/fastly/models/billing_estimate_invoice_id.rb +0 -216
  81. data/lib/fastly/models/billing_estimate_lines.rb +0 -218
  82. data/lib/fastly/models/billing_estimate_lines_line_items.rb +0 -288
  83. data/lib/fastly/models/billing_estimate_response.rb +0 -307
  84. data/lib/fastly/models/billing_invoice_id.rb +0 -216
  85. data/lib/fastly/models/billing_regions.rb +0 -243
  86. data/lib/fastly/models/billing_response.rb +0 -307
  87. data/lib/fastly/models/billing_response_item_items_data.rb +0 -218
  88. data/lib/fastly/models/billing_response_line_item.rb +0 -418
  89. data/lib/fastly/models/billing_status.rb +0 -262
  90. data/lib/fastly/models/billing_total.rb +0 -371
  91. data/lib/fastly/models/billing_total_extras.rb +0 -237
  92. data/lib/fastly/models/header_response_additional.rb +0 -229
  93. data/lib/fastly/models/line_item_data.rb +0 -377
  94. data/lib/fastly/models/schemas_snippet_response_common.rb +0 -276
  95. data/lib/fastly/models/snippet_all_of.rb +0 -251
  96. data/lib/fastly/models/snippet_common.rb +0 -284
  97. data/lib/fastly/models/snippet_response_common.rb +0 -276
  98. data/lib/fastly/models/snippet_response_post.rb +0 -375
  99. data/lib/fastly/models/snippet_with_dynamic_number.rb +0 -314
  100. data/lib/fastly/models/snippet_with_dynamic_number_all_of.rb +0 -251
@@ -1,314 +0,0 @@
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 SnippetWithDynamicNumber
16
- # The name for the snippet.
17
- attr_accessor :name
18
-
19
- # The location in generated VCL where the snippet should be placed.
20
- attr_accessor :type
21
-
22
- # The VCL code that specifies exactly what the snippet does.
23
- attr_accessor :content
24
-
25
- # Priority determines execution order. Lower numbers execute first.
26
- attr_accessor :priority
27
-
28
- # Sets the snippet version.
29
- attr_accessor :dynamic
30
-
31
- class EnumAttributeValidator
32
- attr_reader :datatype
33
- attr_reader :allowable_values
34
-
35
- def initialize(datatype, allowable_values)
36
- @allowable_values = allowable_values.map do |value|
37
- case datatype.to_s
38
- when /Integer/i
39
- value.to_i
40
- when /Float/i
41
- value.to_f
42
- else
43
- value
44
- end
45
- end
46
- end
47
-
48
- def valid?(value)
49
- !value || allowable_values.include?(value)
50
- end
51
- end
52
-
53
- # Attribute mapping from ruby-style variable name to JSON key.
54
- def self.attribute_map
55
- {
56
- :'name' => :'name',
57
- :'type' => :'type',
58
- :'content' => :'content',
59
- :'priority' => :'priority',
60
- :'dynamic' => :'dynamic'
61
- }
62
- end
63
-
64
- # Returns all the JSON keys this model knows about
65
- def self.acceptable_attributes
66
- attribute_map.values
67
- end
68
-
69
- # Attribute type mapping.
70
- def self.fastly_types
71
- {
72
- :'name' => :'String',
73
- :'type' => :'String',
74
- :'content' => :'String',
75
- :'priority' => :'String',
76
- :'dynamic' => :'Float'
77
- }
78
- end
79
-
80
- # List of attributes with nullable: true
81
- def self.fastly_nullable
82
- Set.new([
83
- :'content',
84
- ])
85
- end
86
-
87
- # List of class defined in allOf (OpenAPI v3)
88
- def self.fastly_all_of
89
- [
90
- :'SnippetCommon',
91
- :'SnippetWithDynamicNumberAllOf'
92
- ]
93
- end
94
-
95
- # Initializes the object
96
- # @param [Hash] attributes Model attributes in the form of hash
97
- def initialize(attributes = {})
98
- if (!attributes.is_a?(Hash))
99
- fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::SnippetWithDynamicNumber` initialize method"
100
- end
101
-
102
- # check to see if the attribute exists and convert string to symbol for hash key
103
- attributes = attributes.each_with_object({}) { |(k, v), h|
104
- if (!self.class.attribute_map.key?(k.to_sym))
105
- fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::SnippetWithDynamicNumber`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
106
- end
107
- h[k.to_sym] = v
108
- }
109
-
110
- if attributes.key?(:'name')
111
- self.name = attributes[:'name']
112
- end
113
-
114
- if attributes.key?(:'type')
115
- self.type = attributes[:'type']
116
- end
117
-
118
- if attributes.key?(:'content')
119
- self.content = attributes[:'content']
120
- end
121
-
122
- if attributes.key?(:'priority')
123
- self.priority = attributes[:'priority']
124
- else
125
- self.priority = '100'
126
- end
127
-
128
- if attributes.key?(:'dynamic')
129
- self.dynamic = attributes[:'dynamic']
130
- end
131
- end
132
-
133
- # Show invalid properties with the reasons. Usually used together with valid?
134
- # @return Array for valid properties with the reasons
135
- def list_invalid_properties
136
- invalid_properties = Array.new
137
- invalid_properties
138
- end
139
-
140
- # Check to see if the all the properties in the model are valid
141
- # @return true if the model is valid
142
- def valid?
143
- type_validator = EnumAttributeValidator.new('String', ["init", "recv", "hash", "hit", "miss", "pass", "fetch", "error", "deliver", "log", "none"])
144
- return false unless type_validator.valid?(@type)
145
- dynamic_validator = EnumAttributeValidator.new('Float', [0, 1])
146
- return false unless dynamic_validator.valid?(@dynamic)
147
- true
148
- end
149
-
150
- # Custom attribute writer method checking allowed values (enum).
151
- # @param [Object] type Object to be assigned
152
- def type=(type)
153
- validator = EnumAttributeValidator.new('String', ["init", "recv", "hash", "hit", "miss", "pass", "fetch", "error", "deliver", "log", "none"])
154
- unless validator.valid?(type)
155
- fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
156
- end
157
- @type = type
158
- end
159
-
160
- # Custom attribute writer method checking allowed values (enum).
161
- # @param [Object] dynamic Object to be assigned
162
- def dynamic=(dynamic)
163
- validator = EnumAttributeValidator.new('Float', [0, 1])
164
- unless validator.valid?(dynamic)
165
- fail ArgumentError, "invalid value for \"dynamic\", must be one of #{validator.allowable_values}."
166
- end
167
- @dynamic = dynamic
168
- end
169
-
170
- # Checks equality by comparing each attribute.
171
- # @param [Object] Object to be compared
172
- def ==(o)
173
- return true if self.equal?(o)
174
- self.class == o.class &&
175
- name == o.name &&
176
- type == o.type &&
177
- content == o.content &&
178
- priority == o.priority &&
179
- dynamic == o.dynamic
180
- end
181
-
182
- # @see the `==` method
183
- # @param [Object] Object to be compared
184
- def eql?(o)
185
- self == o
186
- end
187
-
188
- # Calculates hash code according to all attributes.
189
- # @return [Integer] Hash code
190
- def hash
191
- [name, type, content, priority, dynamic].hash
192
- end
193
-
194
- # Builds the object from hash
195
- # @param [Hash] attributes Model attributes in the form of hash
196
- # @return [Object] Returns the model itself
197
- def self.build_from_hash(attributes)
198
- new.build_from_hash(attributes)
199
- end
200
-
201
- # Builds the object from hash
202
- # @param [Hash] attributes Model attributes in the form of hash
203
- # @return [Object] Returns the model itself
204
- def build_from_hash(attributes)
205
- return nil unless attributes.is_a?(Hash)
206
- self.class.fastly_types.each_pair do |key, type|
207
- if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
208
- self.send("#{key}=", nil)
209
- elsif type =~ /\AArray<(.*)>/i
210
- # check to ensure the input is an array given that the attribute
211
- # is documented as an array but the input is not
212
- if attributes[self.class.attribute_map[key]].is_a?(Array)
213
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
214
- end
215
- elsif !attributes[self.class.attribute_map[key]].nil?
216
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
217
- end
218
- end
219
-
220
- self
221
- end
222
-
223
- # Deserializes the data based on type
224
- # @param string type Data type
225
- # @param string value Value to be deserialized
226
- # @return [Object] Deserialized data
227
- def _deserialize(type, value)
228
- case type.to_sym
229
- when :Time
230
- Time.parse(value)
231
- when :Date
232
- Date.parse(value)
233
- when :String
234
- value.to_s
235
- when :Integer
236
- value.to_i
237
- when :Float
238
- value.to_f
239
- when :Boolean
240
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
241
- true
242
- else
243
- false
244
- end
245
- when :Object
246
- # generic object (usually a Hash), return directly
247
- value
248
- when /\AArray<(?<inner_type>.+)>\z/
249
- inner_type = Regexp.last_match[:inner_type]
250
- value.map { |v| _deserialize(inner_type, v) }
251
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
252
- k_type = Regexp.last_match[:k_type]
253
- v_type = Regexp.last_match[:v_type]
254
- {}.tap do |hash|
255
- value.each do |k, v|
256
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
257
- end
258
- end
259
- else # model
260
- # models (e.g. Pet) or oneOf
261
- klass = Fastly.const_get(type)
262
- klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
263
- end
264
- end
265
-
266
- # Returns the string representation of the object
267
- # @return [String] String presentation of the object
268
- def to_s
269
- to_hash.to_s
270
- end
271
-
272
- # to_body is an alias to to_hash (backward compatibility)
273
- # @return [Hash] Returns the object in the form of hash
274
- def to_body
275
- to_hash
276
- end
277
-
278
- # Returns the object in the form of hash
279
- # @return [Hash] Returns the object in the form of hash
280
- def to_hash
281
- hash = {}
282
- self.class.attribute_map.each_pair do |attr, param|
283
- value = self.send(attr)
284
- if value.nil?
285
- is_nullable = self.class.fastly_nullable.include?(attr)
286
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
287
- end
288
-
289
- hash[param] = _to_hash(value)
290
- end
291
- hash
292
- end
293
-
294
- # Outputs non-array value in the form of hash
295
- # For object, use to_hash. Otherwise, just return the value
296
- # @param [Object] value Any valid value
297
- # @return [Hash] Returns the value in the form of hash
298
- def _to_hash(value)
299
- if value.is_a?(Array)
300
- value.compact.map { |v| _to_hash(v) }
301
- elsif value.is_a?(Hash)
302
- {}.tap do |hash|
303
- value.each { |k, v| hash[k] = _to_hash(v) }
304
- end
305
- elsif value.respond_to? :to_hash
306
- value.to_hash
307
- else
308
- value
309
- end
310
- end
311
-
312
- end
313
-
314
- end
@@ -1,251 +0,0 @@
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 SnippetWithDynamicNumberAllOf
16
- # Sets the snippet version.
17
- attr_accessor :dynamic
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
- :'dynamic' => :'dynamic'
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
- :'dynamic' => :'Float'
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::SnippetWithDynamicNumberAllOf` 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::SnippetWithDynamicNumberAllOf`. 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?(:'dynamic')
82
- self.dynamic = attributes[:'dynamic']
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
- dynamic_validator = EnumAttributeValidator.new('Float', [0, 1])
97
- return false unless dynamic_validator.valid?(@dynamic)
98
- true
99
- end
100
-
101
- # Custom attribute writer method checking allowed values (enum).
102
- # @param [Object] dynamic Object to be assigned
103
- def dynamic=(dynamic)
104
- validator = EnumAttributeValidator.new('Float', [0, 1])
105
- unless validator.valid?(dynamic)
106
- fail ArgumentError, "invalid value for \"dynamic\", must be one of #{validator.allowable_values}."
107
- end
108
- @dynamic = dynamic
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
- dynamic == o.dynamic
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
- [dynamic].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