fastly 8.5.0 → 8.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -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/CreateDashboardRequest.md +12 -0
  9. data/docs/Dashboard.md +17 -0
  10. data/docs/DashboardItem.md +15 -0
  11. data/docs/DashboardItemPropertyDataSource.md +11 -0
  12. data/docs/DashboardItemPropertyDataSourcePropertyConfig.md +10 -0
  13. data/docs/DashboardItemPropertyVisualization.md +11 -0
  14. data/docs/DashboardItemPropertyVisualizationPropertyConfig.md +12 -0
  15. data/docs/{RelationshipTlsDnsRecords.md → DashboardPropertyCreatedBy.md} +1 -2
  16. data/docs/{RelationshipTlsDnsRecordDnsRecord.md → DashboardPropertyUpdatedBy.md} +1 -2
  17. data/docs/DomainInspectorMeasurements.md +1 -1
  18. data/docs/{InvoiceResponse.md → EomInvoiceResponse.md} +1 -1
  19. data/docs/GetServiceLevelUsageResponse.md +10 -0
  20. data/docs/GetServiceLevelUsageTypesResponse.md +10 -0
  21. data/docs/IncludedWithTlsConfiguration.md +10 -0
  22. data/docs/IncludedWithTlsConfigurationItem.md +12 -0
  23. data/docs/ListDashboardsResponse.md +11 -0
  24. data/docs/{ListInvoicesResponse.md → ListEomInvoicesResponse.md} +1 -1
  25. data/docs/MtdInvoiceResponse.md +15 -0
  26. data/docs/Mtdinvoice.md +15 -0
  27. data/docs/Mtdlineitems.md +18 -0
  28. data/docs/ObservabilityCustomDashboardsApi.md +203 -0
  29. data/docs/RealtimeEntryAggregated.md +1 -0
  30. data/docs/RealtimeMeasurements.md +1 -0
  31. data/docs/RelationshipDefaultEcdsaTlsCertificate.md +10 -0
  32. data/docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificate.md +10 -0
  33. data/docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificateData.md +11 -0
  34. data/docs/RelationshipDefaultTlsCertificate.md +10 -0
  35. data/docs/RelationshipDefaultTlsCertificateDefaultCertificate.md +10 -0
  36. data/docs/RelationshipDefaultTlsCertificateDefaultCertificateData.md +11 -0
  37. data/docs/RelationshipTlsDnsRecordsRequest.md +10 -0
  38. data/docs/RelationshipTlsDnsRecordsRequestDnsRecords.md +10 -0
  39. data/docs/RelationshipTlsDnsRecordsRequestDnsRecordsData.md +11 -0
  40. data/docs/RelationshipTlsDnsRecordsResponse.md +10 -0
  41. data/docs/RelationshipTlsDnsRecordsResponseDnsRecords.md +10 -0
  42. data/docs/{RelationshipMemberTlsDnsRecord.md → RelationshipTlsDnsRecordsResponseDnsRecordsData.md} +1 -1
  43. data/docs/Results.md +1 -0
  44. data/docs/Serviceusagemetric.md +13 -0
  45. data/docs/Serviceusagemetrics.md +10 -0
  46. data/docs/ServiceusagemetricsData.md +16 -0
  47. data/docs/Serviceusagetype.md +11 -0
  48. data/docs/Serviceusagetypes.md +10 -0
  49. data/docs/TlsCertificateBlobResponse.md +10 -0
  50. data/docs/TlsCertificatesApi.md +38 -0
  51. data/docs/TlsDnsRecord.md +1 -2
  52. data/docs/UpdateDashboardRequest.md +12 -0
  53. data/docs/Values.md +1 -1
  54. data/lib/fastly/api/billing_invoices_api.rb +62 -6
  55. data/lib/fastly/api/billing_usage_metrics_api.rb +213 -0
  56. data/lib/fastly/api/observability_custom_dashboards_api.rb +333 -0
  57. data/lib/fastly/api/tls_certificates_api.rb +63 -0
  58. data/lib/fastly/configuration.rb +54 -0
  59. data/lib/fastly/models/async_response.rb +225 -0
  60. data/lib/fastly/models/create_dashboard_request.rb +245 -0
  61. data/lib/fastly/models/dashboard.rb +290 -0
  62. data/lib/fastly/models/dashboard_item.rb +368 -0
  63. data/lib/fastly/models/dashboard_item_property_data_source.rb +271 -0
  64. data/lib/fastly/models/dashboard_item_property_data_source_property_config.rb +244 -0
  65. data/lib/fastly/models/dashboard_item_property_visualization.rb +271 -0
  66. data/lib/fastly/models/dashboard_item_property_visualization_property_config.rb +303 -0
  67. data/lib/fastly/models/dashboard_property_created_by.rb +208 -0
  68. data/lib/fastly/models/dashboard_property_updated_by.rb +208 -0
  69. data/lib/fastly/models/domain_inspector_measurements.rb +1 -1
  70. data/lib/fastly/models/{invoice_response.rb → eom_invoice_response.rb} +3 -3
  71. data/lib/fastly/models/get_service_level_usage_response.rb +223 -0
  72. data/lib/fastly/models/get_service_level_usage_types_response.rb +225 -0
  73. data/lib/fastly/models/included_with_tls_configuration.rb +218 -0
  74. data/lib/fastly/models/included_with_tls_configuration_item.rb +237 -0
  75. data/lib/fastly/models/invoicelineitems.rb +5 -5
  76. data/lib/fastly/models/list_dashboards_response.rb +229 -0
  77. data/lib/fastly/models/{list_invoices_response.rb → list_eom_invoices_response.rb} +3 -3
  78. data/lib/fastly/models/mtd_invoice_response.rb +275 -0
  79. data/lib/fastly/models/mtdinvoice.rb +268 -0
  80. data/lib/fastly/models/mtdlineitems.rb +297 -0
  81. data/lib/fastly/models/realtime_entry_aggregated.rb +14 -4
  82. data/lib/fastly/models/realtime_measurements.rb +14 -4
  83. data/lib/fastly/models/relationship_default_ecdsa_tls_certificate.rb +216 -0
  84. data/lib/fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate.rb +216 -0
  85. data/lib/fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate_data.rb +228 -0
  86. data/lib/fastly/models/relationship_default_tls_certificate.rb +216 -0
  87. data/lib/fastly/models/relationship_default_tls_certificate_default_certificate.rb +216 -0
  88. data/lib/fastly/models/relationship_default_tls_certificate_default_certificate_data.rb +228 -0
  89. data/lib/fastly/models/{relationship_tls_dns_records.rb → relationship_tls_dns_records_request.rb} +4 -4
  90. data/lib/fastly/models/relationship_tls_dns_records_request_dns_records.rb +218 -0
  91. data/lib/fastly/models/{relationship_member_tls_dns_record.rb → relationship_tls_dns_records_request_dns_records_data.rb} +3 -3
  92. data/lib/fastly/models/relationship_tls_dns_records_response.rb +216 -0
  93. data/lib/fastly/models/relationship_tls_dns_records_response_dns_records.rb +218 -0
  94. data/lib/fastly/models/relationship_tls_dns_records_response_dns_records_data.rb +227 -0
  95. data/lib/fastly/models/relationships_for_tls_configuration.rb +1 -1
  96. data/lib/fastly/models/results.rb +11 -1
  97. data/lib/fastly/models/serviceusagemetric.rb +246 -0
  98. data/lib/fastly/models/{relationship_tls_dns_record.rb → serviceusagemetrics.rb} +10 -10
  99. data/lib/fastly/models/serviceusagemetrics_data.rb +276 -0
  100. data/lib/fastly/models/serviceusagetype.rb +227 -0
  101. data/lib/fastly/models/{relationship_tls_dns_record_dns_record.rb → serviceusagetypes.rb} +4 -4
  102. data/lib/fastly/models/tls_certificate_blob_response.rb +217 -0
  103. data/lib/fastly/models/tls_dns_record.rb +48 -12
  104. data/lib/fastly/models/update_dashboard_request.rb +240 -0
  105. data/lib/fastly/models/values.rb +1 -1
  106. data/lib/fastly/version.rb +1 -1
  107. data/lib/fastly.rb +41 -6
  108. data/sig.json +1 -1
  109. metadata +84 -14
