fastly 8.6.0 → 8.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +1 -1
  5. data/docs/Billing.md +1 -2
  6. data/docs/BillingApi.md +2 -2
  7. data/docs/BillingBandwidth.md +11 -0
  8. data/docs/BillingBandwidthTiers.md +14 -0
  9. data/docs/BillingEstimateInvoiceId.md +10 -0
  10. data/docs/BillingEstimateResponse.md +2 -2
  11. data/docs/{LineItemDataReadOnlyInvoiceId.md → BillingInvoiceId.md} +2 -1
  12. data/docs/BillingInvoicesApi.md +2 -2
  13. data/docs/BillingRegions.md +13 -0
  14. data/docs/BillingResponse.md +2 -2
  15. data/docs/BillingResponseLineItem.md +1 -1
  16. data/docs/EomInvoiceResponse.md +1 -1
  17. data/docs/Invoice.md +1 -1
  18. data/docs/LineItemData.md +1 -1
  19. data/lib/fastly/api/billing_api.rb +2 -2
  20. data/lib/fastly/api/billing_invoices_api.rb +2 -2
  21. data/lib/fastly/models/billing.rb +2 -11
  22. data/lib/fastly/models/billing_bandwidth.rb +227 -0
  23. data/lib/fastly/models/billing_bandwidth_tiers.rb +252 -0
  24. data/lib/fastly/models/billing_estimate_invoice_id.rb +216 -0
  25. data/lib/fastly/models/billing_estimate_response.rb +12 -11
  26. data/lib/fastly/models/{line_item_data_read_only_invoice_id.rb → billing_invoice_id.rb} +14 -5
  27. data/lib/fastly/models/billing_regions.rb +243 -0
  28. data/lib/fastly/models/billing_response.rb +12 -11
  29. data/lib/fastly/models/billing_response_line_item.rb +2 -1
  30. data/lib/fastly/models/eom_invoice_response.rb +1 -1
  31. data/lib/fastly/models/invoice.rb +1 -1
  32. data/lib/fastly/models/line_item_data.rb +2 -1
  33. data/lib/fastly/version.rb +1 -1
  34. data/lib/fastly.rb +5 -1
  35. data/sig.json +1 -1
  36. metadata +12 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 448ec99e562b3c1676294cb52992811a2299e596ad7c9b415011f3b02396d4c6
4
- data.tar.gz: 678b891bd1b3cf0570fdb2c5990258b733a6069c6c0f28bf2d46d000086991de
3
+ metadata.gz: 4904654b7cf5c6adc507b5ba620ed04e76e9672249aefb62e05ecec142dc80f1
4
+ data.tar.gz: bb40afec36a8917d70eb9175fbaa25fc12961503ddda96b9b731364732d14cbd
5
5
  SHA512:
6
- metadata.gz: 7cf5b677d87891764c92af9b2b78f0496b2d55524c3f5aefb99ae277c4c1da4da940aa17f711e5052b94a2c25ebef228b705478c21ac3e0c2c5ae629e7828b7e
7
- data.tar.gz: 7fe8ba6ef682f2d60f44555b0f125ec342e64fa8bc820b6bbd1a5684f55397da39022063f908dff895712179c1369e187709dbf1d04311f5605c82f7fcc9d648
6
+ metadata.gz: 659c8c3f1e002e1be7f2742f7246cccdd0271c367a5b5a70fb8acc9c047060d7c1d8987c95ffb2833ce3bc29bb6a1bd3f57a4c34bbcc051da823a7709b569607
7
+ data.tar.gz: 69703109588baa937fc2908c0c1ecd1ee9f9eb30dd9acf51d3885ab052f4fe085d8bb842dd028cfe30a10d11e4fc90a94e2fd08498e1b1cb8d9169cb03ee8f63
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [v8.7.0](https://github.com/fastly/fastly-ruby/releases/tag/release/v8.7.0) (2024-08-08)
4
+
5
+ **Bug fixes:**
6
+
7
+ - fix(billing): Adjust type of regional data to help the generator
8
+ - fix(billing): Correct type of invoice_id field
9
+
3
10
  ## [v8.6.0](https://github.com/fastly/fastly-ruby/releases/tag/release/v8.6.0) (2024-08-04)
4
11
 
5
12
  **Enhancements:**
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fastly (8.6.0)
4
+ fastly (8.7.0)
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', '~> 8.6.0'
11
+ gem 'fastly', '~> 8.7.0'
12
12
  ```
13
13
 
14
14
  Then run `bundle install`.
data/docs/Billing.md CHANGED
@@ -6,12 +6,11 @@
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **end_time** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] |
8
8
  | **start_time** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] |
9
- | **invoice_id** | **String** | | [optional][readonly] |
10
9
  | **customer_id** | **String** | | [optional][readonly] |
11
10
  | **vendor_state** | **String** | The current state of our third-party billing vendor. One of `up` or `down`. | [optional][readonly] |
12
11
  | **status** | [**BillingStatus**](BillingStatus.md) | | [optional] |
13
12
  | **total** | [**BillingTotal**](BillingTotal.md) | | [optional] |
14
- | **regions** | **Hash<String, Hash<String, Object>>** | Breakdown of regional data for products that are region based. | [optional] |
13
+ | **regions** | [**Hash<String, BillingRegions>**](BillingRegions.md) | Breakdown of regional data for products that are region based. | [optional] |
15
14
 
16
15
  [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
17
16
 
data/docs/BillingApi.md CHANGED
@@ -71,7 +71,7 @@ Get the invoice for the given invoice_id.
71
71
  api_instance = Fastly::BillingApi.new
72
72
  opts = {
73
73
  customer_id: 'customer_id_example', # String | Alphanumeric string identifying the customer.
74
- invoice_id: 'invoice_id_example', # String | Alphanumeric string identifying the invoice.
74
+ invoice_id: 4183280, # Integer |
75
75
  }
76
76
 
77
77
  begin
@@ -88,7 +88,7 @@ end
88
88
  | Name | Type | Description | Notes |
89
89
  | ---- | ---- | ----------- | ----- |
90
90
  | **customer_id** | **String** | Alphanumeric string identifying the customer. | |
91
- | **invoice_id** | **String** | Alphanumeric string identifying the invoice. | |
91
+ | **invoice_id** | **Integer** | | |
92
92
 
93
93
  ### Return type
94
94
 
@@ -0,0 +1,11 @@
1
+ # Fastly::BillingBandwidth
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **total** | **Float** | | [optional] |
8
+ | **tiers** | [**Array<BillingBandwidthTiers>**](BillingBandwidthTiers.md) | | [optional] |
9
+
10
+ [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
11
+
@@ -0,0 +1,14 @@
1
+ # Fastly::BillingBandwidthTiers
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **name** | **String** | | [optional] |
8
+ | **units** | **Float** | | [optional] |
9
+ | **price** | **Float** | | [optional] |
10
+ | **discounted_price** | **Float** | | [optional] |
11
+ | **total** | **Float** | | [optional] |
12
+
13
+ [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
14
+
@@ -0,0 +1,10 @@
1
+ # Fastly::BillingEstimateInvoiceId
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **invoice_id** | **String** | | [optional][readonly] |
8
+
9
+ [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
10
+
@@ -6,12 +6,12 @@
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **end_time** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] |
8
8
  | **start_time** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] |
9
- | **invoice_id** | **String** | | [optional][readonly] |
10
9
  | **customer_id** | **String** | | [optional][readonly] |
11
10
  | **vendor_state** | **String** | The current state of our third-party billing vendor. One of `up` or `down`. | [optional][readonly] |
12
11
  | **status** | [**BillingStatus**](BillingStatus.md) | | [optional] |
13
12
  | **total** | [**BillingTotal**](BillingTotal.md) | | [optional] |
14
- | **regions** | **Hash<String, Hash<String, Object>>** | Breakdown of regional data for products that are region based. | [optional] |
13
+ | **regions** | [**Hash<String, BillingRegions>**](BillingRegions.md) | Breakdown of regional data for products that are region based. | [optional] |
14
+ | **invoice_id** | **String** | | [optional][readonly] |
15
15
  | **line_items** | [**Array<BillingEstimateLinesLineItems>**](BillingEstimateLinesLineItems.md) | | [optional] |
16
16
 
17
17
  [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
@@ -1,9 +1,10 @@
1
- # Fastly::LineItemDataReadOnlyInvoiceId
1
+ # Fastly::BillingInvoiceId
2
2
 
3
3
  ## Properties
4
4
 
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
+ | **invoice_id** | **Integer** | | [optional][readonly] |
7
8
 
8
9
  [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
9
10
 
@@ -31,7 +31,7 @@ Returns invoice associated with the invoice id.
31
31
  ```ruby
32
32
  api_instance = Fastly::BillingInvoicesApi.new
33
33
  opts = {
34
- invoice_id: 'invoice_id_example', # String | Alphanumeric string identifying the invoice.
34
+ invoice_id: 4183280, # Integer |
35
35
  }
36
36
 
37
37
  begin
@@ -47,7 +47,7 @@ end
47
47
 
48
48
  | Name | Type | Description | Notes |
49
49
  | ---- | ---- | ----------- | ----- |
50
- | **invoice_id** | **String** | Alphanumeric string identifying the invoice. | |
50
+ | **invoice_id** | **Integer** | | |
51
51
 
52
52
  ### Return type
53
53
 
@@ -0,0 +1,13 @@
1
+ # Fastly::BillingRegions
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **cost** | **Float** | | [optional] |
8
+ | **bandwidth** | [**BillingBandwidth**](BillingBandwidth.md) | | [optional] |
9
+ | **percentile** | [**BillingBandwidth**](BillingBandwidth.md) | | [optional] |
10
+ | **requests** | [**BillingBandwidth**](BillingBandwidth.md) | | [optional] |
11
+
12
+ [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
13
+
@@ -6,12 +6,12 @@
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **end_time** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] |
8
8
  | **start_time** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] |
