fastly 8.8.0 → 8.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -1
  3. data/Gemfile.lock +1 -1
  4. data/README.md +30 -3
  5. data/docs/AclsInComputeApi.md +284 -0
  6. data/docs/{OriginInspectorRealtimeEntryRecorded.md → ComputeAclCreateAclsRequest.md} +2 -1
  7. data/docs/ComputeAclCreateAclsResponse.md +11 -0
  8. data/docs/ComputeAclListEntries.md +11 -0
  9. data/docs/ComputeAclListEntriesItem.md +11 -0
  10. data/docs/ComputeAclListEntriesMeta.md +11 -0
  11. data/docs/ComputeAclLookup.md +12 -0
  12. data/docs/ComputeAclUpdateEntry.md +12 -0
  13. data/docs/ConfiguredProductResponse.md +13 -0
  14. data/docs/ConfiguredProductResponseConfiguration.md +11 -0
  15. data/docs/ConfiguredProductResponseLinks.md +11 -0
  16. data/docs/ConfiguredProductResponseProduct.md +11 -0
  17. data/docs/ContactApi.md +1 -1
  18. data/docs/CustomerAddress.md +16 -0
  19. data/docs/CustomerAddressesApi.md +127 -0
  20. data/docs/DomainInspector.md +1 -1
  21. data/docs/DomainInspectorRealtimeEntry.md +1 -1
  22. data/docs/EnabledProductsApi.md +93 -9
  23. data/docs/Environment.md +12 -0
  24. data/docs/{RecordedTimestamp.md → EnvironmentName.md} +1 -1
  25. data/docs/{OriginInspectorSubsequentRequestTimestamp.md → InlineResponse201.md} +2 -1
  26. data/docs/{SubsequentRequestTimestamp.md → ListCustomerAddressesResponse.md} +2 -1
  27. data/docs/OriginInspector.md +1 -1
  28. data/docs/OriginInspectorRealtimeEntry.md +1 -1
  29. data/docs/RealtimeEntryAggregated.md +1 -0
  30. data/docs/RealtimeMeasurements.md +1 -0
  31. data/docs/Results.md +1 -0
  32. data/docs/SchemasVersionResponse.md +1 -0
  33. data/docs/ServiceDetail.md +1 -0
  34. data/docs/ServiceListResponse.md +1 -0
  35. data/docs/ServiceListResponseAllOf.md +1 -0
  36. data/docs/ServiceResponse.md +1 -0
  37. data/docs/ServiceResponseAllOf.md +1 -0
  38. data/docs/ServiceVersionDetail.md +1 -0
  39. data/docs/ServiceVersionDetailOrNull.md +1 -0
  40. data/docs/SetConfiguration.md +11 -0
  41. data/docs/SetWorkspaceId.md +10 -0
  42. data/docs/TlsCertificatesApi.md +2 -2
  43. data/docs/TlsDomainsApi.md +2 -2
  44. data/docs/TlsSubscriptionsApi.md +2 -2
  45. data/docs/VersionApi.md +84 -0
  46. data/docs/VersionResponse.md +1 -0
  47. data/docs/VersionResponseAllOf.md +1 -0
  48. data/lib/fastly/api/acls_in_compute_api.rb +470 -0
  49. data/lib/fastly/api/contact_api.rb +1 -1
  50. data/lib/fastly/api/customer_addresses_api.rb +224 -0
  51. data/lib/fastly/api/enabled_products_api.rb +164 -10
  52. data/lib/fastly/api/tls_certificates_api.rb +7 -7
  53. data/lib/fastly/api/tls_domains_api.rb +7 -7
  54. data/lib/fastly/api/tls_subscriptions_api.rb +7 -7
  55. data/lib/fastly/api/version_api.rb +154 -0
  56. data/lib/fastly/configuration.rb +84 -0
  57. data/lib/fastly/models/billing_response_line_item.rb +10 -0
  58. data/lib/fastly/models/{origin_inspector_realtime_entry_recorded.rb → compute_acl_create_acls_request.rb} +15 -6
  59. data/lib/fastly/models/compute_acl_create_acls_response.rb +227 -0
  60. data/lib/fastly/models/compute_acl_list_entries.rb +228 -0
  61. data/lib/fastly/models/compute_acl_list_entries_item.rb +227 -0
  62. data/lib/fastly/models/compute_acl_list_entries_meta.rb +227 -0
  63. data/lib/fastly/models/compute_acl_lookup.rb +238 -0
  64. data/lib/fastly/models/compute_acl_update_entry.rb +238 -0
  65. data/lib/fastly/models/configured_product_response.rb +243 -0
  66. data/lib/fastly/models/configured_product_response_configuration.rb +227 -0
  67. data/lib/fastly/models/configured_product_response_links.rb +227 -0
  68. data/lib/fastly/models/configured_product_response_product.rb +227 -0
  69. data/lib/fastly/models/customer_address.rb +294 -0
  70. data/lib/fastly/models/domain_inspector.rb +2 -1
  71. data/lib/fastly/models/domain_inspector_realtime_entry.rb +2 -1
  72. data/lib/fastly/models/environment.rb +235 -0
  73. data/lib/fastly/models/environment_name.rb +34 -0
  74. data/lib/fastly/models/event_attributes.rb +2 -2
  75. data/lib/fastly/models/{recorded_timestamp.rb → inline_response201.rb} +15 -6
  76. data/lib/fastly/models/line_item_data.rb +10 -0
  77. data/lib/fastly/models/{origin_inspector_subsequent_request_timestamp.rb → list_customer_addresses_response.rb} +16 -6
  78. data/lib/fastly/models/origin_inspector.rb +2 -1
  79. data/lib/fastly/models/origin_inspector_realtime_entry.rb +2 -1
  80. data/lib/fastly/models/realtime_entry_aggregated.rb +14 -4
  81. data/lib/fastly/models/realtime_measurements.rb +14 -4
  82. data/lib/fastly/models/results.rb +11 -1
  83. data/lib/fastly/models/schemas_version_response.rb +16 -4
  84. data/lib/fastly/models/service_detail.rb +13 -1
  85. data/lib/fastly/models/service_list_response.rb +16 -4
  86. data/lib/fastly/models/service_list_response_all_of.rb +16 -4
  87. data/lib/fastly/models/service_response.rb +16 -4
  88. data/lib/fastly/models/service_response_all_of.rb +16 -4
  89. data/lib/fastly/models/service_version_detail.rb +13 -1
  90. data/lib/fastly/models/service_version_detail_or_null.rb +13 -1
  91. data/lib/fastly/models/set_configuration.rb +227 -0
  92. data/lib/fastly/models/{subsequent_request_timestamp.rb → set_workspace_id.rb} +15 -6
  93. data/lib/fastly/models/version_response.rb +16 -4
  94. data/lib/fastly/models/version_response_all_of.rb +16 -4
  95. data/lib/fastly/version.rb +1 -1
  96. data/lib/fastly.rb +20 -4
  97. data/sig.json +1 -1
  98. metadata +42 -10
