passageidentity 0.3.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5fad890a1b4da5a9bda57cf0441dbfb76e7b5275c6e63b97ea001897f146847
4
- data.tar.gz: f5008109d3d726a62312ee8ff85b008ecce5fc993b5f89d963cb44d0f7d21775
3
+ metadata.gz: 3e054f6f2f16c809e2837abab2c504fdc74a72efc17637684fa16d7df46cb711
4
+ data.tar.gz: 7a2fdf636d8c50c6608f6bdf8f136c738ebc4a5778994ee571feaa04d480e640
5
5
  SHA512:
6
- metadata.gz: 1beabd989e6a3357f42326c974cf61a118d8cc076be7ba2df4adccbcd0d90877c1052b03d331b3d20d6defc2d74c285ed38664943810358960dcfe02064431e3
7
- data.tar.gz: 60811539a0ae157adcb4f4f4fcbab795bbd3041cbee5c80710a4793a95dae1d0485e9b68f58b24f3a02f1e6ccf8bd6a237d673d03305c65f43031fdac7cfc76e
6
+ metadata.gz: 4e2c9626cbf491d68743c64ec42559dcfff2f9e555775937f89ba63f56e42ab3f98517f9aebac6b93ec84a145260374934b98dab1041051470663e0b429c6285
7
+ data.tar.gz: e4d50ed30523768f29e90fff59f864fbef471e59bc09dd33ad297ab287f2ff79966c187977212fd0ba8ff33bf63bc492150d96e9dd53266aa14c3414c49353c6
data/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.5.0] - 2024-01-30
6
+
7
+ ### Added
8
+
9
+ - `AppleUserSocialConnection` model has been added
10
+
11
+ ### Changed
12
+
13
+ - `UserEventInfo` has been renamed to `UserRecentEvent`
14
+ - Docs have been moved to `/docs`
15
+ - `GithubSocialConnection` has been renamed to `GithubUserSocialConnection`
16
+ - `GoogleSocialConnection` has been renamed to `GoogleUserSocialConnection`
17
+
18
+ ## [0.4.0] - 2024-01-18
19
+
20
+ ### Added
21
+
22
+ - The `UserInfo` class has a new `'social_connections' =>:'UserSocialConnections'` field for GitHub and Google
23
+
5
24
  ## [0.3.0] - 2023-12-06
6
25
 
7
26
  ### Added
