trinsic_api 1.1.1 → 1.2.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: c8b164b511e5e2523229ecb16af03c13731c8f9a6d6e90781c2e12242b1cb03b
4
- data.tar.gz: 63d098be3edc307d2cee877e8e2dbd048283560bd39094a6b71024877b26cff7
3
+ metadata.gz: 061c604b3743c9636d54b7f3d3661a3ee26ff6399ea873a836590114be9fd312
4
+ data.tar.gz: e1937c4cfd77367e96fd0bd029f1ab8840f89f87fdabea39c5c87ac9bb315c19
5
5
  SHA512:
6
- metadata.gz: c06adcb0ea9c8489c27c83f8cee9b4cd0fd86116efeb7b9c71fbf64f4112dabefcb0095803cfb4f636c756cdd89aa5456401488c718c72422672a4a18bc461de
7
- data.tar.gz: 152b1718bd119f70585f08959d6a89d377cba6ba94650161df6f45ea2864651ae1df2c3cf384245691a1c6d93f2d968de0e9ac06049dcf8fbd414a5d1c87692f
6
+ metadata.gz: 327f19bf74b6aa81ddec5f66f4564b8600fc76c9e83e578825b3317598b752cbe9f5761793d623e806fcbcffd6428ce4245254ad92975b805ac18f8993825918
7
+ data.tar.gz: 2db25d1b579127a94b8ab0f1dd44ce52b2d818da542e829fe13f3cb4ea6b05e3d1eeed444474de2198f440d2ccda955973d75c785ae53bda8239822f18024db8
@@ -5,7 +5,9 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **launch_provider_directly** | **Boolean** | Whether to immediately launch the identity provider, without invoking the Trinsic Widget UI. Users will not be shown the Widget; therefore, reuse of credentials, selection of an identity provider, and saving a verification for future reuse are not available to the end user in this mode. Sessions created with this option enabled must be created with a `RedirectUrl` specified, and cannot be invoked using the frontend SDK at this time. | [optional] |
8
+ | **enable_remember_me** | **Boolean** | Whether to enable Trinsic's \"Remember Me\" feature, which allows users to save their credentials for future use. This option is only relevant when `LaunchProviderDirectly` is unspecified or set to `false`. If `LaunchProviderDirectly` is `true`, this field must be unspecified or set to `false`. If this field is set to `true`, then: - The user will be prompted to authenticate with their phone number at the start of the flow - If the user has previously saved a verification for reuse with Trinsic, they will be offered the ability to reuse it - After the user has verified their identity (and if the identity provider in question supports it), they will be prompted to save their credentials for future use If this field is set to `false`, then: - The user will not be prompted to authenticate with their phone number at the start of the flow. - Instead, the user will be immediately shown the list of available providers - The user will not be offered the ability to reuse a previously-saved Trinsic credential - After the user has verified their identity, they will not be prompted to save their credentials for future use - Instead, they will immediately return to your product | [optional] |
8
9
  | **providers** | **Array<String>** | The list of allowed identity providers. If not specified, all available providers will be allowed. If `LaunchMethodDirectly` is `true`, this field must be set, and must have only a single entry. If `LaunchMethodDirectly` is not specified or is `false`, this field may have any number of entries. | [optional] |
10
+ | **known_identity_data** | [**KnownIdentityData**](KnownIdentityData.md) | Known identity data of an individual being verified. Provide this to Trinsic during Session creation to enable improved identity provider selection recommendations. | [optional] |
9
11
  | **disclosed_fields** | [**DisclosedFieldsRequest**](DisclosedFieldsRequest.md) | Specific identity attributes to request. If not provided, all available attributes will be requested. | [optional] |
10
12
 
11
13
  ## Example
@@ -15,7 +17,9 @@ require 'trinsic_api'
15
17
 
16
18
  instance = TrinsicApi::CreateSessionRequest.new(
17
19
  launch_provider_directly: null,
20
+ enable_remember_me: false,
18
21
  providers: null,
22
+ known_identity_data: null,
19
23
  disclosed_fields: null
20
24
  )