@@ -0,0 +1,243 @@
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 ConfiguredProductResponse
16
+ attr_accessor :product
17
+
18
+ attr_accessor :service
19
+
20
+ attr_accessor :configuration
21
+
22
+ attr_accessor :_links
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'product' => :'product',
28
+ :'service' => :'service',
29
+ :'configuration' => :'configuration',
30
+ :'_links' => :'_links'
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
+ :'product' => :'ConfiguredProductResponseProduct',
43
+ :'service' => :'EnabledProductResponseService',
44
+ :'configuration' => :'ConfiguredProductResponseConfiguration',
45
+ :'_links' => :'ConfiguredProductResponseLinks'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.fastly_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::ConfiguredProductResponse` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ConfiguredProductResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'product')
71
+ self.product = attributes[:'product']
72
+ end
73
+
74
+ if attributes.key?(:'service')
75
+ self.service = attributes[:'service']
76
+ end
77
+
78
+ if attributes.key?(:'configuration')
79
+ self.configuration = attributes[:'configuration']
80
+ end
81
+
82
+ if attributes.key?(:'_links')
83
+ self._links = attributes[:'_links']
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ product == o.product &&
106
+ service == o.service &&
107
+ configuration == o.configuration &&
108
+ _links == o._links
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Integer] Hash code
119
+ def hash
120
+ [product, service, configuration, _links].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def self.build_from_hash(attributes)
127
+ new.build_from_hash(attributes)
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ self.class.fastly_types.each_pair do |key, type|
136
+ if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
137
+ self.send("#{key}=", nil)
138
+ elsif type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
143
+ end
144
+ elsif !attributes[self.class.attribute_map[key]].nil?
145
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
+ end
147
+ end
148
+
149
+ self
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def _deserialize(type, value)
157
+ case type.to_sym
158
+ when :Time
159
+ Time.parse(value)
160
+ when :Date
161
+ Date.parse(value)
162
+ when :String
163
+ value.to_s
164
+ when :Integer
165
+ value.to_i
166
+ when :Float
167
+ value.to_f
168
+ when :Boolean
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
170
+ true
171
+ else
172
+ false
173
+ end
174
+ when :Object
175
+ # generic object (usually a Hash), return directly
176
+ value
177
+ when /\AArray<(?<inner_type>.+)>\z/
178
+ inner_type = Regexp.last_match[:inner_type]
179
+ value.map { |v| _deserialize(inner_type, v) }
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
181
+ k_type = Regexp.last_match[:k_type]
182
+ v_type = Regexp.last_match[:v_type]
183
+ {}.tap do |hash|
184
+ value.each do |k, v|
185
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
186
+ end
187
+ end
188
+ else # model
189
+ # models (e.g. Pet) or oneOf
190
+ klass = Fastly.const_get(type)
191
+ klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.fastly_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ # Outputs non-array value in the form of hash
224
+ # For object, use to_hash. Otherwise, just return the value
225
+ # @param [Object] value Any valid value
226
+ # @return [Hash] Returns the value in the form of hash
227
+ def _to_hash(value)
228
+ if value.is_a?(Array)
229
+ value.compact.map { |v| _to_hash(v) }
230
+ elsif value.is_a?(Hash)
231
+ {}.tap do |hash|
232
+ value.each { |k, v| hash[k] = _to_hash(v) }
233
+ end
234
+ elsif value.respond_to? :to_hash
235
+ value.to_hash
236
+ else
237
+ value
238
+ end
239
+ end
240
+
241
+ end
242
+
243
+ 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 ConfiguredProductResponseConfiguration
16
+ # Workspace ID
17
+ attr_accessor :workspace_id
18
+
19
+ # Traffic ramp
20
+ attr_accessor :traffic_ramp
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'workspace_id' => :'workspace_id',
26
+ :'traffic_ramp' => :'traffic_ramp'
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
+ :'workspace_id' => :'String',
39
+ :'traffic_ramp' => :'String'
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::ConfiguredProductResponseConfiguration` 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::ConfiguredProductResponseConfiguration`. 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?(:'workspace_id')
65
+ self.workspace_id = attributes[:'workspace_id']
66
+ end
67
+
68
+ if attributes.key?(:'traffic_ramp')
69
+ self.traffic_ramp = attributes[:'traffic_ramp']
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
+ workspace_id == o.workspace_id &&
92
+ traffic_ramp == o.traffic_ramp
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
+ [workspace_id, traffic_ramp].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 ConfiguredProductResponseLinks
16
+ # Location of resource
17
+ attr_accessor :_self
18
+
19
+ # Location of the service resource
20
+ attr_accessor :service
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'_self' => :'self',
26
+ :'service' => :'service'
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
+ :'_self' => :'String',
39
+ :'service' => :'String'
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::ConfiguredProductResponseLinks` 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::ConfiguredProductResponseLinks`. 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?(:'_self')
65
+ self._self = attributes[:'_self']
66
+ end
67
+
68
+ if attributes.key?(:'service')
69
+ self.service = attributes[:'service']
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
+ _self == o._self &&
92
+ service == o.service
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
+ [_self, service].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