turnkey_client 0.0.17 → 0.0.18

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.
@@ -0,0 +1,246 @@
1
+ =begin
2
+ #API Reference
3
+
4
+ #Review our [API Introduction](../api-introduction) to get started.
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ =end
10
+
11
+ require 'date'
12
+
13
+ module TurnkeyClient
14
+ class AssetMetadata
15
+ # The caip-19 asset identifier
16
+ attr_accessor :caip19
17
+
18
+ # The asset symbol
19
+ attr_accessor :symbol
20
+
21
+ # The number of decimals this asset uses
22
+ attr_accessor :decimals
23
+
24
+ # The url of the asset logo
25
+ attr_accessor :logo_url
26
+
27
+ # The asset name
28
+ attr_accessor :name
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'caip19' => :'caip19',
34
+ :'symbol' => :'symbol',
35
+ :'decimals' => :'decimals',
36
+ :'logo_url' => :'logoUrl',
37
+ :'name' => :'name'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'caip19' => :'Object',
45
+ :'symbol' => :'Object',
46
+ :'decimals' => :'Object',
47
+ :'logo_url' => :'Object',
48
+ :'name' => :'Object'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ ])
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::AssetMetadata` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ attributes = attributes.each_with_object({}) { |(k, v), h|
67
+ if (!self.class.attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::AssetMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
69
+ end
70
+ h[k.to_sym] = v
71
+ }
72
+
73
+ if attributes.key?(:'caip19')
74
+ self.caip19 = attributes[:'caip19']
75
+ end
76
+
77
+ if attributes.key?(:'symbol')
78
+ self.symbol = attributes[:'symbol']
79
+ end
80
+
81
+ if attributes.key?(:'decimals')
82
+ self.decimals = attributes[:'decimals']
83
+ end
84
+
85
+ if attributes.key?(:'logo_url')
86
+ self.logo_url = attributes[:'logo_url']
87
+ end
88
+
89
+ if attributes.key?(:'name')
90
+ self.name = attributes[:'name']
91
+ end
92
+ end
93
+
94
+ # Show invalid properties with the reasons. Usually used together with valid?
95
+ # @return Array for valid properties with the reasons
96
+ def list_invalid_properties
97
+ invalid_properties = Array.new
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ true
105
+ end
106
+
107
+ # Checks equality by comparing each attribute.
108
+ # @param [Object] Object to be compared
109
+ def ==(o)
110
+ return true if self.equal?(o)
111
+ self.class == o.class &&
112
+ caip19 == o.caip19 &&
113
+ symbol == o.symbol &&
114
+ decimals == o.decimals &&
115
+ logo_url == o.logo_url &&
116
+ name == o.name
117
+ end
118
+
119
+ # @see the `==` method
120
+ # @param [Object] Object to be compared
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculates hash code according to all attributes.
126
+ # @return [Integer] Hash code
127
+ def hash
128
+ [caip19, symbol, decimals, logo_url, name].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def self.build_from_hash(attributes)
135
+ new.build_from_hash(attributes)
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def build_from_hash(attributes)
142
+ return nil unless attributes.is_a?(Hash)
143
+ self.class.openapi_types.each_pair do |key, type|
144
+ if type =~ /\AArray<(.*)>/i
145
+ # check to ensure the input is an array given that the attribute
146
+ # is documented as an array but the input is not
147
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
148
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
149
+ end
150
+ elsif !attributes[self.class.attribute_map[key]].nil?
151
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
152
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
153
+ self.send("#{key}=", nil)
154
+ end
155
+ end
156
+
157
+ self
158
+ end
159
+
160
+ # Deserializes the data based on type
161
+ # @param string type Data type
162
+ # @param string value Value to be deserialized
163
+ # @return [Object] Deserialized data
164
+ def _deserialize(type, value)
165
+ case type.to_sym
166
+ when :DateTime
167
+ DateTime.parse(value)
168
+ when :Date
169
+ Date.parse(value)
170
+ when :String
171
+ value.to_s
172
+ when :Integer
173
+ value.to_i
174
+ when :Float
175
+ value.to_f
176
+ when :Boolean
177
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
178
+ true
179
+ else
180
+ false
181
+ end
182
+ when :Object
183
+ # generic object (usually a Hash), return directly
184
+ value
185
+ when /\AArray<(?<inner_type>.+)>\z/
186
+ inner_type = Regexp.last_match[:inner_type]
187
+ value.map { |v| _deserialize(inner_type, v) }
188
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
189
+ k_type = Regexp.last_match[:k_type]
190
+ v_type = Regexp.last_match[:v_type]
191
+ {}.tap do |hash|
192
+ value.each do |k, v|
193
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
194
+ end
195
+ end
196
+ else # model
197
+ TurnkeyClient.const_get(type).build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map { |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end end
246
+ end
@@ -42,6 +42,12 @@ module TurnkeyClient
42
42
  # Optional nonce to ensure uniqueness of the deployment manifest. If not provided, it defaults to the current Unix timestamp in seconds.
43
43
  attr_accessor :nonce
44
44
 
45
+ # Optional encrypted pull secret to authorize Turnkey to pull the pivot container image. If your image is public, leave this empty.
46
+ attr_accessor :pivot_container_encrypted_pull_secret
47
+
48
+ # Optional encrypted pull secret to authorize Turnkey to pull the host container image. If your image is public, leave this empty.
49
+ attr_accessor :host_container_encrypted_pull_secret
50
+
45
51
  # Attribute mapping from ruby-style variable name to JSON key.
46
52
  def self.attribute_map
47
53
  {
@@ -54,7 +60,9 @@ module TurnkeyClient
54
60
  :'host_container_image_url' => :'hostContainerImageUrl',
55
61
  :'host_path' => :'hostPath',
56
62
  :'host_args' => :'hostArgs',
57
- :'nonce' => :'nonce'
63
+ :'nonce' => :'nonce',
64
+ :'pivot_container_encrypted_pull_secret' => :'pivotContainerEncryptedPullSecret',
65
+ :'host_container_encrypted_pull_secret' => :'hostContainerEncryptedPullSecret'
58
66
  }
59
67
  end
60
68
 
@@ -70,14 +78,18 @@ module TurnkeyClient
70
78
  :'host_container_image_url' => :'Object',
71
79
  :'host_path' => :'Object',
72
80
  :'host_args' => :'Object',
73
- :'nonce' => :'Object'
81
+ :'nonce' => :'Object',
82
+ :'pivot_container_encrypted_pull_secret' => :'Object',
83
+ :'host_container_encrypted_pull_secret' => :'Object'
74
84
  }
75
85
  end
76
86
 
77
87
  # List of attributes with nullable: true
78
88
  def self.openapi_nullable
79
89
  Set.new([
80
- :'nonce'
90
+ :'nonce',
91
+ :'pivot_container_encrypted_pull_secret',
92
+ :'host_container_encrypted_pull_secret'
81
93
  ])
82
94
  end
83
95
 
@@ -139,6 +151,14 @@ module TurnkeyClient
139
151
  if attributes.key?(:'nonce')
140
152
  self.nonce = attributes[:'nonce']
141
153
  end
154
+
155
+ if attributes.key?(:'pivot_container_encrypted_pull_secret')
156
+ self.pivot_container_encrypted_pull_secret = attributes[:'pivot_container_encrypted_pull_secret']
157
+ end
158
+
159
+ if attributes.key?(:'host_container_encrypted_pull_secret')
160
+ self.host_container_encrypted_pull_secret = attributes[:'host_container_encrypted_pull_secret']
161
+ end
142
162
  end
143
163
 
144
164
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -213,7 +233,9 @@ module TurnkeyClient
213
233
  host_container_image_url == o.host_container_image_url &&
214
234
  host_path == o.host_path &&
215
235
  host_args == o.host_args &&
216
- nonce == o.nonce
236
+ nonce == o.nonce &&
237
+ pivot_container_encrypted_pull_secret == o.pivot_container_encrypted_pull_secret &&
238
+ host_container_encrypted_pull_secret == o.host_container_encrypted_pull_secret
217
239
  end
218
240
 
219
241
  # @see the `==` method
@@ -225,7 +247,7 @@ module TurnkeyClient
225
247
  # Calculates hash code according to all attributes.
226
248
  # @return [Integer] Hash code
227
249
  def hash
228
- [app_id, qos_version, pivot_container_image_url, pivot_path, pivot_args, expected_pivot_digest, host_container_image_url, host_path, host_args, nonce].hash
250
+ [app_id, qos_version, pivot_container_image_url, pivot_path, pivot_args, expected_pivot_digest, host_container_image_url, host_path, host_args, nonce, pivot_container_encrypted_pull_secret, host_container_encrypted_pull_secret].hash
229
251
  end
230
252
 
231
253
  # Builds the object from hash
@@ -106,7 +106,7 @@ module TurnkeyClient
106
106
  def valid?
107
107
  return false if @signed_transaction.nil?
108
108
  return false if @caip2.nil?
109
- caip2_validator = EnumAttributeValidator.new('Object', ['eip155:1', 'eip155:11155111', 'eip155:8453', 'eip155:84532'])
109
+ caip2_validator = EnumAttributeValidator.new('Object', ['eip155:1', 'eip155:11155111', 'eip155:8453', 'eip155:84532', 'eip155:137', 'eip155:80002'])
110
110
  return false unless caip2_validator.valid?(@caip2)
111
111
  true
112
112
  end
@@ -114,7 +114,7 @@ module TurnkeyClient
114
114
  # Custom attribute writer method checking allowed values (enum).
115
115
  # @param [Object] caip2 Object to be assigned
116
116
  def caip2=(caip2)
117
- validator = EnumAttributeValidator.new('Object', ['eip155:1', 'eip155:11155111', 'eip155:8453', 'eip155:84532'])
117
+ validator = EnumAttributeValidator.new('Object', ['eip155:1', 'eip155:11155111', 'eip155:8453', 'eip155:84532', 'eip155:137', 'eip155:80002'])
118
118
  unless validator.valid?(caip2)
119
119
  fail ArgumentError, "invalid value for \"caip2\", must be one of #{validator.allowable_values}."
120
120
  end
@@ -18,7 +18,7 @@ module TurnkeyClient
18
18
  # The Ethereum address to query nonces for.
19
19
  attr_accessor :address
20
20
 
21
- # The network identifier in CAIP-2 format (e.g., 'eip155:1' for Ethereum mainnet).
21
+ # CAIP-2 chain ID (e.g., 'eip155:1' for Ethereum mainnet).
22
22
  attr_accessor :caip2
23
23
 
24
24
  # Whether to fetch the standard on-chain nonce.
@@ -27,6 +27,28 @@ module TurnkeyClient
27
27
  # Whether to fetch the gas station nonce used for sponsored transactions.
28
28
  attr_accessor :gas_station_nonce
29
29
 
30
+ class EnumAttributeValidator
31
+ attr_reader :datatype
32
+ attr_reader :allowable_values
33
+
34
+ def initialize(datatype, allowable_values)
35
+ @allowable_values = allowable_values.map do |value|
36
+ case datatype.to_s
37
+ when /Integer/i
38
+ value.to_i
39
+ when /Float/i
40
+ value.to_f
41
+ else
42
+ value
43
+ end
44
+ end
45
+ end
46
+
47
+ def valid?(value)
48
+ !value || allowable_values.include?(value)
49
+ end
50
+ end
51
+
30
52
  # Attribute mapping from ruby-style variable name to JSON key.
31
53
  def self.attribute_map
32
54
  {
@@ -116,9 +138,21 @@ module TurnkeyClient
116
138
  return false if @organization_id.nil?
117
139
  return false if @address.nil?
118
140
  return false if @caip2.nil?
141
+ caip2_validator = EnumAttributeValidator.new('Object', ['eip155:1', 'eip155:11155111', 'eip155:8453', 'eip155:84532', 'eip155:137', 'eip155:80002'])
142
+ return false unless caip2_validator.valid?(@caip2)
119
143
  true
120
144
  end
121
145
 
146
+ # Custom attribute writer method checking allowed values (enum).
147
+ # @param [Object] caip2 Object to be assigned
148
+ def caip2=(caip2)
149
+ validator = EnumAttributeValidator.new('Object', ['eip155:1', 'eip155:11155111', 'eip155:8453', 'eip155:84532', 'eip155:137', 'eip155:80002'])
150
+ unless validator.valid?(caip2)
151
+ fail ArgumentError, "invalid value for \"caip2\", must be one of #{validator.allowable_values}."
152
+ end
153
+ @caip2 = caip2
154
+ end
155
+
122
156
  # Checks equality by comparing each attribute.
123
157
  # @param [Object] Object to be compared
124
158
  def ==(o)
@@ -0,0 +1,275 @@
1
+ =begin
2
+ #API Reference
3
+
4
+ #Review our [API Introduction](../api-introduction) to get started.
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ =end
10
+
11
+ require 'date'
12
+
13
+ module TurnkeyClient
14
+ class GetWalletAddressBalancesRequest
15
+ # Unique identifier for a given organization.
16
+ attr_accessor :organization_id
17
+
18
+ # Address corresponding to a wallet account.
19
+ attr_accessor :address
20
+
21
+ # CAIP-2 chain ID (e.g., 'eip155:1' for Ethereum mainnet).
22
+ attr_accessor :caip2
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'organization_id' => :'organizationId',
50
+ :'address' => :'address',
51
+ :'caip2' => :'caip2'
52
+ }
53
+ end
54
+
55
+ # Attribute type mapping.
56
+ def self.openapi_types
57
+ {
58
+ :'organization_id' => :'Object',
59
+ :'address' => :'Object',
60
+ :'caip2' => :'Object'
61
+ }
62
+ end
63
+
64
+ # List of attributes with nullable: true
65
+ def self.openapi_nullable
66
+ Set.new([
67
+ ])
68
+ end
69
+
70
+ # Initializes the object
71
+ # @param [Hash] attributes Model attributes in the form of hash
72
+ def initialize(attributes = {})
73
+ if (!attributes.is_a?(Hash))
74
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::GetWalletAddressBalancesRequest` initialize method"
75
+ end
76
+
77
+ # check to see if the attribute exists and convert string to symbol for hash key
78
+ attributes = attributes.each_with_object({}) { |(k, v), h|
79
+ if (!self.class.attribute_map.key?(k.to_sym))
80
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::GetWalletAddressBalancesRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
81
+ end
82
+ h[k.to_sym] = v
83
+ }
84
+
85
+ if attributes.key?(:'organization_id')
86
+ self.organization_id = attributes[:'organization_id']
87
+ end
88
+
89
+ if attributes.key?(:'address')
90
+ self.address = attributes[:'address']
91
+ end
92
+
93
+ if attributes.key?(:'caip2')
94
+ self.caip2 = attributes[:'caip2']
95
+ end
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properties with the reasons
100
+ def list_invalid_properties
101
+ invalid_properties = Array.new
102
+ if @organization_id.nil?
103
+ invalid_properties.push('invalid value for "organization_id", organization_id cannot be nil.')
104
+ end
105
+
106
+ if @address.nil?
107
+ invalid_properties.push('invalid value for "address", address cannot be nil.')
108
+ end
109
+
110
+ if @caip2.nil?
111
+ invalid_properties.push('invalid value for "caip2", caip2 cannot be nil.')
112
+ end
113
+
114
+ invalid_properties
115
+ end
116
+
117
+ # Check to see if the all the properties in the model are valid
118
+ # @return true if the model is valid
119
+ def valid?
120
+ return false if @organization_id.nil?
121
+ return false if @address.nil?
122
+ return false if @caip2.nil?
123
+ caip2_validator = EnumAttributeValidator.new('Object', ['eip155:1', 'eip155:11155111', 'eip155:8453', 'eip155:84532', 'eip155:137', 'eip155:80002'])
124
+ return false unless caip2_validator.valid?(@caip2)
125
+ true
126
+ end
127
+
128
+ # Custom attribute writer method checking allowed values (enum).
129
+ # @param [Object] caip2 Object to be assigned
130
+ def caip2=(caip2)
131
+ validator = EnumAttributeValidator.new('Object', ['eip155:1', 'eip155:11155111', 'eip155:8453', 'eip155:84532', 'eip155:137', 'eip155:80002'])
132
+ unless validator.valid?(caip2)
133
+ fail ArgumentError, "invalid value for \"caip2\", must be one of #{validator.allowable_values}."
134
+ end
135
+ @caip2 = caip2
136
+ end
137
+
138
+ # Checks equality by comparing each attribute.
139
+ # @param [Object] Object to be compared
140
+ def ==(o)
141
+ return true if self.equal?(o)
142
+ self.class == o.class &&
143
+ organization_id == o.organization_id &&
144
+ address == o.address &&
145
+ caip2 == o.caip2
146
+ end
147
+
148
+ # @see the `==` method
149
+ # @param [Object] Object to be compared
150
+ def eql?(o)
151
+ self == o
152
+ end
153
+
154
+ # Calculates hash code according to all attributes.
155
+ # @return [Integer] Hash code
156
+ def hash
157
+ [organization_id, address, caip2].hash
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def self.build_from_hash(attributes)
164
+ new.build_from_hash(attributes)
165
+ end
166
+
167
+ # Builds the object from hash
168
+ # @param [Hash] attributes Model attributes in the form of hash
169
+ # @return [Object] Returns the model itself
170
+ def build_from_hash(attributes)
171
+ return nil unless attributes.is_a?(Hash)
172
+ self.class.openapi_types.each_pair do |key, type|
173
+ if type =~ /\AArray<(.*)>/i
174
+ # check to ensure the input is an array given that the attribute
175
+ # is documented as an array but the input is not
176
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
177
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
178
+ end
179
+ elsif !attributes[self.class.attribute_map[key]].nil?
180
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
181
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
182
+ self.send("#{key}=", nil)
183
+ end
184
+ end
185
+
186
+ self
187
+ end
188
+
189
+ # Deserializes the data based on type
190
+ # @param string type Data type
191
+ # @param string value Value to be deserialized
192
+ # @return [Object] Deserialized data
193
+ def _deserialize(type, value)
194
+ case type.to_sym
195
+ when :DateTime
196
+ DateTime.parse(value)
197
+ when :Date
198
+ Date.parse(value)
199
+ when :String
200
+ value.to_s
201
+ when :Integer
202
+ value.to_i
203
+ when :Float
204
+ value.to_f
205
+ when :Boolean
206
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
207
+ true
208
+ else
209
+ false
210
+ end
211
+ when :Object
212
+ # generic object (usually a Hash), return directly
213
+ value
214
+ when /\AArray<(?<inner_type>.+)>\z/
215
+ inner_type = Regexp.last_match[:inner_type]
216
+ value.map { |v| _deserialize(inner_type, v) }
217
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
218
+ k_type = Regexp.last_match[:k_type]
219
+ v_type = Regexp.last_match[:v_type]
220
+ {}.tap do |hash|
221
+ value.each do |k, v|
222
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
223
+ end
224
+ end
225
+ else # model
226
+ TurnkeyClient.const_get(type).build_from_hash(value)
227
+ end
228
+ end
229
+
230
+ # Returns the string representation of the object
231
+ # @return [String] String presentation of the object
232
+ def to_s
233
+ to_hash.to_s
234
+ end
235
+
236
+ # to_body is an alias to to_hash (backward compatibility)
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_body
239
+ to_hash
240
+ end
241
+
242
+ # Returns the object in the form of hash
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_hash
245
+ hash = {}
246
+ self.class.attribute_map.each_pair do |attr, param|
247
+ value = self.send(attr)
248
+ if value.nil?
249
+ is_nullable = self.class.openapi_nullable.include?(attr)
250
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
251
+ end
252
+
253
+ hash[param] = _to_hash(value)
254
+ end
255
+ hash
256
+ end
257
+
258
+ # Outputs non-array value in the form of hash
259
+ # For object, use to_hash. Otherwise, just return the value
260
+ # @param [Object] value Any valid value
261
+ # @return [Hash] Returns the value in the form of hash
262
+ def _to_hash(value)
263
+ if value.is_a?(Array)
264
+ value.compact.map { |v| _to_hash(v) }
265
+ elsif value.is_a?(Hash)
266
+ {}.tap do |hash|
267
+ value.each { |k, v| hash[k] = _to_hash(v) }
268
+ end
269
+ elsif value.respond_to? :to_hash
270
+ value.to_hash
271
+ else
272
+ value
273
+ end
274
+ end end
275
+ end