@@ -0,0 +1,290 @@
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 Dashboard
16
+ # Dashboard identifier (UUID)
17
+ attr_accessor :id
18
+
19
+ # A human-readable name
20
+ attr_accessor :name
21
+
22
+ # A short description of the dashboard
23
+ attr_accessor :description
24
+
25
+ # A list of [dashboard items](#dashboard-item).
26
+ attr_accessor :items
27
+
28
+ # Date and time in ISO 8601 format.
29
+ attr_accessor :created_at
30
+
31
+ # Date and time in ISO 8601 format.
32
+ attr_accessor :updated_at
33
+
34
+ attr_accessor :created_by
35
+
36
+ attr_accessor :updated_by
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'id' => :'id',
42
+ :'name' => :'name',
43
+ :'description' => :'description',
44
+ :'items' => :'items',
45
+ :'created_at' => :'created_at',
46
+ :'updated_at' => :'updated_at',
47
+ :'created_by' => :'created_by',
48
+ :'updated_by' => :'updated_by'
49
+ }
50
+ end
51
+
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ attribute_map.values
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.fastly_types
59
+ {
60
+ :'id' => :'String',
61
+ :'name' => :'String',
62
+ :'description' => :'String',
63
+ :'items' => :'Array<DashboardItem>',
64
+ :'created_at' => :'Time',
65
+ :'updated_at' => :'Time',
66
+ :'created_by' => :'DashboardPropertyCreatedBy',
67
+ :'updated_by' => :'DashboardPropertyUpdatedBy'
68
+ }
69
+ end
70
+
71
+ # List of attributes with nullable: true
72
+ def self.fastly_nullable
73
+ Set.new([
74
+ :'items',
75
+ :'created_at',
76
+ :'updated_at',
77
+ ])
78
+ end
79
+
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ def initialize(attributes = {})
83
+ if (!attributes.is_a?(Hash))
84
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::Dashboard` initialize method"
85
+ end
86
+
87
+ # check to see if the attribute exists and convert string to symbol for hash key
88
+ attributes = attributes.each_with_object({}) { |(k, v), h|
89
+ if (!self.class.attribute_map.key?(k.to_sym))
90
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::Dashboard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
91
+ end
92
+ h[k.to_sym] = v
93
+ }
94
+
95
+ if attributes.key?(:'id')
96
+ self.id = attributes[:'id']
97
+ end
98
+
99
+ if attributes.key?(:'name')
100
+ self.name = attributes[:'name']
101
+ end
102
+
103
+ if attributes.key?(:'description')
104
+ self.description = attributes[:'description']
105
+ end
106
+
107
+ if attributes.key?(:'items')
108
+ if (value = attributes[:'items']).is_a?(Array)
109
+ self.items = value
110
+ end
111
+ end
112
+
113
+ if attributes.key?(:'created_at')
114
+ self.created_at = attributes[:'created_at']
115
+ end
116
+
117
+ if attributes.key?(:'updated_at')
118
+ self.updated_at = attributes[:'updated_at']
119
+ end
120
+
121
+ if attributes.key?(:'created_by')
122
+ self.created_by = attributes[:'created_by']
123
+ end
124
+
125
+ if attributes.key?(:'updated_by')
126
+ self.updated_by = attributes[:'updated_by']
127
+ end
128
+ end
129
+
130
+ # Show invalid properties with the reasons. Usually used together with valid?
131
+ # @return Array for valid properties with the reasons
132
+ def list_invalid_properties
133
+ invalid_properties = Array.new
134
+ invalid_properties
135
+ end
136
+
137
+ # Check to see if the all the properties in the model are valid
138
+ # @return true if the model is valid
139
+ def valid?
140
+ true
141
+ end
142
+
143
+ # Checks equality by comparing each attribute.
144
+ # @param [Object] Object to be compared
145
+ def ==(o)
146
+ return true if self.equal?(o)
147
+ self.class == o.class &&
148
+ id == o.id &&
149
+ name == o.name &&
150
+ description == o.description &&
151
+ items == o.items &&
152
+ created_at == o.created_at &&
153
+ updated_at == o.updated_at &&
154
+ created_by == o.created_by &&
155
+ updated_by == o.updated_by
156
+ end
157
+
158
+ # @see the `==` method
159
+ # @param [Object] Object to be compared
160
+ def eql?(o)
161
+ self == o
162
+ end
163
+
164
+ # Calculates hash code according to all attributes.
165
+ # @return [Integer] Hash code
166
+ def hash
167
+ [id, name, description, items, created_at, updated_at, created_by, updated_by].hash
168
+ end
169
+
170
+ # Builds the object from hash
171
+ # @param [Hash] attributes Model attributes in the form of hash
172
+ # @return [Object] Returns the model itself
173
+ def self.build_from_hash(attributes)
174
+ new.build_from_hash(attributes)
175
+ end
176
+
177
+ # Builds the object from hash
178
+ # @param [Hash] attributes Model attributes in the form of hash
179
+ # @return [Object] Returns the model itself
180
+ def build_from_hash(attributes)
181
+ return nil unless attributes.is_a?(Hash)
182
+ self.class.fastly_types.each_pair do |key, type|
183
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
184
+ self.send("#{key}=", nil)
185
+ elsif type =~ /\AArray<(.*)>/i
186
+ # check to ensure the input is an array given that the attribute
187
+ # is documented as an array but the input is not
188
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
189
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
190
+ end
191
+ elsif !attributes[self.class.attribute_map[key]].nil?
192
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
193
+ end
194
+ end
195
+
196
+ self
197
+ end
198
+
199
+ # Deserializes the data based on type
200
+ # @param string type Data type
201
+ # @param string value Value to be deserialized
202
+ # @return [Object] Deserialized data
203
+ def _deserialize(type, value)
204
+ case type.to_sym
205
+ when :Time
206
+ Time.parse(value)
207
+ when :Date
208
+ Date.parse(value)
209
+ when :String
210
+ value.to_s
211
+ when :Integer
212
+ value.to_i
213
+ when :Float
214
+ value.to_f
215
+ when :Boolean
216
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
217
+ true
218
+ else
219
+ false
220
+ end
221
+ when :Object
222
+ # generic object (usually a Hash), return directly
223
+ value
224
+ when /\AArray<(?<inner_type>.+)>\z/
225
+ inner_type = Regexp.last_match[:inner_type]
226
+ value.map { |v| _deserialize(inner_type, v) }
227
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
228
+ k_type = Regexp.last_match[:k_type]
229
+ v_type = Regexp.last_match[:v_type]
230
+ {}.tap do |hash|
231
+ value.each do |k, v|
232
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
233
+ end
234
+ end
235
+ else # model
236
+ # models (e.g. Pet) or oneOf
237
+ klass = Fastly.const_get(type)
238
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
239
+ end
240
+ end
241
+
242
+ # Returns the string representation of the object
243
+ # @return [String] String presentation of the object
244
+ def to_s
245
+ to_hash.to_s
246
+ end
247
+
248
+ # to_body is an alias to to_hash (backward compatibility)
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_body
251
+ to_hash
252
+ end
253
+
254
+ # Returns the object in the form of hash
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_hash
257
+ hash = {}
258
+ self.class.attribute_map.each_pair do |attr, param|
259
+ value = self.send(attr)
260
+ if value.nil?
261
+ is_nullable = self.class.fastly_nullable.include?(attr)
262
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
263
+ end
264
+
265
+ hash[param] = _to_hash(value)
266
+ end
267
+ hash
268
+ end
269
+
270
+ # Outputs non-array value in the form of hash
271
+ # For object, use to_hash. Otherwise, just return the value
272
+ # @param [Object] value Any valid value
273
+ # @return [Hash] Returns the value in the form of hash
274
+ def _to_hash(value)
275
+ if value.is_a?(Array)
276
+ value.compact.map { |v| _to_hash(v) }
277
+ elsif value.is_a?(Hash)
278
+ {}.tap do |hash|
279
+ value.each { |k, v| hash[k] = _to_hash(v) }
280
+ end
281
+ elsif value.respond_to? :to_hash
282
+ value.to_hash
283
+ else
284
+ value
285
+ end
286
+ end
287
+
288
+ end
289
+
290
+ end
@@ -0,0 +1,368 @@
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
+ # A dashboard item. Typically a data visualization like a chart.
16
+ class DashboardItem
17
+ # A human-readable title for the dashboard item
18
+ attr_accessor :title
19
+
20
+ # A human-readable subtitle for the dashboard item. Often a description of the visualization.
21
+ attr_accessor :subtitle
22
+
23
+ attr_accessor :data_source
24
+
25
+ attr_accessor :visualization
26
+
27
+ # Dashboard item identifier (UUID)
28
+ attr_accessor :id
29
+
30
+ # The number of columns for the dashboard item to span. Dashboards are rendered on a 12-column grid on \"desktop\" screen sizes.
31
+ attr_accessor :span
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'title' => :'title',
37
+ :'subtitle' => :'subtitle',
38
+ :'data_source' => :'data_source',
39
+ :'visualization' => :'visualization',
40
+ :'id' => :'id',
41
+ :'span' => :'span'
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
+ :'title' => :'String',
54
+ :'subtitle' => :'String',
55
+ :'data_source' => :'DashboardItemPropertyDataSource',
56
+ :'visualization' => :'DashboardItemPropertyVisualization',
57
+ :'id' => :'String',
58
+ :'span' => :'Integer'
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::DashboardItem` 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::DashboardItem`. 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?(:'title')
84
+ self.title = attributes[:'title']
85
+ end
86
+
87
+ if attributes.key?(:'subtitle')
88
+ self.subtitle = attributes[:'subtitle']
89
+ end
90
+
91
+ if attributes.key?(:'data_source')
92
+ self.data_source = attributes[:'data_source']
93
+ end
94
+
95
+ if attributes.key?(:'visualization')
96
+ self.visualization = attributes[:'visualization']
97
+ end
98
+
99
+ if attributes.key?(:'id')
100
+ self.id = attributes[:'id']
101
+ end
102
+
103
+ if attributes.key?(:'span')
104
+ self.span = attributes[:'span']
105
+ else
106
+ self.span = 4
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
+ if @title.nil?
115
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
116
+ end
117
+
118
+ if @title.to_s.length > 255
119
+ invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 255.')
120
+ end
121
+
122
+ if @title.to_s.length < 1
123
+ invalid_properties.push('invalid value for "title", the character length must be great than or equal to 1.')
124
+ end
125
+
126
+ if @subtitle.nil?
127
+ invalid_properties.push('invalid value for "subtitle", subtitle cannot be nil.')
128
+ end
129
+
130
+ if @subtitle.to_s.length > 255
131
+ invalid_properties.push('invalid value for "subtitle", the character length must be smaller than or equal to 255.')
132
+ end
133
+
134
+ if @subtitle.to_s.length < 1
135
+ invalid_properties.push('invalid value for "subtitle", the character length must be great than or equal to 1.')
136
+ end
137
+
138
+ if @data_source.nil?
139
+ invalid_properties.push('invalid value for "data_source", data_source cannot be nil.')
140
+ end
141
+
142
+ if @visualization.nil?
143
+ invalid_properties.push('invalid value for "visualization", visualization cannot be nil.')
144
+ end
145
+
146
+ if !@span.nil? && @span > 12
147
+ invalid_properties.push('invalid value for "span", must be smaller than or equal to 12.')
148
+ end
149
+
150
+ if !@span.nil? && @span < 1
151
+ invalid_properties.push('invalid value for "span", must be greater than or equal to 1.')
152
+ end
153
+
154
+ invalid_properties
155
+ end
156
+
157
+ # Check to see if the all the properties in the model are valid
158
+ # @return true if the model is valid
159
+ def valid?
160
+ return false if @title.nil?
161
+ return false if @title.to_s.length > 255
162
+ return false if @title.to_s.length < 1
163
+ return false if @subtitle.nil?
164
+ return false if @subtitle.to_s.length > 255
165
+ return false if @subtitle.to_s.length < 1
166
+ return false if @data_source.nil?
167
+ return false if @visualization.nil?
168
+ return false if !@span.nil? && @span > 12
169
+ return false if !@span.nil? && @span < 1
170
+ true
171
+ end
172
+
173
+ # Custom attribute writer method with validation
174
+ # @param [Object] title Value to be assigned
175
+ def title=(title)
176
+ if title.nil?
177
+ fail ArgumentError, 'title cannot be nil'
178
+ end
179
+
180
+ if title.to_s.length > 255
181
+ fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 255.'
182
+ end
183
+
184
+ if title.to_s.length < 1
185
+ fail ArgumentError, 'invalid value for "title", the character length must be great than or equal to 1.'
186
+ end
187
+
188
+ @title = title
189
+ end
190
+
191
+ # Custom attribute writer method with validation
192
+ # @param [Object] subtitle Value to be assigned
193
+ def subtitle=(subtitle)
194
+ if subtitle.nil?
195
+ fail ArgumentError, 'subtitle cannot be nil'
196
+ end
197
+
198
+ if subtitle.to_s.length > 255
199
+ fail ArgumentError, 'invalid value for "subtitle", the character length must be smaller than or equal to 255.'
200
+ end
201
+
202
+ if subtitle.to_s.length < 1
203
+ fail ArgumentError, 'invalid value for "subtitle", the character length must be great than or equal to 1.'
204
+ end
205
+
206
+ @subtitle = subtitle
207
+ end
208
+
209
+ # Custom attribute writer method with validation
210
+ # @param [Object] span Value to be assigned
211
+ def span=(span)
212
+ if !span.nil? && span > 12
213
+ fail ArgumentError, 'invalid value for "span", must be smaller than or equal to 12.'
214
+ end
215
+
216
+ if !span.nil? && span < 1
217
+ fail ArgumentError, 'invalid value for "span", must be greater than or equal to 1.'
218
+ end
219
+
220
+ @span = span
221
+ end
222
+
223
+ # Checks equality by comparing each attribute.
224
+ # @param [Object] Object to be compared
225
+ def ==(o)
226
+ return true if self.equal?(o)
227
+ self.class == o.class &&
228
+ title == o.title &&
229
+ subtitle == o.subtitle &&
230
+ data_source == o.data_source &&
231
+ visualization == o.visualization &&
232
+ id == o.id &&
233
+ span == o.span
234
+ end
235
+
236
+ # @see the `==` method
237
+ # @param [Object] Object to be compared
238
+ def eql?(o)
239
+ self == o
240
+ end
241
+
242
+ # Calculates hash code according to all attributes.
243
+ # @return [Integer] Hash code
244
+ def hash
245
+ [title, subtitle, data_source, visualization, id, span].hash
246
+ end
247
+
248
+ # Builds the object from hash
249
+ # @param [Hash] attributes Model attributes in the form of hash
250
+ # @return [Object] Returns the model itself
251
+ def self.build_from_hash(attributes)
252
+ new.build_from_hash(attributes)
253
+ end
254
+
255
+ # Builds the object from hash
256
+ # @param [Hash] attributes Model attributes in the form of hash
257
+ # @return [Object] Returns the model itself
258
+ def build_from_hash(attributes)
259
+ return nil unless attributes.is_a?(Hash)
260
+ self.class.fastly_types.each_pair do |key, type|
261
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
262
+ self.send("#{key}=", nil)
263
+ elsif type =~ /\AArray<(.*)>/i
264
+ # check to ensure the input is an array given that the attribute
265
+ # is documented as an array but the input is not
266
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
267
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
268
+ end
269
+ elsif !attributes[self.class.attribute_map[key]].nil?
270
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
271
+ end
272
+ end
273
+
274
+ self
275
+ end
276
+
277
+ # Deserializes the data based on type
278
+ # @param string type Data type
279
+ # @param string value Value to be deserialized
280
+ # @return [Object] Deserialized data
281
+ def _deserialize(type, value)
282
+ case type.to_sym
283
+ when :Time
284
+ Time.parse(value)
285
+ when :Date
286
+ Date.parse(value)
287
+ when :String
288
+ value.to_s
289
+ when :Integer
290
+ value.to_i
291
+ when :Float
292
+ value.to_f
293
+ when :Boolean
294
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
295
+ true
296
+ else
297
+ false
298
+ end
299
+ when :Object
300
+ # generic object (usually a Hash), return directly
301
+ value
302
+ when /\AArray<(?<inner_type>.+)>\z/
303
+ inner_type = Regexp.last_match[:inner_type]
304
+ value.map { |v| _deserialize(inner_type, v) }
305
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
306
+ k_type = Regexp.last_match[:k_type]
307
+ v_type = Regexp.last_match[:v_type]
308
+ {}.tap do |hash|
309
+ value.each do |k, v|
310
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
311
+ end
312
+ end
313
+ else # model
314
+ # models (e.g. Pet) or oneOf
315
+ klass = Fastly.const_get(type)
316
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
317
+ end
318
+ end
319
+
320
+ # Returns the string representation of the object
321
+ # @return [String] String presentation of the object
322
+ def to_s
323
+ to_hash.to_s
324
+ end
325
+
326
+ # to_body is an alias to to_hash (backward compatibility)
327
+ # @return [Hash] Returns the object in the form of hash
328
+ def to_body
329
+ to_hash
330
+ end
331
+
332
+ # Returns the object in the form of hash
333
+ # @return [Hash] Returns the object in the form of hash
334
+ def to_hash
335
+ hash = {}
336
+ self.class.attribute_map.each_pair do |attr, param|
337
+ value = self.send(attr)
338
+ if value.nil?
339
+ is_nullable = self.class.fastly_nullable.include?(attr)
340
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
341
+ end
342
+
343
+ hash[param] = _to_hash(value)
344
+ end
345
+ hash
346
+ end
347
+
348
+ # Outputs non-array value in the form of hash
349
+ # For object, use to_hash. Otherwise, just return the value
350
+ # @param [Object] value Any valid value
351
+ # @return [Hash] Returns the value in the form of hash
352
+ def _to_hash(value)
353
+ if value.is_a?(Array)
354
+ value.compact.map { |v| _to_hash(v) }
355
+ elsif value.is_a?(Hash)
356
+ {}.tap do |hash|
357
+ value.each { |k, v| hash[k] = _to_hash(v) }
358
+ end
359
+ elsif value.respond_to? :to_hash
360
+ value.to_hash
361
+ else
362
+ value
363
+ end
364
+ end
365
+
366
+ end
367
+
368
+ end