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 Values503Responses
16
+ # The HTTP request path.
17
+ attr_accessor :url
18
+
19
+ # The rate at which the reason in this dimension occurs among responses to this URL with a 503 status code.
20
+ attr_accessor :rate_per_url
21
+
22
+ # The rate at which 503 status codes are returned for this URL.
23
+ attr_accessor :_503_rate_per_url
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'url' => :'url',
29
+ :'rate_per_url' => :'rate_per_url',
30
+ :'_503_rate_per_url' => :'503_rate_per_url'
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
+ :'url' => :'String',
43
+ :'rate_per_url' => :'Float',
44
+ :'_503_rate_per_url' => :'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::Values503Responses` 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::Values503Responses`. 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?(:'url')
70
+ self.url = attributes[:'url']
71
+ end
72
+
73
+ if attributes.key?(:'rate_per_url')
74
+ self.rate_per_url = attributes[:'rate_per_url']
75
+ end
76
+
77
+ if attributes.key?(:'_503_rate_per_url')
78
+ self._503_rate_per_url = attributes[:'_503_rate_per_url']
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
+ url == o.url &&
101
+ rate_per_url == o.rate_per_url &&
102
+ _503_rate_per_url == o._503_rate_per_url
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
+ [url, rate_per_url, _503_rate_per_url].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,227 @@
1
+ =begin
2
+ #Fastly API
3
+
4
+ #Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: oss@fastly.com
8
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module Fastly
15
+ class ValuesBandwidth
16
+ # The average bandwidth in bytes for responses to requests to the URL in the current dimension.
17
+ attr_accessor :average_bandwidth_bytes
18
+
19
+ # The total bandwidth percentage for all responses to requests to the URL in the current dimension.
20
+ attr_accessor :bandwidth_percentage
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'average_bandwidth_bytes' => :'average_bandwidth_bytes',
26
+ :'bandwidth_percentage' => :'bandwidth_percentage'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.fastly_types
37
+ {
38
+ :'average_bandwidth_bytes' => :'Float',
39
+ :'bandwidth_percentage' => :'Float'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.fastly_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ValuesBandwidth` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ValuesBandwidth`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'average_bandwidth_bytes')
65
+ self.average_bandwidth_bytes = attributes[:'average_bandwidth_bytes']
66
+ end
67
+
68
+ if attributes.key?(:'bandwidth_percentage')
69
+ self.bandwidth_percentage = attributes[:'bandwidth_percentage']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ average_bandwidth_bytes == o.average_bandwidth_bytes &&
92
+ bandwidth_percentage == o.bandwidth_percentage
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [average_bandwidth_bytes, bandwidth_percentage].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.fastly_types.each_pair do |key, type|
120
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
121
+ self.send("#{key}=", nil)
122
+ elsif type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :Time
143
+ Time.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :Boolean
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ # models (e.g. Pet) or oneOf
174
+ klass = Fastly.const_get(type)
175
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ if value.nil?
198
+ is_nullable = self.class.fastly_nullable.include?(attr)
199
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
200
+ end
201
+
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+
225
+ end
226
+
227
+ end
@@ -0,0 +1,227 @@
1
+ =begin
2
+ #Fastly API
3
+
4
+ #Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: oss@fastly.com
8
+
9
+ =end
10
+
11
+ require 'date'
12
+ require 'time'
13
+
14
+ module Fastly
15
+ class ValuesBrowser
16
+ # The version of the client's browser.
17
+ attr_accessor :browser_version
18
+
19
+ # The percentage of requests by this version of the browser specified in the dimension.
20
+ attr_accessor :rate
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'browser_version' => :'browser_version',
26
+ :'rate' => :'rate'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.fastly_types
37
+ {
38
+ :'browser_version' => :'String',
39
+ :'rate' => :'Float'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.fastly_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ValuesBrowser` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ValuesBrowser`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'browser_version')
65
+ self.browser_version = attributes[:'browser_version']
66
+ end
67
+
68
+ if attributes.key?(:'rate')
69
+ self.rate = attributes[:'rate']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ browser_version == o.browser_version &&
92
+ rate == o.rate
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [browser_version, rate].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.fastly_types.each_pair do |key, type|
120
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
121
+ self.send("#{key}=", nil)
122
+ elsif type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :Time
143
+ Time.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :Boolean
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ # models (e.g. Pet) or oneOf
174
+ klass = Fastly.const_get(type)
175
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ if value.nil?
198
+ is_nullable = self.class.fastly_nullable.include?(attr)
199
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
200
+ end
201
+
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+
225
+ end
226
+
227
+ end