9
- | **invoice_id** | **String** | | [optional][readonly] |
10
9
  | **customer_id** | **String** | | [optional][readonly] |
11
10
  | **vendor_state** | **String** | The current state of our third-party billing vendor. One of `up` or `down`. | [optional][readonly] |
12
11
  | **status** | [**BillingStatus**](BillingStatus.md) | | [optional] |
13
12
  | **total** | [**BillingTotal**](BillingTotal.md) | | [optional] |
14
- | **regions** | **Hash<String, Hash<String, Object>>** | Breakdown of regional data for products that are region based. | [optional] |
13
+ | **regions** | [**Hash<String, BillingRegions>**](BillingRegions.md) | Breakdown of regional data for products that are region based. | [optional] |
14
+ | **invoice_id** | **Integer** | | [optional][readonly] |
15
15
  | **line_items** | [**Array<BillingResponseLineItem>**](BillingResponseLineItem.md) | | [optional] |
16
16
 
17
17
  [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
@@ -8,7 +8,7 @@
8
8
  | **deleted_at** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] |
9
9
  | **updated_at** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] |
10
10
  | **amount** | **Float** | | [optional] |
11
- | **aria_invoice_id** | [**LineItemDataReadOnlyInvoiceId**](LineItemDataReadOnlyInvoiceId.md) | | [optional] |
11
+ | **aria_invoice_id** | **String** | An alphanumeric string identifying the invoice. | [optional][readonly] |
12
12
  | **client_service_id** | **String** | | [optional] |
13
13
  | **credit_coupon_code** | **String** | | [optional] |
14
14
  | **description** | **String** | | [optional] |
@@ -5,7 +5,7 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **customer_id** | **String** | Customer ID associated with the invoice. | [optional] |
8
- | **invoice_id** | **String** | Alphanumeric string identifying the invoice. | [optional] |
8
+ | **invoice_id** | **String** | Numeric string identifying the invoice. | [optional] |
9
9
  | **invoice_posted_on** | **Time** | Date and time invoice was posted on, in ISO 8601 format. | [optional] |
