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,377 +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 LineItemData
16
- attr_accessor :amount
17
-
18
- # An alphanumeric string identifying the invoice.
19
- attr_accessor :aria_invoice_id
20
-
21
- attr_accessor :client_service_id
22
-
23
- attr_accessor :credit_coupon_code
24
-
25
- attr_accessor :description
26
-
27
- attr_accessor :id
28
-
29
- attr_accessor :line_number
30
-
31
- attr_accessor :plan_name
32
-
33
- attr_accessor :plan_no
34
-
35
- attr_accessor :rate_per_unit
36
-
37
- attr_accessor :rate_schedule_no
38
-
39
- attr_accessor :rate_schedule_tier_no
40
-
41
- attr_accessor :service_name
42
-
43
- attr_accessor :service_no
44
-
45
- attr_accessor :units
46
-
47
- attr_accessor :usage_type_cd
48
-
49
- attr_accessor :usage_type_no
50
-
51
- # Attribute mapping from ruby-style variable name to JSON key.
52
- def self.attribute_map
53
- {
54
- :'amount' => :'amount',
55
- :'aria_invoice_id' => :'aria_invoice_id',
56
- :'client_service_id' => :'client_service_id',
57
- :'credit_coupon_code' => :'credit_coupon_code',
58
- :'description' => :'description',
59
- :'id' => :'id',
60
- :'line_number' => :'line_number',
61
- :'plan_name' => :'plan_name',
62
- :'plan_no' => :'plan_no',
63
- :'rate_per_unit' => :'rate_per_unit',
64
- :'rate_schedule_no' => :'rate_schedule_no',
65
- :'rate_schedule_tier_no' => :'rate_schedule_tier_no',
66
- :'service_name' => :'service_name',
67
- :'service_no' => :'service_no',
68
- :'units' => :'units',
69
- :'usage_type_cd' => :'usage_type_cd',
70
- :'usage_type_no' => :'usage_type_no'
71
- }
72
- end
73
-
74
- # Returns all the JSON keys this model knows about
75
- def self.acceptable_attributes
76
- attribute_map.values
77
- end
78
-
79
- # Attribute type mapping.
80
- def self.fastly_types
81
- {
82
- :'amount' => :'Float',
83
- :'aria_invoice_id' => :'String',
84
- :'client_service_id' => :'String',
85
- :'credit_coupon_code' => :'String',
86
- :'description' => :'String',
87
- :'id' => :'String',
88
- :'line_number' => :'Integer',
89
- :'plan_name' => :'String',
90
- :'plan_no' => :'Float',
91
- :'rate_per_unit' => :'Float',
92
- :'rate_schedule_no' => :'Float',
93
- :'rate_schedule_tier_no' => :'Float',
94
- :'service_name' => :'String',
95
- :'service_no' => :'Float',
96
- :'units' => :'Float',
97
- :'usage_type_cd' => :'String',
98
- :'usage_type_no' => :'Float'
99
- }
100
- end
101
-
102
- # List of attributes with nullable: true
103
- def self.fastly_nullable
104
- Set.new([
105
- :'amount',
106
- :'aria_invoice_id',
107
- :'client_service_id',
108
- :'credit_coupon_code',
109
- :'description',
110
- :'line_number',
111
- :'plan_name',
112
- :'plan_no',
113
- :'rate_per_unit',
114
- :'rate_schedule_no',
115
- :'rate_schedule_tier_no',
116
- :'service_name',
117
- :'service_no',
118
- :'units',
119
- :'usage_type_cd',
120
- :'usage_type_no'
121
- ])
122
- end
123
-
124
- # Initializes the object
125
- # @param [Hash] attributes Model attributes in the form of hash
126
- def initialize(attributes = {})
127
- if (!attributes.is_a?(Hash))
128
- fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::LineItemData` initialize method"
129
- end
130
-
131
- # check to see if the attribute exists and convert string to symbol for hash key
132
- attributes = attributes.each_with_object({}) { |(k, v), h|
133
- if (!self.class.attribute_map.key?(k.to_sym))
134
- fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::LineItemData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
135
- end
136
- h[k.to_sym] = v
137
- }
138
-
139
- if attributes.key?(:'amount')
140
- self.amount = attributes[:'amount']
141
- end
142
-
143
- if attributes.key?(:'aria_invoice_id')
144
- self.aria_invoice_id = attributes[:'aria_invoice_id']
145
- end
146
-
147
- if attributes.key?(:'client_service_id')
148
- self.client_service_id = attributes[:'client_service_id']
149
- end
150
-
151
- if attributes.key?(:'credit_coupon_code')
152
- self.credit_coupon_code = attributes[:'credit_coupon_code']
153
- end
154
-
155
- if attributes.key?(:'description')
156
- self.description = attributes[:'description']
157
- end
158
-
159
- if attributes.key?(:'id')
160
- self.id = attributes[:'id']
161
- end
162
-
163
- if attributes.key?(:'line_number')
164
- self.line_number = attributes[:'line_number']
165
- end
166
-
167
- if attributes.key?(:'plan_name')
168
- self.plan_name = attributes[:'plan_name']
169
- end
170
-
171
- if attributes.key?(:'plan_no')
172
- self.plan_no = attributes[:'plan_no']
173
- end
174
-
175
- if attributes.key?(:'rate_per_unit')
176
- self.rate_per_unit = attributes[:'rate_per_unit']
177
- end
178
-
179
- if attributes.key?(:'rate_schedule_no')
180
- self.rate_schedule_no = attributes[:'rate_schedule_no']
181
- end
182
-
183
- if attributes.key?(:'rate_schedule_tier_no')
184
- self.rate_schedule_tier_no = attributes[:'rate_schedule_tier_no']
185
- end
186
-
187
- if attributes.key?(:'service_name')
188
- self.service_name = attributes[:'service_name']
189
- end
190
-
191
- if attributes.key?(:'service_no')
192
- self.service_no = attributes[:'service_no']
193
- end
194
-
195
- if attributes.key?(:'units')
196
- self.units = attributes[:'units']
197
- end
198
-
199
- if attributes.key?(:'usage_type_cd')
200
- self.usage_type_cd = attributes[:'usage_type_cd']
201
- end
202
-
203
- if attributes.key?(:'usage_type_no')
204
- self.usage_type_no = attributes[:'usage_type_no']
205
- end
206
- end
207
-
208
- # Show invalid properties with the reasons. Usually used together with valid?
209
- # @return Array for valid properties with the reasons
210
- def list_invalid_properties
211
- invalid_properties = Array.new
212
- invalid_properties
213
- end
214
-
215
- # Check to see if the all the properties in the model are valid
216
- # @return true if the model is valid
217
- def valid?
218
- true
219
- end
220
-
221
- # Checks equality by comparing each attribute.
222
- # @param [Object] Object to be compared
223
- def ==(o)
224
- return true if self.equal?(o)
225
- self.class == o.class &&
226
- amount == o.amount &&
227
- aria_invoice_id == o.aria_invoice_id &&
228
- client_service_id == o.client_service_id &&
229
- credit_coupon_code == o.credit_coupon_code &&
230
- description == o.description &&
231
- id == o.id &&
232
- line_number == o.line_number &&
233
- plan_name == o.plan_name &&
234
- plan_no == o.plan_no &&
235
- rate_per_unit == o.rate_per_unit &&
236
- rate_schedule_no == o.rate_schedule_no &&
237
- rate_schedule_tier_no == o.rate_schedule_tier_no &&
238
- service_name == o.service_name &&
239
- service_no == o.service_no &&
240
- units == o.units &&
241
- usage_type_cd == o.usage_type_cd &&
242
- usage_type_no == o.usage_type_no
243
- end
244
-
245
- # @see the `==` method
246
- # @param [Object] Object to be compared
247
- def eql?(o)
248
- self == o
249
- end
250
-
251
- # Calculates hash code according to all attributes.
252
- # @return [Integer] Hash code
253
- def hash
254
- [amount, aria_invoice_id, client_service_id, credit_coupon_code, description, id, line_number, plan_name, plan_no, rate_per_unit, rate_schedule_no, rate_schedule_tier_no, service_name, service_no, units, usage_type_cd, usage_type_no].hash
255
- end
256
-
257
- # Builds the object from hash
258
- # @param [Hash] attributes Model attributes in the form of hash
259
- # @return [Object] Returns the model itself
260
- def self.build_from_hash(attributes)
261
- new.build_from_hash(attributes)
262
- end
263
-
264
- # Builds the object from hash
265
- # @param [Hash] attributes Model attributes in the form of hash
266
- # @return [Object] Returns the model itself
267
- def build_from_hash(attributes)
268
- return nil unless attributes.is_a?(Hash)
269
- self.class.fastly_types.each_pair do |key, type|
270
- if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
271
- self.send("#{key}=", nil)
272
- elsif type =~ /\AArray<(.*)>/i
273
- # check to ensure the input is an array given that the attribute
274
- # is documented as an array but the input is not
275
- if attributes[self.class.attribute_map[key]].is_a?(Array)
276
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
277
- end
278
- elsif !attributes[self.class.attribute_map[key]].nil?
279
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
280
- end
281
- end
282
-
283
- self
284
- end
285
-
286
- # Deserializes the data based on type
287
- # @param string type Data type
288
- # @param string value Value to be deserialized
289
- # @return [Object] Deserialized data
290
- def _deserialize(type, value)
291
- case type.to_sym
292
- when :Time
293
- Time.parse(value)
294
- when :Date
295
- Date.parse(value)
296
- when :String
297
- value.to_s
298
- when :Integer
299
- value.to_i
300
- when :Float
301
- value.to_f
302
- when :Boolean
303
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
304
- true
305
- else
306
- false
307
- end
308
- when :Object
309
- # generic object (usually a Hash), return directly
310
- value
311
- when /\AArray<(?<inner_type>.+)>\z/
312
- inner_type = Regexp.last_match[:inner_type]
313
- value.map { |v| _deserialize(inner_type, v) }
314
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
315
- k_type = Regexp.last_match[:k_type]
316
- v_type = Regexp.last_match[:v_type]
317
- {}.tap do |hash|
318
- value.each do |k, v|
319
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
320
- end
321
- end
322
- else # model
323
- # models (e.g. Pet) or oneOf
324
- klass = Fastly.const_get(type)
325
- klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
326
- end
327
- end
328
-
329
- # Returns the string representation of the object
330
- # @return [String] String presentation of the object
331
- def to_s
332
- to_hash.to_s
333
- end
334
-
335
- # to_body is an alias to to_hash (backward compatibility)
336
- # @return [Hash] Returns the object in the form of hash
337
- def to_body
338
- to_hash
339
- end
340
-
341
- # Returns the object in the form of hash
342
- # @return [Hash] Returns the object in the form of hash
343
- def to_hash
344
- hash = {}
345
- self.class.attribute_map.each_pair do |attr, param|
346
- value = self.send(attr)
347
- if value.nil?
348
- is_nullable = self.class.fastly_nullable.include?(attr)
349
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
350
- end
351
-
352
- hash[param] = _to_hash(value)
353
- end
354
- hash
355
- end
356
-
357
- # Outputs non-array value in the form of hash
358
- # For object, use to_hash. Otherwise, just return the value
359
- # @param [Object] value Any valid value
360
- # @return [Hash] Returns the value in the form of hash
361
- def _to_hash(value)
362
- if value.is_a?(Array)
363
- value.compact.map { |v| _to_hash(v) }
364
- elsif value.is_a?(Hash)
365
- {}.tap do |hash|
366
- value.each { |k, v| hash[k] = _to_hash(v) }
367
- end
368
- elsif value.respond_to? :to_hash
369
- value.to_hash
370
- else
371
- value
372
- end
373
- end
374
-
375
- end
376
-
377
- end
@@ -1,276 +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 SchemasSnippetResponseCommon
16
- # Date and time in ISO 8601 format.
17
- attr_accessor :created_at
18
-
19
- # Date and time in ISO 8601 format.
20
- attr_accessor :deleted_at
21
-
22
- # Date and time in ISO 8601 format.
23
- attr_accessor :updated_at
24
-
25
- attr_accessor :service_id
26
-
27
- # String representing the number identifying a version of the service.
28
- attr_accessor :version
29
-
30
- attr_accessor :id
31
-
32
- # Attribute mapping from ruby-style variable name to JSON key.
33
- def self.attribute_map
34
- {
35
- :'created_at' => :'created_at',
36
- :'deleted_at' => :'deleted_at',
37
- :'updated_at' => :'updated_at',
38
- :'service_id' => :'service_id',
39
- :'version' => :'version',
40
- :'id' => :'id'
41
- }
42
- end
43
-
44
- # Returns all the JSON keys this model knows about
45
- def self.acceptable_attributes
46
- attribute_map.values
47
- end
48
-
49
- # Attribute type mapping.
50
- def self.fastly_types
51
- {
52
- :'created_at' => :'Time',
53
- :'deleted_at' => :'Time',
54
- :'updated_at' => :'Time',
55
- :'service_id' => :'String',
56
- :'version' => :'String',
57
- :'id' => :'String'
58
- }
59
- end
60
-
61
- # List of attributes with nullable: true
62
- def self.fastly_nullable
63
- Set.new([
64
- :'created_at',
65
- :'deleted_at',
66
- :'updated_at',
67
- ])
68
- end
69
-
70
- # List of class defined in allOf (OpenAPI v3)
71
- def self.fastly_all_of
72
- [
73
- :'SnippetResponseCommonAllOf',
74
- :'Timestamps'
75
- ]
76
- end
77
-
78
- # Initializes the object
79
- # @param [Hash] attributes Model attributes in the form of hash
80
- def initialize(attributes = {})
81
- if (!attributes.is_a?(Hash))
82
- fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::SchemasSnippetResponseCommon` initialize method"
83
- end
84
-
85
- # check to see if the attribute exists and convert string to symbol for hash key
86
- attributes = attributes.each_with_object({}) { |(k, v), h|
87
- if (!self.class.attribute_map.key?(k.to_sym))
88
- fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::SchemasSnippetResponseCommon`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
89
- end
90
- h[k.to_sym] = v
91
- }
92
-
93
- if attributes.key?(:'created_at')
94
- self.created_at = attributes[:'created_at']
95
- end
96
-
97
- if attributes.key?(:'deleted_at')
98
- self.deleted_at = attributes[:'deleted_at']
99
- end
100
-
101
- if attributes.key?(:'updated_at')
102
- self.updated_at = attributes[:'updated_at']
103
- end
104
-
105
- if attributes.key?(:'service_id')
106
- self.service_id = attributes[:'service_id']
107
- end
108
-
109
- if attributes.key?(:'version')
110
- self.version = attributes[:'version']
111
- end
112
-
113
- if attributes.key?(:'id')
114
- self.id = attributes[:'id']
115
- end
116
- end
117
-
118
- # Show invalid properties with the reasons. Usually used together with valid?
119
- # @return Array for valid properties with the reasons
120
- def list_invalid_properties
121
- invalid_properties = Array.new
122
- invalid_properties
123
- end
124
-
125
- # Check to see if the all the properties in the model are valid
126
- # @return true if the model is valid
127
- def valid?
128
- true
129
- end
130
-
131
- # Checks equality by comparing each attribute.
132
- # @param [Object] Object to be compared
133
- def ==(o)
134
- return true if self.equal?(o)
135
- self.class == o.class &&
136
- created_at == o.created_at &&
137
- deleted_at == o.deleted_at &&
138
- updated_at == o.updated_at &&
139
- service_id == o.service_id &&
140
- version == o.version &&
141
- id == o.id
142
- end
143
-
144
- # @see the `==` method
145
- # @param [Object] Object to be compared
146
- def eql?(o)
147
- self == o
148
- end
149
-
150
- # Calculates hash code according to all attributes.
151
- # @return [Integer] Hash code
152
- def hash
153
- [created_at, deleted_at, updated_at, service_id, version, id].hash
154
- end
155
-
156
- # Builds the object from hash
157
- # @param [Hash] attributes Model attributes in the form of hash
158
- # @return [Object] Returns the model itself
159
- def self.build_from_hash(attributes)
160
- new.build_from_hash(attributes)
161
- end
162
-
163
- # Builds the object from hash
164
- # @param [Hash] attributes Model attributes in the form of hash
165
- # @return [Object] Returns the model itself
166
- def build_from_hash(attributes)
167
- return nil unless attributes.is_a?(Hash)
168
- self.class.fastly_types.each_pair do |key, type|
169
- if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
170
- self.send("#{key}=", nil)
171
- elsif type =~ /\AArray<(.*)>/i
172
- # check to ensure the input is an array given that the attribute
173
- # is documented as an array but the input is not
174
- if attributes[self.class.attribute_map[key]].is_a?(Array)
175
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
176
- end
177
- elsif !attributes[self.class.attribute_map[key]].nil?
178
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
179
- end
180
- end
181
-
182
- self
183
- end
184
-
185
- # Deserializes the data based on type
186
- # @param string type Data type
187
- # @param string value Value to be deserialized
188
- # @return [Object] Deserialized data
189
- def _deserialize(type, value)
190
- case type.to_sym
191
- when :Time
192
- Time.parse(value)
193
- when :Date
194
- Date.parse(value)
195
- when :String
196
- value.to_s
197
- when :Integer
198
- value.to_i
199
- when :Float
200
- value.to_f
201
- when :Boolean
202
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
203
- true
204
- else
205
- false
206
- end
207
- when :Object
208
- # generic object (usually a Hash), return directly
209
- value
210
- when /\AArray<(?<inner_type>.+)>\z/
211
- inner_type = Regexp.last_match[:inner_type]
212
- value.map { |v| _deserialize(inner_type, v) }
213
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
214
- k_type = Regexp.last_match[:k_type]
215
- v_type = Regexp.last_match[:v_type]
216
- {}.tap do |hash|
217
- value.each do |k, v|
218
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
219
- end
220
- end
221
- else # model
222
- # models (e.g. Pet) or oneOf
223
- klass = Fastly.const_get(type)
224
- klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
225
- end
226
- end
227
-
228
- # Returns the string representation of the object
229
- # @return [String] String presentation of the object
230
- def to_s
231
- to_hash.to_s
232
- end
233
-
234
- # to_body is an alias to to_hash (backward compatibility)
235
- # @return [Hash] Returns the object in the form of hash
236
- def to_body
237
- to_hash
238
- end
239
-
240
- # Returns the object in the form of hash
241
- # @return [Hash] Returns the object in the form of hash
242
- def to_hash
243
- hash = {}
244
- self.class.attribute_map.each_pair do |attr, param|
245
- value = self.send(attr)
246
- if value.nil?
247
- is_nullable = self.class.fastly_nullable.include?(attr)
248
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
249
- end
250
-
251
- hash[param] = _to_hash(value)
252
- end
253
- hash
254
- end
255
-
256
- # Outputs non-array value in the form of hash
257
- # For object, use to_hash. Otherwise, just return the value
258
- # @param [Object] value Any valid value
259
- # @return [Hash] Returns the value in the form of hash
260
- def _to_hash(value)
261
- if value.is_a?(Array)
262
- value.compact.map { |v| _to_hash(v) }
263
- elsif value.is_a?(Hash)
264
- {}.tap do |hash|
265
- value.each { |k, v| hash[k] = _to_hash(v) }
266
- end
267
- elsif value.respond_to? :to_hash
268
- value.to_hash
269
- else
270
- value
271
- end
272
- end
273
-
274
- end
275
-
276
- end