21
25
  ```
@@ -0,0 +1,30 @@
1
+ # TrinsicApi::KnownAddress
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **line1** | **String** | | [optional] |
8
+ | **line2** | **String** | | [optional] |
9
+ | **line3** | **String** | | [optional] |
10
+ | **city** | **String** | | [optional] |
11
+ | **state** | **String** | | [optional] |
12
+ | **postal_code** | **String** | | [optional] |
13
+ | **country** | **String** | | [optional] |
14
+
15
+ ## Example
16
+
17
+ ```ruby
18
+ require 'trinsic_api'
19
+
20
+ instance = TrinsicApi::KnownAddress.new(
21
+ line1: null,
22
+ line2: null,
23
+ line3: null,
24
+ city: null,
25
+ state: null,
26
+ postal_code: null,
27
+ country: null
28
+ )
29
+ ```
30
+
@@ -0,0 +1,18 @@
1
+ # TrinsicApi::KnownIdentityData
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **person** | [**KnownPersonData**](KnownPersonData.md) | Known identity data specific to the person being verified | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'trinsic_api'
13
+
14
+ instance = TrinsicApi::KnownIdentityData.new(
15
+ person: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,28 @@
1
+ # TrinsicApi::KnownPersonData
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **given_name** | **String** | Given (first) name of the individual | [optional] |
8
+ | **family_name** | **String** | Family (last) name of the individual | [optional] |
9
+ | **middle_name** | **String** | Middle name of the individual | [optional] |
10
+ | **phone_number** | **String** | The phone number (with preceding + character and country code) of the individual being verified | [optional] |
11
+ | **address** | [**KnownAddress**](KnownAddress.md) | The address of the individual being verified | [optional] |
12
+ | **date_of_birth** | **String** | Date of birth of the individual, in the format \"YYYY-MM-DD\" | [optional] |
13
+
14
+ ## Example
15
+
16
+ ```ruby
17
+ require 'trinsic_api'
18
+
19
+ instance = TrinsicApi::KnownPersonData.new(
20
+ given_name: John,
21
+ family_name: Doe,
22
+ middle_name: Jacob,
23
+ phone_number: null,
24
+ address: null,
25
+ date_of_birth: null
26
+ )
27
+ ```
28
+
data/docs/NetworkApi.md CHANGED
@@ -6,6 +6,7 @@ All URIs are relative to *https://api.trinsic.id*
6
6
  | ------ | ------------ | ----------- |
7
7
  | [**identity_lookup**](NetworkApi.md#identity_lookup) | **GET** /api/v1/network/identities/{phoneNumber} | Lookup Identity |
8
8
  | [**list_providers**](NetworkApi.md#list_providers) | **GET** /api/v1/network/providers | List Identity Providers |
9
+ | [**recommend_providers**](NetworkApi.md#recommend_providers) | **POST** /api/v1/network/recommend | Recommend Providers |
9
10
 
10
11
 
11
12
  ## identity_lookup
@@ -142,3 +143,74 @@ This endpoint does not need any parameter.
142
143
  - **Content-Type**: Not defined
143
144
  - **Accept**: text/plain, application/json, text/json
144
145
 
146
+
147
+ ## recommend_providers
148
+
149
+ > <RecommendResponse> recommend_providers(opts)
150
+
151
+ Recommend Providers
152
+
153
+ Generate provider recommendations based on the given signals (phone number, countries, states)
154
+
155
+ ### Examples
156
+
157
+ ```ruby
158
+ require 'time'
159
+ require 'trinsic_api'
160
+ # setup authorization
161
+ TrinsicApi.configure do |config|
162
+ # Configure Bearer authorization: Bearer
163
+ config.access_token = 'YOUR_BEARER_TOKEN'
164
+ end
165
+
166
+ api_instance = TrinsicApi::NetworkApi.new
167
+ opts = {
168
+ recommend_request: TrinsicApi::RecommendRequest.new({phone_number: 'phone_number_example'}) # RecommendRequest |
169
+ }
170
+
171
+ begin
172
+ # Recommend Providers
173
+ result = api_instance.recommend_providers(opts)
174
+ p result
175
+ rescue TrinsicApi::ApiError => e
176
+ puts "Error when calling NetworkApi->recommend_providers: #{e}"
177
+ end
178
+ ```
179
+
180
+ #### Using the recommend_providers_with_http_info variant
181
+
182
+ This returns an Array which contains the response data, status code and headers.
183
+
184
+ > <Array(<RecommendResponse>, Integer, Hash)> recommend_providers_with_http_info(opts)
185
+
186
+ ```ruby
187
+ begin
188
+ # Recommend Providers
189
+ data, status_code, headers = api_instance.recommend_providers_with_http_info(opts)
190
+ p status_code # => 2xx
191
+ p headers # => { ... }
192
+ p data # => <RecommendResponse>
193
+ rescue TrinsicApi::ApiError => e
194
+ puts "Error when calling NetworkApi->recommend_providers_with_http_info: #{e}"
195
+ end
196
+ ```
197
+
198
+ ### Parameters
199
+
200
+ | Name | Type | Description | Notes |
201
+ | ---- | ---- | ----------- | ----- |
202
+ | **recommend_request** | [**RecommendRequest**](RecommendRequest.md) | | [optional] |
203
+
204
+ ### Return type
205
+
206
+ [**RecommendResponse**](RecommendResponse.md)
207
+
208
+ ### Authorization
209
+
210
+ [Bearer](../README.md#Bearer)
211
+
212
+ ### HTTP request headers
213
+
214
+ - **Content-Type**: application/json, text/json, application/*+json
215
+ - **Accept**: text/plain, application/json, text/json
216
+
@@ -0,0 +1,22 @@
1
+ # TrinsicApi::ProviderInformation
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **provider_id** | **String** | | |
8
+ | **provider_display_name** | **String** | | |
9
+ | **provider_logo** | **String** | | |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'trinsic_api'
15
+
16
+ instance = TrinsicApi::ProviderInformation.new(
17
+ provider_id: null,
18
+ provider_display_name: null,
19
+ provider_logo: null
20
+ )
21
+ ```
22
+
@@ -0,0 +1,22 @@
1
+ # TrinsicApi::RecommendRequest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **phone_number** | **String** | The phone number of the user you whish to generate a recommendation for. Will be used to lookup the user&#39;s identity in the network | |
8
+ | **countries** | **Array&lt;String&gt;** | A list of countries, in alpha-2 ISO 3166 format, you wish to specify for the recommendation, this can include the user&#39;s country of residence, nationality, etc. | [optional] |
9
+ | **states** | **Array&lt;String&gt;** | If one of the countries is US, you can specify a list of US states to further refine the recommendation (e.g., CA, UT, NY) | [optional] |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'trinsic_api'
15
+
16
+ instance = TrinsicApi::RecommendRequest.new(
17
+ phone_number: null,
18
+ countries: null,
19
+ states: null
20
+ )
21
+ ```
22
+
@@ -0,0 +1,22 @@
1
+ # TrinsicApi::RecommendResponse
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **recognized** | [**Array&lt;ProviderInformation&gt;**](ProviderInformation.md) | The list of providers that were recognized in Trinsic&#39;s network. These are providers that already verified this user | |
8
+ | **relevant** | [**Array&lt;ProviderInformation&gt;**](ProviderInformation.md) | The list of providers that although not recognized, are relevant to the user&#39;s identity. The user may have been verified by these providers | |
9
+ | **remainder** | [**Array&lt;ProviderInformation&gt;**](ProviderInformation.md) | The list of providers that are not recognized and are not relevant to the user&#39;s identity | |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'trinsic_api'
15
+
16
+ instance = TrinsicApi::RecommendResponse.new(
17
+ recognized: null,
18
+ relevant: null,
19
+ remainder: null
20
+ )
21
+ ```
22
+
@@ -138,5 +138,69 @@ module TrinsicApi
138
138
  end
