fastly 4.2.0 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -5
- data/Gemfile.lock +1 -1
- data/README.md +87 -8
- data/docs/AclEntryApi.md +1 -1
- data/docs/DomainOwnershipsApi.md +47 -0
- data/docs/InlineResponse2002.md +1 -2
- data/docs/InlineResponse2003.md +11 -0
- data/docs/{InlineResponse2002Meta.md → InlineResponse2003Meta.md} +1 -1
- data/docs/{ErrorResponseData.md → InlineResponse2004.md} +3 -3
- data/docs/{ErrorResponse.md → InlineResponse2004Meta.md} +3 -2
- data/docs/ObjectStoreApi.md +6 -2
- data/docs/ObjectStoreItemApi.md +195 -0
- data/docs/RealtimeMeasurements.md +6 -0
- data/docs/Results.md +6 -0
- data/lib/fastly/api/acl_entry_api.rb +2 -2
- data/lib/fastly/api/{tls_csrs_api.rb → domain_ownerships_api.rb} +17 -24
- data/lib/fastly/api/object_store_api.rb +9 -3
- data/lib/fastly/api/object_store_item_api.rb +331 -0
- data/lib/fastly/api/purge_api.rb +1 -1
- data/lib/fastly/models/inline_response2002.rb +8 -18
- data/lib/fastly/models/{tls_csr_response.rb → inline_response2003.rb} +19 -8
- data/lib/fastly/models/{inline_response2002_meta.rb → inline_response2003_meta.rb} +3 -3
- data/lib/fastly/models/{tls_csr.rb → inline_response2004.rb} +19 -8
- data/lib/fastly/models/{error_response_data.rb → inline_response2004_meta.rb} +16 -16
- data/lib/fastly/models/realtime_measurements.rb +64 -4
- data/lib/fastly/models/results.rb +64 -4
- data/lib/fastly/version.rb +1 -1
- data/lib/fastly.rb +6 -12
- data/sig.json +1 -1
- metadata +14 -26
- data/docs/RelationshipsForTlsCsr.md +0 -10
- data/docs/TlsCsr.md +0 -10
- data/docs/TlsCsrData.md +0 -12
- data/docs/TlsCsrDataAttributes.md +0 -19
- data/docs/TlsCsrResponse.md +0 -10
- data/docs/TlsCsrResponseAttributes.md +0 -10
- data/docs/TlsCsrResponseData.md +0 -13
- data/docs/TlsCsrsApi.md +0 -52
- data/docs/TypeTlsCsr.md +0 -9
- data/lib/fastly/models/error_response.rb +0 -218
- data/lib/fastly/models/relationships_for_tls_csr.rb +0 -235
- data/lib/fastly/models/tls_csr_data.rb +0 -236
- data/lib/fastly/models/tls_csr_data_attributes.rb +0 -314
- data/lib/fastly/models/tls_csr_response_attributes.rb +0 -217
- data/lib/fastly/models/tls_csr_response_data.rb +0 -245
- data/lib/fastly/models/type_tls_csr.rb +0 -34
@@ -1,236 +0,0 @@
|
|
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 TlsCsrData
|
16
|
-
attr_accessor :type
|
17
|
-
|
18
|
-
attr_accessor :attributes
|
19
|
-
|
20
|
-
attr_accessor :relationships
|
21
|
-
|
22
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
-
def self.attribute_map
|
24
|
-
{
|
25
|
-
:'type' => :'type',
|
26
|
-
:'attributes' => :'attributes',
|
27
|
-
:'relationships' => :'relationships'
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
# Returns all the JSON keys this model knows about
|
32
|
-
def self.acceptable_attributes
|
33
|
-
attribute_map.values
|
34
|
-
end
|
35
|
-
|
36
|
-
# Attribute type mapping.
|
37
|
-
def self.fastly_types
|
38
|
-
{
|
39
|
-
:'type' => :'TypeTlsCsr',
|
40
|
-
:'attributes' => :'TlsCsrDataAttributes',
|
41
|
-
:'relationships' => :'RelationshipsForTlsCsr'
|
42
|
-
}
|
43
|
-
end
|
44
|
-
|
45
|
-
# List of attributes with nullable: true
|
46
|
-
def self.fastly_nullable
|
47
|
-
Set.new([
|
48
|
-
])
|
49
|
-
end
|
50
|
-
|
51
|
-
# Initializes the object
|
52
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
53
|
-
def initialize(attributes = {})
|
54
|
-
if (!attributes.is_a?(Hash))
|
55
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::TlsCsrData` initialize method"
|
56
|
-
end
|
57
|
-
|
58
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
59
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
60
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
61
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::TlsCsrData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
62
|
-
end
|
63
|
-
h[k.to_sym] = v
|
64
|
-
}
|
65
|
-
|
66
|
-
if attributes.key?(:'type')
|
67
|
-
self.type = attributes[:'type']
|
68
|
-
else
|
69
|
-
self.type = 'csr'
|
70
|
-
end
|
71
|
-
|
72
|
-
if attributes.key?(:'attributes')
|
73
|
-
self.attributes = attributes[:'attributes']
|
74
|
-
end
|
75
|
-
|
76
|
-
if attributes.key?(:'relationships')
|
77
|
-
self.relationships = attributes[:'relationships']
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
82
|
-
# @return Array for valid properties with the reasons
|
83
|
-
def list_invalid_properties
|
84
|
-
invalid_properties = Array.new
|
85
|
-
invalid_properties
|
86
|
-
end
|
87
|
-
|
88
|
-
# Check to see if the all the properties in the model are valid
|
89
|
-
# @return true if the model is valid
|
90
|
-
def valid?
|
91
|
-
true
|
92
|
-
end
|
93
|
-
|
94
|
-
# Checks equality by comparing each attribute.
|
95
|
-
# @param [Object] Object to be compared
|
96
|
-
def ==(o)
|
97
|
-
return true if self.equal?(o)
|
98
|
-
self.class == o.class &&
|
99
|
-
type == o.type &&
|
100
|
-
attributes == o.attributes &&
|
101
|
-
relationships == o.relationships
|
102
|
-
end
|
103
|
-
|
104
|
-
# @see the `==` method
|
105
|
-
# @param [Object] Object to be compared
|
106
|
-
def eql?(o)
|
107
|
-
self == o
|
108
|
-
end
|
109
|
-
|
110
|
-
# Calculates hash code according to all attributes.
|
111
|
-
# @return [Integer] Hash code
|
112
|
-
def hash
|
113
|
-
[type, attributes, relationships].hash
|
114
|
-
end
|
115
|
-
|
116
|
-
# Builds the object from hash
|
117
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
118
|
-
# @return [Object] Returns the model itself
|
119
|
-
def self.build_from_hash(attributes)
|
120
|
-
new.build_from_hash(attributes)
|
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 build_from_hash(attributes)
|
127
|
-
return nil unless attributes.is_a?(Hash)
|
128
|
-
self.class.fastly_types.each_pair do |key, type|
|
129
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
|
130
|
-
self.send("#{key}=", nil)
|
131
|
-
elsif type =~ /\AArray<(.*)>/i
|
132
|
-
# check to ensure the input is an array given that the attribute
|
133
|
-
# is documented as an array but the input is not
|
134
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
135
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
136
|
-
end
|
137
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
138
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
self
|
143
|
-
end
|
144
|
-
|
145
|
-
# Deserializes the data based on type
|
146
|
-
# @param string type Data type
|
147
|
-
# @param string value Value to be deserialized
|
148
|
-
# @return [Object] Deserialized data
|
149
|
-
def _deserialize(type, value)
|
150
|
-
case type.to_sym
|
151
|
-
when :Time
|
152
|
-
Time.parse(value)
|
153
|
-
when :Date
|
154
|
-
Date.parse(value)
|
155
|
-
when :String
|
156
|
-
value.to_s
|
157
|
-
when :Integer
|
158
|
-
value.to_i
|
159
|
-
when :Float
|
160
|
-
value.to_f
|
161
|
-
when :Boolean
|
162
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
163
|
-
true
|
164
|
-
else
|
165
|
-
false
|
166
|
-
end
|
167
|
-
when :Object
|
168
|
-
# generic object (usually a Hash), return directly
|
169
|
-
value
|
170
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
171
|
-
inner_type = Regexp.last_match[:inner_type]
|
172
|
-
value.map { |v| _deserialize(inner_type, v) }
|
173
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
174
|
-
k_type = Regexp.last_match[:k_type]
|
175
|
-
v_type = Regexp.last_match[:v_type]
|
176
|
-
{}.tap do |hash|
|
177
|
-
value.each do |k, v|
|
178
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
179
|
-
end
|
180
|
-
end
|
181
|
-
else # model
|
182
|
-
# models (e.g. Pet) or oneOf
|
183
|
-
klass = Fastly.const_get(type)
|
184
|
-
klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
# Returns the string representation of the object
|
189
|
-
# @return [String] String presentation of the object
|
190
|
-
def to_s
|
191
|
-
to_hash.to_s
|
192
|
-
end
|
193
|
-
|
194
|
-
# to_body is an alias to to_hash (backward compatibility)
|
195
|
-
# @return [Hash] Returns the object in the form of hash
|
196
|
-
def to_body
|
197
|
-
to_hash
|
198
|
-
end
|
199
|
-
|
200
|
-
# Returns the object in the form of hash
|
201
|
-
# @return [Hash] Returns the object in the form of hash
|
202
|
-
def to_hash
|
203
|
-
hash = {}
|
204
|
-
self.class.attribute_map.each_pair do |attr, param|
|
205
|
-
value = self.send(attr)
|
206
|
-
if value.nil?
|
207
|
-
is_nullable = self.class.fastly_nullable.include?(attr)
|
208
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
209
|
-
end
|
210
|
-
|
211
|
-
hash[param] = _to_hash(value)
|
212
|
-
end
|
213
|
-
hash
|
214
|
-
end
|
215
|
-
|
216
|
-
# Outputs non-array value in the form of hash
|
217
|
-
# For object, use to_hash. Otherwise, just return the value
|
218
|
-
# @param [Object] value Any valid value
|
219
|
-
# @return [Hash] Returns the value in the form of hash
|
220
|
-
def _to_hash(value)
|
221
|
-
if value.is_a?(Array)
|
222
|
-
value.compact.map { |v| _to_hash(v) }
|
223
|
-
elsif value.is_a?(Hash)
|
224
|
-
{}.tap do |hash|
|
225
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
226
|
-
end
|
227
|
-
elsif value.respond_to? :to_hash
|
228
|
-
value.to_hash
|
229
|
-
else
|
230
|
-
value
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
end
|
235
|
-
|
236
|
-
end
|
@@ -1,314 +0,0 @@
|
|
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 TlsCsrDataAttributes
|
16
|
-
# Subject Altername Names - An array of one or more fully qualified domain names or public IP addresses to be secured by this certificate. Required.
|
17
|
-
attr_accessor :sans
|
18
|
-
|
19
|
-
# Common Name (CN) - The fully qualified domain name (FQDN) to be secured by this certificate. The common name should be one of the entries in the SANs parameter.
|
20
|
-
attr_accessor :common_name
|
21
|
-
|
22
|
-
# Country (C) - The two-letter ISO country code where the organization is located.
|
23
|
-
attr_accessor :country
|
24
|
-
|
25
|
-
# State (S) - The state, province, region, or county where the organization is located. This should not be abbreviated.
|
26
|
-
attr_accessor :state
|
27
|
-
|
28
|
-
# Locality (L) - The locality, city, town, or village where the organization is located.
|
29
|
-
attr_accessor :city
|
30
|
-
|
31
|
-
# Postal Code - The postal code where the organization is located.
|
32
|
-
attr_accessor :postal_code
|
33
|
-
|
34
|
-
# Street Address - The street address where the organization is located.
|
35
|
-
attr_accessor :street_address
|
36
|
-
|
37
|
-
# Organization (O) - The legal name of the organization, including any suffixes. This should not be abbreviated.
|
38
|
-
attr_accessor :organization
|
39
|
-
|
40
|
-
# Organizational Unit (OU) - The internal division of the organization managing the certificate.
|
41
|
-
attr_accessor :organizational_unit
|
42
|
-
|
43
|
-
# Email Address (EMAIL) - The organizational contact for this.
|
44
|
-
attr_accessor :email
|
45
|
-
|
46
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
47
|
-
def self.attribute_map
|
48
|
-
{
|
49
|
-
:'sans' => :'sans',
|
50
|
-
:'common_name' => :'common_name',
|
51
|
-
:'country' => :'country',
|
52
|
-
:'state' => :'state',
|
53
|
-
:'city' => :'city',
|
54
|
-
:'postal_code' => :'postal_code',
|
55
|
-
:'street_address' => :'street_address',
|
56
|
-
:'organization' => :'organization',
|
57
|
-
:'organizational_unit' => :'organizational_unit',
|
58
|
-
:'email' => :'email'
|
59
|
-
}
|
60
|
-
end
|
61
|
-
|
62
|
-
# Returns all the JSON keys this model knows about
|
63
|
-
def self.acceptable_attributes
|
64
|
-
attribute_map.values
|
65
|
-
end
|
66
|
-
|
67
|
-
# Attribute type mapping.
|
68
|
-
def self.fastly_types
|
69
|
-
{
|
70
|
-
:'sans' => :'Array<String>',
|
71
|
-
:'common_name' => :'String',
|
72
|
-
:'country' => :'String',
|
73
|
-
:'state' => :'String',
|
74
|
-
:'city' => :'String',
|
75
|
-
:'postal_code' => :'String',
|
76
|
-
:'street_address' => :'String',
|
77
|
-
:'organization' => :'String',
|
78
|
-
:'organizational_unit' => :'String',
|
79
|
-
:'email' => :'String'
|
80
|
-
}
|
81
|
-
end
|
82
|
-
|
83
|
-
# List of attributes with nullable: true
|
84
|
-
def self.fastly_nullable
|
85
|
-
Set.new([
|
86
|
-
])
|
87
|
-
end
|
88
|
-
|
89
|
-
# Initializes the object
|
90
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
91
|
-
def initialize(attributes = {})
|
92
|
-
if (!attributes.is_a?(Hash))
|
93
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::TlsCsrDataAttributes` initialize method"
|
94
|
-
end
|
95
|
-
|
96
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
97
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
98
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
99
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::TlsCsrDataAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
100
|
-
end
|
101
|
-
h[k.to_sym] = v
|
102
|
-
}
|
103
|
-
|
104
|
-
if attributes.key?(:'sans')
|
105
|
-
if (value = attributes[:'sans']).is_a?(Array)
|
106
|
-
self.sans = value
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
if attributes.key?(:'common_name')
|
111
|
-
self.common_name = attributes[:'common_name']
|
112
|
-
end
|
113
|
-
|
114
|
-
if attributes.key?(:'country')
|
115
|
-
self.country = attributes[:'country']
|
116
|
-
end
|
117
|
-
|
118
|
-
if attributes.key?(:'state')
|
119
|
-
self.state = attributes[:'state']
|
120
|
-
end
|
121
|
-
|
122
|
-
if attributes.key?(:'city')
|
123
|
-
self.city = attributes[:'city']
|
124
|
-
end
|
125
|
-
|
126
|
-
if attributes.key?(:'postal_code')
|
127
|
-
self.postal_code = attributes[:'postal_code']
|
128
|
-
end
|
129
|
-
|
130
|
-
if attributes.key?(:'street_address')
|
131
|
-
self.street_address = attributes[:'street_address']
|
132
|
-
end
|
133
|
-
|
134
|
-
if attributes.key?(:'organization')
|
135
|
-
self.organization = attributes[:'organization']
|
136
|
-
end
|
137
|
-
|
138
|
-
if attributes.key?(:'organizational_unit')
|
139
|
-
self.organizational_unit = attributes[:'organizational_unit']
|
140
|
-
end
|
141
|
-
|
142
|
-
if attributes.key?(:'email')
|
143
|
-
self.email = attributes[:'email']
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
148
|
-
# @return Array for valid properties with the reasons
|
149
|
-
def list_invalid_properties
|
150
|
-
invalid_properties = Array.new
|
151
|
-
if @sans.nil?
|
152
|
-
invalid_properties.push('invalid value for "sans", sans cannot be nil.')
|
153
|
-
end
|
154
|
-
|
155
|
-
invalid_properties
|
156
|
-
end
|
157
|
-
|
158
|
-
# Check to see if the all the properties in the model are valid
|
159
|
-
# @return true if the model is valid
|
160
|
-
def valid?
|
161
|
-
return false if @sans.nil?
|
162
|
-
true
|
163
|
-
end
|
164
|
-
|
165
|
-
# Checks equality by comparing each attribute.
|
166
|
-
# @param [Object] Object to be compared
|
167
|
-
def ==(o)
|
168
|
-
return true if self.equal?(o)
|
169
|
-
self.class == o.class &&
|
170
|
-
sans == o.sans &&
|
171
|
-
common_name == o.common_name &&
|
172
|
-
country == o.country &&
|
173
|
-
state == o.state &&
|
174
|
-
city == o.city &&
|
175
|
-
postal_code == o.postal_code &&
|
176
|
-
street_address == o.street_address &&
|
177
|
-
organization == o.organization &&
|
178
|
-
organizational_unit == o.organizational_unit &&
|
179
|
-
email == o.email
|
180
|
-
end
|
181
|
-
|
182
|
-
# @see the `==` method
|
183
|
-
# @param [Object] Object to be compared
|
184
|
-
def eql?(o)
|
185
|
-
self == o
|
186
|
-
end
|
187
|
-
|
188
|
-
# Calculates hash code according to all attributes.
|
189
|
-
# @return [Integer] Hash code
|
190
|
-
def hash
|
191
|
-
[sans, common_name, country, state, city, postal_code, street_address, organization, organizational_unit, email].hash
|
192
|
-
end
|
193
|
-
|
194
|
-
# Builds the object from hash
|
195
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
196
|
-
# @return [Object] Returns the model itself
|
197
|
-
def self.build_from_hash(attributes)
|
198
|
-
new.build_from_hash(attributes)
|
199
|
-
end
|
200
|
-
|
201
|
-
# Builds the object from hash
|
202
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
203
|
-
# @return [Object] Returns the model itself
|
204
|
-
def build_from_hash(attributes)
|
205
|
-
return nil unless attributes.is_a?(Hash)
|
206
|
-
self.class.fastly_types.each_pair do |key, type|
|
207
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
|
208
|
-
self.send("#{key}=", nil)
|
209
|
-
elsif type =~ /\AArray<(.*)>/i
|
210
|
-
# check to ensure the input is an array given that the attribute
|
211
|
-
# is documented as an array but the input is not
|
212
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
213
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
214
|
-
end
|
215
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
216
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
self
|
221
|
-
end
|
222
|
-
|
223
|
-
# Deserializes the data based on type
|
224
|
-
# @param string type Data type
|
225
|
-
# @param string value Value to be deserialized
|
226
|
-
# @return [Object] Deserialized data
|
227
|
-
def _deserialize(type, value)
|
228
|
-
case type.to_sym
|
229
|
-
when :Time
|
230
|
-
Time.parse(value)
|
231
|
-
when :Date
|
232
|
-
Date.parse(value)
|
233
|
-
when :String
|
234
|
-
value.to_s
|
235
|
-
when :Integer
|
236
|
-
value.to_i
|
237
|
-
when :Float
|
238
|
-
value.to_f
|
239
|
-
when :Boolean
|
240
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
241
|
-
true
|
242
|
-
else
|
243
|
-
false
|
244
|
-
end
|
245
|
-
when :Object
|
246
|
-
# generic object (usually a Hash), return directly
|
247
|
-
value
|
248
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
249
|
-
inner_type = Regexp.last_match[:inner_type]
|
250
|
-
value.map { |v| _deserialize(inner_type, v) }
|
251
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
252
|
-
k_type = Regexp.last_match[:k_type]
|
253
|
-
v_type = Regexp.last_match[:v_type]
|
254
|
-
{}.tap do |hash|
|
255
|
-
value.each do |k, v|
|
256
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
257
|
-
end
|
258
|
-
end
|
259
|
-
else # model
|
260
|
-
# models (e.g. Pet) or oneOf
|
261
|
-
klass = Fastly.const_get(type)
|
262
|
-
klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
263
|
-
end
|
264
|
-
end
|
265
|
-
|
266
|
-
# Returns the string representation of the object
|
267
|
-
# @return [String] String presentation of the object
|
268
|
-
def to_s
|
269
|
-
to_hash.to_s
|
270
|
-
end
|
271
|
-
|
272
|
-
# to_body is an alias to to_hash (backward compatibility)
|
273
|
-
# @return [Hash] Returns the object in the form of hash
|
274
|
-
def to_body
|
275
|
-
to_hash
|
276
|
-
end
|
277
|
-
|
278
|
-
# Returns the object in the form of hash
|
279
|
-
# @return [Hash] Returns the object in the form of hash
|
280
|
-
def to_hash
|
281
|
-
hash = {}
|
282
|
-
self.class.attribute_map.each_pair do |attr, param|
|
283
|
-
value = self.send(attr)
|
284
|
-
if value.nil?
|
285
|
-
is_nullable = self.class.fastly_nullable.include?(attr)
|
286
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
287
|
-
end
|
288
|
-
|
289
|
-
hash[param] = _to_hash(value)
|
290
|
-
end
|
291
|
-
hash
|
292
|
-
end
|
293
|
-
|
294
|
-
# Outputs non-array value in the form of hash
|
295
|
-
# For object, use to_hash. Otherwise, just return the value
|
296
|
-
# @param [Object] value Any valid value
|
297
|
-
# @return [Hash] Returns the value in the form of hash
|
298
|
-
def _to_hash(value)
|
299
|
-
if value.is_a?(Array)
|
300
|
-
value.compact.map { |v| _to_hash(v) }
|
301
|
-
elsif value.is_a?(Hash)
|
302
|
-
{}.tap do |hash|
|
303
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
304
|
-
end
|
305
|
-
elsif value.respond_to? :to_hash
|
306
|
-
value.to_hash
|
307
|
-
else
|
308
|
-
value
|
309
|
-
end
|
310
|
-
end
|
311
|
-
|
312
|
-
end
|
313
|
-
|
314
|
-
end
|