DealMakerAPI 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/DealMakerAPI.gemspec +38 -0
  3. data/Gemfile +9 -0
  4. data/README.md +371 -0
  5. data/Rakefile +10 -0
  6. data/docs/DealApi.md +289 -0
  7. data/docs/V1EntitiesAttachment.md +22 -0
  8. data/docs/V1EntitiesBackgroundCheckSearch.md +18 -0
  9. data/docs/V1EntitiesDeal.md +20 -0
  10. data/docs/V1EntitiesInvestor.md +58 -0
  11. data/docs/V1EntitiesInvestors.md +18 -0
  12. data/docs/V1EntitiesSubscriptionAgreement.md +20 -0
  13. data/git_push.sh +57 -0
  14. data/lib/DealMakerAPI/api/deal_api.rb +299 -0
  15. data/lib/DealMakerAPI/api_client.rb +389 -0
  16. data/lib/DealMakerAPI/api_error.rb +57 -0
  17. data/lib/DealMakerAPI/configuration.rb +271 -0
  18. data/lib/DealMakerAPI/models/v1_entities_attachment.rb +239 -0
  19. data/lib/DealMakerAPI/models/v1_entities_background_check_search.rb +219 -0
  20. data/lib/DealMakerAPI/models/v1_entities_deal.rb +230 -0
  21. data/lib/DealMakerAPI/models/v1_entities_investor.rb +487 -0
  22. data/lib/DealMakerAPI/models/v1_entities_investors.rb +219 -0
  23. data/lib/DealMakerAPI/models/v1_entities_subscription_agreement.rb +229 -0
  24. data/lib/DealMakerAPI/version.rb +15 -0
  25. data/lib/DealMakerAPI.rb +46 -0
  26. data/spec/api/deal_api_spec.rb +89 -0
  27. data/spec/api_client_spec.rb +226 -0
  28. data/spec/configuration_spec.rb +42 -0
  29. data/spec/models/v1_entities_attachment_spec.rb +46 -0
  30. data/spec/models/v1_entities_background_check_search_spec.rb +34 -0
  31. data/spec/models/v1_entities_deal_spec.rb +40 -0
  32. data/spec/models/v1_entities_investor_spec.rb +170 -0
  33. data/spec/models/v1_entities_investors_spec.rb +34 -0
  34. data/spec/models/v1_entities_subscription_agreement_spec.rb +40 -0
  35. data/spec/spec_helper.rb +111 -0
  36. metadata +127 -0