10
10
  | **billing_start_date** | **Time** | Date and time (in ISO 8601 format) for initiation point of a billing cycle, signifying the start of charges for a service or subscription. | [optional] |
11
11
  | **billing_end_date** | **Time** | Date and time (in ISO 8601 format) for termination point of a billing cycle, signifying the end of charges for a service or subscription. | [optional] |
data/docs/Invoice.md CHANGED
@@ -5,7 +5,7 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **customer_id** | **String** | Customer ID associated with the invoice. | [optional] |
8
- | **invoice_id** | **String** | Alphanumeric string identifying the invoice. | [optional] |
8
+ | **invoice_id** | **String** | Numeric string identifying the invoice. | [optional] |
9
9
  | **invoice_posted_on** | **Time** | Date and time invoice was posted on, in ISO 8601 format. | [optional] |
10
10
  | **billing_start_date** | **Time** | Date and time (in ISO 8601 format) for initiation point of a billing cycle, signifying the start of charges for a service or subscription. | [optional] |
11
11
  | **billing_end_date** | **Time** | Date and time (in ISO 8601 format) for termination point of a billing cycle, signifying the end of charges for a service or subscription. | [optional] |
data/docs/LineItemData.md CHANGED
@@ -5,7 +5,7 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **amount** | **Float** | | [optional] |
8
- | **aria_invoice_id** | [**LineItemDataReadOnlyInvoiceId**](LineItemDataReadOnlyInvoiceId.md) | | [optional] |
8
+ | **aria_invoice_id** | **String** | An alphanumeric string identifying the invoice. | [optional][readonly] |
9
9
  | **client_service_id** | **String** | | [optional] |
10
10
  | **credit_coupon_code** | **String** | | [optional] |
11
11
  | **description** | **String** | | [optional] |
@@ -90,7 +90,7 @@ module Fastly
90
90
  # Get an invoice
91
91
  # Get the invoice for the given invoice_id.
92
92
  # @option opts [String] :customer_id Alphanumeric string identifying the customer. (required)
93
- # @option opts [String] :invoice_id Alphanumeric string identifying the invoice. (required)
93
+ # @option opts [Integer] :invoice_id (required)
94
94
  # @return [BillingResponse]
95
95
  def get_invoice_by_id(opts = {})
96
96
  data, _status_code, _headers = get_invoice_by_id_with_http_info(opts)
@@ -100,7 +100,7 @@ module Fastly
100
100
  # Get an invoice
101
101
  # Get the invoice for the given invoice_id.
102
102
  # @option opts [String] :customer_id Alphanumeric string identifying the customer. (required)
103
- # @option opts [String] :invoice_id Alphanumeric string identifying the invoice. (required)
103
+ # @option opts [Integer] :invoice_id (required)
104
104
  # @return [Array<(BillingResponse, Integer, Hash)>] BillingResponse data, response status code and response headers
105
105
  def get_invoice_by_id_with_http_info(opts = {})
106
106
  if @api_client.config.debugging
@@ -19,7 +19,7 @@ module Fastly
19
19
  end
20
20
  # Get invoice by ID.
21
21
  # Returns invoice associated with the invoice id.
22
- # @option opts [String] :invoice_id Alphanumeric string identifying the invoice. (required)
22
+ # @option opts [Integer] :invoice_id (required)
23
23
  # @return [EomInvoiceResponse]
24
24
  def get_invoice_by_invoice_id(opts = {})
25
25
  data, _status_code, _headers = get_invoice_by_invoice_id_with_http_info(opts)
@@ -28,7 +28,7 @@ module Fastly
28
28
 
29
29
  # Get invoice by ID.
30
30
  # Returns invoice associated with the invoice id.
31
- # @option opts [String] :invoice_id Alphanumeric string identifying the invoice. (required)
31
+ # @option opts [Integer] :invoice_id (required)
32
32
  # @return [Array<(EomInvoiceResponse, Integer, Hash)>] EomInvoiceResponse data, response status code and response headers
