pnap_network_storage_api 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/VERSION +1 -1
- data/docs/NfsPermissionsCreate.md +26 -0
- data/docs/NfsPermissionsUpdate.md +26 -0
- data/docs/PermissionsCreate.md +18 -0
- data/docs/PermissionsUpdate.md +18 -0
- data/docs/StorageNetworkCreate.md +1 -1
- data/docs/StorageNetworkVolumeCreate.md +24 -0
- data/docs/StorageNetworksApi.md +1 -1
- data/docs/VolumeCreate.md +3 -1
- data/docs/VolumeUpdate.md +3 -1
- data/lib/pnap_network_storage_api/models/nfs_permissions_create.rb +271 -0
- data/lib/pnap_network_storage_api/models/nfs_permissions_update.rb +271 -0
- data/lib/pnap_network_storage_api/models/permissions_create.rb +220 -0
- data/lib/pnap_network_storage_api/models/permissions_update.rb +220 -0
- data/lib/pnap_network_storage_api/models/storage_network_create.rb +1 -1
- data/lib/pnap_network_storage_api/models/storage_network_volume_create.rb +358 -0
- data/lib/pnap_network_storage_api/models/volume_create.rb +13 -4
- data/lib/pnap_network_storage_api/models/volume_update.rb +13 -4
- data/lib/pnap_network_storage_api.rb +5 -0
- data/spec/models/nfs_permissions_create_spec.rb +58 -0
- data/spec/models/nfs_permissions_update_spec.rb +58 -0
- data/spec/models/permissions_create_spec.rb +34 -0
- data/spec/models/permissions_update_spec.rb +34 -0
- data/spec/models/storage_network_volume_create_spec.rb +52 -0
- metadata +26 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d120bcac5267b846f83dbc1ea051aee392e9b82300931c585dfdcac8cadb63a
|
4
|
+
data.tar.gz: bcd0e1bbb133621426684eaf5e2458e577b929abb6c7178e82e1bb036b79f47d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 239ff1a8f22703984c1ff835bd980a0327182efbdeab62e9d47abfd850faa52bd832e95138890ef732cacfbe2ff7ed74cff5235e40b834fc513ffbe5a2944c61
|
7
|
+
data.tar.gz: ccc43adb4c49d25efd01379afbd3b60ab0b67817814b68a4a0b5b0345c21ec570f715f845c6c32eb36012c3e2e9ee587e10f446bda2a94c2d825bc95b56cac12
|
data/README.md
CHANGED
@@ -137,11 +137,16 @@ Class | Method | HTTP request | Description
|
|
137
137
|
|
138
138
|
- [NetworkStorageApi::Error](docs/Error.md)
|
139
139
|
- [NetworkStorageApi::NfsPermissions](docs/NfsPermissions.md)
|
140
|
+
- [NetworkStorageApi::NfsPermissionsCreate](docs/NfsPermissionsCreate.md)
|
141
|
+
- [NetworkStorageApi::NfsPermissionsUpdate](docs/NfsPermissionsUpdate.md)
|
140
142
|
- [NetworkStorageApi::Permissions](docs/Permissions.md)
|
143
|
+
- [NetworkStorageApi::PermissionsCreate](docs/PermissionsCreate.md)
|
144
|
+
- [NetworkStorageApi::PermissionsUpdate](docs/PermissionsUpdate.md)
|
141
145
|
- [NetworkStorageApi::Status](docs/Status.md)
|
142
146
|
- [NetworkStorageApi::StorageNetwork](docs/StorageNetwork.md)
|
143
147
|
- [NetworkStorageApi::StorageNetworkCreate](docs/StorageNetworkCreate.md)
|
144
148
|
- [NetworkStorageApi::StorageNetworkUpdate](docs/StorageNetworkUpdate.md)
|
149
|
+
- [NetworkStorageApi::StorageNetworkVolumeCreate](docs/StorageNetworkVolumeCreate.md)
|
145
150
|
- [NetworkStorageApi::Volume](docs/Volume.md)
|
146
151
|
- [NetworkStorageApi::VolumeCreate](docs/VolumeCreate.md)
|
147
152
|
- [NetworkStorageApi::VolumeUpdate](docs/VolumeUpdate.md)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.0
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# NetworkStorageApi::NfsPermissionsCreate
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **read_write** | **Array<String>** | Read/Write access. | [optional] |
|
8
|
+
| **read_only** | **Array<String>** | Read only access. | [optional] |
|
9
|
+
| **root_squash** | **Array<String>** | Root squash permission. | [optional] |
|
10
|
+
| **no_squash** | **Array<String>** | No squash permission. | [optional] |
|
11
|
+
| **all_squash** | **Array<String>** | All squash permission. | [optional] |
|
12
|
+
|
13
|
+
## Example
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require 'pnap_network_storage_api'
|
17
|
+
|
18
|
+
instance = NetworkStorageApi::NfsPermissionsCreate.new(
|
19
|
+
read_write: ["100.80.0.5","100.80.0.6"],
|
20
|
+
read_only: ["100.80.0.5"],
|
21
|
+
root_squash: ["100.80.0.5","100.80.0.4/24"],
|
22
|
+
no_squash: ["100.80.0.7","100.80.0.*"],
|
23
|
+
all_squash: ["100.80.0.5","100.80.0.6"]
|
24
|
+
)
|
25
|
+
```
|
26
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# NetworkStorageApi::NfsPermissionsUpdate
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **read_write** | **Array<String>** | Read/Write access. | [optional] |
|
8
|
+
| **read_only** | **Array<String>** | Read only access. | [optional] |
|
9
|
+
| **root_squash** | **Array<String>** | Root squash permission. | [optional] |
|
10
|
+
| **no_squash** | **Array<String>** | No squash permission. | [optional] |
|
11
|
+
| **all_squash** | **Array<String>** | All squash permission. | [optional] |
|
12
|
+
|
13
|
+
## Example
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require 'pnap_network_storage_api'
|
17
|
+
|
18
|
+
instance = NetworkStorageApi::NfsPermissionsUpdate.new(
|
19
|
+
read_write: ["100.80.0.5","100.80.0.6"],
|
20
|
+
read_only: ["100.80.0.5"],
|
21
|
+
root_squash: ["100.80.0.5","100.80.0.4/24"],
|
22
|
+
no_squash: ["100.80.0.7","100.80.0.*"],
|
23
|
+
all_squash: ["100.80.0.5","100.80.0.6"]
|
24
|
+
)
|
25
|
+
```
|
26
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# NetworkStorageApi::PermissionsCreate
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **nfs** | [**NfsPermissionsCreate**](NfsPermissionsCreate.md) | | [optional] |
|
8
|
+
|
9
|
+
## Example
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'pnap_network_storage_api'
|
13
|
+
|
14
|
+
instance = NetworkStorageApi::PermissionsCreate.new(
|
15
|
+
nfs: null
|
16
|
+
)
|
17
|
+
```
|
18
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# NetworkStorageApi::PermissionsUpdate
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **nfs** | [**NfsPermissionsUpdate**](NfsPermissionsUpdate.md) | | [optional] |
|
8
|
+
|
9
|
+
## Example
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'pnap_network_storage_api'
|
13
|
+
|
14
|
+
instance = NetworkStorageApi::PermissionsUpdate.new(
|
15
|
+
nfs: null
|
16
|
+
)
|
17
|
+
```
|
18
|
+
|
@@ -7,7 +7,7 @@
|
|
7
7
|
| **name** | **String** | Storage network friendly name. | |
|
8
8
|
| **description** | **String** | Storage network description. | [optional] |
|
9
9
|
| **location** | **String** | Location of storage network. Currently this field should be set to `PHX` or `ASH`. | |
|
10
|
-
| **volumes** | [**Array<
|
10
|
+
| **volumes** | [**Array<StorageNetworkVolumeCreate>**](StorageNetworkVolumeCreate.md) | Volume to be created alongside storage. Currently only 1 volume is supported. | |
|
11
11
|
|
12
12
|
## Example
|
13
13
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# NetworkStorageApi::StorageNetworkVolumeCreate
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **name** | **String** | Volume friendly name. | |
|
8
|
+
| **description** | **String** | Volume description. | [optional] |
|
9
|
+
| **path_suffix** | **String** | Last part of volume's path. | [optional] |
|
10
|
+
| **capacity_in_gb** | **Integer** | Capacity of Volume in GB. Currently only whole numbers and multiples of 1000GB are supported. | |
|
11
|
+
|
12
|
+
## Example
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
require 'pnap_network_storage_api'
|
16
|
+
|
17
|
+
instance = NetworkStorageApi::StorageNetworkVolumeCreate.new(
|
18
|
+
name: My volume name,
|
19
|
+
description: My volume description,
|
20
|
+
path_suffix: /shared-docs,
|
21
|
+
capacity_in_gb: 2000
|
22
|
+
)
|
23
|
+
```
|
24
|
+
|
data/docs/StorageNetworksApi.md
CHANGED
@@ -318,7 +318,7 @@ end
|
|
318
318
|
|
319
319
|
api_instance = NetworkStorageApi::StorageNetworksApi.new
|
320
320
|
opts = {
|
321
|
-
storage_network_create: NetworkStorageApi::StorageNetworkCreate.new({name: 'My storage network', location: 'PHX', volumes: [NetworkStorageApi::
|
321
|
+
storage_network_create: NetworkStorageApi::StorageNetworkCreate.new({name: 'My storage network', location: 'PHX', volumes: [NetworkStorageApi::StorageNetworkVolumeCreate.new({name: 'My volume name', capacity_in_gb: 2000})]}) # StorageNetworkCreate |
|
322
322
|
}
|
323
323
|
|
324
324
|
begin
|
data/docs/VolumeCreate.md
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
| **description** | **String** | Volume description. | [optional] |
|
9
9
|
| **path_suffix** | **String** | Last part of volume's path. | [optional] |
|
10
10
|
| **capacity_in_gb** | **Integer** | Capacity of Volume in GB. Currently only whole numbers and multiples of 1000GB are supported. | |
|
11
|
+
| **permissions** | [**PermissionsCreate**](PermissionsCreate.md) | | [optional] |
|
11
12
|
|
12
13
|
## Example
|
13
14
|
|
@@ -18,7 +19,8 @@ instance = NetworkStorageApi::VolumeCreate.new(
|
|
18
19
|
name: My volume name,
|
19
20
|
description: My volume description,
|
20
21
|
path_suffix: /shared-docs,
|
21
|
-
capacity_in_gb: 2000
|
22
|
+
capacity_in_gb: 2000,
|
23
|
+
permissions: null
|
22
24
|
)
|
23
25
|
```
|
24
26
|
|
data/docs/VolumeUpdate.md
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
| **description** | **String** | Volume description. | [optional] |
|
9
9
|
| **capacity_in_gb** | **Integer** | Capacity of Volume in GB. Currently only whole numbers and multiples of 1000GB are supported. | [optional] |
|
10
10
|
| **path_suffix** | **String** | Last part of volume's path. | [optional] |
|
11
|
+
| **permissions** | [**PermissionsUpdate**](PermissionsUpdate.md) | | [optional] |
|
11
12
|
|
12
13
|
## Example
|
13
14
|
|
@@ -18,7 +19,8 @@ instance = NetworkStorageApi::VolumeUpdate.new(
|
|
18
19
|
name: New Volume name,
|
19
20
|
description: New Volume description,
|
20
21
|
capacity_in_gb: 2000,
|
21
|
-
path_suffix: null
|
22
|
+
path_suffix: null,
|
23
|
+
permissions: null
|
22
24
|
)
|
23
25
|
```
|
24
26
|
|
@@ -0,0 +1,271 @@
|
|
1
|
+
=begin
|
2
|
+
#Network Storage API
|
3
|
+
|
4
|
+
#Create, list, edit, and delete storage networks with the Network Storage API. Use storage networks to expand storage capacity on a private network. <br> <span class='pnap-api-knowledge-base-link'> Knowledge base articles to help you can be found <a href='https://phoenixnap.com/kb/bare-metal-cloud-storage' target='_blank'>here</a> </span> <br> <b>All URLs are relative to (https://api.phoenixnap.com/network-storage/v1/)</b>
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0
|
7
|
+
Contact: support@phoenixnap.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.1.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module NetworkStorageApi
|
17
|
+
# NFS specific permissions on a volume.
|
18
|
+
class NfsPermissionsCreate
|
19
|
+
# Read/Write access.
|
20
|
+
attr_accessor :read_write
|
21
|
+
|
22
|
+
# Read only access.
|
23
|
+
attr_accessor :read_only
|
24
|
+
|
25
|
+
# Root squash permission.
|
26
|
+
attr_accessor :root_squash
|
27
|
+
|
28
|
+
# No squash permission.
|
29
|
+
attr_accessor :no_squash
|
30
|
+
|
31
|
+
# All squash permission.
|
32
|
+
attr_accessor :all_squash
|
33
|
+
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
35
|
+
def self.attribute_map
|
36
|
+
{
|
37
|
+
:'read_write' => :'readWrite',
|
38
|
+
:'read_only' => :'readOnly',
|
39
|
+
:'root_squash' => :'rootSquash',
|
40
|
+
:'no_squash' => :'noSquash',
|
41
|
+
:'all_squash' => :'allSquash'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# Returns all the JSON keys this model knows about
|
46
|
+
def self.acceptable_attributes
|
47
|
+
attribute_map.values
|
48
|
+
end
|
49
|
+
|
50
|
+
# Attribute type mapping.
|
51
|
+
def self.openapi_types
|
52
|
+
{
|
53
|
+
:'read_write' => :'Array<String>',
|
54
|
+
:'read_only' => :'Array<String>',
|
55
|
+
:'root_squash' => :'Array<String>',
|
56
|
+
:'no_squash' => :'Array<String>',
|
57
|
+
:'all_squash' => :'Array<String>'
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
# List of attributes with nullable: true
|
62
|
+
def self.openapi_nullable
|
63
|
+
Set.new([
|
64
|
+
])
|
65
|
+
end
|
66
|
+
|
67
|
+
# Initializes the object
|
68
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
69
|
+
def initialize(attributes = {})
|
70
|
+
if (!attributes.is_a?(Hash))
|
71
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `NetworkStorageApi::NfsPermissionsCreate` initialize method"
|
72
|
+
end
|
73
|
+
|
74
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
75
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
76
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
77
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `NetworkStorageApi::NfsPermissionsCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
78
|
+
end
|
79
|
+
h[k.to_sym] = v
|
80
|
+
}
|
81
|
+
|
82
|
+
if attributes.key?(:'read_write')
|
83
|
+
if (value = attributes[:'read_write']).is_a?(Array)
|
84
|
+
self.read_write = value
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.key?(:'read_only')
|
89
|
+
if (value = attributes[:'read_only']).is_a?(Array)
|
90
|
+
self.read_only = value
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.key?(:'root_squash')
|
95
|
+
if (value = attributes[:'root_squash']).is_a?(Array)
|
96
|
+
self.root_squash = value
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.key?(:'no_squash')
|
101
|
+
if (value = attributes[:'no_squash']).is_a?(Array)
|
102
|
+
self.no_squash = value
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.key?(:'all_squash')
|
107
|
+
if (value = attributes[:'all_squash']).is_a?(Array)
|
108
|
+
self.all_squash = value
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
114
|
+
# @return Array for valid properties with the reasons
|
115
|
+
def list_invalid_properties
|
116
|
+
invalid_properties = Array.new
|
117
|
+
invalid_properties
|
118
|
+
end
|
119
|
+
|
120
|
+
# Check to see if the all the properties in the model are valid
|
121
|
+
# @return true if the model is valid
|
122
|
+
def valid?
|
123
|
+
true
|
124
|
+
end
|
125
|
+
|
126
|
+
# Checks equality by comparing each attribute.
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def ==(o)
|
129
|
+
return true if self.equal?(o)
|
130
|
+
self.class == o.class &&
|
131
|
+
read_write == o.read_write &&
|
132
|
+
read_only == o.read_only &&
|
133
|
+
root_squash == o.root_squash &&
|
134
|
+
no_squash == o.no_squash &&
|
135
|
+
all_squash == o.all_squash
|
136
|
+
end
|
137
|
+
|
138
|
+
# @see the `==` method
|
139
|
+
# @param [Object] Object to be compared
|
140
|
+
def eql?(o)
|
141
|
+
self == o
|
142
|
+
end
|
143
|
+
|
144
|
+
# Calculates hash code according to all attributes.
|
145
|
+
# @return [Integer] Hash code
|
146
|
+
def hash
|
147
|
+
[read_write, read_only, root_squash, no_squash, all_squash].hash
|
148
|
+
end
|
149
|
+
|
150
|
+
# Builds the object from hash
|
151
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
152
|
+
# @return [Object] Returns the model itself
|
153
|
+
def self.build_from_hash(attributes)
|
154
|
+
new.build_from_hash(attributes)
|
155
|
+
end
|
156
|
+
|
157
|
+
# Builds the object from hash
|
158
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
159
|
+
# @return [Object] Returns the model itself
|
160
|
+
def build_from_hash(attributes)
|
161
|
+
return nil unless attributes.is_a?(Hash)
|
162
|
+
attributes = attributes.transform_keys(&:to_sym)
|
163
|
+
self.class.openapi_types.each_pair do |key, type|
|
164
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
165
|
+
self.send("#{key}=", nil)
|
166
|
+
elsif type =~ /\AArray<(.*)>/i
|
167
|
+
# check to ensure the input is an array given that the attribute
|
168
|
+
# is documented as an array but the input is not
|
169
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
170
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
171
|
+
end
|
172
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
173
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
self
|
178
|
+
end
|
179
|
+
|
180
|
+
# Deserializes the data based on type
|
181
|
+
# @param string type Data type
|
182
|
+
# @param string value Value to be deserialized
|
183
|
+
# @return [Object] Deserialized data
|
184
|
+
def _deserialize(type, value)
|
185
|
+
case type.to_sym
|
186
|
+
when :Time
|
187
|
+
Time.parse(value)
|
188
|
+
when :Date
|
189
|
+
Date.parse(value)
|
190
|
+
when :String
|
191
|
+
value.to_s
|
192
|
+
when :Integer
|
193
|
+
value.to_i
|
194
|
+
when :Float
|
195
|
+
value.to_f
|
196
|
+
when :Boolean
|
197
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
198
|
+
true
|
199
|
+
else
|
200
|
+
false
|
201
|
+
end
|
202
|
+
when :Object
|
203
|
+
# generic object (usually a Hash), return directly
|
204
|
+
value
|
205
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
206
|
+
inner_type = Regexp.last_match[:inner_type]
|
207
|
+
value.map { |v| _deserialize(inner_type, v) }
|
208
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
209
|
+
k_type = Regexp.last_match[:k_type]
|
210
|
+
v_type = Regexp.last_match[:v_type]
|
211
|
+
{}.tap do |hash|
|
212
|
+
value.each do |k, v|
|
213
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
else # model
|
217
|
+
# models (e.g. Pet) or oneOf
|
218
|
+
klass = NetworkStorageApi.const_get(type)
|
219
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
# Returns the string representation of the object
|
224
|
+
# @return [String] String presentation of the object
|
225
|
+
def to_s
|
226
|
+
to_hash.to_s
|
227
|
+
end
|
228
|
+
|
229
|
+
# to_body is an alias to to_hash (backward compatibility)
|
230
|
+
# @return [Hash] Returns the object in the form of hash
|
231
|
+
def to_body
|
232
|
+
to_hash
|
233
|
+
end
|
234
|
+
|
235
|
+
# Returns the object in the form of hash
|
236
|
+
# @return [Hash] Returns the object in the form of hash
|
237
|
+
def to_hash
|
238
|
+
hash = {}
|
239
|
+
self.class.attribute_map.each_pair do |attr, param|
|
240
|
+
value = self.send(attr)
|
241
|
+
if value.nil?
|
242
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
243
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
244
|
+
end
|
245
|
+
|
246
|
+
hash[param] = _to_hash(value)
|
247
|
+
end
|
248
|
+
hash
|
249
|
+
end
|
250
|
+
|
251
|
+
# Outputs non-array value in the form of hash
|
252
|
+
# For object, use to_hash. Otherwise, just return the value
|
253
|
+
# @param [Object] value Any valid value
|
254
|
+
# @return [Hash] Returns the value in the form of hash
|
255
|
+
def _to_hash(value)
|
256
|
+
if value.is_a?(Array)
|
257
|
+
value.compact.map { |v| _to_hash(v) }
|
258
|
+
elsif value.is_a?(Hash)
|
259
|
+
{}.tap do |hash|
|
260
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
261
|
+
end
|
262
|
+
elsif value.respond_to? :to_hash
|
263
|
+
value.to_hash
|
264
|
+
else
|
265
|
+
value
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
end
|
270
|
+
|
271
|
+
end
|