@@ -0,0 +1,487 @@
1
+ =begin
2
+ #DealMaker API
3
+
4
+ ## Introduction Welcome to DealMaker’s Web API v1! This API is RESTful, easy to integrate with, and offers support in 2 different languages. # Libraries * Javascript * Ruby # Authentication To authenticate, add an Authorization header to your API request that contains an access token. ## Create an Application DealMaker’s Web API v1 supports the use of OAuth applications. Applications can be generated in your [account](https://www.dealmaker.tech/developer/applications). Unde the developer tab, click the `Create New Application` button ![Screenshot](https://s3.ca-central-1.amazonaws.com/docs.dealmaker.tech/images/api-application-1.png) Name your application and assign the level of permissions for this application ![Screenshot](https://s3.ca-central-1.amazonaws.com/docs.dealmaker.tech/images/api-application-2.png) Once your application is created, save in a secure space your public and secret keys. **WARNING**: The secret key will not be visible after you click the close button ![Screenshot](https://s3.ca-central-1.amazonaws.com/docs.dealmaker.tech/images/api-application-3.png) From the developer tab, you will be able to view and manage all the available applications ![Screenshot](https://s3.ca-central-1.amazonaws.com/docs.dealmaker.tech/images/api-application-4.png) Each Application consists of a client id, secret and set of scopes. The scopes define what resources you want to have access to. The client ID and secret are used to generate an access token. You will need to create an application to use API endpoints. ## How to generate an access token After creating an application, you must make a call to obtain a bearer token using the Generate an OAuth token operation. This operation requires the following parameters: `token endpoint` - https://app.dealmaker.tech/oauth/token `grant_type` - must be set to `client_credentials` `client_id` - the Client ID displayed when you created the OAuth application in the previous step `client_secret` - the Client Secret displayed when you created the OAuth application in the previous step `scope` - the scope is established when you created the OAuth application in the previous step Note: The Generate an OAuth token response specifies how long the bearer token is valid for. You should reuse the bearer token until it is expired. When the token is expired, call Generate an OAuth token again to generate a new one. To use the access token, you must set a plain text header named `Authorization` with the contents of the header being “Bearer XXX” where XXX is your generated access token. # Status Codes ## Content-Type Header All responses are returned in JSON format. We specify this by sending the Content-Type header. ## Status Codes Below is a table containing descriptions of the various status codes we currently support against various resources. Sometimes your API call will generate an error. Here you will find additional information about what to expect if you don’t format your request properly, or we fail to properly process your request. | Status Code | Description | | ----------- | ----------- | | `200` | Success | | `403` | Forbiden | | `404` | Not found | # Pagination Pagination is used to divide large resposes is smaller portions (pages). By default, all endpoints return a maximum of 25 records per page. You can change the number of records on a per request basis by passing a `per_page` parameter in the request header parameters. When the response exceeds the `per_page` parameter, you can paginate through the records by increasing the `offset` parameter. Example: `offset=25` will return 25 records starting from 26th record. You may also paginate using the `page` parameter to indicate the page number you would like to show on the response. Please review the table below for the input parameters ## Inputs | Parameter | Description | | ----------- | ----------- | | `per_page` | Amount of records included on each page (Default is 25) | | `page` | Page number | | `offset` | Amount of records offset on the API request where 0 represents the first record | ## Respose Headers To review additional information about pagination on a specific response, including how to determine the total number of pages of the avaialble data set, the API returns the following header fields with every paginated response: | Response Header | Description | | ----------- | ----------- | | `X-Total` | Total number of records of response | | `X-Total-Pages` | Total number of pages of response | | `X-Per-Page` | Total number of records per page of response | | `X-Page` | Number of current page | | `X-Next-Page` | Number of next page | | `X-Prev-Page` | Number of previous page| | `X-Offset` | Total number of records offset | # Versioning The latest version is v1. The version can be updated on the `Accept` header, just set the version as stated on the following example: ``` Accept:application/vnd.dealmaker-v1+json ``` | Version | Accept Header | | ----------- | ----------- | | `v1` | application/vnd.dealmaker-`v1`+json | # SDK’s For instruction on installing SDKs, please view the following links * [Javascript](https://github.com/DealMakerTech/api/tree/main/v1/clients/javascript) * [Ruby](https://github.com/DealMakerTech/api/tree/main/v1/clients/ruby) # Webhooks Our webhooks functionality allows clients to automatically receive updates on a deal's investor data. The type of data that the webhooks include: * Investor Name * Date created * Email * Phone * Allocation * Attachments * Accredited investor status * Accredited investor category * Status (Draft, Invited, Accepted, Waiting) Via webhooks clients can subscribe to the following events as they happen on Dealmaker: * Investor is created * Investor details are updated (any of the investor details above change or are updated) * Investor is deleted A URL supplied by the client will receive all the events with the information as part of the payload. Clients are able to add and update the URL within DealMaker. ## Configuration For a comprehensive guide on how to configure Webhooks please visit our support article: [Configuring Webhooks on DealMaker – DealMaker Support](https://help.dealmaker.tech/configuring-webhooks-on-dealmaker). As a developer user on DealMaker, you are able to configure webhooks by following the steps below: 1. Sign into Dealmaker 2. Go to **“Your profile”** in the top right corner 3. Access an **“Integrations”** configuration via the left menu 4. The developer configures webhooks by including: * The HTTPS URL where the request will be sent * Optionally, a security token that we would use to build a SHA1 hash that would be included in the request headers. The name of the header is `X-DealMaker-Signature`. If the secret is not specified, the hash won’t be included in the headers. * An email address that will be used to notify about errors. 5. The developers can disable webhooks temporarily if needed ## Specification ### Events The initial set of events will be related to the investor. The events are: 1. `investor.created` * Triggers every time a new investor is added to a deal 2. `investor.updated` * Triggers on updates to any of the following fields: 1. Status 2. Name 3. Email - (this is a user field so we trigger event for all investors with webhook subscription) 4. Allocated Amount 5. Investment Amount 6. Accredited investor fields 7. Adding or removing attachments 8. Tags * When the investor status is signed, the payload also includes a link to the signed document; the link expires after 30 minutes 3. `investor.deleted` * Triggers when the investor is removed from the deal * The investor key of the payload only includes investor ID * The deal is not included in the payload. Due to our implementation it’s impossible to retrieve the deal the investor was part of ### Requests * The request is a `POST` * The payload’s `content-type` is `application/json` * Only `2XX` responses are considered successful. In the event of a different response, we consider it failed and queue the event for retry * We retry the request five times, after the initial attempt. Doubling the waiting time between intervals with each try. The first retry happens after 30 seconds, then 60 seconds, 2 mins, 4 minutes, and 8 minutes. This timing scheme gives the receiver about 1 hour if all the requests fail * If an event fails all the attempts to be delivered, we send an email to the address that the user configured ### Payload #### Common Properties There will be some properties that are common to all the events on the system. |Key|Type|Description| |--- |--- |--- | |event|String|The event that triggered the call| |event_id|String|A unique identifier for the event| |deal<sup>*</sup>|Object|The deal in which the event occurred. It includes id, title, created_at and updated_at| <sup>*</sup>This field is not included when deleting a resource #### Common Properties (investor scope) Every event on this scope must contain an investor object, here are some properties that are common to this object on all events in the investor scope: |Key|Type|Description| |--- |--- |--- | |id|Integer|The unique ID of the Investor| |name|String|Investor’s Name| |status|String|Current status of the investor<br />Possible states are: <br />draft<br />invited<br />signed<br />waiting<br />accepted| |email|String|| |phone_number|String|| |investment_amount|Double|| |allocated_amount|Double|| |accredited_investor|Object|See format in respective ticket| |attachments|Array of Objects|List of supporting documents uploaded to the investor, including URL (expire after 30 minutes) and title (caption)| |funding_state|String|Investor’s current funding state (unfunded, underfunded, funded, overfunded)| |funds_pending|Boolean|True if there are pending transactions, False otherwise| |created_at|Date|| |updated_at|Date|| |tags|Array of Strings|a list of the investor's tags, separated by comma.| ### investor.status >= signed Specific Properties |Key|Type|Description| |--- |--- |--- | |subscription_agreement|object|id, url (expiring URL)| #### Investor Status Here is a brief description of each investor state: * **Draft:** the investor is added to the platform but hasn't been invited yet and cannot access the portal * **Invited:** the investor was added to the platform but hasn’t completed the questionnaire * **Signed:** the investor signed the document (needs approval from Lawyer or Reviewer before countersignature) * **Waiting:** the investor was approved for countersignature by any of the Lawyers or Reviewers in the deal * **Accepted:** the investor's agreement was countersigned by the Signatory #### Update Delay Given the high number of updates our platform performs on any investor, we’ve added a cool down period on update events that allows us to “group” updates and trigger only one every minute. In consequence, update events will be delivered 1 minute after the initial request was made and will include the latest version of the investor data at delivery time.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.4.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module DealMakerAPI
17
+ # V1_Entities_Investor model
18
+ class V1EntitiesInvestor
19
+ # Investor id.
20
+ attr_accessor :id
21
+
22
+ # The creation time.
23
+ attr_accessor :created_at
24
+
25
+ # The last update time.
26
+ attr_accessor :updated_at
27
+
28
+ # The full name of the investor.
29
+ attr_accessor :name
30
+
31
+ # The allocation unit.
32
+ attr_accessor :allocation_unit
33
+
34
+ # The state.
35
+ attr_accessor :state
36
+
37
+ # The funding state.
38
+ attr_accessor :funds_state
39
+
40
+ # True if any funds are pending; false otherwise.
41
+ attr_accessor :funds_pending
42
+
43
+ # The address.
44
+ attr_accessor :beneficial_address
45
+
46
+ # The investor currency.
47
+ attr_accessor :investor_currency
48
+
49
+ # The current investment value.
50
+ attr_accessor :investment_value
51
+
52
+ # The number of securities.
53
+ attr_accessor :number_of_securities
54
+
55
+ # The amount allocated.
56
+ attr_accessor :allocated_amount
57
+
58
+ # The current amount that has been funded.
59
+ attr_accessor :funds_value
60
+
61
+ # The access link for the investor.
62
+ attr_accessor :access_link
63
+
64
+ attr_accessor :subscription_agreement
65
+
66
+ attr_accessor :attachments
67
+
68
+ attr_accessor :background_check_searches
69
+
70
+ # The current 506c verification state.
71
+ attr_accessor :verification_status
72
+
73
+ # The warrant expiry date.
74
+ attr_accessor :warrant_expiry_date
75
+
76
+ # The warrant certificate number.
77
+ attr_accessor :warrant_certificate_number
78
+
79
+ class EnumAttributeValidator
80
+ attr_reader :datatype
81
+ attr_reader :allowable_values
82
+
83
+ def initialize(datatype, allowable_values)
84
+ @allowable_values = allowable_values.map do |value|
85
+ case datatype.to_s
86
+ when /Integer/i
87
+ value.to_i
88
+ when /Float/i
89
+ value.to_f
90
+ else
91
+ value
92
+ end
93
+ end
94
+ end
95
+
96
+ def valid?(value)
97
+ !value || allowable_values.include?(value)
98
+ end
99
+ end
100
+
101
+ # Attribute mapping from ruby-style variable name to JSON key.
102
+ def self.attribute_map
103
+ {
104
+ :'id' => :'id',
105
+ :'created_at' => :'created_at',
106
+ :'updated_at' => :'updated_at',
107
+ :'name' => :'name',
108
+ :'allocation_unit' => :'allocation_unit',
109
+ :'state' => :'state',
110
+ :'funds_state' => :'funds_state',
111
+ :'funds_pending' => :'funds_pending',
112
+ :'beneficial_address' => :'beneficial_address',
113
+ :'investor_currency' => :'investor_currency',
114
+ :'investment_value' => :'investment_value',
115
+ :'number_of_securities' => :'number_of_securities',
116
+ :'allocated_amount' => :'allocated_amount',
117
+ :'funds_value' => :'funds_value',
118
+ :'access_link' => :'access_link',
119
+ :'subscription_agreement' => :'subscription_agreement',
120
+ :'attachments' => :'attachments',
121
+ :'background_check_searches' => :'background_check_searches',
122
+ :'verification_status' => :'verification_status',
123
+ :'warrant_expiry_date' => :'warrant_expiry_date',
124
+ :'warrant_certificate_number' => :'warrant_certificate_number'
125
+ }
126
+ end
127
+
128
+ # Returns all the JSON keys this model knows about
129
+ def self.acceptable_attributes
130
+ attribute_map.values
131
+ end
132
+
133
+ # Attribute type mapping.
134
+ def self.openapi_types
135
+ {
136
+ :'id' => :'Integer',
137
+ :'created_at' => :'Time',
138
+ :'updated_at' => :'Time',
139
+ :'name' => :'String',
140
+ :'allocation_unit' => :'String',
141
+ :'state' => :'String',
142
+ :'funds_state' => :'String',
143
+ :'funds_pending' => :'Boolean',
144
+ :'beneficial_address' => :'String',
145
+ :'investor_currency' => :'String',
146
+ :'investment_value' => :'Float',
147
+ :'number_of_securities' => :'Integer',
148
+ :'allocated_amount' => :'Float',
149
+ :'funds_value' => :'Float',
150
+ :'access_link' => :'String',
151
+ :'subscription_agreement' => :'V1EntitiesSubscriptionAgreement',
152
+ :'attachments' => :'V1EntitiesAttachment',
153
+ :'background_check_searches' => :'V1EntitiesBackgroundCheckSearch',
154
+ :'verification_status' => :'String',
155
+ :'warrant_expiry_date' => :'Date',
156
+ :'warrant_certificate_number' => :'Integer'
157
+ }
158
+ end
159
+
160
+ # List of attributes with nullable: true
161
+ def self.openapi_nullable
162
+ Set.new([
163
+ ])
164
+ end
165
+
166
+ # Initializes the object
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ def initialize(attributes = {})
169
+ if (!attributes.is_a?(Hash))
170
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DealMakerAPI::V1EntitiesInvestor` initialize method"
171
+ end
172
+
173
+ # check to see if the attribute exists and convert string to symbol for hash key
174
+ attributes = attributes.each_with_object({}) { |(k, v), h|
175
+ if (!self.class.attribute_map.key?(k.to_sym))
176
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DealMakerAPI::V1EntitiesInvestor`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
177
+ end
178
+ h[k.to_sym] = v
179
+ }
180
+
181
+ if attributes.key?(:'id')
182
+ self.id = attributes[:'id']
183
+ end
184
+
185
+ if attributes.key?(:'created_at')
186
+ self.created_at = attributes[:'created_at']
187
+ end
188
+
189
+ if attributes.key?(:'updated_at')
190
+ self.updated_at = attributes[:'updated_at']
191
+ end
192
+
193
+ if attributes.key?(:'name')
194
+ self.name = attributes[:'name']
195
+ end
196
+
197
+ if attributes.key?(:'allocation_unit')
198
+ self.allocation_unit = attributes[:'allocation_unit']
199
+ end
200
+
201
+ if attributes.key?(:'state')
202
+ self.state = attributes[:'state']
203
+ end
204
+
205
+ if attributes.key?(:'funds_state')
206
+ self.funds_state = attributes[:'funds_state']
207
+ end
208
+
209
+ if attributes.key?(:'funds_pending')
210
+ self.funds_pending = attributes[:'funds_pending']
211
+ end
212
+
213
+ if attributes.key?(:'beneficial_address')
214
+ self.beneficial_address = attributes[:'beneficial_address']
215
+ end
216
+
217
+ if attributes.key?(:'investor_currency')
218
+ self.investor_currency = attributes[:'investor_currency']
219
+ end
220
+
221
+ if attributes.key?(:'investment_value')
222
+ self.investment_value = attributes[:'investment_value']
223
+ end
224
+
225
+ if attributes.key?(:'number_of_securities')
226
+ self.number_of_securities = attributes[:'number_of_securities']
227
+ end
228
+
229
+ if attributes.key?(:'allocated_amount')
230
+ self.allocated_amount = attributes[:'allocated_amount']
231
+ end
232
+
233
+ if attributes.key?(:'funds_value')
234
+ self.funds_value = attributes[:'funds_value']
235
+ end
236
+
237
+ if attributes.key?(:'access_link')
238
+ self.access_link = attributes[:'access_link']
239
+ end
240
+
241
+ if attributes.key?(:'subscription_agreement')
242
+ self.subscription_agreement = attributes[:'subscription_agreement']
243
+ end
244
+
245
+ if attributes.key?(:'attachments')
246
+ self.attachments = attributes[:'attachments']
247
+ end
248
+
249
+ if attributes.key?(:'background_check_searches')
250
+ self.background_check_searches = attributes[:'background_check_searches']
251
+ end
252
+
253
+ if attributes.key?(:'verification_status')
254
+ self.verification_status = attributes[:'verification_status']
255
+ end
256
+
257
+ if attributes.key?(:'warrant_expiry_date')
258
+ self.warrant_expiry_date = attributes[:'warrant_expiry_date']
259
+ end
260
+
261
+ if attributes.key?(:'warrant_certificate_number')
262
+ self.warrant_certificate_number = attributes[:'warrant_certificate_number']
263
+ end
264
+ end
265
+
266
+ # Show invalid properties with the reasons. Usually used together with valid?
267
+ # @return Array for valid properties with the reasons
268
+ def list_invalid_properties
269
+ invalid_properties = Array.new
270
+ invalid_properties
271
+ end
272
+
273
+ # Check to see if the all the properties in the model are valid
274
+ # @return true if the model is valid
275
+ def valid?
276
+ allocation_unit_validator = EnumAttributeValidator.new('String', ["securities", "amount"])
277
+ return false unless allocation_unit_validator.valid?(@allocation_unit)
278
+ state_validator = EnumAttributeValidator.new('String', ["draft", "invited", "cosigning", "signed", "waiting", "accepted"])
279
+ return false unless state_validator.valid?(@state)
280
+ funds_state_validator = EnumAttributeValidator.new('String', ["unfunded", "underfunded", "funded", "overfunded"])
281
+ return false unless funds_state_validator.valid?(@funds_state)
282
+ verification_status_validator = EnumAttributeValidator.new('String', ["pending", "approved", "rejected", "new_documents_requested"])
283
+ return false unless verification_status_validator.valid?(@verification_status)
284
+ true
285
+ end
286
+
287
+ # Custom attribute writer method checking allowed values (enum).
288
+ # @param [Object] allocation_unit Object to be assigned
289
+ def allocation_unit=(allocation_unit)
290
+ validator = EnumAttributeValidator.new('String', ["securities", "amount"])
291
+ unless validator.valid?(allocation_unit)
292
+ fail ArgumentError, "invalid value for \"allocation_unit\", must be one of #{validator.allowable_values}."
293
+ end
294
+ @allocation_unit = allocation_unit
295
+ end
296
+
297
+ # Custom attribute writer method checking allowed values (enum).
298
+ # @param [Object] state Object to be assigned
299
+ def state=(state)
300
+ validator = EnumAttributeValidator.new('String', ["draft", "invited", "cosigning", "signed", "waiting", "accepted"])
301
+ unless validator.valid?(state)
302
+ fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
303
+ end
304
+ @state = state
305
+ end
306
+
307
+ # Custom attribute writer method checking allowed values (enum).
308
+ # @param [Object] funds_state Object to be assigned
309
+ def funds_state=(funds_state)
310
+ validator = EnumAttributeValidator.new('String', ["unfunded", "underfunded", "funded", "overfunded"])
311
+ unless validator.valid?(funds_state)
312
+ fail ArgumentError, "invalid value for \"funds_state\", must be one of #{validator.allowable_values}."
313
+ end
314
+ @funds_state = funds_state
315
+ end
316
+
317
+ # Custom attribute writer method checking allowed values (enum).
318
+ # @param [Object] verification_status Object to be assigned
319
+ def verification_status=(verification_status)
320
+ validator = EnumAttributeValidator.new('String', ["pending", "approved", "rejected", "new_documents_requested"])
321
+ unless validator.valid?(verification_status)
322
+ fail ArgumentError, "invalid value for \"verification_status\", must be one of #{validator.allowable_values}."
323
+ end
324
+ @verification_status = verification_status
325
+ end
326
+
327
+ # Checks equality by comparing each attribute.
328
+ # @param [Object] Object to be compared
329
+ def ==(o)
330
+ return true if self.equal?(o)
331
+ self.class == o.class &&
332
+ id == o.id &&
333
+ created_at == o.created_at &&
334
+ updated_at == o.updated_at &&
335
+ name == o.name &&
336
+ allocation_unit == o.allocation_unit &&
337
+ state == o.state &&
338
+ funds_state == o.funds_state &&
339
+ funds_pending == o.funds_pending &&
340
+ beneficial_address == o.beneficial_address &&
341
+ investor_currency == o.investor_currency &&
342
+ investment_value == o.investment_value &&
343
+ number_of_securities == o.number_of_securities &&
344
+ allocated_amount == o.allocated_amount &&
345
+ funds_value == o.funds_value &&
346
+ access_link == o.access_link &&
347
+ subscription_agreement == o.subscription_agreement &&
348
+ attachments == o.attachments &&
349
+ background_check_searches == o.background_check_searches &&
350
+ verification_status == o.verification_status &&
351
+ warrant_expiry_date == o.warrant_expiry_date &&
352
+ warrant_certificate_number == o.warrant_certificate_number
353
+ end
354
+
355
+ # @see the `==` method
356
+ # @param [Object] Object to be compared
357
+ def eql?(o)
358
+ self == o
359
+ end
360
+
361
+ # Calculates hash code according to all attributes.
362
+ # @return [Integer] Hash code
363
+ def hash
364
+ [id, created_at, updated_at, name, allocation_unit, state, funds_state, funds_pending, beneficial_address, investor_currency, investment_value, number_of_securities, allocated_amount, funds_value, access_link, subscription_agreement, attachments, background_check_searches, verification_status, warrant_expiry_date, warrant_certificate_number].hash
365
+ end
366
+
367
+ # Builds the object from hash
368
+ # @param [Hash] attributes Model attributes in the form of hash
369
+ # @return [Object] Returns the model itself
370
+ def self.build_from_hash(attributes)
371
+ new.build_from_hash(attributes)
372
+ end
373
+
374
+ # Builds the object from hash
375
+ # @param [Hash] attributes Model attributes in the form of hash
376
+ # @return [Object] Returns the model itself
377
+ def build_from_hash(attributes)
378
+ return nil unless attributes.is_a?(Hash)
379
+ self.class.openapi_types.each_pair do |key, type|
380
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
381
+ self.send("#{key}=", nil)
382
+ elsif type =~ /\AArray<(.*)>/i
383
+ # check to ensure the input is an array given that the attribute
384
+ # is documented as an array but the input is not
385
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
386
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
387
+ end
388
+ elsif !attributes[self.class.attribute_map[key]].nil?
389
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
390
+ end
391
+ end
392
+
393
+ self
394
+ end
395
+
396
+ # Deserializes the data based on type
397
+ # @param string type Data type
398
+ # @param string value Value to be deserialized
399
+ # @return [Object] Deserialized data
400
+ def _deserialize(type, value)
401
+ case type.to_sym
402
+ when :Time
403
+ Time.parse(value)
404
+ when :Date
405
+ Date.parse(value)
406
+ when :String
407
+ value.to_s
408
+ when :Integer
409
+ value.to_i
410
+ when :Float
411
+ value.to_f
412
+ when :Boolean
413
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
414
+ true
415
+ else
416
+ false
417
+ end
418
+ when :Object
419
+ # generic object (usually a Hash), return directly
420
+ value
421
+ when /\AArray<(?<inner_type>.+)>\z/
422
+ inner_type = Regexp.last_match[:inner_type]
423
+ value.map { |v| _deserialize(inner_type, v) }
424
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
425
+ k_type = Regexp.last_match[:k_type]
426
+ v_type = Regexp.last_match[:v_type]
427
+ {}.tap do |hash|
428
+ value.each do |k, v|
429
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
430
+ end
431
+ end
432
+ else # model
433
+ # models (e.g. Pet) or oneOf
434
+ klass = DealMakerAPI.const_get(type)
435
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
436
+ end
437
+ end
438
+
439
+ # Returns the string representation of the object
440
+ # @return [String] String presentation of the object
441
+ def to_s
442
+ to_hash.to_s
443
+ end
444
+
445
+ # to_body is an alias to to_hash (backward compatibility)
446
+ # @return [Hash] Returns the object in the form of hash
447
+ def to_body
448
+ to_hash
449
+ end
450
+
451
+ # Returns the object in the form of hash
452
+ # @return [Hash] Returns the object in the form of hash
453
+ def to_hash
454
+ hash = {}
455
+ self.class.attribute_map.each_pair do |attr, param|
456
+ value = self.send(attr)
457
+ if value.nil?
458
+ is_nullable = self.class.openapi_nullable.include?(attr)
459
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
460
+ end
461
+
462
+ hash[param] = _to_hash(value)
463
+ end
464
+ hash
465
+ end
466
+
467
+ # Outputs non-array value in the form of hash
468
+ # For object, use to_hash. Otherwise, just return the value
469
+ # @param [Object] value Any valid value
470
+ # @return [Hash] Returns the value in the form of hash
471
+ def _to_hash(value)
472
+ if value.is_a?(Array)
473
+ value.compact.map { |v| _to_hash(v) }
474
+ elsif value.is_a?(Hash)
475
+ {}.tap do |hash|
476
+ value.each { |k, v| hash[k] = _to_hash(v) }
477
+ end
478
+ elsif value.respond_to? :to_hash
479
+ value.to_hash
480
+ else
481
+ value
482
+ end
483
+ end
484
+
485
+ end
486
+
487
+ end