fastly 8.10.0 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -1
  3. data/Gemfile.lock +1 -1
  4. data/README.md +15 -4
  5. data/docs/AccessKey.md +12 -0
  6. data/docs/AccessKeyResponse.md +15 -0
  7. data/docs/AclsInComputeApi.md +2 -2
  8. data/docs/BillingUsageMetricsApi.md +13 -19
  9. data/docs/ComputeAclUpdate.md +10 -0
  10. data/docs/DimensionAttributesCountryStats.md +12 -0
  11. data/docs/DimensionAttributesRate.md +10 -0
  12. data/docs/DimensionBrowser.md +10 -0
  13. data/docs/DimensionContentType.md +10 -0
  14. data/docs/DimensionCountry.md +10 -0
  15. data/docs/DimensionDevice.md +10 -0
  16. data/docs/DimensionOs.md +10 -0
  17. data/docs/DimensionResponse.md +10 -0
  18. data/docs/DimensionStatusCode.md +10 -0
  19. data/docs/DimensionUrl.md +10 -0
  20. data/docs/EnabledProductsApi.md +5 -5
  21. data/docs/FilterFieldItem.md +12 -0
  22. data/docs/GetLogInsightsResponse.md +11 -0
  23. data/docs/GetLogRecordsResponse.md +11 -0
  24. data/docs/GetLogRecordsResponseMeta.md +10 -0
  25. data/docs/GetLogRecordsResponseMetaFilters.md +16 -0
  26. data/docs/InsightsApi.md +69 -0
  27. data/docs/KvStoreItemApi.md +2 -0
  28. data/docs/LogExplorerApi.md +65 -0
  29. data/docs/LogInsights.md +12 -0
  30. data/docs/LogInsightsDimensionAttributes.md +49 -0
  31. data/docs/LogInsightsDimensions.md +61 -0
  32. data/docs/LogInsightsMeta.md +10 -0
  33. data/docs/LogInsightsMetaFilter.md +14 -0
  34. data/docs/LogInsightsValues.md +65 -0
  35. data/docs/LogPropertyServiceId.md +9 -0
  36. data/docs/LogRecord.md +37 -0
  37. data/docs/LoggingGrafanacloudlogsAdditional.md +14 -0
  38. data/docs/LoggingGrafanacloudlogsApi.md +259 -0
  39. data/docs/LoggingGrafanacloudlogsResponse.md +23 -0
  40. data/docs/ObjectStorageAccessKeysApi.md +163 -0
  41. data/docs/RealtimeEntryAggregated.md +3 -7
  42. data/docs/RealtimeMeasurements.md +3 -7
  43. data/docs/Results.md +3 -7
  44. data/docs/SetConfiguration.md +1 -0
  45. data/docs/Usagemetric.md +18 -0
  46. data/docs/Usagemetrics.md +10 -0
  47. data/docs/ValueField.md +59 -0
  48. data/docs/Values503Responses.md +12 -0
  49. data/docs/ValuesBandwidth.md +11 -0
  50. data/docs/ValuesBrowser.md +11 -0
  51. data/docs/ValuesCacheHitRatio.md +10 -0
  52. data/docs/ValuesCountryStats.md +12 -0
  53. data/docs/ValuesDuration.md +12 -0
  54. data/docs/ValuesMisses.md +10 -0
  55. data/docs/ValuesRate.md +10 -0
  56. data/docs/ValuesRequests.md +10 -0
  57. data/docs/ValuesStatusCodes.md +12 -0
  58. data/lib/fastly/api/acls_in_compute_api.rb +3 -3
  59. data/lib/fastly/api/billing_usage_metrics_api.rb +30 -57
  60. data/lib/fastly/api/enabled_products_api.rb +10 -10
  61. data/lib/fastly/api/insights_api.rb +125 -0
  62. data/lib/fastly/api/kv_store_item_api.rb +3 -0
  63. data/lib/fastly/api/log_explorer_api.rb +109 -0
  64. data/lib/fastly/api/logging_grafanacloudlogs_api.rb +471 -0
  65. data/lib/fastly/api/object_storage_access_keys_api.rb +263 -0
  66. data/lib/fastly/configuration.rb +67 -1
  67. data/lib/fastly/models/access_key.rb +248 -0
  68. data/lib/fastly/models/access_key_response.rb +269 -0
  69. data/lib/fastly/models/compute_acl_list_entries.rb +1 -1
  70. data/lib/fastly/models/compute_acl_lookup.rb +1 -1
  71. data/lib/fastly/models/compute_acl_update.rb +219 -0
  72. data/lib/fastly/models/compute_acl_update_entry.rb +1 -1
  73. data/lib/fastly/models/dimension_attributes_country_stats.rb +237 -0
  74. data/lib/fastly/models/dimension_attributes_rate.rb +217 -0
  75. data/lib/fastly/models/dimension_browser.rb +217 -0
  76. data/lib/fastly/models/dimension_content_type.rb +217 -0
  77. data/lib/fastly/models/dimension_country.rb +217 -0
  78. data/lib/fastly/models/dimension_device.rb +217 -0
  79. data/lib/fastly/models/dimension_os.rb +217 -0
  80. data/lib/fastly/models/dimension_response.rb +217 -0
  81. data/lib/fastly/models/dimension_status_code.rb +217 -0
  82. data/lib/fastly/models/dimension_url.rb +217 -0
  83. data/lib/fastly/models/filter_field_item.rb +271 -0
  84. data/lib/fastly/models/get_log_insights_response.rb +227 -0
  85. data/lib/fastly/models/get_log_records_response.rb +227 -0
  86. data/lib/fastly/models/get_log_records_response_meta.rb +216 -0
  87. data/lib/fastly/models/get_log_records_response_meta_filters.rb +307 -0
  88. data/lib/fastly/models/log_insights.rb +234 -0
  89. data/lib/fastly/models/log_insights_dimension_attributes.rb +103 -0
  90. data/lib/fastly/models/log_insights_dimensions.rb +109 -0
  91. data/lib/fastly/models/log_insights_meta.rb +217 -0
  92. data/lib/fastly/models/log_insights_meta_filter.rb +284 -0
  93. data/lib/fastly/models/log_insights_values.rb +111 -0
  94. data/lib/fastly/models/log_property_service_id.rb +208 -0
  95. data/lib/fastly/models/log_record.rb +486 -0
  96. data/lib/fastly/models/logging_grafanacloudlogs_additional.rb +257 -0
  97. data/lib/fastly/models/logging_grafanacloudlogs_response.rb +408 -0
  98. data/lib/fastly/models/realtime_entry_aggregated.rb +34 -74
  99. data/lib/fastly/models/realtime_measurements.rb +34 -74
  100. data/lib/fastly/models/results.rb +31 -71
  101. data/lib/fastly/models/set_configuration.rb +14 -4
  102. data/lib/fastly/models/usagemetric.rb +297 -0
  103. data/lib/fastly/models/usagemetrics.rb +218 -0
  104. data/lib/fastly/models/value_field.rb +108 -0
  105. data/lib/fastly/models/values503_responses.rb +237 -0
  106. data/lib/fastly/models/values_bandwidth.rb +227 -0
  107. data/lib/fastly/models/values_browser.rb +227 -0
  108. data/lib/fastly/models/values_cache_hit_ratio.rb +217 -0
  109. data/lib/fastly/models/values_country_stats.rb +237 -0
  110. data/lib/fastly/models/values_duration.rb +237 -0
  111. data/lib/fastly/models/values_misses.rb +217 -0
  112. data/lib/fastly/models/values_rate.rb +217 -0
  113. data/lib/fastly/models/values_requests.rb +217 -0
  114. data/lib/fastly/models/values_status_codes.rb +237 -0
  115. data/lib/fastly/version.rb +1 -1
  116. data/lib/fastly.rb +45 -0
  117. data/sig.json +1 -1
  118. metadata +92 -2
