fastly 8.4.0 → 8.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +15 -2
  5. data/docs/{RelationshipTlsDnsRecord.md → AsyncResponse.md} +3 -2
  6. data/docs/BillingInvoicesApi.md +37 -4
  7. data/docs/BillingUsageMetricsApi.md +111 -0
  8. data/docs/ContentApi.md +1 -1
  9. data/docs/CreateDashboardRequest.md +12 -0
  10. data/docs/Dashboard.md +17 -0
  11. data/docs/DashboardItem.md +15 -0
  12. data/docs/DashboardItemPropertyDataSource.md +11 -0
  13. data/docs/DashboardItemPropertyDataSourcePropertyConfig.md +10 -0
  14. data/docs/DashboardItemPropertyVisualization.md +11 -0
  15. data/docs/DashboardItemPropertyVisualizationPropertyConfig.md +12 -0
  16. data/docs/{RelationshipTlsDnsRecords.md → DashboardPropertyCreatedBy.md} +1 -2
  17. data/docs/{RelationshipTlsDnsRecordDnsRecord.md → DashboardPropertyUpdatedBy.md} +1 -2
  18. data/docs/DomainInspectorMeasurements.md +1 -1
  19. data/docs/{InvoiceResponse.md → EomInvoiceResponse.md} +1 -1
  20. data/docs/GetServiceLevelUsageResponse.md +10 -0
  21. data/docs/GetServiceLevelUsageTypesResponse.md +10 -0
  22. data/docs/IncludedWithTlsConfiguration.md +10 -0
  23. data/docs/IncludedWithTlsConfigurationItem.md +12 -0
  24. data/docs/ListDashboardsResponse.md +11 -0
  25. data/docs/{ListInvoicesResponse.md → ListEomInvoicesResponse.md} +1 -1
  26. data/docs/LoggingKafkaAdditional.md +1 -1
  27. data/docs/LoggingKafkaApi.md +2 -2
  28. data/docs/LoggingKafkaResponse.md +1 -1
  29. data/docs/LoggingKafkaResponsePost.md +1 -1
  30. data/docs/LoggingLogentriesAdditional.md +1 -1
  31. data/docs/LoggingLogentriesApi.md +4 -4
  32. data/docs/LoggingLogentriesResponse.md +1 -1
  33. data/docs/LoggingSplunkAdditional.md +1 -1
  34. data/docs/LoggingSplunkApi.md +4 -4
  35. data/docs/LoggingSplunkResponse.md +1 -1
  36. data/docs/LoggingSyslogAdditional.md +1 -1
  37. data/docs/LoggingSyslogApi.md +4 -4
  38. data/docs/LoggingSyslogResponse.md +1 -1
  39. data/docs/{LoggingUseTls.md → LoggingUseTlsString.md} +1 -1
  40. data/docs/MtdInvoiceResponse.md +15 -0
  41. data/docs/Mtdinvoice.md +15 -0
  42. data/docs/Mtdlineitems.md +18 -0
  43. data/docs/ObservabilityCustomDashboardsApi.md +203 -0
  44. data/docs/RealtimeEntryAggregated.md +1 -0
  45. data/docs/RealtimeMeasurements.md +1 -0
  46. data/docs/RelationshipDefaultEcdsaTlsCertificate.md +10 -0
  47. data/docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificate.md +10 -0
  48. data/docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificateData.md +11 -0
  49. data/docs/RelationshipDefaultTlsCertificate.md +10 -0
  50. data/docs/RelationshipDefaultTlsCertificateDefaultCertificate.md +10 -0
  51. data/docs/RelationshipDefaultTlsCertificateDefaultCertificateData.md +11 -0
  52. data/docs/RelationshipTlsDnsRecordsRequest.md +10 -0
  53. data/docs/RelationshipTlsDnsRecordsRequestDnsRecords.md +10 -0
  54. data/docs/RelationshipTlsDnsRecordsRequestDnsRecordsData.md +11 -0
  55. data/docs/RelationshipTlsDnsRecordsResponse.md +10 -0
  56. data/docs/RelationshipTlsDnsRecordsResponseDnsRecords.md +10 -0
  57. data/docs/{RelationshipMemberTlsDnsRecord.md → RelationshipTlsDnsRecordsResponseDnsRecordsData.md} +1 -1
  58. data/docs/Results.md +1 -0
  59. data/docs/Serviceusagemetric.md +13 -0
  60. data/docs/Serviceusagemetrics.md +10 -0
  61. data/docs/ServiceusagemetricsData.md +16 -0
  62. data/docs/Serviceusagetype.md +11 -0
  63. data/docs/Serviceusagetypes.md +10 -0
  64. data/docs/TlsCertificateBlobResponse.md +10 -0
  65. data/docs/TlsCertificatesApi.md +38 -0
  66. data/docs/TlsDnsRecord.md +1 -2
  67. data/docs/UpdateDashboardRequest.md +12 -0
  68. data/docs/Values.md +1 -1
  69. data/lib/fastly/api/billing_invoices_api.rb +62 -6
  70. data/lib/fastly/api/billing_usage_metrics_api.rb +213 -0
  71. data/lib/fastly/api/content_api.rb +2 -2
  72. data/lib/fastly/api/logging_datadog_api.rb +2 -2
  73. data/lib/fastly/api/logging_kafka_api.rb +2 -2
  74. data/lib/fastly/api/logging_logentries_api.rb +4 -4
  75. data/lib/fastly/api/logging_splunk_api.rb +4 -4
  76. data/lib/fastly/api/logging_syslog_api.rb +4 -4
  77. data/lib/fastly/api/observability_custom_dashboards_api.rb +333 -0
  78. data/lib/fastly/api/tls_certificates_api.rb +63 -0
  79. data/lib/fastly/configuration.rb +54 -0
  80. data/lib/fastly/models/async_response.rb +225 -0
  81. data/lib/fastly/models/create_dashboard_request.rb +245 -0
  82. data/lib/fastly/models/dashboard.rb +290 -0
  83. data/lib/fastly/models/dashboard_item.rb +368 -0
  84. data/lib/fastly/models/dashboard_item_property_data_source.rb +271 -0
  85. data/lib/fastly/models/dashboard_item_property_data_source_property_config.rb +244 -0
  86. data/lib/fastly/models/dashboard_item_property_visualization.rb +271 -0
  87. data/lib/fastly/models/dashboard_item_property_visualization_property_config.rb +303 -0
  88. data/lib/fastly/models/dashboard_property_created_by.rb +208 -0
  89. data/lib/fastly/models/dashboard_property_updated_by.rb +208 -0
  90. data/lib/fastly/models/domain_inspector_measurements.rb +1 -1
  91. data/lib/fastly/models/{invoice_response.rb → eom_invoice_response.rb} +3 -3
  92. data/lib/fastly/models/get_service_level_usage_response.rb +223 -0
  93. data/lib/fastly/models/get_service_level_usage_types_response.rb +225 -0
  94. data/lib/fastly/models/included_with_tls_configuration.rb +218 -0
  95. data/lib/fastly/models/included_with_tls_configuration_item.rb +237 -0
  96. data/lib/fastly/models/invoicelineitems.rb +5 -5
  97. data/lib/fastly/models/list_dashboards_response.rb +229 -0
  98. data/lib/fastly/models/{list_invoices_response.rb → list_eom_invoices_response.rb} +3 -3
  99. data/lib/fastly/models/logging_datadog_additional.rb +2 -2
  100. data/lib/fastly/models/logging_datadog_response.rb +2 -2
  101. data/lib/fastly/models/logging_kafka_additional.rb +2 -2
  102. data/lib/fastly/models/logging_kafka_response.rb +2 -2
  103. data/lib/fastly/models/logging_kafka_response_post.rb +2 -2
  104. data/lib/fastly/models/logging_logentries_additional.rb +2 -2
  105. data/lib/fastly/models/logging_logentries_response.rb +2 -2
  106. data/lib/fastly/models/logging_splunk_additional.rb +2 -2
  107. data/lib/fastly/models/logging_splunk_response.rb +2 -2
  108. data/lib/fastly/models/logging_syslog_additional.rb +2 -2
  109. data/lib/fastly/models/logging_syslog_response.rb +2 -2
  110. data/lib/fastly/models/{logging_use_tls.rb → logging_use_tls_string.rb} +5 -5
  111. data/lib/fastly/models/mtd_invoice_response.rb +275 -0
  112. data/lib/fastly/models/mtdinvoice.rb +268 -0
  113. data/lib/fastly/models/mtdlineitems.rb +297 -0
  114. data/lib/fastly/models/realtime_entry_aggregated.rb +14 -4
  115. data/lib/fastly/models/realtime_measurements.rb +14 -4
  116. data/lib/fastly/models/relationship_default_ecdsa_tls_certificate.rb +216 -0
  117. data/lib/fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate.rb +216 -0
  118. data/lib/fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate_data.rb +228 -0
  119. data/lib/fastly/models/relationship_default_tls_certificate.rb +216 -0
  120. data/lib/fastly/models/relationship_default_tls_certificate_default_certificate.rb +216 -0
  121. data/lib/fastly/models/relationship_default_tls_certificate_default_certificate_data.rb +228 -0
  122. data/lib/fastly/models/{relationship_tls_dns_records.rb → relationship_tls_dns_records_request.rb} +4 -4
  123. data/lib/fastly/models/relationship_tls_dns_records_request_dns_records.rb +218 -0
  124. data/lib/fastly/models/{relationship_member_tls_dns_record.rb → relationship_tls_dns_records_request_dns_records_data.rb} +3 -3
  125. data/lib/fastly/models/relationship_tls_dns_records_response.rb +216 -0
  126. data/lib/fastly/models/relationship_tls_dns_records_response_dns_records.rb +218 -0
  127. data/lib/fastly/models/relationship_tls_dns_records_response_dns_records_data.rb +227 -0
  128. data/lib/fastly/models/relationships_for_tls_configuration.rb +1 -1
  129. data/lib/fastly/models/results.rb +11 -1
  130. data/lib/fastly/models/serviceusagemetric.rb +246 -0
  131. data/lib/fastly/models/{relationship_tls_dns_record.rb → serviceusagemetrics.rb} +10 -10
  132. data/lib/fastly/models/serviceusagemetrics_data.rb +276 -0
  133. data/lib/fastly/models/serviceusagetype.rb +227 -0
  134. data/lib/fastly/models/{relationship_tls_dns_record_dns_record.rb → serviceusagetypes.rb} +4 -4
  135. data/lib/fastly/models/tls_certificate_blob_response.rb +217 -0
  136. data/lib/fastly/models/tls_dns_record.rb +48 -12
  137. data/lib/fastly/models/update_dashboard_request.rb +240 -0
  138. data/lib/fastly/models/values.rb +1 -1
  139. data/lib/fastly/version.rb +1 -1
  140. data/lib/fastly.rb +42 -7
  141. data/sig.json +1 -1
  142. metadata +86 -16
