From 767f2455e75d1e45d010f27c8aff9f0675f1b7b2 Mon Sep 17 00:00:00 2001 From: github-actions Date: Thu, 8 Aug 2024 09:35:06 +0000 Subject: [PATCH] Generated v8.7.0 --- CHANGELOG.md | 7 + README.md | 2 +- docs/Billing.md | 3 +- docs/BillingApi.md | 4 +- docs/BillingBandwidth.md | 11 + docs/BillingBandwidthTiers.md | 14 + docs/BillingEstimateInvoiceId.md | 10 + docs/BillingEstimateResponse.md | 4 +- ...adOnlyInvoiceId.md => BillingInvoiceId.md} | 3 +- docs/BillingInvoicesApi.md | 4 +- docs/BillingRegions.md | 13 + docs/BillingResponse.md | 4 +- docs/BillingResponseLineItem.md | 2 +- docs/EomInvoiceResponse.md | 2 +- docs/Invoice.md | 2 +- docs/LineItemData.md | 2 +- lib/fastly.rb | 6 +- lib/fastly/api/billing_api.rb | 4 +- lib/fastly/api/billing_invoices_api.rb | 4 +- lib/fastly/models/billing.rb | 13 +- lib/fastly/models/billing_bandwidth.rb | 227 ++++++++++++++++ lib/fastly/models/billing_bandwidth_tiers.rb | 252 ++++++++++++++++++ .../models/billing_estimate_invoice_id.rb | 216 +++++++++++++++ .../models/billing_estimate_response.rb | 23 +- ...ly_invoice_id.rb => billing_invoice_id.rb} | 19 +- lib/fastly/models/billing_regions.rb | 243 +++++++++++++++++ lib/fastly/models/billing_response.rb | 23 +- .../models/billing_response_line_item.rb | 3 +- lib/fastly/models/eom_invoice_response.rb | 2 +- lib/fastly/models/invoice.rb | 2 +- lib/fastly/models/line_item_data.rb | 3 +- lib/fastly/version.rb | 2 +- sig.json | 2 +- 33 files changed, 1066 insertions(+), 65 deletions(-) create mode 100644 docs/BillingBandwidth.md create mode 100644 docs/BillingBandwidthTiers.md create mode 100644 docs/BillingEstimateInvoiceId.md rename docs/{LineItemDataReadOnlyInvoiceId.md => BillingInvoiceId.md} (67%) create mode 100644 docs/BillingRegions.md create mode 100644 lib/fastly/models/billing_bandwidth.rb create mode 100644 lib/fastly/models/billing_bandwidth_tiers.rb create mode 100644 lib/fastly/models/billing_estimate_invoice_id.rb rename lib/fastly/models/{line_item_data_read_only_invoice_id.rb => billing_invoice_id.rb} (92%) create mode 100644 lib/fastly/models/billing_regions.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 042a1ce1..f31b0b76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [v8.7.0](https://github.com/fastly/fastly-ruby/releases/tag/release/v8.7.0) (2024-08-08) + +**Bug fixes:** + +- fix(billing): Adjust type of regional data to help the generator +- fix(billing): Correct type of invoice_id field + ## [v8.6.0](https://github.com/fastly/fastly-ruby/releases/tag/release/v8.6.0) (2024-08-04) **Enhancements:** diff --git a/README.md b/README.md index efbf2b84..98ddf46d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ A Ruby client library for interacting with most facets of the [Fastly API](https To install via RubyGems, add the following to your project's `Gemfile`: ```ruby -gem 'fastly', '~> 8.6.0' +gem 'fastly', '~> 8.7.0' ``` Then run `bundle install`. diff --git a/docs/Billing.md b/docs/Billing.md index d6115111..380b0e7e 100644 --- a/docs/Billing.md +++ b/docs/Billing.md @@ -6,12 +6,11 @@ | ---- | ---- | ----------- | ----- | | **end_time** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] | | **start_time** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] | -| **invoice_id** | **String** | | [optional][readonly] | | **customer_id** | **String** | | [optional][readonly] | | **vendor_state** | **String** | The current state of our third-party billing vendor. One of `up` or `down`. | [optional][readonly] | | **status** | [**BillingStatus**](BillingStatus.md) | | [optional] | | **total** | [**BillingTotal**](BillingTotal.md) | | [optional] | -| **regions** | **Hash<String, Hash<String, Object>>** | Breakdown of regional data for products that are region based. | [optional] | +| **regions** | [**Hash<String, BillingRegions>**](BillingRegions.md) | Breakdown of regional data for products that are region based. | [optional] | [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/BillingApi.md b/docs/BillingApi.md index 8eecb568..168a7fd9 100644 --- a/docs/BillingApi.md +++ b/docs/BillingApi.md @@ -71,7 +71,7 @@ Get the invoice for the given invoice_id. api_instance = Fastly::BillingApi.new opts = { customer_id: 'customer_id_example', # String | Alphanumeric string identifying the customer. - invoice_id: 'invoice_id_example', # String | Alphanumeric string identifying the invoice. + invoice_id: 4183280, # Integer | } begin @@ -88,7 +88,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **customer_id** | **String** | Alphanumeric string identifying the customer. | | -| **invoice_id** | **String** | Alphanumeric string identifying the invoice. | | +| **invoice_id** | **Integer** | | | ### Return type diff --git a/docs/BillingBandwidth.md b/docs/BillingBandwidth.md new file mode 100644 index 00000000..9888c5f3 --- /dev/null +++ b/docs/BillingBandwidth.md @@ -0,0 +1,11 @@ +# Fastly::BillingBandwidth + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total** | **Float** | | [optional] | +| **tiers** | [**Array<BillingBandwidthTiers>**](BillingBandwidthTiers.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/BillingBandwidthTiers.md b/docs/BillingBandwidthTiers.md new file mode 100644 index 00000000..612f2577 --- /dev/null +++ b/docs/BillingBandwidthTiers.md @@ -0,0 +1,14 @@ +# Fastly::BillingBandwidthTiers + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | | [optional] | +| **units** | **Float** | | [optional] | +| **price** | **Float** | | [optional] | +| **discounted_price** | **Float** | | [optional] | +| **total** | **Float** | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/BillingEstimateInvoiceId.md b/docs/BillingEstimateInvoiceId.md new file mode 100644 index 00000000..f8888f64 --- /dev/null +++ b/docs/BillingEstimateInvoiceId.md @@ -0,0 +1,10 @@ +# Fastly::BillingEstimateInvoiceId + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **invoice_id** | **String** | | [optional][readonly] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/BillingEstimateResponse.md b/docs/BillingEstimateResponse.md index fcc9e01c..4c4f3891 100644 --- a/docs/BillingEstimateResponse.md +++ b/docs/BillingEstimateResponse.md @@ -6,12 +6,12 @@ | ---- | ---- | ----------- | ----- | | **end_time** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] | | **start_time** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] | -| **invoice_id** | **String** | | [optional][readonly] | | **customer_id** | **String** | | [optional][readonly] | | **vendor_state** | **String** | The current state of our third-party billing vendor. One of `up` or `down`. | [optional][readonly] | | **status** | [**BillingStatus**](BillingStatus.md) | | [optional] | | **total** | [**BillingTotal**](BillingTotal.md) | | [optional] | -| **regions** | **Hash<String, Hash<String, Object>>** | Breakdown of regional data for products that are region based. | [optional] | +| **regions** | [**Hash<String, BillingRegions>**](BillingRegions.md) | Breakdown of regional data for products that are region based. | [optional] | +| **invoice_id** | **String** | | [optional][readonly] | | **line_items** | [**Array<BillingEstimateLinesLineItems>**](BillingEstimateLinesLineItems.md) | | [optional] | [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/LineItemDataReadOnlyInvoiceId.md b/docs/BillingInvoiceId.md similarity index 67% rename from docs/LineItemDataReadOnlyInvoiceId.md rename to docs/BillingInvoiceId.md index dcb48d7c..0b50a0a2 100644 --- a/docs/LineItemDataReadOnlyInvoiceId.md +++ b/docs/BillingInvoiceId.md @@ -1,9 +1,10 @@ -# Fastly::LineItemDataReadOnlyInvoiceId +# Fastly::BillingInvoiceId ## Properties | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | +| **invoice_id** | **Integer** | | [optional][readonly] | [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/BillingInvoicesApi.md b/docs/BillingInvoicesApi.md index 442e17a2..70faa500 100644 --- a/docs/BillingInvoicesApi.md +++ b/docs/BillingInvoicesApi.md @@ -31,7 +31,7 @@ Returns invoice associated with the invoice id. ```ruby api_instance = Fastly::BillingInvoicesApi.new opts = { - invoice_id: 'invoice_id_example', # String | Alphanumeric string identifying the invoice. + invoice_id: 4183280, # Integer | } begin @@ -47,7 +47,7 @@ end | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | -| **invoice_id** | **String** | Alphanumeric string identifying the invoice. | | +| **invoice_id** | **Integer** | | | ### Return type diff --git a/docs/BillingRegions.md b/docs/BillingRegions.md new file mode 100644 index 00000000..8f846c83 --- /dev/null +++ b/docs/BillingRegions.md @@ -0,0 +1,13 @@ +# Fastly::BillingRegions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **cost** | **Float** | | [optional] | +| **bandwidth** | [**BillingBandwidth**](BillingBandwidth.md) | | [optional] | +| **percentile** | [**BillingBandwidth**](BillingBandwidth.md) | | [optional] | +| **requests** | [**BillingBandwidth**](BillingBandwidth.md) | | [optional] | + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) + diff --git a/docs/BillingResponse.md b/docs/BillingResponse.md index e09cc35c..3ae5700a 100644 --- a/docs/BillingResponse.md +++ b/docs/BillingResponse.md @@ -6,12 +6,12 @@ | ---- | ---- | ----------- | ----- | | **end_time** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] | | **start_time** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] | -| **invoice_id** | **String** | | [optional][readonly] | | **customer_id** | **String** | | [optional][readonly] | | **vendor_state** | **String** | The current state of our third-party billing vendor. One of `up` or `down`. | [optional][readonly] | | **status** | [**BillingStatus**](BillingStatus.md) | | [optional] | | **total** | [**BillingTotal**](BillingTotal.md) | | [optional] | -| **regions** | **Hash<String, Hash<String, Object>>** | Breakdown of regional data for products that are region based. | [optional] | +| **regions** | [**Hash<String, BillingRegions>**](BillingRegions.md) | Breakdown of regional data for products that are region based. | [optional] | +| **invoice_id** | **Integer** | | [optional][readonly] | | **line_items** | [**Array<BillingResponseLineItem>**](BillingResponseLineItem.md) | | [optional] | [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/BillingResponseLineItem.md b/docs/BillingResponseLineItem.md index 81318c6e..37c2f7ae 100644 --- a/docs/BillingResponseLineItem.md +++ b/docs/BillingResponseLineItem.md @@ -8,7 +8,7 @@ | **deleted_at** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] | | **updated_at** | **Time** | Date and time in ISO 8601 format. | [optional][readonly] | | **amount** | **Float** | | [optional] | -| **aria_invoice_id** | [**LineItemDataReadOnlyInvoiceId**](LineItemDataReadOnlyInvoiceId.md) | | [optional] | +| **aria_invoice_id** | **String** | An alphanumeric string identifying the invoice. | [optional][readonly] | | **client_service_id** | **String** | | [optional] | | **credit_coupon_code** | **String** | | [optional] | | **description** | **String** | | [optional] | diff --git a/docs/EomInvoiceResponse.md b/docs/EomInvoiceResponse.md index 5fd191e5..59a0fb6b 100644 --- a/docs/EomInvoiceResponse.md +++ b/docs/EomInvoiceResponse.md @@ -5,7 +5,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **customer_id** | **String** | Customer ID associated with the invoice. | [optional] | -| **invoice_id** | **String** | Alphanumeric string identifying the invoice. | [optional] | +| **invoice_id** | **String** | Numeric string identifying the invoice. | [optional] | | **invoice_posted_on** | **Time** | Date and time invoice was posted on, in ISO 8601 format. | [optional] | | **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] | | **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] | diff --git a/docs/Invoice.md b/docs/Invoice.md index 0f296e97..4826e742 100644 --- a/docs/Invoice.md +++ b/docs/Invoice.md @@ -5,7 +5,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **customer_id** | **String** | Customer ID associated with the invoice. | [optional] | -| **invoice_id** | **String** | Alphanumeric string identifying the invoice. | [optional] | +| **invoice_id** | **String** | Numeric string identifying the invoice. | [optional] | | **invoice_posted_on** | **Time** | Date and time invoice was posted on, in ISO 8601 format. | [optional] | | **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] | | **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] | diff --git a/docs/LineItemData.md b/docs/LineItemData.md index 00e1edfc..ef3a064b 100644 --- a/docs/LineItemData.md +++ b/docs/LineItemData.md @@ -5,7 +5,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **amount** | **Float** | | [optional] | -| **aria_invoice_id** | [**LineItemDataReadOnlyInvoiceId**](LineItemDataReadOnlyInvoiceId.md) | | [optional] | +| **aria_invoice_id** | **String** | An alphanumeric string identifying the invoice. | [optional][readonly] | | **client_service_id** | **String** | | [optional] | | **credit_coupon_code** | **String** | | [optional] | | **description** | **String** | | [optional] | diff --git a/lib/fastly.rb b/lib/fastly.rb index 7e014cac..63a75b96 100644 --- a/lib/fastly.rb +++ b/lib/fastly.rb @@ -46,9 +46,14 @@ require 'fastly/models/billing_address_response_data' require 'fastly/models/billing_address_verification_error_response' require 'fastly/models/billing_address_verification_error_response_errors' +require 'fastly/models/billing_bandwidth' +require 'fastly/models/billing_bandwidth_tiers' +require 'fastly/models/billing_estimate_invoice_id' require 'fastly/models/billing_estimate_lines' require 'fastly/models/billing_estimate_lines_line_items' require 'fastly/models/billing_estimate_response' +require 'fastly/models/billing_invoice_id' +require 'fastly/models/billing_regions' require 'fastly/models/billing_response' require 'fastly/models/billing_response_item_items_data' require 'fastly/models/billing_response_line_item' @@ -214,7 +219,6 @@ require 'fastly/models/legacy_waf_tag' require 'fastly/models/legacy_waf_update_status' require 'fastly/models/line_item_data' -require 'fastly/models/line_item_data_read_only_invoice_id' require 'fastly/models/list_dashboards_response' require 'fastly/models/list_eom_invoices_response' require 'fastly/models/listinvoices' diff --git a/lib/fastly/api/billing_api.rb b/lib/fastly/api/billing_api.rb index cea8c08b..ac95395e 100644 --- a/lib/fastly/api/billing_api.rb +++ b/lib/fastly/api/billing_api.rb @@ -90,7 +90,7 @@ def get_invoice_with_http_info(opts = {}) # Get an invoice # Get the invoice for the given invoice_id. # @option opts [String] :customer_id Alphanumeric string identifying the customer. (required) - # @option opts [String] :invoice_id Alphanumeric string identifying the invoice. (required) + # @option opts [Integer] :invoice_id (required) # @return [BillingResponse] def get_invoice_by_id(opts = {}) data, _status_code, _headers = get_invoice_by_id_with_http_info(opts) @@ -100,7 +100,7 @@ def get_invoice_by_id(opts = {}) # Get an invoice # Get the invoice for the given invoice_id. # @option opts [String] :customer_id Alphanumeric string identifying the customer. (required) - # @option opts [String] :invoice_id Alphanumeric string identifying the invoice. (required) + # @option opts [Integer] :invoice_id (required) # @return [Array<(BillingResponse, Integer, Hash)>] BillingResponse data, response status code and response headers def get_invoice_by_id_with_http_info(opts = {}) if @api_client.config.debugging diff --git a/lib/fastly/api/billing_invoices_api.rb b/lib/fastly/api/billing_invoices_api.rb index 16c3d679..25488e4e 100644 --- a/lib/fastly/api/billing_invoices_api.rb +++ b/lib/fastly/api/billing_invoices_api.rb @@ -19,7 +19,7 @@ def initialize(api_client = ApiClient.default) end # Get invoice by ID. # Returns invoice associated with the invoice id. - # @option opts [String] :invoice_id Alphanumeric string identifying the invoice. (required) + # @option opts [Integer] :invoice_id (required) # @return [EomInvoiceResponse] def get_invoice_by_invoice_id(opts = {}) data, _status_code, _headers = get_invoice_by_invoice_id_with_http_info(opts) @@ -28,7 +28,7 @@ def get_invoice_by_invoice_id(opts = {}) # Get invoice by ID. # Returns invoice associated with the invoice id. - # @option opts [String] :invoice_id Alphanumeric string identifying the invoice. (required) + # @option opts [Integer] :invoice_id (required) # @return [Array<(EomInvoiceResponse, Integer, Hash)>] EomInvoiceResponse data, response status code and response headers def get_invoice_by_invoice_id_with_http_info(opts = {}) if @api_client.config.debugging diff --git a/lib/fastly/models/billing.rb b/lib/fastly/models/billing.rb index eb1f7930..261025b1 100644 --- a/lib/fastly/models/billing.rb +++ b/lib/fastly/models/billing.rb @@ -19,8 +19,6 @@ class Billing # Date and time in ISO 8601 format. attr_accessor :start_time - attr_accessor :invoice_id - attr_accessor :customer_id # The current state of our third-party billing vendor. One of `up` or `down`. @@ -38,7 +36,6 @@ def self.attribute_map { :'end_time' => :'end_time', :'start_time' => :'start_time', - :'invoice_id' => :'invoice_id', :'customer_id' => :'customer_id', :'vendor_state' => :'vendor_state', :'status' => :'status', @@ -57,12 +54,11 @@ def self.fastly_types { :'end_time' => :'Time', :'start_time' => :'Time', - :'invoice_id' => :'String', :'customer_id' => :'String', :'vendor_state' => :'String', :'status' => :'BillingStatus', :'total' => :'BillingTotal', - :'regions' => :'Hash>' + :'regions' => :'Hash' } end @@ -97,10 +93,6 @@ def initialize(attributes = {}) self.start_time = attributes[:'start_time'] end - if attributes.key?(:'invoice_id') - self.invoice_id = attributes[:'invoice_id'] - end - if attributes.key?(:'customer_id') self.customer_id = attributes[:'customer_id'] end @@ -144,7 +136,6 @@ def ==(o) self.class == o.class && end_time == o.end_time && start_time == o.start_time && - invoice_id == o.invoice_id && customer_id == o.customer_id && vendor_state == o.vendor_state && status == o.status && @@ -161,7 +152,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [end_time, start_time, invoice_id, customer_id, vendor_state, status, total, regions].hash + [end_time, start_time, customer_id, vendor_state, status, total, regions].hash end # Builds the object from hash diff --git a/lib/fastly/models/billing_bandwidth.rb b/lib/fastly/models/billing_bandwidth.rb new file mode 100644 index 00000000..53ddd502 --- /dev/null +++ b/lib/fastly/models/billing_bandwidth.rb @@ -0,0 +1,227 @@ +=begin +#Fastly API + +#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/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class BillingBandwidth + attr_accessor :total + + attr_accessor :tiers + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total' => :'total', + :'tiers' => :'tiers' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'total' => :'Float', + :'tiers' => :'Array' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::BillingBandwidth` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + 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 + end + h[k.to_sym] = v + } + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + + if attributes.key?(:'tiers') + if (value = attributes[:'tiers']).is_a?(Array) + self.tiers = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total == o.total && + tiers == o.tiers + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total, tiers].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/billing_bandwidth_tiers.rb b/lib/fastly/models/billing_bandwidth_tiers.rb new file mode 100644 index 00000000..1915fb07 --- /dev/null +++ b/lib/fastly/models/billing_bandwidth_tiers.rb @@ -0,0 +1,252 @@ +=begin +#Fastly API + +#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/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class BillingBandwidthTiers + attr_accessor :name + + attr_accessor :units + + attr_accessor :price + + attr_accessor :discounted_price + + attr_accessor :total + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'units' => :'units', + :'price' => :'price', + :'discounted_price' => :'discounted_price', + :'total' => :'total' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'name' => :'String', + :'units' => :'Float', + :'price' => :'Float', + :'discounted_price' => :'Float', + :'total' => :'Float' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::BillingBandwidthTiers` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::BillingBandwidthTiers`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'units') + self.units = attributes[:'units'] + end + + if attributes.key?(:'price') + self.price = attributes[:'price'] + end + + if attributes.key?(:'discounted_price') + self.discounted_price = attributes[:'discounted_price'] + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + units == o.units && + price == o.price && + discounted_price == o.discounted_price && + total == o.total + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, units, price, discounted_price, total].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/billing_estimate_invoice_id.rb b/lib/fastly/models/billing_estimate_invoice_id.rb new file mode 100644 index 00000000..a9ba754e --- /dev/null +++ b/lib/fastly/models/billing_estimate_invoice_id.rb @@ -0,0 +1,216 @@ +=begin +#Fastly API + +#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/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class BillingEstimateInvoiceId + attr_accessor :invoice_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'invoice_id' => :'invoice_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'invoice_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::BillingEstimateInvoiceId` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::BillingEstimateInvoiceId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'invoice_id') + self.invoice_id = attributes[:'invoice_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + invoice_id == o.invoice_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [invoice_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/billing_estimate_response.rb b/lib/fastly/models/billing_estimate_response.rb index 5c2a72d3..62c0f0e6 100644 --- a/lib/fastly/models/billing_estimate_response.rb +++ b/lib/fastly/models/billing_estimate_response.rb @@ -19,8 +19,6 @@ class BillingEstimateResponse # Date and time in ISO 8601 format. attr_accessor :start_time - attr_accessor :invoice_id - attr_accessor :customer_id # The current state of our third-party billing vendor. One of `up` or `down`. @@ -33,6 +31,8 @@ class BillingEstimateResponse # Breakdown of regional data for products that are region based. attr_accessor :regions + attr_accessor :invoice_id + attr_accessor :line_items # Attribute mapping from ruby-style variable name to JSON key. @@ -40,12 +40,12 @@ def self.attribute_map { :'end_time' => :'end_time', :'start_time' => :'start_time', - :'invoice_id' => :'invoice_id', :'customer_id' => :'customer_id', :'vendor_state' => :'vendor_state', :'status' => :'status', :'total' => :'total', :'regions' => :'regions', + :'invoice_id' => :'invoice_id', :'line_items' => :'line_items' } end @@ -60,12 +60,12 @@ def self.fastly_types { :'end_time' => :'Time', :'start_time' => :'Time', - :'invoice_id' => :'String', :'customer_id' => :'String', :'vendor_state' => :'String', :'status' => :'BillingStatus', :'total' => :'BillingTotal', - :'regions' => :'Hash>', + :'regions' => :'Hash', + :'invoice_id' => :'String', :'line_items' => :'Array' } end @@ -82,6 +82,7 @@ def self.fastly_nullable def self.fastly_all_of [ :'Billing', + :'BillingEstimateInvoiceId', :'BillingEstimateLines' ] end @@ -109,10 +110,6 @@ def initialize(attributes = {}) self.start_time = attributes[:'start_time'] end - if attributes.key?(:'invoice_id') - self.invoice_id = attributes[:'invoice_id'] - end - if attributes.key?(:'customer_id') self.customer_id = attributes[:'customer_id'] end @@ -135,6 +132,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'invoice_id') + self.invoice_id = attributes[:'invoice_id'] + end + if attributes.key?(:'line_items') if (value = attributes[:'line_items']).is_a?(Array) self.line_items = value @@ -162,12 +163,12 @@ def ==(o) self.class == o.class && end_time == o.end_time && start_time == o.start_time && - invoice_id == o.invoice_id && customer_id == o.customer_id && vendor_state == o.vendor_state && status == o.status && total == o.total && regions == o.regions && + invoice_id == o.invoice_id && line_items == o.line_items end @@ -180,7 +181,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [end_time, start_time, invoice_id, customer_id, vendor_state, status, total, regions, line_items].hash + [end_time, start_time, customer_id, vendor_state, status, total, regions, invoice_id, line_items].hash end # Builds the object from hash diff --git a/lib/fastly/models/line_item_data_read_only_invoice_id.rb b/lib/fastly/models/billing_invoice_id.rb similarity index 92% rename from lib/fastly/models/line_item_data_read_only_invoice_id.rb rename to lib/fastly/models/billing_invoice_id.rb index 7d1c154b..7636f442 100644 --- a/lib/fastly/models/line_item_data_read_only_invoice_id.rb +++ b/lib/fastly/models/billing_invoice_id.rb @@ -12,10 +12,13 @@ require 'time' module Fastly - class LineItemDataReadOnlyInvoiceId + class BillingInvoiceId + attr_accessor :invoice_id + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'invoice_id' => :'invoice_id' } end @@ -27,6 +30,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.fastly_types { + :'invoice_id' => :'Integer' } end @@ -40,16 +44,20 @@ def self.fastly_nullable # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::LineItemDataReadOnlyInvoiceId` initialize method" + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::BillingInvoiceId` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::LineItemDataReadOnlyInvoiceId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::BillingInvoiceId`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } + + if attributes.key?(:'invoice_id') + self.invoice_id = attributes[:'invoice_id'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -69,7 +77,8 @@ def valid? # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) - self.class == o.class + self.class == o.class && + invoice_id == o.invoice_id end # @see the `==` method @@ -81,7 +90,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [].hash + [invoice_id].hash end # Builds the object from hash diff --git a/lib/fastly/models/billing_regions.rb b/lib/fastly/models/billing_regions.rb new file mode 100644 index 00000000..7f2ddb2a --- /dev/null +++ b/lib/fastly/models/billing_regions.rb @@ -0,0 +1,243 @@ +=begin +#Fastly API + +#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/) + +The version of the OpenAPI document: 1.0.0 +Contact: oss@fastly.com + +=end + +require 'date' +require 'time' + +module Fastly + class BillingRegions + attr_accessor :cost + + attr_accessor :bandwidth + + attr_accessor :percentile + + attr_accessor :requests + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'cost' => :'cost', + :'bandwidth' => :'bandwidth', + :'percentile' => :'percentile', + :'requests' => :'requests' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.fastly_types + { + :'cost' => :'Float', + :'bandwidth' => :'BillingBandwidth', + :'percentile' => :'BillingBandwidth', + :'requests' => :'BillingBandwidth' + } + end + + # List of attributes with nullable: true + def self.fastly_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::BillingRegions` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::BillingRegions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'cost') + self.cost = attributes[:'cost'] + end + + if attributes.key?(:'bandwidth') + self.bandwidth = attributes[:'bandwidth'] + end + + if attributes.key?(:'percentile') + self.percentile = attributes[:'percentile'] + end + + if attributes.key?(:'requests') + self.requests = attributes[:'requests'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + cost == o.cost && + bandwidth == o.bandwidth && + percentile == o.percentile && + requests == o.requests + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [cost, bandwidth, percentile, requests].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.fastly_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Fastly.const_get(type) + klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.fastly_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/fastly/models/billing_response.rb b/lib/fastly/models/billing_response.rb index 5c923f65..aa7cb322 100644 --- a/lib/fastly/models/billing_response.rb +++ b/lib/fastly/models/billing_response.rb @@ -19,8 +19,6 @@ class BillingResponse # Date and time in ISO 8601 format. attr_accessor :start_time - attr_accessor :invoice_id - attr_accessor :customer_id # The current state of our third-party billing vendor. One of `up` or `down`. @@ -33,6 +31,8 @@ class BillingResponse # Breakdown of regional data for products that are region based. attr_accessor :regions + attr_accessor :invoice_id + attr_accessor :line_items # Attribute mapping from ruby-style variable name to JSON key. @@ -40,12 +40,12 @@ def self.attribute_map { :'end_time' => :'end_time', :'start_time' => :'start_time', - :'invoice_id' => :'invoice_id', :'customer_id' => :'customer_id', :'vendor_state' => :'vendor_state', :'status' => :'status', :'total' => :'total', :'regions' => :'regions', + :'invoice_id' => :'invoice_id', :'line_items' => :'line_items' } end @@ -60,12 +60,12 @@ def self.fastly_types { :'end_time' => :'Time', :'start_time' => :'Time', - :'invoice_id' => :'String', :'customer_id' => :'String', :'vendor_state' => :'String', :'status' => :'BillingStatus', :'total' => :'BillingTotal', - :'regions' => :'Hash>', + :'regions' => :'Hash', + :'invoice_id' => :'Integer', :'line_items' => :'Array' } end @@ -82,6 +82,7 @@ def self.fastly_nullable def self.fastly_all_of [ :'Billing', + :'BillingInvoiceId', :'BillingResponseItemItemsData' ] end @@ -109,10 +110,6 @@ def initialize(attributes = {}) self.start_time = attributes[:'start_time'] end - if attributes.key?(:'invoice_id') - self.invoice_id = attributes[:'invoice_id'] - end - if attributes.key?(:'customer_id') self.customer_id = attributes[:'customer_id'] end @@ -135,6 +132,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'invoice_id') + self.invoice_id = attributes[:'invoice_id'] + end + if attributes.key?(:'line_items') if (value = attributes[:'line_items']).is_a?(Array) self.line_items = value @@ -162,12 +163,12 @@ def ==(o) self.class == o.class && end_time == o.end_time && start_time == o.start_time && - invoice_id == o.invoice_id && customer_id == o.customer_id && vendor_state == o.vendor_state && status == o.status && total == o.total && regions == o.regions && + invoice_id == o.invoice_id && line_items == o.line_items end @@ -180,7 +181,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [end_time, start_time, invoice_id, customer_id, vendor_state, status, total, regions, line_items].hash + [end_time, start_time, customer_id, vendor_state, status, total, regions, invoice_id, line_items].hash end # Builds the object from hash diff --git a/lib/fastly/models/billing_response_line_item.rb b/lib/fastly/models/billing_response_line_item.rb index 178bc565..7ee224b0 100644 --- a/lib/fastly/models/billing_response_line_item.rb +++ b/lib/fastly/models/billing_response_line_item.rb @@ -24,6 +24,7 @@ class BillingResponseLineItem attr_accessor :amount + # An alphanumeric string identifying the invoice. attr_accessor :aria_invoice_id attr_accessor :client_service_id @@ -94,7 +95,7 @@ def self.fastly_types :'deleted_at' => :'Time', :'updated_at' => :'Time', :'amount' => :'Float', - :'aria_invoice_id' => :'LineItemDataReadOnlyInvoiceId', + :'aria_invoice_id' => :'String', :'client_service_id' => :'String', :'credit_coupon_code' => :'String', :'description' => :'String', diff --git a/lib/fastly/models/eom_invoice_response.rb b/lib/fastly/models/eom_invoice_response.rb index c4a8f814..d907acec 100644 --- a/lib/fastly/models/eom_invoice_response.rb +++ b/lib/fastly/models/eom_invoice_response.rb @@ -16,7 +16,7 @@ class EomInvoiceResponse # Customer ID associated with the invoice. attr_accessor :customer_id - # Alphanumeric string identifying the invoice. + # Numeric string identifying the invoice. attr_accessor :invoice_id # Date and time invoice was posted on, in ISO 8601 format. diff --git a/lib/fastly/models/invoice.rb b/lib/fastly/models/invoice.rb index 669bbca3..c9f2e43c 100644 --- a/lib/fastly/models/invoice.rb +++ b/lib/fastly/models/invoice.rb @@ -16,7 +16,7 @@ class Invoice # Customer ID associated with the invoice. attr_accessor :customer_id - # Alphanumeric string identifying the invoice. + # Numeric string identifying the invoice. attr_accessor :invoice_id # Date and time invoice was posted on, in ISO 8601 format. diff --git a/lib/fastly/models/line_item_data.rb b/lib/fastly/models/line_item_data.rb index 279921ee..675657d6 100644 --- a/lib/fastly/models/line_item_data.rb +++ b/lib/fastly/models/line_item_data.rb @@ -15,6 +15,7 @@ module Fastly class LineItemData attr_accessor :amount + # An alphanumeric string identifying the invoice. attr_accessor :aria_invoice_id attr_accessor :client_service_id @@ -79,7 +80,7 @@ def self.acceptable_attributes def self.fastly_types { :'amount' => :'Float', - :'aria_invoice_id' => :'LineItemDataReadOnlyInvoiceId', + :'aria_invoice_id' => :'String', :'client_service_id' => :'String', :'credit_coupon_code' => :'String', :'description' => :'String', diff --git a/lib/fastly/version.rb b/lib/fastly/version.rb index ecda697a..01feb1eb 100644 --- a/lib/fastly/version.rb +++ b/lib/fastly/version.rb @@ -9,5 +9,5 @@ =end module Fastly - VERSION = '8.6.0' + VERSION = '8.7.0' end diff --git a/sig.json b/sig.json index 713aa7d4..67771c68 100644 --- a/sig.json +++ b/sig.json @@ -1 +1 @@ -{"G": "01161630", "D": "e05af2db"} +{"G": "01161630", "D": "80b361d0"}