@@ -0,0 +1,237 @@
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 DimensionAttributesCountryStats
16
+ # The cache hit ratio for the country.
17
+ attr_accessor :country_chr
18
+
19
+ # The error rate for the country.
20
+ attr_accessor :country_error_rate
21
+
22
+ # This country's percentage of the total requests.
23
+ attr_accessor :country_request_rate
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'country_chr' => :'country_chr',
29
+ :'country_error_rate' => :'country_error_rate',
30
+ :'country_request_rate' => :'country_request_rate'
31
+ }
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.fastly_types
41
+ {
42
+ :'country_chr' => :'Float',
43
+ :'country_error_rate' => :'Float',
44
+ :'country_request_rate' => :'Float'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.fastly_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DimensionAttributesCountryStats` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DimensionAttributesCountryStats`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'country_chr')
70
+ self.country_chr = attributes[:'country_chr']
71
+ end
72
+
73
+ if attributes.key?(:'country_error_rate')
74
+ self.country_error_rate = attributes[:'country_error_rate']
75
+ end
76
+
77
+ if attributes.key?(:'country_request_rate')
78
+ self.country_request_rate = attributes[:'country_request_rate']
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ invalid_properties = Array.new
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ country_chr == o.country_chr &&
101
+ country_error_rate == o.country_error_rate &&
102
+ country_request_rate == o.country_request_rate
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [country_chr, country_error_rate, country_request_rate].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ new.build_from_hash(attributes)
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ self.class.fastly_types.each_pair do |key, type|
130
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
131
+ self.send("#{key}=", nil)
132
+ elsif type =~ /\AArray<(.*)>/i
133
+ # check to ensure the input is an array given that the attribute
134
+ # is documented as an array but the input is not
135
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
136
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
137
+ end
138
+ elsif !attributes[self.class.attribute_map[key]].nil?
139
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
140
+ end
141
+ end
142
+
143
+ self
144
+ end
145
+
146
+ # Deserializes the data based on type
147
+ # @param string type Data type
148
+ # @param string value Value to be deserialized
149
+ # @return [Object] Deserialized data
150
+ def _deserialize(type, value)
151
+ case type.to_sym
152
+ when :Time
153
+ Time.parse(value)
154
+ when :Date
155
+ Date.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :Boolean
163
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ else # model
183
+ # models (e.g. Pet) or oneOf
184
+ klass = Fastly.const_get(type)
185
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
186
+ end
187
+ end
188
+
189
+ # Returns the string representation of the object
190
+ # @return [String] String presentation of the object
191
+ def to_s
192
+ to_hash.to_s
193
+ end
194
+
195
+ # to_body is an alias to to_hash (backward compatibility)
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_body
198
+ to_hash
199
+ end
200
+
201
+ # Returns the object in the form of hash
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_hash
204
+ hash = {}
205
+ self.class.attribute_map.each_pair do |attr, param|
206
+ value = self.send(attr)
207
+ if value.nil?
208
+ is_nullable = self.class.fastly_nullable.include?(attr)
209
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
210
+ end
211
+
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+
237
+ end
@@ -0,0 +1,217 @@
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 DimensionAttributesRate
16
+ # The rate at which the value in the current dimension occurs.
17
+ attr_accessor :rate
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'rate' => :'rate'
23
+ }
24
+ end
25
+
26
+ # Returns all the JSON keys this model knows about
27
+ def self.acceptable_attributes
28
+ attribute_map.values
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.fastly_types
33
+ {
34
+ :'rate' => :'Float'
35
+ }
36
+ end
37
+
38
+ # List of attributes with nullable: true
39
+ def self.fastly_nullable
40
+ Set.new([
41
+ ])
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DimensionAttributesRate` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DimensionAttributesRate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:'rate')
60
+ self.rate = attributes[:'rate']
61
+ end
62
+ end
63
+
64
+ # Show invalid properties with the reasons. Usually used together with valid?
65
+ # @return Array for valid properties with the reasons
66
+ def list_invalid_properties
67
+ invalid_properties = Array.new
68
+ invalid_properties
69
+ end
70
+
71
+ # Check to see if the all the properties in the model are valid
72
+ # @return true if the model is valid
73
+ def valid?
74
+ true
75
+ end
76
+
77
+ # Checks equality by comparing each attribute.
78
+ # @param [Object] Object to be compared
79
+ def ==(o)
80
+ return true if self.equal?(o)
81
+ self.class == o.class &&
82
+ rate == o.rate
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] Object to be compared
87
+ def eql?(o)
88
+ self == o
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Integer] Hash code
93
+ def hash
94
+ [rate].hash
95
+ end
96
+
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def self.build_from_hash(attributes)
101
+ new.build_from_hash(attributes)
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def build_from_hash(attributes)
108
+ return nil unless attributes.is_a?(Hash)
109
+ self.class.fastly_types.each_pair do |key, type|
110
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
111
+ self.send("#{key}=", nil)
112
+ elsif type =~ /\AArray<(.*)>/i
113
+ # check to ensure the input is an array given that the attribute
114
+ # is documented as an array but the input is not
115
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
116
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
117
+ end
118
+ elsif !attributes[self.class.attribute_map[key]].nil?
119
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
+ end
121
+ end
122
+
123
+ self
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def _deserialize(type, value)
131
+ case type.to_sym
132
+ when :Time
133
+ Time.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :Boolean
143
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ # models (e.g. Pet) or oneOf
164
+ klass = Fastly.const_get(type)
165
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.fastly_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+
215
+ end
216
+
217
+ end
@@ -0,0 +1,217 @@
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 DimensionBrowser
16
+ # The client's browser for this dimension.
17
+ attr_accessor :browser
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'browser' => :'browser'
23
+ }
24
+ end
25
+
26
+ # Returns all the JSON keys this model knows about
27
+ def self.acceptable_attributes
28
+ attribute_map.values
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.fastly_types
33
+ {
34
+ :'browser' => :'String'
35
+ }
36
+ end
37
+
38
+ # List of attributes with nullable: true
39
+ def self.fastly_nullable
40
+ Set.new([
41
+ ])
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::DimensionBrowser` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::DimensionBrowser`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:'browser')
60
+ self.browser = attributes[:'browser']
61
+ end
62
+ end
63
+
64
+ # Show invalid properties with the reasons. Usually used together with valid?
65
+ # @return Array for valid properties with the reasons
66
+ def list_invalid_properties
67
+ invalid_properties = Array.new
68
+ invalid_properties
69
+ end
70
+
71
+ # Check to see if the all the properties in the model are valid
72
+ # @return true if the model is valid
73
+ def valid?
74
+ true
75
+ end
76
+
77
+ # Checks equality by comparing each attribute.
78
+ # @param [Object] Object to be compared
79
+ def ==(o)
80
+ return true if self.equal?(o)
81
+ self.class == o.class &&
82
+ browser == o.browser
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] Object to be compared
87
+ def eql?(o)
88
+ self == o
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Integer] Hash code
93
+ def hash
94
+ [browser].hash
95
+ end
96
+
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def self.build_from_hash(attributes)
101
+ new.build_from_hash(attributes)
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def build_from_hash(attributes)
108
+ return nil unless attributes.is_a?(Hash)
109
+ self.class.fastly_types.each_pair do |key, type|
110
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
111
+ self.send("#{key}=", nil)
112
+ elsif type =~ /\AArray<(.*)>/i
113
+ # check to ensure the input is an array given that the attribute
114
+ # is documented as an array but the input is not
115
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
116
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
117
+ end
118
+ elsif !attributes[self.class.attribute_map[key]].nil?
119
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
120
+ end
121
+ end
122
+
123
+ self
124
+ end
125
+
126
+ # Deserializes the data based on type
127
+ # @param string type Data type
128
+ # @param string value Value to be deserialized
129
+ # @return [Object] Deserialized data
130
+ def _deserialize(type, value)
131
+ case type.to_sym
132
+ when :Time
133
+ Time.parse(value)
134
+ when :Date
135
+ Date.parse(value)
136
+ when :String
137
+ value.to_s
138
+ when :Integer
139
+ value.to_i
140
+ when :Float
141
+ value.to_f
142
+ when :Boolean
143
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
144
+ true
145
+ else
146
+ false
147
+ end
148
+ when :Object
149
+ # generic object (usually a Hash), return directly
150
+ value
151
+ when /\AArray<(?<inner_type>.+)>\z/
152
+ inner_type = Regexp.last_match[:inner_type]
153
+ value.map { |v| _deserialize(inner_type, v) }
154
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
155
+ k_type = Regexp.last_match[:k_type]
156
+ v_type = Regexp.last_match[:v_type]
157
+ {}.tap do |hash|
158
+ value.each do |k, v|
159
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
160
+ end
161
+ end
162
+ else # model
163
+ # models (e.g. Pet) or oneOf
164
+ klass = Fastly.const_get(type)
165
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.fastly_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+
215
+ end
216
+
217
+ end