fastly 5.3.0 → 5.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c3742c86b7a3ebb49a32c347d3d861c1b5283e29cec0275b53bf805aba8a971
4
- data.tar.gz: 9efd52c7c9ceba6560182a942a2df7e574c68a637e2370e06b146c38f7d9ec28
3
+ metadata.gz: b38a491618944f861e22226af46994f0f191cdb23fd34eaae6f7396d014a9682
4
+ data.tar.gz: 4fd97cc8a1bda9eedd210405d58030661c05eec4dee93fc1542718faaf40b777
5
5
  SHA512:
6
- metadata.gz: d984ff4c06039d109d4dac339b9ced309929c92212f9a08c08d475e8f1dc03372642cab2583ce2e8cd7326eff1919ee50ca429d8086b0207d2d5914768c149ce
7
- data.tar.gz: 6adb541facd607662f32f504598f6109f343903bd2b15f864d01f3e3ce475d33599e38884d4fc9cb6391bd92726e3c5e43d89a6cc48335599191541f1b715d94
6
+ metadata.gz: 4250762ba0be3bae93b6a2b7a8a2a80a2fa1a402e202c6c2b9e1169ae346b7ae67652fbd2d43e1364e91f303e5e5575b2f6c387ac186460cf9643aa8cada5fb4
7
+ data.tar.gz: 80408232d3678508bba1779c0fed55c845627d8da8a54e5e9ab7127f046fafeb5a32824c715373541528327673a8d56ff10c8d11ef4c6d074d14af020045953f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [v5.3.1](https://github.com/fastly/fastly-ruby/releases/tag/release/v5.3.1) (2023-07-05)
4
+
5
+ **Bug fixes:**
6
+
7
+ - fix(snippet): dynamic field switched from int to string.
8
+ - fix(vcl): implement correct response models.
9
+
3
10
  ## [v5.3.0](https://github.com/fastly/fastly-ruby/releases/tag/release/v5.3.0) (2023-06-27)
4
11
 
5
12
  **Enhancements:**
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fastly (5.3.0)
4
+ fastly (5.3.1)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -8,7 +8,7 @@ A Ruby client library for interacting with most facets of the [Fastly API](https
8
8
  To install via RubyGems, add the following to your project's `Gemfile`:
9
9
 
10
10
  ```ruby
11
- gem 'fastly', '~> 5.3.0'
11
+ gem 'fastly', '~> 5.3.1'
12
12
  ```
13
13
 
14
14
  Then run `bundle install`.
@@ -509,6 +509,7 @@ The fastly-ruby API client currently does not support the following endpoints:
509
509
  - [`/customer/{customer_id}/contacts`](https://developer.fastly.com/reference/api/account/contact) (POST)
510
510
  - [`/metrics/domains/services/{service_id}`](https://developer.fastly.com/reference/api/metrics-stats/domain-inspector/historical) (GET)
511
511
  - [`/metrics/origins/services/{service_id}`](https://developer.fastly.com/reference/api/metrics-stats/origin-inspector/historical) (GET)
512
+ - [`/resources/stores/kv/{store_id}/batch`](https://developer.fastly.com/reference/api/services/resources/kv-store-item) (PUT)
512
513
  - [`/resources/stores/secret/client-key`](https://developer.fastly.com/reference/api/services/resources/secret-store) (POST)
513
514
  - [`/resources/stores/secret/signing-key`](https://developer.fastly.com/reference/api/services/resources/secret-store) (GET)
514
515
  - [`/resources/stores/secret/{store_id}/secrets/{secret_name}`](https://developer.fastly.com/reference/api/services/resources/secret) (DELETE, GET)
data/docs/Batch.md ADDED
@@ -0,0 +1,12 @@
1
+ # Fastly::Batch
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **title** | **String** | A descriptor for the response of the entire batch | [optional] |
8
+ | **type** | **String** | If an error is present in any of the requests, this field will describe that error | [optional] |
9
+ | **errors** | [**Array<BatchErrors>**](BatchErrors.md) | Per-key errors which failed to parse, validate, or otherwise transmit | [optional] |
10
+
11
+ [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
12
+
@@ -0,0 +1,13 @@
1
+ # Fastly::BatchErrors
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **key** | **String** | The key that the error corresponds to. This field will be empty if the object or one of its fields was unable to be parsed. | [optional] |
8
+ | **index** | **Integer** | The line number of the payload on which the error occurred (starting from 0 for the first line). | [optional] |
9
+ | **code** | **String** | The HTTP response code for the request, or a 400 if the request was not able to be completed. | [optional] |
10
+ | **reason** | **String** | A descriptor of this particular item's error. | [optional] |
11
+
12
+ [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
13
+
@@ -5,7 +5,7 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **name** | **String** | The name for the snippet. | [optional] |
8
- | **dynamic** | **Integer** | Sets the snippet version. | [optional] |
8
+ | **dynamic** | **String** | Sets the snippet version. | [optional] |
9
9
  | **type** | **String** | The location in generated VCL where the snippet should be placed. | [optional] |
10
10
  | **content** | **String** | The VCL code that specifies exactly what the snippet does. | [optional] |
11
11
  | **priority** | **String** | Priority determines execution order. Lower numbers execute first. | [optional][default to '100'] |
data/docs/Snippet.md CHANGED
@@ -5,7 +5,7 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **name** | **String** | The name for the snippet. | [optional] |
8
- | **dynamic** | **Integer** | Sets the snippet version. | [optional] |
8
+ | **dynamic** | **String** | Sets the snippet version. | [optional] |
9
9
  | **type** | **String** | The location in generated VCL where the snippet should be placed. | [optional] |
10
10
  | **content** | **String** | The VCL code that specifies exactly what the snippet does. | [optional] |
11
11
  | **priority** | **String** | Priority determines execution order. Lower numbers execute first. | [optional][default to '100'] |
data/docs/SnippetApi.md CHANGED
@@ -34,7 +34,7 @@ opts = {
34
34
  service_id: 'service_id_example', # String | Alphanumeric string identifying the service.
35
35
  version_id: 56, # Integer | Integer identifying a service version.
36
36
  name: 'name_example', # String | The name for the snippet.
37
- dynamic: 0, # Integer | Sets the snippet version.
37
+ dynamic: '0', # String | Sets the snippet version.
38
38
  type: 'init', # String | The location in generated VCL where the snippet should be placed.
39
39
  content: 'content_example', # String | The VCL code that specifies exactly what the snippet does.
40
40
  priority: 'priority_example', # String | Priority determines execution order. Lower numbers execute first.
@@ -56,7 +56,7 @@ end
56
56
  | **service_id** | **String** | Alphanumeric string identifying the service. | |
57
57
  | **version_id** | **Integer** | Integer identifying a service version. | |
58
58
  | **name** | **String** | The name for the snippet. | [optional] |
59
- | **dynamic** | **Integer** | Sets the snippet version. | [optional] |
59
+ | **dynamic** | **String** | Sets the snippet version. | [optional] |
60
60
  | **type** | **String** | The location in generated VCL where the snippet should be placed. | [optional] |
61
61
  | **content** | **String** | The VCL code that specifies exactly what the snippet does. | [optional] |
62
62
  | **priority** | **String** | Priority determines execution order. Lower numbers execute first. | [optional][default to '100'] |
@@ -243,7 +243,7 @@ opts = {
243
243
  service_id: 'service_id_example', # String | Alphanumeric string identifying the service.
244
244
  snippet_id: 'snippet_id_example', # String | Alphanumeric string identifying a VCL Snippet.
245
245
  name: 'name_example', # String | The name for the snippet.
246
- dynamic: 0, # Integer | Sets the snippet version.
246
+ dynamic: '0', # String | Sets the snippet version.
247
247
  type: 'init', # String | The location in generated VCL where the snippet should be placed.
248
248
  content: 'content_example', # String | The VCL code that specifies exactly what the snippet does.
249
249
  priority: 'priority_example', # String | Priority determines execution order. Lower numbers execute first.
@@ -265,7 +265,7 @@ end
265
265
  | **service_id** | **String** | Alphanumeric string identifying the service. | |
266
266
  | **snippet_id** | **String** | Alphanumeric string identifying a VCL Snippet. | |
267
267
  | **name** | **String** | The name for the snippet. | [optional] |
268
- | **dynamic** | **Integer** | Sets the snippet version. | [optional] |
268
+ | **dynamic** | **String** | Sets the snippet version. | [optional] |
269
269
  | **type** | **String** | The location in generated VCL where the snippet should be placed. | [optional] |
270
270
  | **content** | **String** | The VCL code that specifies exactly what the snippet does. | [optional] |
271
271
  | **priority** | **String** | Priority determines execution order. Lower numbers execute first. | [optional][default to '100'] |
@@ -5,7 +5,7 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **name** | **String** | The name for the snippet. | [optional] |
8
- | **dynamic** | **Integer** | Sets the snippet version. | [optional] |
8
+ | **dynamic** | **String** | Sets the snippet version. | [optional] |
9
9
  | **type** | **String** | The location in generated VCL where the snippet should be placed. | [optional] |
10
10
  | **content** | **String** | The VCL code that specifies exactly what the snippet does. | [optional] |
11
11
  | **priority** | **String** | Priority determines execution order. Lower numbers execute first. | [optional][default to '100'] |
@@ -0,0 +1,9 @@
1
+ # Fastly::TokensAdditionalProps
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+
8
+ [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
9
+
@@ -4,11 +4,7 @@
4
4
 
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
- | **msg** | **String** | | [optional] |
8
- | **status** | **String** | | [optional] |
9
- | **errors** | **Array<String>** | | [optional] |
10
- | **warnings** | **Array<String>** | | [optional] |
11
- | **messages** | [**Array<ValidatorResultMessages>**](ValidatorResultMessages.md) | | [optional] |
7
+ | **data** | [**ValidatorResultData**](ValidatorResultData.md) | | [optional] |
12
8
 
13
9
  [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
14
10
 
@@ -0,0 +1,12 @@
1
+ # Fastly::ValidatorResultData
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **id** | **String** | | [optional] |
8
+ | **type** | **String** | | [optional] |
9
+ | **attributes** | [**ValidatorResultDataAttributes**](ValidatorResultDataAttributes.md) | | [optional] |
10
+
11
+ [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
12
+
@@ -0,0 +1,14 @@
1
+ # Fastly::ValidatorResultDataAttributes
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **msg** | **String** | | [optional] |
8
+ | **status** | **String** | | [optional] |
9
+ | **errors** | **Array<String>** | | [optional] |
10
+ | **warnings** | **Array<String>** | | [optional] |
11
+ | **messages** | [**Array<ValidatorResultDataAttributesMessages>**](ValidatorResultDataAttributesMessages.md) | | [optional] |
12
+
13
+ [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
14
+
@@ -1,4 +1,4 @@
1
- # Fastly::ValidatorResultMessages
1
+ # Fastly::ValidatorResultDataAttributesMessages
2
2
 
3
3
  ## Properties
4
4
 
@@ -7,7 +7,7 @@
7
7
  | **type** | **String** | | |
8
8
  | **warning** | **Boolean** | | |
9
9
  | **message** | **String** | | |
10
- | **tokens** | **Array<Hash<String, AnyOfstringnumber>>** | | |
10
+ | **tokens** | **Array<Hash<String, TokensAdditionalProps>>** | | |
11
11
 
12
12
  [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
13
13
 
data/docs/VclApi.md CHANGED
@@ -235,7 +235,7 @@ end
235
235
  ## `get_custom_vcl_generated_highlighted()`
236
236
 
237
237
  ```ruby
238
- get_custom_vcl_generated_highlighted(opts) # Get the generated VCL with syntax highlighting
238
+ get_custom_vcl_generated_highlighted(opts): <VclSyntaxHighlightingResponse> # Get the generated VCL with syntax highlighting
239
239
  ```
240
240
 
241
241
  Display the content of generated VCL with HTML syntax highlighting. Include line numbers by sending `lineno=true` as a request parameter.
@@ -251,7 +251,8 @@ opts = {
251
251
 
252
252
  begin
253
253
  # Get the generated VCL with syntax highlighting
254
- api_instance.get_custom_vcl_generated_highlighted(opts)
254
+ result = api_instance.get_custom_vcl_generated_highlighted(opts)
255
+ p result
255
256
  rescue Fastly::ApiError => e
256
257
  puts "Error when calling VclApi->get_custom_vcl_generated_highlighted: #{e}"
257
258
  end
@@ -266,14 +267,14 @@ end
266
267
 
267
268
  ### Return type
268
269
 
269
- nil (empty response body)
270
+ [**VclSyntaxHighlightingResponse**](VclSyntaxHighlightingResponse.md)
270
271
 
271
272
  [[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
272
273
  [[Back to README]](../../README.md)
273
274
  ## `get_custom_vcl_highlighted()`
274
275
 
275
276
  ```ruby
276
- get_custom_vcl_highlighted(opts) # Get a custom VCL file with syntax highlighting
277
+ get_custom_vcl_highlighted(opts): <VclSyntaxHighlightingResponse> # Get a custom VCL file with syntax highlighting
277
278
  ```
278
279
 
279
280
  Get the uploaded VCL for a particular service and version with HTML syntax highlighting. Include line numbers by sending `lineno=true` as a request parameter.
@@ -290,7 +291,8 @@ opts = {
290
291
 
291
292
  begin
292
293
  # Get a custom VCL file with syntax highlighting
293
- api_instance.get_custom_vcl_highlighted(opts)
294
+ result = api_instance.get_custom_vcl_highlighted(opts)
295
+ p result
294
296
  rescue Fastly::ApiError => e
295
297
  puts "Error when calling VclApi->get_custom_vcl_highlighted: #{e}"
296
298
  end
@@ -306,7 +308,7 @@ end
306
308
 
307
309
  ### Return type
308
310
 
309
- nil (empty response body)
311
+ [**VclSyntaxHighlightingResponse**](VclSyntaxHighlightingResponse.md)
310
312
 
311
313
  [[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
312
314
  [[Back to README]](../../README.md)
@@ -0,0 +1,10 @@
1
+ # Fastly::VclSyntaxHighlightingResponse
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **content** | **String** | VCL with HTML syntax highlighting. | [optional] |
8
+
9
+ [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
10
+
@@ -22,7 +22,7 @@ module Fastly
22
22
  # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
23
23
  # @option opts [Integer] :version_id Integer identifying a service version. (required)
24
24
  # @option opts [String] :name The name for the snippet.
25
- # @option opts [Integer] :dynamic Sets the snippet version.
25
+ # @option opts [String] :dynamic Sets the snippet version.
26
26
  # @option opts [String] :type The location in generated VCL where the snippet should be placed.
27
27
  # @option opts [String] :content The VCL code that specifies exactly what the snippet does.
28
28
  # @option opts [String] :priority Priority determines execution order. Lower numbers execute first. (default to '100')
@@ -37,7 +37,7 @@ module Fastly
37
37
  # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
38
38
  # @option opts [Integer] :version_id Integer identifying a service version. (required)
39
39
  # @option opts [String] :name The name for the snippet.
40
- # @option opts [Integer] :dynamic Sets the snippet version.
40
+ # @option opts [String] :dynamic Sets the snippet version.
41
41
  # @option opts [String] :type The location in generated VCL where the snippet should be placed.
42
42
  # @option opts [String] :content The VCL code that specifies exactly what the snippet does.
43
43
  # @option opts [String] :priority Priority determines execution order. Lower numbers execute first. (default to '100')
@@ -57,7 +57,7 @@ module Fastly
57
57
  if @api_client.config.client_side_validation && version_id.nil?
58
58
  fail ArgumentError, "Missing the required parameter 'version_id' when calling SnippetApi.create_snippet"
59
59
  end
60
- allowable_values = [0, 1]
60
+ allowable_values = ["0", "1"]
61
61
  if @api_client.config.client_side_validation && opts[:'dynamic'] && !allowable_values.include?(opts[:'dynamic'])
62
62
  fail ArgumentError, "invalid value for \"dynamic\", must be one of #{allowable_values}"
63
63
  end
@@ -414,7 +414,7 @@ module Fastly
414
414
  # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
415
415
  # @option opts [String] :snippet_id Alphanumeric string identifying a VCL Snippet. (required)
416
416
  # @option opts [String] :name The name for the snippet.
417
- # @option opts [Integer] :dynamic Sets the snippet version.
417
+ # @option opts [String] :dynamic Sets the snippet version.
418
418
  # @option opts [String] :type The location in generated VCL where the snippet should be placed.
419
419
  # @option opts [String] :content The VCL code that specifies exactly what the snippet does.
420
420
  # @option opts [String] :priority Priority determines execution order. Lower numbers execute first. (default to '100')
@@ -429,7 +429,7 @@ module Fastly
429
429
  # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
430
430
  # @option opts [String] :snippet_id Alphanumeric string identifying a VCL Snippet. (required)
431
431
  # @option opts [String] :name The name for the snippet.
432
- # @option opts [Integer] :dynamic Sets the snippet version.
432
+ # @option opts [String] :dynamic Sets the snippet version.
433
433
  # @option opts [String] :type The location in generated VCL where the snippet should be placed.
434
434
  # @option opts [String] :content The VCL code that specifies exactly what the snippet does.
435
435
  # @option opts [String] :priority Priority determines execution order. Lower numbers execute first. (default to '100')
@@ -449,7 +449,7 @@ module Fastly
449
449
  if @api_client.config.client_side_validation && snippet_id.nil?
450
450
  fail ArgumentError, "Missing the required parameter 'snippet_id' when calling SnippetApi.update_snippet_dynamic"
451
451
  end
452
- allowable_values = [0, 1]
452
+ allowable_values = ["0", "1"]
453
453
  if @api_client.config.client_side_validation && opts[:'dynamic'] && !allowable_values.include?(opts[:'dynamic'])
454
454
  fail ArgumentError, "invalid value for \"dynamic\", must be one of #{allowable_values}"
455
455
  end
@@ -402,17 +402,17 @@ module Fastly
402
402
  # Display the content of generated VCL with HTML syntax highlighting. Include line numbers by sending `lineno=true` as a request parameter.
403
403
  # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
404
404
  # @option opts [Integer] :version_id Integer identifying a service version. (required)
405
- # @return [nil]
405
+ # @return [VclSyntaxHighlightingResponse]
406
406
  def get_custom_vcl_generated_highlighted(opts = {})
407
- get_custom_vcl_generated_highlighted_with_http_info(opts)
408
- nil
407
+ data, _status_code, _headers = get_custom_vcl_generated_highlighted_with_http_info(opts)
408
+ data
409
409
  end
410
410
 
411
411
  # Get the generated VCL with syntax highlighting
412
412
  # Display the content of generated VCL with HTML syntax highlighting. Include line numbers by sending &#x60;lineno&#x3D;true&#x60; as a request parameter.
413
413
  # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
414
414
  # @option opts [Integer] :version_id Integer identifying a service version. (required)
415
- # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
415
+ # @return [Array<(VclSyntaxHighlightingResponse, Integer, Hash)>] VclSyntaxHighlightingResponse data, response status code and response headers
416
416
  def get_custom_vcl_generated_highlighted_with_http_info(opts = {})
417
417
  if @api_client.config.debugging
418
418
  @api_client.config.logger.debug 'Calling API: VclApi.get_custom_vcl_generated_highlighted ...'
@@ -446,7 +446,7 @@ module Fastly
446
446
  post_body = opts[:debug_body]
447
447
 
448
448
  # return_type
449
- return_type = opts[:debug_return_type]
449
+ return_type = opts[:debug_return_type] || 'VclSyntaxHighlightingResponse'
450
450
 
451
451
  # auth_names
452
452
  auth_names = opts[:debug_auth_names] || ['token']
@@ -473,10 +473,10 @@ module Fastly
473
473
  # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
474
474
  # @option opts [Integer] :version_id Integer identifying a service version. (required)
475
475
  # @option opts [String] :vcl_name The name of this VCL. (required)
476
- # @return [nil]
476
+ # @return [VclSyntaxHighlightingResponse]
477
477
  def get_custom_vcl_highlighted(opts = {})
478
- get_custom_vcl_highlighted_with_http_info(opts)
479
- nil
478
+ data, _status_code, _headers = get_custom_vcl_highlighted_with_http_info(opts)
479
+ data
480
480
  end
481
481
 
482
482
  # Get a custom VCL file with syntax highlighting
@@ -484,7 +484,7 @@ module Fastly
484
484
  # @option opts [String] :service_id Alphanumeric string identifying the service. (required)
485
485
  # @option opts [Integer] :version_id Integer identifying a service version. (required)
486
486
  # @option opts [String] :vcl_name The name of this VCL. (required)
487
- # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
487
+ # @return [Array<(VclSyntaxHighlightingResponse, Integer, Hash)>] VclSyntaxHighlightingResponse data, response status code and response headers
488
488
  def get_custom_vcl_highlighted_with_http_info(opts = {})
489
489
  if @api_client.config.debugging
490
490
  @api_client.config.logger.debug 'Calling API: VclApi.get_custom_vcl_highlighted ...'
@@ -523,7 +523,7 @@ module Fastly
523
523
  post_body = opts[:debug_body]
524
524
 
525
525
  # return_type
526
- return_type = opts[:debug_return_type]
526
+ return_type = opts[:debug_return_type] || 'VclSyntaxHighlightingResponse'
527
527
 
528
528
  # auth_names
529
529
  auth_names = opts[:debug_auth_names] || ['token']
@@ -0,0 +1,239 @@
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 Batch
16
+ # A descriptor for the response of the entire batch
17
+ attr_accessor :title
18
+
19
+ # If an error is present in any of the requests, this field will describe that error
20
+ attr_accessor :type
21
+
22
+ # Per-key errors which failed to parse, validate, or otherwise transmit
23
+ attr_accessor :errors
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'title' => :'title',
29
+ :'type' => :'type',
30
+ :'errors' => :'errors'
31
+ }
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.fastly_types
41
+ {
42
+ :'title' => :'String',
43
+ :'type' => :'String',
44
+ :'errors' => :'Array<BatchErrors>'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.fastly_nullable
50
+ Set.new([
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::Batch` 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::Batch`. 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?(:'title')
70
+ self.title = attributes[:'title']
71
+ end
72
+
73
+ if attributes.key?(:'type')
74
+ self.type = attributes[:'type']
75
+ end
76
+
77
+ if attributes.key?(:'errors')
78
+ if (value = attributes[:'errors']).is_a?(Array)
79
+ self.errors = value
80
+ end
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ title == o.title &&
103
+ type == o.type &&
104
+ errors == o.errors
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(o)
110
+ self == o
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
115
+ def hash
116
+ [title, type, errors].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def self.build_from_hash(attributes)
123
+ new.build_from_hash(attributes)
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ self.class.fastly_types.each_pair do |key, type|
132
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
133
+ self.send("#{key}=", nil)
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
138
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
139
+ end
140
+ elsif !attributes[self.class.attribute_map[key]].nil?
141
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
+ end
143
+ end
144
+
145
+ self
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def _deserialize(type, value)
153
+ case type.to_sym
154
+ when :Time
155
+ Time.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :Boolean
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ # models (e.g. Pet) or oneOf
186
+ klass = Fastly.const_get(type)
187
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.fastly_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+
239
+ end