139
139
  return data, status_code, headers
140
140
  end
141
+
142
+ # Recommend Providers
143
+ # Generate provider recommendations based on the given signals (phone number, countries, states)
144
+ # @param [Hash] opts the optional parameters
145
+ # @option opts [RecommendRequest] :recommend_request
146
+ # @return [RecommendResponse]
147
+ def recommend_providers(opts = {})
148
+ data, _status_code, _headers = recommend_providers_with_http_info(opts)
149
+ data
150
+ end
151
+
152
+ # Recommend Providers
153
+ # Generate provider recommendations based on the given signals (phone number, countries, states)
154
+ # @param [Hash] opts the optional parameters
155
+ # @option opts [RecommendRequest] :recommend_request
156
+ # @return [Array<(RecommendResponse, Integer, Hash)>] RecommendResponse data, response status code and response headers
157
+ def recommend_providers_with_http_info(opts = {})
158
+ if @api_client.config.debugging
159
+ @api_client.config.logger.debug 'Calling API: NetworkApi.recommend_providers ...'
160
+ end
161
+ # resource path
162
+ local_var_path = '/api/v1/network/recommend'
163
+
164
+ # query parameters
165
+ query_params = opts[:query_params] || {}
166
+
167
+ # header parameters
168
+ header_params = opts[:header_params] || {}
169
+ # HTTP header 'Accept' (if needed)
170
+ header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json']) unless header_params['Accept']
171
+ # HTTP header 'Content-Type'
172
+ content_type = @api_client.select_header_content_type(['application/json', 'text/json', 'application/*+json'])
173
+ if !content_type.nil?
174
+ header_params['Content-Type'] = content_type
175
+ end
176
+
177
+ # form parameters
178
+ form_params = opts[:form_params] || {}
179
+
180
+ # http body (model)
181
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'recommend_request'])
182
+
183
+ # return_type
184
+ return_type = opts[:debug_return_type] || 'RecommendResponse'
185
+
186
+ # auth_names
187
+ auth_names = opts[:debug_auth_names] || ['Bearer']
188
+
189
+ new_options = opts.merge(
190
+ :operation => :"NetworkApi.recommend_providers",
191
+ :header_params => header_params,
192
+ :query_params => query_params,
193
+ :form_params => form_params,
194
+ :body => post_body,
195
+ :auth_names => auth_names,
196
+ :return_type => return_type
197
+ )
198
+
199
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
200
+ if @api_client.config.debugging
201
+ @api_client.config.logger.debug "API called: NetworkApi#recommend_providers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
202
+ end
203
+ return data, status_code, headers
204
+ end
141
205
  end