33
33
  def get_invoice_by_invoice_id_with_http_info(opts = {})
34
34
  if @api_client.config.debugging
@@ -19,8 +19,6 @@ module Fastly
19
19
  # Date and time in ISO 8601 format.
20
20
  attr_accessor :start_time
21
21
 
22
- attr_accessor :invoice_id
23
-
24
22
  attr_accessor :customer_id
25
23
 
26
24
  # The current state of our third-party billing vendor. One of `up` or `down`.
@@ -38,7 +36,6 @@ module Fastly
38
36
  {
39
37
  :'end_time' => :'end_time',
40
38
  :'start_time' => :'start_time',
41
- :'invoice_id' => :'invoice_id',
42
39
  :'customer_id' => :'customer_id',
43
40
  :'vendor_state' => :'vendor_state',
44
41
  :'status' => :'status',
@@ -57,12 +54,11 @@ module Fastly
57
54
  {
58
55
  :'end_time' => :'Time',
59
56
  :'start_time' => :'Time',
60
- :'invoice_id' => :'String',
61
57
  :'customer_id' => :'String',
62
58
  :'vendor_state' => :'String',
63
59
  :'status' => :'BillingStatus',
64
60
  :'total' => :'BillingTotal',
65
- :'regions' => :'Hash<String, Hash<String, Object>>'
61
+ :'regions' => :'Hash<String, BillingRegions>'
66
62
  }
67
63
  end
68
64
 
@@ -97,10 +93,6 @@ module Fastly
97
93
  self.start_time = attributes[:'start_time']
98
94
  end
99
95
 
100
- if attributes.key?(:'invoice_id')
101
- self.invoice_id = attributes[:'invoice_id']
102
- end
103
-
104
96
  if attributes.key?(:'customer_id')
105
97
  self.customer_id = attributes[:'customer_id']
106
98
  end
@@ -144,7 +136,6 @@ module Fastly
144
136
  self.class == o.class &&
145
137
  end_time == o.end_time &&
146
138
  start_time == o.start_time &&
147
- invoice_id == o.invoice_id &&
148
139
  customer_id == o.customer_id &&
149
140
  vendor_state == o.vendor_state &&
150
141
  status == o.status &&
@@ -161,7 +152,7 @@ module Fastly
161
152
  # Calculates hash code according to all attributes.
162
153
  # @return [Integer] Hash code
163
154
  def hash
164
- [end_time, start_time, invoice_id, customer_id, vendor_state, status, total, regions].hash
155
+ [end_time, start_time, customer_id, vendor_state, status, total, regions].hash
165
156
  end
166
157
 
167
158
  # Builds the object from hash
@@ -0,0 +1,227 @@
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 BillingBandwidth
16
+ attr_accessor :total
17
+
18
+ attr_accessor :tiers
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'total' => :'total',
24
+ :'tiers' => :'tiers'
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
+ :'total' => :'Float',
37
+ :'tiers' => :'Array<BillingBandwidthTiers>'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.fastly_nullable
43
+ Set.new([
44
+ ])
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ if (!attributes.is_a?(Hash))
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::BillingBandwidth` initialize method"
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::BillingBandwidth`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:'total')
63
+ self.total = attributes[:'total']
64
+ end
65
+
66
+ if attributes.key?(:'tiers')
67
+ if (value = attributes[:'tiers']).is_a?(Array)
68
+ self.tiers = value
69
+ end
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ total == o.total &&
92
+ tiers == o.tiers
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [total, tiers].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.fastly_types.each_pair do |key, type|
120
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
121
+ self.send("#{key}=", nil)
122
+ elsif type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :Time
143
+ Time.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :Boolean
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ # models (e.g. Pet) or oneOf
174
+ klass = Fastly.const_get(type)
175
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ if value.nil?
198
+ is_nullable = self.class.fastly_nullable.include?(attr)
199
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
200
+ end
201
+
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+
225
+ end
226
+
227
+ end