|
1 | | -# frozen_string_literal: true |
2 | | - |
3 | | -module ApiCreator |
4 | | - def create_initial_api_client(host: nil, client_module: DocuSign_eSign, debugging: false) |
5 | | - configuration = client_module::Configuration.new |
6 | | - configuration.debugging = debugging |
7 | | - api_client = client_module::ApiClient.new(configuration) |
8 | | - api_client.set_oauth_base_path(host) |
9 | | - api_client |
10 | | - end |
11 | | - |
12 | | - def create_account_api(args) |
13 | | - # Obtain your OAuth token |
14 | | - configuration = DocuSign_eSign::Configuration.new |
15 | | - configuration.host = args[:base_path] |
16 | | - api_client = DocuSign_eSign::ApiClient.new configuration |
17 | | - |
18 | | - # Construct your API headers |
19 | | - api_client.default_headers['Authorization'] = "Bearer #{args[:access_token]}" |
20 | | - |
21 | | - # Construct your request body |
22 | | - DocuSign_eSign::AccountsApi.new api_client |
23 | | - end |
24 | | - |
25 | | - def create_template_api(args) |
26 | | - configuration = DocuSign_eSign::Configuration.new |
27 | | - configuration.host = args[:base_path] |
28 | | - api_client = DocuSign_eSign::ApiClient.new configuration |
29 | | - api_client.default_headers['Authorization'] = "Bearer #{args[:access_token]}" |
30 | | - DocuSign_eSign::TemplatesApi.new api_client |
31 | | - end |
32 | | - |
33 | | - def create_envelope_api(args) |
34 | | - # Obtain your OAuth token |
35 | | - #ds-snippet-start:eSignRubyStep2 |
36 | | - configuration = DocuSign_eSign::Configuration.new |
37 | | - configuration.host = args[:base_path] |
38 | | - api_client = DocuSign_eSign::ApiClient.new configuration |
39 | | - |
40 | | - api_client.default_headers['Authorization'] = "Bearer #{args[:access_token]}" |
41 | | - #ds-snippet-end:eSignRubyStep2 |
42 | | - DocuSign_eSign::EnvelopesApi.new api_client |
43 | | - end |
44 | | - |
45 | | - def create_group_api(args) |
46 | | - configuration = DocuSign_eSign::Configuration.new |
47 | | - configuration.host = args[:base_path] |
48 | | - api_client = DocuSign_eSign::ApiClient.new configuration |
49 | | - api_client.default_headers['Authorization'] = "Bearer #{args[:access_token]}" |
50 | | - DocuSign_eSign::GroupsApi.new api_client |
51 | | - end |
52 | | -end |
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +module ApiCreator |
| 4 | + def create_initial_api_client(host: nil, client_module: DocuSign_eSign, debugging: false) |
| 5 | + configuration = client_module::Configuration.new |
| 6 | + configuration.debugging = debugging |
| 7 | + api_client = client_module::ApiClient.new(configuration) |
| 8 | + api_client.set_oauth_base_path(host) |
| 9 | + api_client |
| 10 | + end |
| 11 | + |
| 12 | + def create_account_api(args) |
| 13 | + # Obtain your OAuth token |
| 14 | + configuration = DocuSign_eSign::Configuration.new |
| 15 | + configuration.host = args[:base_path] |
| 16 | + api_client = DocuSign_eSign::ApiClient.new configuration |
| 17 | + |
| 18 | + # Construct your API headers |
| 19 | + api_client.default_headers['Authorization'] = "Bearer #{args[:access_token]}" |
| 20 | + |
| 21 | + # Construct your request body |
| 22 | + DocuSign_eSign::AccountsApi.new api_client |
| 23 | + end |
| 24 | + |
| 25 | + def create_template_api(args) |
| 26 | + configuration = DocuSign_eSign::Configuration.new |
| 27 | + configuration.host = args[:base_path] |
| 28 | + api_client = DocuSign_eSign::ApiClient.new configuration |
| 29 | + api_client.default_headers['Authorization'] = "Bearer #{args[:access_token]}" |
| 30 | + DocuSign_eSign::TemplatesApi.new api_client |
| 31 | + end |
| 32 | + |
| 33 | + def create_envelope_api(args) |
| 34 | + # Obtain your OAuth token |
| 35 | + #ds-snippet-start:eSignRubyStep2 |
| 36 | + configuration = DocuSign_eSign::Configuration.new |
| 37 | + configuration.host = args[:base_path] |
| 38 | + api_client = DocuSign_eSign::ApiClient.new configuration |
| 39 | + |
| 40 | + api_client.default_headers['Authorization'] = "Bearer #{args[:access_token]}" |
| 41 | + #ds-snippet-end:eSignRubyStep2 |
| 42 | + DocuSign_eSign::EnvelopesApi.new api_client |
| 43 | + end |
| 44 | + |
| 45 | + def create_group_api(args) |
| 46 | + configuration = DocuSign_eSign::Configuration.new |
| 47 | + configuration.host = args[:base_path] |
| 48 | + api_client = DocuSign_eSign::ApiClient.new configuration |
| 49 | + api_client.default_headers['Authorization'] = "Bearer #{args[:access_token]}" |
| 50 | + DocuSign_eSign::GroupsApi.new api_client |
| 51 | + end |
| 52 | + |
| 53 | + def create_folders_api(args) |
| 54 | + configuration = DocuSign_eSign::Configuration.new |
| 55 | + configuration.host = args[:base_path] |
| 56 | + api_client = DocuSign_eSign::ApiClient.new configuration |
| 57 | + api_client.default_headers['Authorization'] = "Bearer #{args[:access_token]}" |
| 58 | + DocuSign_eSign::FoldersApi.new api_client |
| 59 | + end |
| 60 | +end |
0 commit comments