142
206
  end
@@ -18,9 +18,15 @@ module TrinsicApi
18
18
  # Whether to immediately launch the identity provider, without invoking the Trinsic Widget UI. Users will not be shown the Widget; therefore, reuse of credentials, selection of an identity provider, and saving a verification for future reuse are not available to the end user in this mode. Sessions created with this option enabled must be created with a `RedirectUrl` specified, and cannot be invoked using the frontend SDK at this time.
19
19
  attr_accessor :launch_provider_directly
20
20
 
21
+ # Whether to enable Trinsic's \"Remember Me\" feature, which allows users to save their credentials for future use. This option is only relevant when `LaunchProviderDirectly` is unspecified or set to `false`. If `LaunchProviderDirectly` is `true`, this field must be unspecified or set to `false`. If this field is set to `true`, then: - The user will be prompted to authenticate with their phone number at the start of the flow - If the user has previously saved a verification for reuse with Trinsic, they will be offered the ability to reuse it - After the user has verified their identity (and if the identity provider in question supports it), they will be prompted to save their credentials for future use If this field is set to `false`, then: - The user will not be prompted to authenticate with their phone number at the start of the flow. - Instead, the user will be immediately shown the list of available providers - The user will not be offered the ability to reuse a previously-saved Trinsic credential - After the user has verified their identity, they will not be prompted to save their credentials for future use - Instead, they will immediately return to your product
22
+ attr_accessor :enable_remember_me
23
+
21
24
  # The list of allowed identity providers. If not specified, all available providers will be allowed. If `LaunchMethodDirectly` is `true`, this field must be set, and must have only a single entry. If `LaunchMethodDirectly` is not specified or is `false`, this field may have any number of entries.
22
25
  attr_accessor :providers
23
26
 
27
+ # Known identity data of an individual being verified. Provide this to Trinsic during Session creation to enable improved identity provider selection recommendations.
28
+ attr_accessor :known_identity_data
29
+
24
30
  # Specific identity attributes to request. If not provided, all available attributes will be requested.
25
31
  attr_accessor :disclosed_fields
26
32
 
@@ -28,7 +34,9 @@ module TrinsicApi
28
34
  def self.attribute_map
29
35
  {
30
36
  :'launch_provider_directly' => :'launchProviderDirectly',
37
+ :'enable_remember_me' => :'enableRememberMe',
31
38
  :'providers' => :'providers',
39
+ :'known_identity_data' => :'knownIdentityData',
32
40
  :'disclosed_fields' => :'disclosedFields'
33
41
  }
34
42
  end
@@ -42,7 +50,9 @@ module TrinsicApi
42
50
  def self.openapi_types
43
51
  {
44
52
  :'launch_provider_directly' => :'Boolean',
53
+ :'enable_remember_me' => :'Boolean',
45
54
  :'providers' => :'Array<String>',
55
+ :'known_identity_data' => :'KnownIdentityData',
46
56
  :'disclosed_fields' => :'DisclosedFieldsRequest'
47
57
  }