@@ -0,0 +1,24 @@
1
+ # OpenapiClient::AppleUserSocialConnection
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **provider_id** | **String** | The external ID of the Social Connection. | |
8
+ | **created_at** | **Time** | | |
9
+ | **last_login_at** | **Time** | | |
10
+ | **provider_identifier** | **String** | The email of connected social user. | |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'openapi_client'
16
+
17
+ instance = OpenapiClient::AppleUserSocialConnection.new(
18
+ provider_id: null,
19
+ created_at: null,
20
+ last_login_at: null,
21
+ provider_identifier: null
22
+ )
23
+ ```
24
+
@@ -0,0 +1,24 @@
1
+ # OpenapiClient::GithubUserSocialConnection
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **provider_id** | **String** | The external ID of the Social Connection. | |
8
+ | **created_at** | **Time** | | |
9
+ | **last_login_at** | **Time** | | |
10
+ | **provider_identifier** | **String** | The email of connected social user. | |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'openapi_client'
16
+
17
+ instance = OpenapiClient::GithubUserSocialConnection.new(
18
+ provider_id: null,
19
+ created_at: null,
20
+ last_login_at: null,
21
+ provider_identifier: null
22
+ )
23
+ ```
24
+
@@ -0,0 +1,24 @@
1
+ # OpenapiClient::GoogleUserSocialConnection
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **provider_id** | **String** | The external ID of the Social Connection. | |
8
+ | **created_at** | **Time** | | |
9
+ | **last_login_at** | **Time** | | |
10
+ | **provider_identifier** | **String** | The email of connected social user. | |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'openapi_client'
16
+
17
+ instance = OpenapiClient::GoogleUserSocialConnection.new(
18
+ provider_id: null,
19
+ created_at: null,
20
+ last_login_at: null,
21
+ provider_identifier: null
22
+ )
23
+ ```
24
+
@@ -0,0 +1,153 @@
1
+ # openapi_client
2
+
3
+ OpenapiClient - the Ruby gem for the Passage Management API
4
+
5
+ Passage's management API to manage your Passage apps and users.
6
+
7
+ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
8
+
9
+ - API version: 1
10
+ - Package version: 1.0.0
11
+ - Build package: org.openapitools.codegen.languages.RubyClientCodegen
12
+ For more information, please visit [https://passage.id/support](https://passage.id/support)
13
+
14
+ ## Installation
15
+
16
+ ### Build a gem
17
+
18
+ To build the Ruby code into a gem:
19
+
20
+ ```shell
21
+ gem build openapi_client.gemspec
22
+ ```
23
+
24
+ Then either install the gem locally:
25
+
26
+ ```shell
27
+ gem install ./openapi_client-1.0.0.gem
28
+ ```
29
+
30
+ (for development, run `gem install --dev ./openapi_client-1.0.0.gem` to install the development dependencies)
31
+
32
+ or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
33
+
34
+ Finally add this to the Gemfile:
35
+
36
+ gem 'openapi_client', '~> 1.0.0'
37
+
38
+ ### Install from Git
39
+
40
+ If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
41
+
42
+ gem 'openapi_client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
43
+
44
+ ### Include the Ruby code directly
45
+
46
+ Include the Ruby code directly using `-I` as follows:
47
+
48
+ ```shell
49
+ ruby -Ilib script.rb
50
+ ```
51
+
52
+ ## Getting Started
53
+
54
+ Please follow the [installation](#installation) procedure and then run the following code:
55
+
56
+ ```ruby
57
+ # Load the gem
58
+ require 'openapi_client'
59
+
60
+ # Setup authorization
61
+ OpenapiClient.configure do |config|
62
+ # Configure Bearer authorization (JWT): bearerAuth
63
+ config.access_token = 'YOUR_BEARER_TOKEN'
64
+ # Configure a proc to get access tokens in lieu of the static access_token configuration
65
+ config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' }
66
+ # Configure faraday connection
67
+ config.configure_faraday_connection { |connection| 'YOUR CONNECTION CONFIG PROC' }
68
+ end
69
+
70
+ api_instance = OpenapiClient::AppsApi.new
71
+ app_id = 'app_id_example' # String | App ID
72
+
73
+ begin
74
+ #Get App
75
+ result = api_instance.get_app(app_id)
76
+ p result
77
+ rescue OpenapiClient::ApiError => e
78
+ puts "Exception when calling AppsApi->get_app: #{e}"
79
+ end
80
+
81
+ ```
82
+
83
+ ## Documentation for API Endpoints
84
+
85
+ All URIs are relative to *https://api.passage.id/v1*
86
+
87
+ Class | Method | HTTP request | Description
88
+ ------------ | ------------- | ------------- | -------------
89
+ *OpenapiClient::AppsApi* | [**get_app**](docs/AppsApi.md#get_app) | **GET** /apps/{app_id} | Get App
90
+ *OpenapiClient::MagicLinksApi* | [**create_magic_link**](docs/MagicLinksApi.md#create_magic_link) | **POST** /apps/{app_id}/magic-links | Create Embeddable Magic Link
91
+ *OpenapiClient::TokensApi* | [**revoke_user_refresh_tokens**](docs/TokensApi.md#revoke_user_refresh_tokens) | **DELETE** /apps/{app_id}/users/{user_id}/tokens | Revokes refresh tokens
92
+ *OpenapiClient::UserDevicesApi* | [**delete_user_devices**](docs/UserDevicesApi.md#delete_user_devices) | **DELETE** /apps/{app_id}/users/{user_id}/devices/{device_id} | Delete a device for a user
93
+ *OpenapiClient::UserDevicesApi* | [**list_user_devices**](docs/UserDevicesApi.md#list_user_devices) | **GET** /apps/{app_id}/users/{user_id}/devices | List User Devices
94
+ *OpenapiClient::UsersApi* | [**activate_user**](docs/UsersApi.md#activate_user) | **PATCH** /apps/{app_id}/users/{user_id}/activate | Activate User
95
+ *OpenapiClient::UsersApi* | [**create_user**](docs/UsersApi.md#create_user) | **POST** /apps/{app_id}/users | Create User
96
+ *OpenapiClient::UsersApi* | [**deactivate_user**](docs/UsersApi.md#deactivate_user) | **PATCH** /apps/{app_id}/users/{user_id}/deactivate | Deactivate User
97
+ *OpenapiClient::UsersApi* | [**delete_user**](docs/UsersApi.md#delete_user) | **DELETE** /apps/{app_id}/users/{user_id} | Delete User
98
+ *OpenapiClient::UsersApi* | [**get_user**](docs/UsersApi.md#get_user) | **GET** /apps/{app_id}/users/{user_id} | Get User
99
+ *OpenapiClient::UsersApi* | [**update_user**](docs/UsersApi.md#update_user) | **PATCH** /apps/{app_id}/users/{user_id} | Update User
100
+
101
+
102
+ ## Documentation for Models
103
+
104
+ - [OpenapiClient::AppInfo](docs/AppInfo.md)
105
+ - [OpenapiClient::AppResponse](docs/AppResponse.md)
106
+ - [OpenapiClient::AppleUserSocialConnection](docs/AppleUserSocialConnection.md)
107
+ - [OpenapiClient::AuthMethods](docs/AuthMethods.md)
108
+ - [OpenapiClient::CreateMagicLinkRequest](docs/CreateMagicLinkRequest.md)
109
+ - [OpenapiClient::CreateUserRequest](docs/CreateUserRequest.md)
110
+ - [OpenapiClient::ElementCustomization](docs/ElementCustomization.md)
111
+ - [OpenapiClient::FontFamily](docs/FontFamily.md)
112
+ - [OpenapiClient::GithubUserSocialConnection](docs/GithubUserSocialConnection.md)
113
+ - [OpenapiClient::GoogleUserSocialConnection](docs/GoogleUserSocialConnection.md)
114
+ - [OpenapiClient::LayoutConfig](docs/LayoutConfig.md)
115
+ - [OpenapiClient::Layouts](docs/Layouts.md)
116
+ - [OpenapiClient::ListDevicesResponse](docs/ListDevicesResponse.md)
117
+ - [OpenapiClient::MagicLink](docs/MagicLink.md)
118
+ - [OpenapiClient::MagicLinkAuthMethod](docs/MagicLinkAuthMethod.md)
119
+ - [OpenapiClient::MagicLinkChannel](docs/MagicLinkChannel.md)
120
+ - [OpenapiClient::MagicLinkResponse](docs/MagicLinkResponse.md)
121
+ - [OpenapiClient::MagicLinkType](docs/MagicLinkType.md)
122
+ - [OpenapiClient::Model400Error](docs/Model400Error.md)
123
+ - [OpenapiClient::Model401Error](docs/Model401Error.md)
124
+ - [OpenapiClient::Model404Error](docs/Model404Error.md)
125
+ - [OpenapiClient::Model500Error](docs/Model500Error.md)
126
+ - [OpenapiClient::OtpAuthMethod](docs/OtpAuthMethod.md)
127
+ - [OpenapiClient::PasskeysAuthMethod](docs/PasskeysAuthMethod.md)
128
+ - [OpenapiClient::Technologies](docs/Technologies.md)
129
+ - [OpenapiClient::TtlDisplayUnit](docs/TtlDisplayUnit.md)
130
+ - [OpenapiClient::UpdateMagicLinkAuthMethod](docs/UpdateMagicLinkAuthMethod.md)
131
+ - [OpenapiClient::UpdateOtpAuthMethod](docs/UpdateOtpAuthMethod.md)
132
+ - [OpenapiClient::UpdatePasskeysAuthMethod](docs/UpdatePasskeysAuthMethod.md)
133
+ - [OpenapiClient::UpdateUserRequest](docs/UpdateUserRequest.md)
134
+ - [OpenapiClient::UserInfo](docs/UserInfo.md)
135
+ - [OpenapiClient::UserMetadataField](docs/UserMetadataField.md)
136
+ - [OpenapiClient::UserMetadataFieldType](docs/UserMetadataFieldType.md)
137
+ - [OpenapiClient::UserRecentEvent](docs/UserRecentEvent.md)
138
+ - [OpenapiClient::UserResponse](docs/UserResponse.md)
139
+ - [OpenapiClient::UserSocialConnections](docs/UserSocialConnections.md)
140
+ - [OpenapiClient::UserStatus](docs/UserStatus.md)
141
+ - [OpenapiClient::WebAuthnDevices](docs/WebAuthnDevices.md)
142
+ - [OpenapiClient::WebAuthnIcons](docs/WebAuthnIcons.md)
143
+ - [OpenapiClient::WebAuthnType](docs/WebAuthnType.md)
144
+
145
+
146
+ ## Documentation for Authorization
147
+
148
+
149
+ Authentication schemes defined for the API:
150
+ ### bearerAuth
151
+
152
+ - **Type**: Bearer authentication (JWT)
153
+
@@ -12,7 +12,8 @@
12
12
  | **login_count** | **Integer** | | |
13
13
  | **phone** | **String** | | |
14
14
  | **phone_verified** | **Boolean** | | |
15
- | **recent_events** | [**Array<UserEventInfo>**](UserEventInfo.md) | | |
15
+ | **recent_events** | [**Array<UserRecentEvent>**](UserRecentEvent.md) | | |
16
+ | **social_connections** | [**UserSocialConnections**](UserSocialConnections.md) | | |
16
17
  | **status** | [**UserStatus**](UserStatus.md) | | |
17
18
  | **updated_at** | **Time** | | |
18
19
  | **user_metadata** | **Object** | | |
@@ -35,6 +36,7 @@ instance = OpenapiClient::UserInfo.new(
35
36
  phone: null,
36
37
  phone_verified: null,
37
38
  recent_events: null,
39
+ social_connections: null,
38
40
  status: null,
39
41
  updated_at: null,
40
42
  user_metadata: null,
@@ -1,4 +1,4 @@
1
- # OpenapiClient::UserEventInfo
1
+ # OpenapiClient::UserRecentEvent
2
2
 
3
3
  ## Properties
4
4
 
@@ -15,7 +15,7 @@
15
15
  ```ruby
