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,299 @@
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 'cgi'
14
+
15
+ module DealMakerAPI
16
+ class DealApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a deal investor
23
+ # Create a single deal investor.
24
+ # @param id [Integer] The deal id.
25
+ # @param unknown_base_type [UNKNOWN_BASE_TYPE]
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [V1EntitiesInvestor]
28
+ def create_investor(id, unknown_base_type, opts = {})
29
+ data, _status_code, _headers = create_investor_with_http_info(id, unknown_base_type, opts)
30
+ data
31
+ end
32
+
33
+ # Create a deal investor
34
+ # Create a single deal investor.
35
+ # @param id [Integer] The deal id.
36
+ # @param unknown_base_type [UNKNOWN_BASE_TYPE]
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(V1EntitiesInvestor, Integer, Hash)>] V1EntitiesInvestor data, response status code and response headers
39
+ def create_investor_with_http_info(id, unknown_base_type, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: DealApi.create_investor ...'
42
+ end
43
+ # verify the required parameter 'id' is set
44
+ if @api_client.config.client_side_validation && id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'id' when calling DealApi.create_investor"
46
+ end
47
+ # resource path
48
+ local_var_path = '/deals/{id}/investors'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
49
+
50
+ # query parameters
51
+ query_params = opts[:query_params] || {}
52
+
53
+ # header parameters
54
+ header_params = opts[:header_params] || {}
55
+ # HTTP header 'Accept' (if needed)
56
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
57
+ # HTTP header 'Content-Type'
58
+ content_type = @api_client.select_header_content_type(['application/json'])
59
+ if !content_type.nil?
60
+ header_params['Content-Type'] = content_type
61
+ end
62
+
63
+ # form parameters
64
+ form_params = opts[:form_params] || {}
65
+
66
+ # http body (model)
67
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(unknown_base_type)
68
+
69
+ # return_type
70
+ return_type = opts[:debug_return_type] || 'V1EntitiesInvestor'
71
+
72
+ # auth_names
73
+ auth_names = opts[:debug_auth_names] || []
74
+
75
+ new_options = opts.merge(
76
+ :operation => :"DealApi.create_investor",
77
+ :header_params => header_params,
78
+ :query_params => query_params,
79
+ :form_params => form_params,
80
+ :body => post_body,
81
+ :auth_names => auth_names,
82
+ :return_type => return_type
83
+ )
84
+
85
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
86
+ if @api_client.config.debugging
87
+ @api_client.config.logger.debug "API called: DealApi#create_investor\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
88
+ end
89
+ return data, status_code, headers
90
+ end
91
+
92
+ # Get a deal by id
93
+ # Get a deal
94
+ # @param id [Integer] The deal id.
95
+ # @param [Hash] opts the optional parameters
96
+ # @return [V1EntitiesDeal]
97
+ def get_deal(id, opts = {})
98
+ data, _status_code, _headers = get_deal_with_http_info(id, opts)
99
+ data
100
+ end
101
+
102
+ # Get a deal by id
103
+ # Get a deal
104
+ # @param id [Integer] The deal id.
105
+ # @param [Hash] opts the optional parameters
106
+ # @return [Array<(V1EntitiesDeal, Integer, Hash)>] V1EntitiesDeal data, response status code and response headers
107
+ def get_deal_with_http_info(id, opts = {})
108
+ if @api_client.config.debugging
109
+ @api_client.config.logger.debug 'Calling API: DealApi.get_deal ...'
110
+ end
111
+ # verify the required parameter 'id' is set
112
+ if @api_client.config.client_side_validation && id.nil?
113
+ fail ArgumentError, "Missing the required parameter 'id' when calling DealApi.get_deal"
114
+ end
115
+ # resource path
116
+ local_var_path = '/deals/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
117
+
118
+ # query parameters
119
+ query_params = opts[:query_params] || {}
120
+
121
+ # header parameters
122
+ header_params = opts[:header_params] || {}
123
+ # HTTP header 'Accept' (if needed)
124
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
125
+
126
+ # form parameters
127
+ form_params = opts[:form_params] || {}
128
+
129
+ # http body (model)
130
+ post_body = opts[:debug_body]
131
+
132
+ # return_type
133
+ return_type = opts[:debug_return_type] || 'V1EntitiesDeal'
134
+
135
+ # auth_names
136
+ auth_names = opts[:debug_auth_names] || []
137
+
138
+ new_options = opts.merge(
139
+ :operation => :"DealApi.get_deal",
140
+ :header_params => header_params,
141
+ :query_params => query_params,
142
+ :form_params => form_params,
143
+ :body => post_body,
144
+ :auth_names => auth_names,
145
+ :return_type => return_type
146
+ )
147
+
148
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
149
+ if @api_client.config.debugging
150
+ @api_client.config.logger.debug "API called: DealApi#get_deal\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
151
+ end
152
+ return data, status_code, headers
153
+ end
154
+
155
+ # Get a deal investor by id
156
+ # Gets a single investor by the id.
157
+ # @param id [Integer] The deal id.
158
+ # @param investor_id [Integer] The investor id.
159
+ # @param [Hash] opts the optional parameters
160
+ # @return [V1EntitiesInvestor]
161
+ def get_investor(id, investor_id, opts = {})
162
+ data, _status_code, _headers = get_investor_with_http_info(id, investor_id, opts)
163
+ data
164
+ end
165
+
166
+ # Get a deal investor by id
167
+ # Gets a single investor by the id.
168
+ # @param id [Integer] The deal id.
169
+ # @param investor_id [Integer] The investor id.
170
+ # @param [Hash] opts the optional parameters
171
+ # @return [Array<(V1EntitiesInvestor, Integer, Hash)>] V1EntitiesInvestor data, response status code and response headers
172
+ def get_investor_with_http_info(id, investor_id, opts = {})
173
+ if @api_client.config.debugging
174
+ @api_client.config.logger.debug 'Calling API: DealApi.get_investor ...'
175
+ end
176
+ # verify the required parameter 'id' is set
177
+ if @api_client.config.client_side_validation && id.nil?
178
+ fail ArgumentError, "Missing the required parameter 'id' when calling DealApi.get_investor"
179
+ end
180
+ # verify the required parameter 'investor_id' is set
181
+ if @api_client.config.client_side_validation && investor_id.nil?
182
+ fail ArgumentError, "Missing the required parameter 'investor_id' when calling DealApi.get_investor"
183
+ end
184
+ # resource path
185
+ local_var_path = '/deals/{id}/investors/{investor_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'investor_id' + '}', CGI.escape(investor_id.to_s))
186
+
187
+ # query parameters
188
+ query_params = opts[:query_params] || {}
189
+
190
+ # header parameters
191
+ header_params = opts[:header_params] || {}
192
+ # HTTP header 'Accept' (if needed)
193
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
194
+
195
+ # form parameters
196
+ form_params = opts[:form_params] || {}
197
+
198
+ # http body (model)
199
+ post_body = opts[:debug_body]
200
+
201
+ # return_type
202
+ return_type = opts[:debug_return_type] || 'V1EntitiesInvestor'
203
+
204
+ # auth_names
205
+ auth_names = opts[:debug_auth_names] || []
206
+
207
+ new_options = opts.merge(
208
+ :operation => :"DealApi.get_investor",
209
+ :header_params => header_params,
210
+ :query_params => query_params,
211
+ :form_params => form_params,
212
+ :body => post_body,
213
+ :auth_names => auth_names,
214
+ :return_type => return_type
215
+ )
216
+
217
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
218
+ if @api_client.config.debugging
219
+ @api_client.config.logger.debug "API called: DealApi#get_investor\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
220
+ end
221
+ return data, status_code, headers
222
+ end
223
+
224
+ # List deal investors
225
+ # List deal investors according to the specified search criteria.
226
+ # @param id [Integer] The deal id.
227
+ # @param [Hash] opts the optional parameters
228
+ # @option opts [Integer] :page Page offset to fetch. (default to 1)
229
+ # @option opts [Integer] :per_page Number of results to return per page. (default to 25)
230
+ # @option opts [Integer] :offset Pad a number of results. (default to 0)
231
+ # @option opts [Array<Integer>] :investor_ids An array of investor ids.
232
+ # @return [V1EntitiesInvestors]
233
+ def list_investors(id, opts = {})
234
+ data, _status_code, _headers = list_investors_with_http_info(id, opts)
235
+ data
236
+ end
237
+
238
+ # List deal investors
239
+ # List deal investors according to the specified search criteria.
240
+ # @param id [Integer] The deal id.
241
+ # @param [Hash] opts the optional parameters
242
+ # @option opts [Integer] :page Page offset to fetch.
243
+ # @option opts [Integer] :per_page Number of results to return per page.
244
+ # @option opts [Integer] :offset Pad a number of results.
245
+ # @option opts [Array<Integer>] :investor_ids An array of investor ids.
246
+ # @return [Array<(V1EntitiesInvestors, Integer, Hash)>] V1EntitiesInvestors data, response status code and response headers
247
+ def list_investors_with_http_info(id, opts = {})
248
+ if @api_client.config.debugging
249
+ @api_client.config.logger.debug 'Calling API: DealApi.list_investors ...'
250
+ end
251
+ # verify the required parameter 'id' is set
252
+ if @api_client.config.client_side_validation && id.nil?
253
+ fail ArgumentError, "Missing the required parameter 'id' when calling DealApi.list_investors"
254
+ end
255
+ # resource path
256
+ local_var_path = '/deals/{id}/investors'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
257
+
258
+ # query parameters
259
+ query_params = opts[:query_params] || {}
260
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
261
+ query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
262
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
263
+ query_params[:'investor_ids'] = @api_client.build_collection_param(opts[:'investor_ids'], :csv) if !opts[:'investor_ids'].nil?
264
+
265
+ # header parameters
266
+ header_params = opts[:header_params] || {}
267
+ # HTTP header 'Accept' (if needed)
268
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
269
+
270
+ # form parameters
271
+ form_params = opts[:form_params] || {}
272
+
273
+ # http body (model)
274
+ post_body = opts[:debug_body]
275
+
276
+ # return_type
277
+ return_type = opts[:debug_return_type] || 'V1EntitiesInvestors'
278
+
279
+ # auth_names
280
+ auth_names = opts[:debug_auth_names] || []
281
+
282
+ new_options = opts.merge(
283
+ :operation => :"DealApi.list_investors",
284
+ :header_params => header_params,
285
+ :query_params => query_params,
286
+ :form_params => form_params,
287
+ :body => post_body,
288
+ :auth_names => auth_names,
289
+ :return_type => return_type
290
+ )
291
+
292
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
293
+ if @api_client.config.debugging
294
+ @api_client.config.logger.debug "API called: DealApi#list_investors\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
295
+ end
296
+ return data, status_code, headers
297
+ end
298
+ end
299
+ end