48
58
  end
@@ -72,12 +82,20 @@ module TrinsicApi
72
82
  self.launch_provider_directly = attributes[:'launch_provider_directly']
73
83
  end
74
84
 
85
+ if attributes.key?(:'enable_remember_me')
86
+ self.enable_remember_me = attributes[:'enable_remember_me']
87
+ end
88
+
75
89
  if attributes.key?(:'providers')
76
90
  if (value = attributes[:'providers']).is_a?(Array)
77
91
  self.providers = value
78
92
  end
79
93
  end
80
94
 
95
+ if attributes.key?(:'known_identity_data')
96
+ self.known_identity_data = attributes[:'known_identity_data']
97
+ end
98
+
81
99
  if attributes.key?(:'disclosed_fields')
82
100
  self.disclosed_fields = attributes[:'disclosed_fields']
83
101
  end
@@ -104,7 +122,9 @@ module TrinsicApi
104
122
  return true if self.equal?(o)
105
123
  self.class == o.class &&
106
124
  launch_provider_directly == o.launch_provider_directly &&
125
+ enable_remember_me == o.enable_remember_me &&
107
126
  providers == o.providers &&
127
+ known_identity_data == o.known_identity_data &&
108
128
  disclosed_fields == o.disclosed_fields
109
129
  end
110
130
 
@@ -117,7 +137,7 @@ module TrinsicApi
117
137
  # Calculates hash code according to all attributes.
118
138
  # @return [Integer] Hash code
119
139
  def hash
120
- [launch_provider_directly, providers, disclosed_fields].hash
140
+ [launch_provider_directly, enable_remember_me, providers, known_identity_data, disclosed_fields].hash
121
141
  end
122
142
 
123
143
  # Builds the object from hash
