fastly 5.3.0 → 5.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/docs/Batch.md +12 -0
- data/docs/BatchErrors.md +13 -0
- data/docs/SchemasSnippetResponse.md +1 -1
- data/docs/Snippet.md +1 -1
- data/docs/SnippetApi.md +4 -4
- data/docs/SnippetResponse.md +1 -1
- data/docs/TokensAdditionalProps.md +9 -0
- data/docs/ValidatorResult.md +1 -5
- data/docs/ValidatorResultData.md +12 -0
- data/docs/ValidatorResultDataAttributes.md +14 -0
- data/docs/{ValidatorResultMessages.md → ValidatorResultDataAttributesMessages.md} +2 -2
- data/docs/VclApi.md +8 -6
- data/docs/VclSyntaxHighlightingResponse.md +10 -0
- data/lib/fastly/api/snippet_api.rb +6 -6
- data/lib/fastly/api/vcl_api.rb +10 -10
- data/lib/fastly/models/batch.rb +239 -0
- data/lib/fastly/models/batch_errors.rb +247 -0
- data/lib/fastly/models/schemas_snippet_response.rb +3 -3
- data/lib/fastly/models/snippet.rb +3 -3
- data/lib/fastly/models/snippet_response.rb +3 -3
- data/lib/fastly/models/tokens_additional_props.rb +227 -0
- data/lib/fastly/models/validator_result.rb +7 -84
- data/lib/fastly/models/validator_result_data.rb +234 -0
- data/lib/fastly/models/validator_result_data_attributes.rb +293 -0
- data/lib/fastly/models/{validator_result_messages.rb → validator_result_data_attributes_messages.rb} +4 -4
- data/lib/fastly/models/vcl_syntax_highlighting_response.rb +217 -0
- data/lib/fastly/version.rb +1 -1
- data/lib/fastly.rb +7 -1
- data/sig.json +1 -1
- metadata +16 -4
@@ -0,0 +1,247 @@
|
|
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://developer.fastly.com/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 BatchErrors
|
16
|
+
# The key that the error corresponds to. This field will be empty if the object or one of its fields was unable to be parsed.
|
17
|
+
attr_accessor :key
|
18
|
+
|
19
|
+
# The line number of the payload on which the error occurred (starting from 0 for the first line).
|
20
|
+
attr_accessor :index
|
21
|
+
|
22
|
+
# The HTTP response code for the request, or a 400 if the request was not able to be completed.
|
23
|
+
attr_accessor :code
|
24
|
+
|
25
|
+
# A descriptor of this particular item's error.
|
26
|
+
attr_accessor :reason
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'key' => :'key',
|
32
|
+
:'index' => :'index',
|
33
|
+
:'code' => :'code',
|
34
|
+
:'reason' => :'reason'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Returns all the JSON keys this model knows about
|
39
|
+
def self.acceptable_attributes
|
40
|
+
attribute_map.values
|
41
|
+
end
|
42
|
+
|
43
|
+
# Attribute type mapping.
|
44
|
+
def self.fastly_types
|
45
|
+
{
|
46
|
+
:'key' => :'String',
|
47
|
+
:'index' => :'Integer',
|
48
|
+
:'code' => :'String',
|
49
|
+
:'reason' => :'String'
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# List of attributes with nullable: true
|
54
|
+
def self.fastly_nullable
|
55
|
+
Set.new([
|
56
|
+
])
|
57
|
+
end
|
58
|
+
|
59
|
+
# Initializes the object
|
60
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
61
|
+
def initialize(attributes = {})
|
62
|
+
if (!attributes.is_a?(Hash))
|
63
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::BatchErrors` initialize method"
|
64
|
+
end
|
65
|
+
|
66
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
67
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
68
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
69
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::BatchErrors`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
70
|
+
end
|
71
|
+
h[k.to_sym] = v
|
72
|
+
}
|
73
|
+
|
74
|
+
if attributes.key?(:'key')
|
75
|
+
self.key = attributes[:'key']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'index')
|
79
|
+
self.index = attributes[:'index']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:'code')
|
83
|
+
self.code = attributes[:'code']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'reason')
|
87
|
+
self.reason = attributes[:'reason']
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
92
|
+
# @return Array for valid properties with the reasons
|
93
|
+
def list_invalid_properties
|
94
|
+
invalid_properties = Array.new
|
95
|
+
invalid_properties
|
96
|
+
end
|
97
|
+
|
98
|
+
# Check to see if the all the properties in the model are valid
|
99
|
+
# @return true if the model is valid
|
100
|
+
def valid?
|
101
|
+
true
|
102
|
+
end
|
103
|
+
|
104
|
+
# Checks equality by comparing each attribute.
|
105
|
+
# @param [Object] Object to be compared
|
106
|
+
def ==(o)
|
107
|
+
return true if self.equal?(o)
|
108
|
+
self.class == o.class &&
|
109
|
+
key == o.key &&
|
110
|
+
index == o.index &&
|
111
|
+
code == o.code &&
|
112
|
+
reason == o.reason
|
113
|
+
end
|
114
|
+
|
115
|
+
# @see the `==` method
|
116
|
+
# @param [Object] Object to be compared
|
117
|
+
def eql?(o)
|
118
|
+
self == o
|
119
|
+
end
|
120
|
+
|
121
|
+
# Calculates hash code according to all attributes.
|
122
|
+
# @return [Integer] Hash code
|
123
|
+
def hash
|
124
|
+
[key, index, code, reason].hash
|
125
|
+
end
|
126
|
+
|
127
|
+
# Builds the object from hash
|
128
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
129
|
+
# @return [Object] Returns the model itself
|
130
|
+
def self.build_from_hash(attributes)
|
131
|
+
new.build_from_hash(attributes)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Builds the object from hash
|
135
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
136
|
+
# @return [Object] Returns the model itself
|
137
|
+
def build_from_hash(attributes)
|
138
|
+
return nil unless attributes.is_a?(Hash)
|
139
|
+
self.class.fastly_types.each_pair do |key, type|
|
140
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
|
141
|
+
self.send("#{key}=", nil)
|
142
|
+
elsif type =~ /\AArray<(.*)>/i
|
143
|
+
# check to ensure the input is an array given that the attribute
|
144
|
+
# is documented as an array but the input is not
|
145
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
146
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
147
|
+
end
|
148
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
149
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
self
|
154
|
+
end
|
155
|
+
|
156
|
+
# Deserializes the data based on type
|
157
|
+
# @param string type Data type
|
158
|
+
# @param string value Value to be deserialized
|
159
|
+
# @return [Object] Deserialized data
|
160
|
+
def _deserialize(type, value)
|
161
|
+
case type.to_sym
|
162
|
+
when :Time
|
163
|
+
Time.parse(value)
|
164
|
+
when :Date
|
165
|
+
Date.parse(value)
|
166
|
+
when :String
|
167
|
+
value.to_s
|
168
|
+
when :Integer
|
169
|
+
value.to_i
|
170
|
+
when :Float
|
171
|
+
value.to_f
|
172
|
+
when :Boolean
|
173
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
174
|
+
true
|
175
|
+
else
|
176
|
+
false
|
177
|
+
end
|
178
|
+
when :Object
|
179
|
+
# generic object (usually a Hash), return directly
|
180
|
+
value
|
181
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
182
|
+
inner_type = Regexp.last_match[:inner_type]
|
183
|
+
value.map { |v| _deserialize(inner_type, v) }
|
184
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
185
|
+
k_type = Regexp.last_match[:k_type]
|
186
|
+
v_type = Regexp.last_match[:v_type]
|
187
|
+
{}.tap do |hash|
|
188
|
+
value.each do |k, v|
|
189
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
else # model
|
193
|
+
# models (e.g. Pet) or oneOf
|
194
|
+
klass = Fastly.const_get(type)
|
195
|
+
klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
# Returns the string representation of the object
|
200
|
+
# @return [String] String presentation of the object
|
201
|
+
def to_s
|
202
|
+
to_hash.to_s
|
203
|
+
end
|
204
|
+
|
205
|
+
# to_body is an alias to to_hash (backward compatibility)
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
207
|
+
def to_body
|
208
|
+
to_hash
|
209
|
+
end
|
210
|
+
|
211
|
+
# Returns the object in the form of hash
|
212
|
+
# @return [Hash] Returns the object in the form of hash
|
213
|
+
def to_hash
|
214
|
+
hash = {}
|
215
|
+
self.class.attribute_map.each_pair do |attr, param|
|
216
|
+
value = self.send(attr)
|
217
|
+
if value.nil?
|
218
|
+
is_nullable = self.class.fastly_nullable.include?(attr)
|
219
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
220
|
+
end
|
221
|
+
|
222
|
+
hash[param] = _to_hash(value)
|
223
|
+
end
|
224
|
+
hash
|
225
|
+
end
|
226
|
+
|
227
|
+
# Outputs non-array value in the form of hash
|
228
|
+
# For object, use to_hash. Otherwise, just return the value
|
229
|
+
# @param [Object] value Any valid value
|
230
|
+
# @return [Hash] Returns the value in the form of hash
|
231
|
+
def _to_hash(value)
|
232
|
+
if value.is_a?(Array)
|
233
|
+
value.compact.map { |v| _to_hash(v) }
|
234
|
+
elsif value.is_a?(Hash)
|
235
|
+
{}.tap do |hash|
|
236
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
237
|
+
end
|
238
|
+
elsif value.respond_to? :to_hash
|
239
|
+
value.to_hash
|
240
|
+
else
|
241
|
+
value
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
end
|
246
|
+
|
247
|
+
end
|
@@ -92,7 +92,7 @@ module Fastly
|
|
92
92
|
def self.fastly_types
|
93
93
|
{
|
94
94
|
:'name' => :'String',
|
95
|
-
:'dynamic' => :'
|
95
|
+
:'dynamic' => :'String',
|
96
96
|
:'type' => :'String',
|
97
97
|
:'content' => :'String',
|
98
98
|
:'priority' => :'String',
|
@@ -195,7 +195,7 @@ module Fastly
|
|
195
195
|
# Check to see if the all the properties in the model are valid
|
196
196
|
# @return true if the model is valid
|
197
197
|
def valid?
|
198
|
-
dynamic_validator = EnumAttributeValidator.new('
|
198
|
+
dynamic_validator = EnumAttributeValidator.new('String', ["0", "1"])
|
199
199
|
return false unless dynamic_validator.valid?(@dynamic)
|
200
200
|
type_validator = EnumAttributeValidator.new('String', ["init", "recv", "hash", "hit", "miss", "pass", "fetch", "error", "deliver", "log", "none"])
|
201
201
|
return false unless type_validator.valid?(@type)
|
@@ -205,7 +205,7 @@ module Fastly
|
|
205
205
|
# Custom attribute writer method checking allowed values (enum).
|
206
206
|
# @param [Object] dynamic Object to be assigned
|
207
207
|
def dynamic=(dynamic)
|
208
|
-
validator = EnumAttributeValidator.new('
|
208
|
+
validator = EnumAttributeValidator.new('String', ["0", "1"])
|
209
209
|
unless validator.valid?(dynamic)
|
210
210
|
fail ArgumentError, "invalid value for \"dynamic\", must be one of #{validator.allowable_values}."
|
211
211
|
end
|
@@ -70,7 +70,7 @@ module Fastly
|
|
70
70
|
def self.fastly_types
|
71
71
|
{
|
72
72
|
:'name' => :'String',
|
73
|
-
:'dynamic' => :'
|
73
|
+
:'dynamic' => :'String',
|
74
74
|
:'type' => :'String',
|
75
75
|
:'content' => :'String',
|
76
76
|
:'priority' => :'String'
|
@@ -131,7 +131,7 @@ module Fastly
|
|
131
131
|
# Check to see if the all the properties in the model are valid
|
132
132
|
# @return true if the model is valid
|
133
133
|
def valid?
|
134
|
-
dynamic_validator = EnumAttributeValidator.new('
|
134
|
+
dynamic_validator = EnumAttributeValidator.new('String', ["0", "1"])
|
135
135
|
return false unless dynamic_validator.valid?(@dynamic)
|
136
136
|
type_validator = EnumAttributeValidator.new('String', ["init", "recv", "hash", "hit", "miss", "pass", "fetch", "error", "deliver", "log", "none"])
|
137
137
|
return false unless type_validator.valid?(@type)
|
@@ -141,7 +141,7 @@ module Fastly
|
|
141
141
|
# Custom attribute writer method checking allowed values (enum).
|
142
142
|
# @param [Object] dynamic Object to be assigned
|
143
143
|
def dynamic=(dynamic)
|
144
|
-
validator = EnumAttributeValidator.new('
|
144
|
+
validator = EnumAttributeValidator.new('String', ["0", "1"])
|
145
145
|
unless validator.valid?(dynamic)
|
146
146
|
fail ArgumentError, "invalid value for \"dynamic\", must be one of #{validator.allowable_values}."
|
147
147
|
end
|
@@ -92,7 +92,7 @@ module Fastly
|
|
92
92
|
def self.fastly_types
|
93
93
|
{
|
94
94
|
:'name' => :'String',
|
95
|
-
:'dynamic' => :'
|
95
|
+
:'dynamic' => :'String',
|
96
96
|
:'type' => :'String',
|
97
97
|
:'content' => :'String',
|
98
98
|
:'priority' => :'String',
|
@@ -195,7 +195,7 @@ module Fastly
|
|
195
195
|
# Check to see if the all the properties in the model are valid
|
196
196
|
# @return true if the model is valid
|
197
197
|
def valid?
|
198
|
-
dynamic_validator = EnumAttributeValidator.new('
|
198
|
+
dynamic_validator = EnumAttributeValidator.new('String', ["0", "1"])
|
199
199
|
return false unless dynamic_validator.valid?(@dynamic)
|
200
200
|
type_validator = EnumAttributeValidator.new('String', ["init", "recv", "hash", "hit", "miss", "pass", "fetch", "error", "deliver", "log", "none"])
|
201
201
|
return false unless type_validator.valid?(@type)
|
@@ -205,7 +205,7 @@ module Fastly
|
|
205
205
|
# Custom attribute writer method checking allowed values (enum).
|
206
206
|
# @param [Object] dynamic Object to be assigned
|
207
207
|
def dynamic=(dynamic)
|
208
|
-
validator = EnumAttributeValidator.new('
|
208
|
+
validator = EnumAttributeValidator.new('String', ["0", "1"])
|
209
209
|
unless validator.valid?(dynamic)
|
210
210
|
fail ArgumentError, "invalid value for \"dynamic\", must be one of #{validator.allowable_values}."
|
211
211
|
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://developer.fastly.com/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 TokensAdditionalProps
|
16
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
17
|
+
def self.attribute_map
|
18
|
+
{
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns all the JSON keys this model knows about
|
23
|
+
def self.acceptable_attributes
|
24
|
+
attribute_map.values
|
25
|
+
end
|
26
|
+
|
27
|
+
# Attribute type mapping.
|
28
|
+
def self.fastly_types
|
29
|
+
{
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# List of attributes with nullable: true
|
34
|
+
def self.fastly_nullable
|
35
|
+
Set.new([
|
36
|
+
])
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of class defined in anyOf (OpenAPI v3)
|
40
|
+
def self.fastly_any_of
|
41
|
+
[
|
42
|
+
:'Float',
|
43
|
+
:'String'
|
44
|
+
]
|
45
|
+
end
|
46
|
+
|
47
|
+
# Initializes the object
|
48
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
49
|
+
def initialize(attributes = {})
|
50
|
+
if (!attributes.is_a?(Hash))
|
51
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::TokensAdditionalProps` initialize method"
|
52
|
+
end
|
53
|
+
|
54
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
55
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
56
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
57
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::TokensAdditionalProps`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
58
|
+
end
|
59
|
+
h[k.to_sym] = v
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
64
|
+
# @return Array for valid properties with the reasons
|
65
|
+
def list_invalid_properties
|
66
|
+
invalid_properties = Array.new
|
67
|
+
invalid_properties
|
68
|
+
end
|
69
|
+
|
70
|
+
# Check to see if the all the properties in the model are valid
|
71
|
+
# @return true if the model is valid
|
72
|
+
def valid?
|
73
|
+
_any_of_found = false
|
74
|
+
self.class.fastly_any_of.each do |_class|
|
75
|
+
_any_of = Fastly.const_get(_class).build_from_hash(self.to_hash)
|
76
|
+
if _any_of.valid?
|
77
|
+
_any_of_found = true
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
if !_any_of_found
|
82
|
+
return false
|
83
|
+
end
|
84
|
+
|
85
|
+
true
|
86
|
+
end
|
87
|
+
|
88
|
+
# Checks equality by comparing each attribute.
|
89
|
+
# @param [Object] Object to be compared
|
90
|
+
def ==(o)
|
91
|
+
return true if self.equal?(o)
|
92
|
+
self.class == o.class
|
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
|
+
[].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
|
@@ -14,46 +14,12 @@ require 'time'
|
|
14
14
|
module Fastly
|
15
15
|
# Results from VCL linting
|
16
16
|
class ValidatorResult
|
17
|
-
attr_accessor :
|
18
|
-
|
19
|
-
attr_accessor :status
|
20
|
-
|
21
|
-
attr_accessor :errors
|
22
|
-
|
23
|
-
attr_accessor :warnings
|
24
|
-
|
25
|
-
attr_accessor :messages
|
26
|
-
|
27
|
-
class EnumAttributeValidator
|
28
|
-
attr_reader :datatype
|
29
|
-
attr_reader :allowable_values
|
30
|
-
|
31
|
-
def initialize(datatype, allowable_values)
|
32
|
-
@allowable_values = allowable_values.map do |value|
|
33
|
-
case datatype.to_s
|
34
|
-
when /Integer/i
|
35
|
-
value.to_i
|
36
|
-
when /Float/i
|
37
|
-
value.to_f
|
38
|
-
else
|
39
|
-
value
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def valid?(value)
|
45
|
-
!value || allowable_values.include?(value)
|
46
|
-
end
|
47
|
-
end
|
17
|
+
attr_accessor :data
|
48
18
|
|
49
19
|
# Attribute mapping from ruby-style variable name to JSON key.
|
50
20
|
def self.attribute_map
|
51
21
|
{
|
52
|
-
:'
|
53
|
-
:'status' => :'status',
|
54
|
-
:'errors' => :'errors',
|
55
|
-
:'warnings' => :'warnings',
|
56
|
-
:'messages' => :'messages'
|
22
|
+
:'data' => :'data'
|
57
23
|
}
|
58
24
|
end
|
59
25
|
|
@@ -65,18 +31,13 @@ module Fastly
|
|
65
31
|
# Attribute type mapping.
|
66
32
|
def self.fastly_types
|
67
33
|
{
|
68
|
-
:'
|
69
|
-
:'status' => :'String',
|
70
|
-
:'errors' => :'Array<String>',
|
71
|
-
:'warnings' => :'Array<String>',
|
72
|
-
:'messages' => :'Array<ValidatorResultMessages>'
|
34
|
+
:'data' => :'ValidatorResultData'
|
73
35
|
}
|
74
36
|
end
|
75
37
|
|
76
38
|
# List of attributes with nullable: true
|
77
39
|
def self.fastly_nullable
|
78
40
|
Set.new([
|
79
|
-
:'msg',
|
80
41
|
])
|
81
42
|
end
|
82
43
|
|
@@ -95,30 +56,8 @@ module Fastly
|
|
95
56
|
h[k.to_sym] = v
|
96
57
|
}
|
97
58
|
|
98
|
-
if attributes.key?(:'
|
99
|
-
self.
|
100
|
-
end
|
101
|
-
|
102
|
-
if attributes.key?(:'status')
|
103
|
-
self.status = attributes[:'status']
|
104
|
-
end
|
105
|
-
|
106
|
-
if attributes.key?(:'errors')
|
107
|
-
if (value = attributes[:'errors']).is_a?(Array)
|
108
|
-
self.errors = value
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
if attributes.key?(:'warnings')
|
113
|
-
if (value = attributes[:'warnings']).is_a?(Array)
|
114
|
-
self.warnings = value
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
if attributes.key?(:'messages')
|
119
|
-
if (value = attributes[:'messages']).is_a?(Array)
|
120
|
-
self.messages = value
|
121
|
-
end
|
59
|
+
if attributes.key?(:'data')
|
60
|
+
self.data = attributes[:'data']
|
122
61
|
end
|
123
62
|
end
|
124
63
|
|
@@ -132,31 +71,15 @@ module Fastly
|
|
132
71
|
# Check to see if the all the properties in the model are valid
|
133
72
|
# @return true if the model is valid
|
134
73
|
def valid?
|
135
|
-
status_validator = EnumAttributeValidator.new('String', ["error", "ok"])
|
136
|
-
return false unless status_validator.valid?(@status)
|
137
74
|
true
|
138
75
|
end
|
139
76
|
|
140
|
-
# Custom attribute writer method checking allowed values (enum).
|
141
|
-
# @param [Object] status Object to be assigned
|
142
|
-
def status=(status)
|
143
|
-
validator = EnumAttributeValidator.new('String', ["error", "ok"])
|
144
|
-
unless validator.valid?(status)
|
145
|
-
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
146
|
-
end
|
147
|
-
@status = status
|
148
|
-
end
|
149
|
-
|
150
77
|
# Checks equality by comparing each attribute.
|
151
78
|
# @param [Object] Object to be compared
|
152
79
|
def ==(o)
|
153
80
|
return true if self.equal?(o)
|
154
81
|
self.class == o.class &&
|
155
|
-
|
156
|
-
status == o.status &&
|
157
|
-
errors == o.errors &&
|
158
|
-
warnings == o.warnings &&
|
159
|
-
messages == o.messages
|
82
|
+
data == o.data
|
160
83
|
end
|
161
84
|
|
162
85
|
# @see the `==` method
|
@@ -168,7 +91,7 @@ module Fastly
|
|
168
91
|
# Calculates hash code according to all attributes.
|
169
92
|
# @return [Integer] Hash code
|
170
93
|
def hash
|
171
|
-
[
|
94
|
+
[data].hash
|
172
95
|
end
|
173
96
|
|
174
97
|
# Builds the object from hash
|