@@ -0,0 +1,275 @@
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 MtdInvoiceResponse
16
+ # The Customer ID associated with the invoice.
17
+ attr_accessor :customer_id
18
+
19
+ # An alphanumeric string identifying the invoice.
20
+ attr_accessor :invoice_id
21
+
22
+ # The date and time (in ISO 8601 format) for the initiation point of a billing cycle, signifying the start of charges for a service or subscription.
23
+ attr_accessor :billing_start_date
24
+
25
+ # The date and time (in ISO 8601 format) for the termination point of a billing cycle, signifying the end of charges for a service or subscription.
26
+ attr_accessor :billing_end_date
27
+
28
+ # The total billable amount for invoiced services charged within a single month.
29
+ attr_accessor :monthly_transaction_amount
30
+
31
+ attr_accessor :transaction_line_items
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'customer_id' => :'customer_id',
37
+ :'invoice_id' => :'invoice_id',
38
+ :'billing_start_date' => :'billing_start_date',
39
+ :'billing_end_date' => :'billing_end_date',
40
+ :'monthly_transaction_amount' => :'monthly_transaction_amount',
41
+ :'transaction_line_items' => :'transaction_line_items'
42
+ }
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.fastly_types
52
+ {
53
+ :'customer_id' => :'String',
54
+ :'invoice_id' => :'String',
55
+ :'billing_start_date' => :'Time',
56
+ :'billing_end_date' => :'Time',
57
+ :'monthly_transaction_amount' => :'String',
58
+ :'transaction_line_items' => :'Array<Mtdlineitems>'
59
+ }
60
+ end
61
+
62
+ # List of attributes with nullable: true
63
+ def self.fastly_nullable
64
+ Set.new([
65
+ ])
66
+ end
67
+
68
+ # List of class defined in allOf (OpenAPI v3)
69
+ def self.fastly_all_of
70
+ [
71
+ :'Mtdinvoice'
72
+ ]
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ if (!attributes.is_a?(Hash))
79
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::MtdInvoiceResponse` initialize method"
80
+ end
81
+
82
+ # check to see if the attribute exists and convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!self.class.attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::MtdInvoiceResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'customer_id')
91
+ self.customer_id = attributes[:'customer_id']
92
+ end
93
+
94
+ if attributes.key?(:'invoice_id')
95
+ self.invoice_id = attributes[:'invoice_id']
96
+ end
97
+
98
+ if attributes.key?(:'billing_start_date')
99
+ self.billing_start_date = attributes[:'billing_start_date']
100
+ end
101
+
102
+ if attributes.key?(:'billing_end_date')
103
+ self.billing_end_date = attributes[:'billing_end_date']
104
+ end
105
+
106
+ if attributes.key?(:'monthly_transaction_amount')
107
+ self.monthly_transaction_amount = attributes[:'monthly_transaction_amount']
108
+ end
109
+
110
+ if attributes.key?(:'transaction_line_items')
111
+ if (value = attributes[:'transaction_line_items']).is_a?(Array)
112
+ self.transaction_line_items = value
113
+ end
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ invalid_properties = Array.new
121
+ invalid_properties
122
+ end
123
+
124
+ # Check to see if the all the properties in the model are valid
125
+ # @return true if the model is valid
126
+ def valid?
127
+ true
128
+ end
129
+
130
+ # Checks equality by comparing each attribute.
131
+ # @param [Object] Object to be compared
132
+ def ==(o)
133
+ return true if self.equal?(o)
134
+ self.class == o.class &&
135
+ customer_id == o.customer_id &&
136
+ invoice_id == o.invoice_id &&
137
+ billing_start_date == o.billing_start_date &&
138
+ billing_end_date == o.billing_end_date &&
139
+ monthly_transaction_amount == o.monthly_transaction_amount &&
140
+ transaction_line_items == o.transaction_line_items
141
+ end
142
+
143
+ # @see the `==` method
144
+ # @param [Object] Object to be compared
145
+ def eql?(o)
146
+ self == o
147
+ end
148
+
149
+ # Calculates hash code according to all attributes.
150
+ # @return [Integer] Hash code
151
+ def hash
152
+ [customer_id, invoice_id, billing_start_date, billing_end_date, monthly_transaction_amount, transaction_line_items].hash
153
+ end
154
+
155
+ # Builds the object from hash
156
+ # @param [Hash] attributes Model attributes in the form of hash
157
+ # @return [Object] Returns the model itself
158
+ def self.build_from_hash(attributes)
159
+ new.build_from_hash(attributes)
160
+ end
161
+
162
+ # Builds the object from hash
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @return [Object] Returns the model itself
165
+ def build_from_hash(attributes)
166
+ return nil unless attributes.is_a?(Hash)
167
+ self.class.fastly_types.each_pair do |key, type|
168
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
169
+ self.send("#{key}=", nil)
170
+ elsif type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
174
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
175
+ end
176
+ elsif !attributes[self.class.attribute_map[key]].nil?
177
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
178
+ end
179
+ end
180
+
181
+ self
182
+ end
183
+
184
+ # Deserializes the data based on type
185
+ # @param string type Data type
186
+ # @param string value Value to be deserialized
187
+ # @return [Object] Deserialized data
188
+ def _deserialize(type, value)
189
+ case type.to_sym
190
+ when :Time
191
+ Time.parse(value)
192
+ when :Date
193
+ Date.parse(value)
194
+ when :String
195
+ value.to_s
196
+ when :Integer
197
+ value.to_i
198
+ when :Float
199
+ value.to_f
200
+ when :Boolean
201
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
+ true
203
+ else
204
+ false
205
+ end
206
+ when :Object
207
+ # generic object (usually a Hash), return directly
208
+ value
209
+ when /\AArray<(?<inner_type>.+)>\z/
210
+ inner_type = Regexp.last_match[:inner_type]
211
+ value.map { |v| _deserialize(inner_type, v) }
212
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
+ k_type = Regexp.last_match[:k_type]
214
+ v_type = Regexp.last_match[:v_type]
215
+ {}.tap do |hash|
216
+ value.each do |k, v|
217
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
+ end
219
+ end
220
+ else # model
221
+ # models (e.g. Pet) or oneOf
222
+ klass = Fastly.const_get(type)
223
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
224
+ end
225
+ end
226
+
227
+ # Returns the string representation of the object
228
+ # @return [String] String presentation of the object
229
+ def to_s
230
+ to_hash.to_s
231
+ end
232
+
233
+ # to_body is an alias to to_hash (backward compatibility)
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_body
236
+ to_hash
237
+ end
238
+
239
+ # Returns the object in the form of hash
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_hash
242
+ hash = {}
243
+ self.class.attribute_map.each_pair do |attr, param|
244
+ value = self.send(attr)
245
+ if value.nil?
246
+ is_nullable = self.class.fastly_nullable.include?(attr)
247
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
248
+ end
249
+
250
+ hash[param] = _to_hash(value)
251
+ end
252
+ hash
253
+ end
254
+
255
+ # Outputs non-array value in the form of hash
256
+ # For object, use to_hash. Otherwise, just return the value
257
+ # @param [Object] value Any valid value
258
+ # @return [Hash] Returns the value in the form of hash
259
+ def _to_hash(value)
260
+ if value.is_a?(Array)
261
+ value.compact.map { |v| _to_hash(v) }
262
+ elsif value.is_a?(Hash)
263
+ {}.tap do |hash|
264
+ value.each { |k, v| hash[k] = _to_hash(v) }
265
+ end
266
+ elsif value.respond_to? :to_hash
267
+ value.to_hash
268
+ else
269
+ value
270
+ end
271
+ end
272
+
273
+ end
274
+
275
+ end
@@ -0,0 +1,268 @@
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 Mtdinvoice
16
+ # The Customer ID associated with the invoice.
17
+ attr_accessor :customer_id
18
+
19
+ # An alphanumeric string identifying the invoice.
20
+ attr_accessor :invoice_id
21
+
22
+ # The date and time (in ISO 8601 format) for the initiation point of a billing cycle, signifying the start of charges for a service or subscription.
23
+ attr_accessor :billing_start_date
24
+
25
+ # The date and time (in ISO 8601 format) for the termination point of a billing cycle, signifying the end of charges for a service or subscription.
26
+ attr_accessor :billing_end_date
27
+
28
+ # The total billable amount for invoiced services charged within a single month.
29
+ attr_accessor :monthly_transaction_amount
30
+
31
+ attr_accessor :transaction_line_items
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'customer_id' => :'customer_id',
37
+ :'invoice_id' => :'invoice_id',
38
+ :'billing_start_date' => :'billing_start_date',
39
+ :'billing_end_date' => :'billing_end_date',
40
+ :'monthly_transaction_amount' => :'monthly_transaction_amount',
41
+ :'transaction_line_items' => :'transaction_line_items'
42
+ }
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.fastly_types
52
+ {
53
+ :'customer_id' => :'String',
54
+ :'invoice_id' => :'String',
55
+ :'billing_start_date' => :'Time',
56
+ :'billing_end_date' => :'Time',
57
+ :'monthly_transaction_amount' => :'String',
58
+ :'transaction_line_items' => :'Array<Mtdlineitems>'
59
+ }
60
+ end
61
+
62
+ # List of attributes with nullable: true
63
+ def self.fastly_nullable
64
+ Set.new([
65
+ ])
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::Mtdinvoice` initialize method"
73
+ end
74
+
75
+ # check to see if the attribute exists and convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!self.class.attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::Mtdinvoice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'customer_id')
84
+ self.customer_id = attributes[:'customer_id']
85
+ end
86
+
87
+ if attributes.key?(:'invoice_id')
88
+ self.invoice_id = attributes[:'invoice_id']
89
+ end
90
+
91
+ if attributes.key?(:'billing_start_date')
92
+ self.billing_start_date = attributes[:'billing_start_date']
93
+ end
94
+
95
+ if attributes.key?(:'billing_end_date')
96
+ self.billing_end_date = attributes[:'billing_end_date']
97
+ end
98
+
99
+ if attributes.key?(:'monthly_transaction_amount')
100
+ self.monthly_transaction_amount = attributes[:'monthly_transaction_amount']
101
+ end
102
+
103
+ if attributes.key?(:'transaction_line_items')
104
+ if (value = attributes[:'transaction_line_items']).is_a?(Array)
105
+ self.transaction_line_items = value
106
+ end
107
+ end
108
+ end
109
+
110
+ # Show invalid properties with the reasons. Usually used together with valid?
111
+ # @return Array for valid properties with the reasons
112
+ def list_invalid_properties
113
+ invalid_properties = Array.new
114
+ invalid_properties
115
+ end
116
+
117
+ # Check to see if the all the properties in the model are valid
118
+ # @return true if the model is valid
119
+ def valid?
120
+ true
121
+ end
122
+
123
+ # Checks equality by comparing each attribute.
124
+ # @param [Object] Object to be compared
125
+ def ==(o)
126
+ return true if self.equal?(o)
127
+ self.class == o.class &&
128
+ customer_id == o.customer_id &&
129
+ invoice_id == o.invoice_id &&
130
+ billing_start_date == o.billing_start_date &&
131
+ billing_end_date == o.billing_end_date &&
132
+ monthly_transaction_amount == o.monthly_transaction_amount &&
133
+ transaction_line_items == o.transaction_line_items
134
+ end
135
+
136
+ # @see the `==` method
137
+ # @param [Object] Object to be compared
138
+ def eql?(o)
139
+ self == o
140
+ end
141
+
142
+ # Calculates hash code according to all attributes.
143
+ # @return [Integer] Hash code
144
+ def hash
145
+ [customer_id, invoice_id, billing_start_date, billing_end_date, monthly_transaction_amount, transaction_line_items].hash
146
+ end
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def self.build_from_hash(attributes)
152
+ new.build_from_hash(attributes)
153
+ end
154
+
155
+ # Builds the object from hash
156
+ # @param [Hash] attributes Model attributes in the form of hash
157
+ # @return [Object] Returns the model itself
158
+ def build_from_hash(attributes)
159
+ return nil unless attributes.is_a?(Hash)
160
+ self.class.fastly_types.each_pair do |key, type|
161
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
162
+ self.send("#{key}=", nil)
163
+ elsif type =~ /\AArray<(.*)>/i
164
+ # check to ensure the input is an array given that the attribute
165
+ # is documented as an array but the input is not
166
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
167
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
168
+ end
169
+ elsif !attributes[self.class.attribute_map[key]].nil?
170
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
171
+ end
172
+ end
173
+
174
+ self
175
+ end
176
+
177
+ # Deserializes the data based on type
178
+ # @param string type Data type
179
+ # @param string value Value to be deserialized
180
+ # @return [Object] Deserialized data
181
+ def _deserialize(type, value)
182
+ case type.to_sym
183
+ when :Time
184
+ Time.parse(value)
185
+ when :Date
186
+ Date.parse(value)
187
+ when :String
188
+ value.to_s
189
+ when :Integer
190
+ value.to_i
191
+ when :Float
192
+ value.to_f
193
+ when :Boolean
194
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
195
+ true
196
+ else
197
+ false
198
+ end
199
+ when :Object
200
+ # generic object (usually a Hash), return directly
201
+ value
202
+ when /\AArray<(?<inner_type>.+)>\z/
203
+ inner_type = Regexp.last_match[:inner_type]
204
+ value.map { |v| _deserialize(inner_type, v) }
205
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
206
+ k_type = Regexp.last_match[:k_type]
207
+ v_type = Regexp.last_match[:v_type]
208
+ {}.tap do |hash|
209
+ value.each do |k, v|
210
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
211
+ end
212
+ end
213
+ else # model
214
+ # models (e.g. Pet) or oneOf
215
+ klass = Fastly.const_get(type)
216
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
217
+ end
218
+ end
219
+
220
+ # Returns the string representation of the object
221
+ # @return [String] String presentation of the object
222
+ def to_s
223
+ to_hash.to_s
224
+ end
225
+
226
+ # to_body is an alias to to_hash (backward compatibility)
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_body
229
+ to_hash
230
+ end
231
+
232
+ # Returns the object in the form of hash
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_hash
235
+ hash = {}
236
+ self.class.attribute_map.each_pair do |attr, param|
237
+ value = self.send(attr)
238
+ if value.nil?
239
+ is_nullable = self.class.fastly_nullable.include?(attr)
240
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
241
+ end
242
+
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ # Outputs non-array value in the form of hash
249
+ # For object, use to_hash. Otherwise, just return the value
250
+ # @param [Object] value Any valid value
251
+ # @return [Hash] Returns the value in the form of hash
252
+ def _to_hash(value)
253
+ if value.is_a?(Array)
254
+ value.compact.map { |v| _to_hash(v) }
255
+ elsif value.is_a?(Hash)
256
+ {}.tap do |hash|
257
+ value.each { |k, v| hash[k] = _to_hash(v) }
258
+ end
259
+ elsif value.respond_to? :to_hash
260
+ value.to_hash
261
+ else
262
+ value
263
+ end
264
+ end
265
+
266
+ end
267
+
268
+ end