@@ -0,0 +1,269 @@
1
+ =begin
2
+ #Connect API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrinsicApi
17
+ # Address information for an individual
18
+ class KnownAddress
19
+ attr_accessor :line1
20
+
21
+ attr_accessor :line2
22
+
23
+ attr_accessor :line3
24
+
25
+ attr_accessor :city
26
+
27
+ attr_accessor :state
28
+
29
+ attr_accessor :postal_code
30
+
31
+ attr_accessor :country
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'line1' => :'line1',
37
+ :'line2' => :'line2',
38
+ :'line3' => :'line3',
39
+ :'city' => :'city',
40
+ :'state' => :'state',
41
+ :'postal_code' => :'postalCode',
42
+ :'country' => :'country'
43
+ }
44
+ end
45
+
46
+ # Returns all the JSON keys this model knows about
47
+ def self.acceptable_attributes
48
+ attribute_map.values
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.openapi_types
53
+ {
54
+ :'line1' => :'String',
55
+ :'line2' => :'String',
56
+ :'line3' => :'String',
57
+ :'city' => :'String',
58
+ :'state' => :'String',
59
+ :'postal_code' => :'String',
60
+ :'country' => :'String'
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 `TrinsicApi::KnownAddress` 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 `TrinsicApi::KnownAddress`. 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?(:'line1')
86
+ self.line1 = attributes[:'line1']
87
+ end
88
+
89
+ if attributes.key?(:'line2')
90
+ self.line2 = attributes[:'line2']
91
+ end
92
+
93
+ if attributes.key?(:'line3')
94
+ self.line3 = attributes[:'line3']
95
+ end
96
+
97
+ if attributes.key?(:'city')
98
+ self.city = attributes[:'city']
99
+ end
100
+
101
+ if attributes.key?(:'state')
102
+ self.state = attributes[:'state']
103
+ end
104
+
105
+ if attributes.key?(:'postal_code')
106
+ self.postal_code = attributes[:'postal_code']
107
+ end
108
+
109
+ if attributes.key?(:'country')
110
+ self.country = attributes[:'country']
111
+ end
112
+ end
113
+
114
+ # Show invalid properties with the reasons. Usually used together with valid?
115
+ # @return Array for valid properties with the reasons
116
+ def list_invalid_properties
117
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
118
+ invalid_properties = Array.new
119
+ invalid_properties
120
+ end
121
+
122
+ # Check to see if the all the properties in the model are valid
123
+ # @return true if the model is valid
124
+ def valid?
125
+ warn '[DEPRECATED] the `valid?` method is obsolete'
126
+ true
127
+ end
128
+
129
+ # Checks equality by comparing each attribute.
130
+ # @param [Object] Object to be compared
131
+ def ==(o)
132
+ return true if self.equal?(o)
133
+ self.class == o.class &&
134
+ line1 == o.line1 &&
135
+ line2 == o.line2 &&
136
+ line3 == o.line3 &&
137
+ city == o.city &&
138
+ state == o.state &&
139
+ postal_code == o.postal_code &&
140
+ country == o.country
141
+ end
142
+
143
+ # @see the `==` method
144
+ # @param [Object] Object to be compared
145
+ def eql?(o)
146
+ self == o
147
+ end
148
+
149
+ # Calculates hash code according to all attributes.
150
+ # @return [Integer] Hash code
151
+ def hash
152
+ [line1, line2, line3, city, state, postal_code, country].hash
153
+ end
154
+
155
+ # Builds the object from hash
156
+ # @param [Hash] attributes Model attributes in the form of hash
157
+ # @return [Object] Returns the model itself
158
+ def self.build_from_hash(attributes)
159
+ return nil unless attributes.is_a?(Hash)
160
+ attributes = attributes.transform_keys(&:to_sym)
161
+ transformed_hash = {}
162
+ openapi_types.each_pair do |key, type|
163
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
164
+ transformed_hash["#{key}"] = nil
165
+ elsif type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[attribute_map[key]].is_a?(Array)
169
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
170
+ end
171
+ elsif !attributes[attribute_map[key]].nil?
172
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
173
+ end
174
+ end
175
+ new(transformed_hash)
176
+ end
177
+
178
+ # Deserializes the data based on type
179
+ # @param string type Data type
180
+ # @param string value Value to be deserialized
181
+ # @return [Object] Deserialized data
182
+ def self._deserialize(type, value)
183
+ case type.to_sym
184
+ when :Time
185
+ Time.parse(value)
186
+ when :Date
187
+ Date.parse(value)
188
+ when :String
189
+ value.to_s
190
+ when :Integer
191
+ value.to_i
192
+ when :Float
193
+ value.to_f
194
+ when :Boolean
195
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
196
+ true
197
+ else
198
+ false
199
+ end
200
+ when :Object
201
+ # generic object (usually a Hash), return directly
202
+ value
203
+ when /\AArray<(?<inner_type>.+)>\z/
204
+ inner_type = Regexp.last_match[:inner_type]
205
+ value.map { |v| _deserialize(inner_type, v) }
206
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
207
+ k_type = Regexp.last_match[:k_type]
208
+ v_type = Regexp.last_match[:v_type]
209
+ {}.tap do |hash|
210
+ value.each do |k, v|
211
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
212
+ end
213
+ end
214
+ else # model
215
+ # models (e.g. Pet) or oneOf
216
+ klass = TrinsicApi.const_get(type)
217
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
218
+ end
219
+ end
220
+
221
+ # Returns the string representation of the object
222
+ # @return [String] String presentation of the object
223
+ def to_s
224
+ to_hash.to_s
225
+ end
226
+
227
+ # to_body is an alias to to_hash (backward compatibility)
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_body
230
+ to_hash
231
+ end
232
+
233
+ # Returns the object in the form of hash
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_hash
236
+ hash = {}
237
+ self.class.attribute_map.each_pair do |attr, param|
238
+ value = self.send(attr)
239
+ if value.nil?
240
+ is_nullable = self.class.openapi_nullable.include?(attr)
241
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
242
+ end
243
+
244
+ hash[param] = _to_hash(value)
245
+ end
246
+ hash
247
+ end
248
+
249
+ # Outputs non-array value in the form of hash
250
+ # For object, use to_hash. Otherwise, just return the value
251
+ # @param [Object] value Any valid value
252
+ # @return [Hash] Returns the value in the form of hash
253
+ def _to_hash(value)
254
+ if value.is_a?(Array)
255
+ value.compact.map { |v| _to_hash(v) }
256
+ elsif value.is_a?(Hash)
257
+ {}.tap do |hash|
258
+ value.each { |k, v| hash[k] = _to_hash(v) }
259
+ end
260
+ elsif value.respond_to? :to_hash
261
+ value.to_hash
262
+ else
263
+ value
264
+ end
265
+ end
266
+
267
+ end
268
+
269
+ end