16
16
  require 'openapi_client'
17
17
 
18
- instance = OpenapiClient::UserEventInfo.new(
18
+ instance = OpenapiClient::UserRecentEvent.new(
19
19
  created_at: null,
20
20
  id: null,
21
21
  ip_addr: null,
@@ -0,0 +1,22 @@
1
+ # OpenapiClient::UserSocialConnections
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **apple** | [**AppleUserSocialConnection**](AppleUserSocialConnection.md) | | [optional] |
8
+ | **github** | [**GithubUserSocialConnection**](GithubUserSocialConnection.md) | | [optional] |
9
+ | **google** | [**GoogleUserSocialConnection**](GoogleUserSocialConnection.md) | | [optional] |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'openapi_client'
15
+
16
+ instance = OpenapiClient::UserSocialConnections.new(
17
+ apple: null,
18
+ github: null,
19
+ google: null
20
+ )
21
+ ```
22
+
@@ -0,0 +1,271 @@
1
+ =begin
2
+ #Passage Management API
3
+
4
+ #Passage's management API to manage your Passage apps and users.
5
+
6
+ The version of the OpenAPI document: 1
7
+ Contact: support@passage.id
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module OpenapiClient
17
+ class AppleUserSocialConnection
18
+ # The external ID of the Social Connection.
19
+ attr_accessor :provider_id
20
+
21
+ attr_accessor :created_at
22
+
23
+ attr_accessor :last_login_at
24
+
25
+ # The email of connected social user.
26
+ attr_accessor :provider_identifier
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'provider_id' => :'provider_id',
32
+ :'created_at' => :'created_at',
33
+ :'last_login_at' => :'last_login_at',
34
+ :'provider_identifier' => :'provider_identifier'
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.openapi_types
45
+ {
46
+ :'provider_id' => :'String',
47
+ :'created_at' => :'Time',
48
+ :'last_login_at' => :'Time',
49
+ :'provider_identifier' => :'String'
50
+ }
51
+ end
52
+
53
+ # List of attributes with nullable: true
54
+ def self.openapi_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 `OpenapiClient::AppleUserSocialConnection` 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 `OpenapiClient::AppleUserSocialConnection`. 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?(:'provider_id')
75
+ self.provider_id = attributes[:'provider_id']
76
+ else
77
+ self.provider_id = nil
78
+ end
79
+
80
+ if attributes.key?(:'created_at')
81
+ self.created_at = attributes[:'created_at']
82
+ else
83
+ self.created_at = nil
84
+ end
85
+
86
+ if attributes.key?(:'last_login_at')
87
+ self.last_login_at = attributes[:'last_login_at']
88
+ else
89
+ self.last_login_at = nil
90
+ end
91
+
92
+ if attributes.key?(:'provider_identifier')
93
+ self.provider_identifier = attributes[:'provider_identifier']
94
+ else
95
+ self.provider_identifier = nil
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
103
+ invalid_properties = Array.new
104
+ if @provider_id.nil?
105
+ invalid_properties.push('invalid value for "provider_id", provider_id cannot be nil.')
106
+ end
107
+
108
+ if @created_at.nil?
109
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
110
+ end
111
+
112
+ if @last_login_at.nil?
113
+ invalid_properties.push('invalid value for "last_login_at", last_login_at cannot be nil.')
114
+ end
115
+
116
+ if @provider_identifier.nil?
117
+ invalid_properties.push('invalid value for "provider_identifier", provider_identifier cannot be nil.')
118
+ end
119
+
120
+ invalid_properties
121
+ end
122
+
123
+ # Check to see if the all the properties in the model are valid
124
+ # @return true if the model is valid
125
+ def valid?
126
+ warn '[DEPRECATED] the `valid?` method is obsolete'
127
+ return false if @provider_id.nil?
128
+ return false if @created_at.nil?
129
+ return false if @last_login_at.nil?
130
+ return false if @provider_identifier.nil?
131
+ true
132
+ end
133
+
134
+ # Checks equality by comparing each attribute.
135
+ # @param [Object] Object to be compared
136
+ def ==(o)
137
+ return true if self.equal?(o)
138
+ self.class == o.class &&
139
+ provider_id == o.provider_id &&
140
+ created_at == o.created_at &&
141
+ last_login_at == o.last_login_at &&
142
+ provider_identifier == o.provider_identifier
143
+ end
144
+
145
+ # @see the `==` method
146
+ # @param [Object] Object to be compared
147
+ def eql?(o)
148
+ self == o
149
+ end
150
+
151
+ # Calculates hash code according to all attributes.
152
+ # @return [Integer] Hash code
153
+ def hash
154
+ [provider_id, created_at, last_login_at, provider_identifier].hash
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 self.build_from_hash(attributes)
161
+ return nil unless attributes.is_a?(Hash)
162
+ attributes = attributes.transform_keys(&:to_sym)
163
+ transformed_hash = {}
164
+ openapi_types.each_pair do |key, type|
165
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
166
+ transformed_hash["#{key}"] = nil
167
+ elsif type =~ /\AArray<(.*)>/i
168
+ # check to ensure the input is an array given that the attribute
169
+ # is documented as an array but the input is not
170
+ if attributes[attribute_map[key]].is_a?(Array)
171
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
172
+ end
173
+ elsif !attributes[attribute_map[key]].nil?
174
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
175
+ end
176
+ end
177
+ new(transformed_hash)
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 self._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 = OpenapiClient.const_get(type)
219
+ klass.respond_to?(:openapi_any_of) || 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