ory-hydra-client 1.2.0.alpha3 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -8
- data/docs/JSONWebKey.md +12 -12
- data/docs/OAuth2Client.md +2 -2
- data/lib/ory-hydra-client.rb +0 -4
- data/lib/ory-hydra-client/models/attribute_type_and_value.rb +1 -1
- data/lib/ory-hydra-client/models/json_web_key.rb +13 -0
- data/lib/ory-hydra-client/models/o_auth2_client.rb +2 -2
- data/lib/ory-hydra-client/models/oauth2_token_response.rb +1 -1
- data/lib/ory-hydra-client/models/previous_consent_session.rb +1 -1
- data/lib/ory-hydra-client/models/version.rb +0 -1
- data/lib/ory-hydra-client/version.rb +1 -1
- metadata +23 -39
- data/docs/Extension.md +0 -21
- data/docs/IPNet.md +0 -19
- data/docs/Name.md +0 -27
- data/docs/URL.md +0 -33
- data/lib/ory-hydra-client/models/extension.rb +0 -231
- data/lib/ory-hydra-client/models/ip_net.rb +0 -220
- data/lib/ory-hydra-client/models/name.rb +0 -268
- data/lib/ory-hydra-client/models/url.rb +0 -288
- data/spec/models/extension_spec.rb +0 -53
- data/spec/models/ip_net_spec.rb +0 -47
- data/spec/models/name_spec.rb +0 -71
- data/spec/models/url_spec.rb +0 -89
data/docs/IPNet.md
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# OryHydraClient::IPNet
|
2
|
-
|
3
|
-
## Properties
|
4
|
-
|
5
|
-
Name | Type | Description | Notes
|
6
|
-
------------ | ------------- | ------------- | -------------
|
7
|
-
**ip** | **Array<Integer>** | Note that in this documentation, referring to an IP address as an IPv4 address or an IPv6 address is a semantic property of the address, not just the length of the byte slice: a 16-byte slice can still be an IPv4 address. | [optional]
|
8
|
-
**mask** | **Array<Integer>** | | [optional]
|
9
|
-
|
10
|
-
## Code Sample
|
11
|
-
|
12
|
-
```ruby
|
13
|
-
require 'OryHydraClient'
|
14
|
-
|
15
|
-
instance = OryHydraClient::IPNet.new(ip: null,
|
16
|
-
mask: null)
|
17
|
-
```
|
18
|
-
|
19
|
-
|
data/docs/Name.md
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# OryHydraClient::Name
|
2
|
-
|
3
|
-
## Properties
|
4
|
-
|
5
|
-
Name | Type | Description | Notes
|
6
|
-
------------ | ------------- | ------------- | -------------
|
7
|
-
**country** | **Array<String>** | country | [optional]
|
8
|
-
**extra_names** | [**Array<AttributeTypeAndValue>**](AttributeTypeAndValue.md) | extra names | [optional]
|
9
|
-
**locality** | **Array<String>** | locality | [optional]
|
10
|
-
**names** | [**Array<AttributeTypeAndValue>**](AttributeTypeAndValue.md) | names | [optional]
|
11
|
-
**serial_number** | **String** | serial number | [optional]
|
12
|
-
**street_address** | **Array<String>** | street address | [optional]
|
13
|
-
|
14
|
-
## Code Sample
|
15
|
-
|
16
|
-
```ruby
|
17
|
-
require 'OryHydraClient'
|
18
|
-
|
19
|
-
instance = OryHydraClient::Name.new(country: null,
|
20
|
-
extra_names: null,
|
21
|
-
locality: null,
|
22
|
-
names: null,
|
23
|
-
serial_number: null,
|
24
|
-
street_address: null)
|
25
|
-
```
|
26
|
-
|
27
|
-
|
data/docs/URL.md
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
# OryHydraClient::URL
|
2
|
-
|
3
|
-
## Properties
|
4
|
-
|
5
|
-
Name | Type | Description | Notes
|
6
|
-
------------ | ------------- | ------------- | -------------
|
7
|
-
**force_query** | **Boolean** | force query | [optional]
|
8
|
-
**fragment** | **String** | fragment | [optional]
|
9
|
-
**host** | **String** | host | [optional]
|
10
|
-
**opaque** | **String** | opaque | [optional]
|
11
|
-
**path** | **String** | path | [optional]
|
12
|
-
**raw_path** | **String** | raw path | [optional]
|
13
|
-
**raw_query** | **String** | raw query | [optional]
|
14
|
-
**scheme** | **String** | scheme | [optional]
|
15
|
-
**user** | [**Object**](.md) | Userinfo Userinfo Userinfo Userinfo Userinfo The Userinfo type is an immutable encapsulation of username and password details for a URL. An existing Userinfo value is guaranteed to have a username set (potentially empty, as allowed by RFC 2396), and optionally a password. | [optional]
|
16
|
-
|
17
|
-
## Code Sample
|
18
|
-
|
19
|
-
```ruby
|
20
|
-
require 'OryHydraClient'
|
21
|
-
|
22
|
-
instance = OryHydraClient::URL.new(force_query: null,
|
23
|
-
fragment: null,
|
24
|
-
host: null,
|
25
|
-
opaque: null,
|
26
|
-
path: null,
|
27
|
-
raw_path: null,
|
28
|
-
raw_query: null,
|
29
|
-
scheme: null,
|
30
|
-
user: null)
|
31
|
-
```
|
32
|
-
|
33
|
-
|
@@ -1,231 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#ORY Hydra
|
3
|
-
|
4
|
-
#Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here.
|
5
|
-
|
6
|
-
The version of the OpenAPI document: latest
|
7
|
-
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.2.2
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
|
15
|
-
module OryHydraClient
|
16
|
-
# Extension Extension Extension Extension Extension Extension represents the ASN.1 structure of the same name. See RFC 5280, section 4.2.
|
17
|
-
class Extension
|
18
|
-
# critical
|
19
|
-
attr_accessor :critical
|
20
|
-
|
21
|
-
attr_accessor :id
|
22
|
-
|
23
|
-
# value
|
24
|
-
attr_accessor :value
|
25
|
-
|
26
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
-
def self.attribute_map
|
28
|
-
{
|
29
|
-
:'critical' => :'Critical',
|
30
|
-
:'id' => :'Id',
|
31
|
-
:'value' => :'Value'
|
32
|
-
}
|
33
|
-
end
|
34
|
-
|
35
|
-
# Attribute type mapping.
|
36
|
-
def self.openapi_types
|
37
|
-
{
|
38
|
-
:'critical' => :'Boolean',
|
39
|
-
:'id' => :'Array<Integer>',
|
40
|
-
:'value' => :'Array<Integer>'
|
41
|
-
}
|
42
|
-
end
|
43
|
-
|
44
|
-
# List of attributes with nullable: true
|
45
|
-
def self.openapi_nullable
|
46
|
-
Set.new([
|
47
|
-
])
|
48
|
-
end
|
49
|
-
|
50
|
-
# Initializes the object
|
51
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
-
def initialize(attributes = {})
|
53
|
-
if (!attributes.is_a?(Hash))
|
54
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::Extension` initialize method"
|
55
|
-
end
|
56
|
-
|
57
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
58
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
59
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
60
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::Extension`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
61
|
-
end
|
62
|
-
h[k.to_sym] = v
|
63
|
-
}
|
64
|
-
|
65
|
-
if attributes.key?(:'critical')
|
66
|
-
self.critical = attributes[:'critical']
|
67
|
-
end
|
68
|
-
|
69
|
-
if attributes.key?(:'id')
|
70
|
-
if (value = attributes[:'id']).is_a?(Array)
|
71
|
-
self.id = value
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
if attributes.key?(:'value')
|
76
|
-
if (value = attributes[:'value']).is_a?(Array)
|
77
|
-
self.value = value
|
78
|
-
end
|
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
|
-
critical == o.critical &&
|
101
|
-
id == o.id &&
|
102
|
-
value == o.value
|
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
|
-
[critical, id, value].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.openapi_types.each_pair do |key, type|
|
130
|
-
if type =~ /\AArray<(.*)>/i
|
131
|
-
# check to ensure the input is an array given that the attribute
|
132
|
-
# is documented as an array but the input is not
|
133
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
134
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
135
|
-
end
|
136
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
137
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
138
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
139
|
-
end
|
140
|
-
|
141
|
-
self
|
142
|
-
end
|
143
|
-
|
144
|
-
# Deserializes the data based on type
|
145
|
-
# @param string type Data type
|
146
|
-
# @param string value Value to be deserialized
|
147
|
-
# @return [Object] Deserialized data
|
148
|
-
def _deserialize(type, value)
|
149
|
-
case type.to_sym
|
150
|
-
when :DateTime
|
151
|
-
DateTime.parse(value)
|
152
|
-
when :Date
|
153
|
-
Date.parse(value)
|
154
|
-
when :String
|
155
|
-
value.to_s
|
156
|
-
when :Integer
|
157
|
-
value.to_i
|
158
|
-
when :Float
|
159
|
-
value.to_f
|
160
|
-
when :Boolean
|
161
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
162
|
-
true
|
163
|
-
else
|
164
|
-
false
|
165
|
-
end
|
166
|
-
when :Object
|
167
|
-
# generic object (usually a Hash), return directly
|
168
|
-
value
|
169
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
170
|
-
inner_type = Regexp.last_match[:inner_type]
|
171
|
-
value.map { |v| _deserialize(inner_type, v) }
|
172
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
173
|
-
k_type = Regexp.last_match[:k_type]
|
174
|
-
v_type = Regexp.last_match[:v_type]
|
175
|
-
{}.tap do |hash|
|
176
|
-
value.each do |k, v|
|
177
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
178
|
-
end
|
179
|
-
end
|
180
|
-
else # model
|
181
|
-
OryHydraClient.const_get(type).build_from_hash(value)
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
# Returns the string representation of the object
|
186
|
-
# @return [String] String presentation of the object
|
187
|
-
def to_s
|
188
|
-
to_hash.to_s
|
189
|
-
end
|
190
|
-
|
191
|
-
# to_body is an alias to to_hash (backward compatibility)
|
192
|
-
# @return [Hash] Returns the object in the form of hash
|
193
|
-
def to_body
|
194
|
-
to_hash
|
195
|
-
end
|
196
|
-
|
197
|
-
# Returns the object in the form of hash
|
198
|
-
# @return [Hash] Returns the object in the form of hash
|
199
|
-
def to_hash
|
200
|
-
hash = {}
|
201
|
-
self.class.attribute_map.each_pair do |attr, param|
|
202
|
-
value = self.send(attr)
|
203
|
-
if value.nil?
|
204
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
205
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
206
|
-
end
|
207
|
-
|
208
|
-
hash[param] = _to_hash(value)
|
209
|
-
end
|
210
|
-
hash
|
211
|
-
end
|
212
|
-
|
213
|
-
# Outputs non-array value in the form of hash
|
214
|
-
# For object, use to_hash. Otherwise, just return the value
|
215
|
-
# @param [Object] value Any valid value
|
216
|
-
# @return [Hash] Returns the value in the form of hash
|
217
|
-
def _to_hash(value)
|
218
|
-
if value.is_a?(Array)
|
219
|
-
value.compact.map { |v| _to_hash(v) }
|
220
|
-
elsif value.is_a?(Hash)
|
221
|
-
{}.tap do |hash|
|
222
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
223
|
-
end
|
224
|
-
elsif value.respond_to? :to_hash
|
225
|
-
value.to_hash
|
226
|
-
else
|
227
|
-
value
|
228
|
-
end
|
229
|
-
end
|
230
|
-
end
|
231
|
-
end
|
@@ -1,220 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#ORY Hydra
|
3
|
-
|
4
|
-
#Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here.
|
5
|
-
|
6
|
-
The version of the OpenAPI document: latest
|
7
|
-
|
8
|
-
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.2.2
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
|
15
|
-
module OryHydraClient
|
16
|
-
class IPNet
|
17
|
-
# Note that in this documentation, referring to an IP address as an IPv4 address or an IPv6 address is a semantic property of the address, not just the length of the byte slice: a 16-byte slice can still be an IPv4 address.
|
18
|
-
attr_accessor :ip
|
19
|
-
|
20
|
-
attr_accessor :mask
|
21
|
-
|
22
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
-
def self.attribute_map
|
24
|
-
{
|
25
|
-
:'ip' => :'IP',
|
26
|
-
:'mask' => :'Mask'
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
# Attribute type mapping.
|
31
|
-
def self.openapi_types
|
32
|
-
{
|
33
|
-
:'ip' => :'Array<Integer>',
|
34
|
-
:'mask' => :'Array<Integer>'
|
35
|
-
}
|
36
|
-
end
|
37
|
-
|
38
|
-
# List of attributes with nullable: true
|
39
|
-
def self.openapi_nullable
|
40
|
-
Set.new([
|
41
|
-
])
|
42
|
-
end
|
43
|
-
|
44
|
-
# Initializes the object
|
45
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
46
|
-
def initialize(attributes = {})
|
47
|
-
if (!attributes.is_a?(Hash))
|
48
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `OryHydraClient::IPNet` initialize method"
|
49
|
-
end
|
50
|
-
|
51
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
52
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
53
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
54
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `OryHydraClient::IPNet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
55
|
-
end
|
56
|
-
h[k.to_sym] = v
|
57
|
-
}
|
58
|
-
|
59
|
-
if attributes.key?(:'ip')
|
60
|
-
if (value = attributes[:'ip']).is_a?(Array)
|
61
|
-
self.ip = value
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
if attributes.key?(:'mask')
|
66
|
-
if (value = attributes[:'mask']).is_a?(Array)
|
67
|
-
self.mask = value
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
73
|
-
# @return Array for valid properties with the reasons
|
74
|
-
def list_invalid_properties
|
75
|
-
invalid_properties = Array.new
|
76
|
-
invalid_properties
|
77
|
-
end
|
78
|
-
|
79
|
-
# Check to see if the all the properties in the model are valid
|
80
|
-
# @return true if the model is valid
|
81
|
-
def valid?
|
82
|
-
true
|
83
|
-
end
|
84
|
-
|
85
|
-
# Checks equality by comparing each attribute.
|
86
|
-
# @param [Object] Object to be compared
|
87
|
-
def ==(o)
|
88
|
-
return true if self.equal?(o)
|
89
|
-
self.class == o.class &&
|
90
|
-
ip == o.ip &&
|
91
|
-
mask == o.mask
|
92
|
-
end
|
93
|
-
|
94
|
-
# @see the `==` method
|
95
|
-
# @param [Object] Object to be compared
|
96
|
-
def eql?(o)
|
97
|
-
self == o
|
98
|
-
end
|
99
|
-
|
100
|
-
# Calculates hash code according to all attributes.
|
101
|
-
# @return [Integer] Hash code
|
102
|
-
def hash
|
103
|
-
[ip, mask].hash
|
104
|
-
end
|
105
|
-
|
106
|
-
# Builds the object from hash
|
107
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
108
|
-
# @return [Object] Returns the model itself
|
109
|
-
def self.build_from_hash(attributes)
|
110
|
-
new.build_from_hash(attributes)
|
111
|
-
end
|
112
|
-
|
113
|
-
# Builds the object from hash
|
114
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
115
|
-
# @return [Object] Returns the model itself
|
116
|
-
def build_from_hash(attributes)
|
117
|
-
return nil unless attributes.is_a?(Hash)
|
118
|
-
self.class.openapi_types.each_pair do |key, type|
|
119
|
-
if type =~ /\AArray<(.*)>/i
|
120
|
-
# check to ensure the input is an array given that the attribute
|
121
|
-
# is documented as an array but the input is not
|
122
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
123
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
124
|
-
end
|
125
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
126
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
127
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
128
|
-
end
|
129
|
-
|
130
|
-
self
|
131
|
-
end
|
132
|
-
|
133
|
-
# Deserializes the data based on type
|
134
|
-
# @param string type Data type
|
135
|
-
# @param string value Value to be deserialized
|
136
|
-
# @return [Object] Deserialized data
|
137
|
-
def _deserialize(type, value)
|
138
|
-
case type.to_sym
|
139
|
-
when :DateTime
|
140
|
-
DateTime.parse(value)
|
141
|
-
when :Date
|
142
|
-
Date.parse(value)
|
143
|
-
when :String
|
144
|
-
value.to_s
|
145
|
-
when :Integer
|
146
|
-
value.to_i
|
147
|
-
when :Float
|
148
|
-
value.to_f
|
149
|
-
when :Boolean
|
150
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
151
|
-
true
|
152
|
-
else
|
153
|
-
false
|
154
|
-
end
|
155
|
-
when :Object
|
156
|
-
# generic object (usually a Hash), return directly
|
157
|
-
value
|
158
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
159
|
-
inner_type = Regexp.last_match[:inner_type]
|
160
|
-
value.map { |v| _deserialize(inner_type, v) }
|
161
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
162
|
-
k_type = Regexp.last_match[:k_type]
|
163
|
-
v_type = Regexp.last_match[:v_type]
|
164
|
-
{}.tap do |hash|
|
165
|
-
value.each do |k, v|
|
166
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
167
|
-
end
|
168
|
-
end
|
169
|
-
else # model
|
170
|
-
OryHydraClient.const_get(type).build_from_hash(value)
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
# Returns the string representation of the object
|
175
|
-
# @return [String] String presentation of the object
|
176
|
-
def to_s
|
177
|
-
to_hash.to_s
|
178
|
-
end
|
179
|
-
|
180
|
-
# to_body is an alias to to_hash (backward compatibility)
|
181
|
-
# @return [Hash] Returns the object in the form of hash
|
182
|
-
def to_body
|
183
|
-
to_hash
|
184
|
-
end
|
185
|
-
|
186
|
-
# Returns the object in the form of hash
|
187
|
-
# @return [Hash] Returns the object in the form of hash
|
188
|
-
def to_hash
|
189
|
-
hash = {}
|
190
|
-
self.class.attribute_map.each_pair do |attr, param|
|
191
|
-
value = self.send(attr)
|
192
|
-
if value.nil?
|
193
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
194
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
195
|
-
end
|
196
|
-
|
197
|
-
hash[param] = _to_hash(value)
|
198
|
-
end
|
199
|
-
hash
|
200
|
-
end
|
201
|
-
|
202
|
-
# Outputs non-array value in the form of hash
|
203
|
-
# For object, use to_hash. Otherwise, just return the value
|
204
|
-
# @param [Object] value Any valid value
|
205
|
-
# @return [Hash] Returns the value in the form of hash
|
206
|
-
def _to_hash(value)
|
207
|
-
if value.is_a?(Array)
|
208
|
-
value.compact.map { |v| _to_hash(v) }
|
209
|
-
elsif value.is_a?(Hash)
|
210
|
-
{}.tap do |hash|
|
211
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
212
|
-
end
|
213
|
-
elsif value.respond_to? :to_hash
|
214
|
-
value.to_hash
|
215
|
-
else
|
216
|
-
value
|
217
|
-
end
|
218
|
-
end
|
219
|
-
end
|
220
|
-
end
|