docusign_admin 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,6 +13,27 @@ require "uri"
13
13
 
14
14
  module DocuSign_Admin
15
15
 
16
+ class GetUserDSProfileOptions
17
+ # Sorts user information by account name ascending
18
+ attr_accessor :sort
19
+
20
+ def self.default
21
+ @@default ||= GetUserDSProfileOptions.new
22
+ end
23
+ end
24
+
25
+ class GetUserDSProfilesByEmailOptions
26
+ # The email address of the user
27
+ attr_accessor :email
28
+
29
+ # Sorts user information by account name ascending
30
+ attr_accessor :sort
31
+
32
+ def self.default
33
+ @@default ||= GetUserDSProfilesByEmailOptions.new
34
+ end
35
+ end
36
+
16
37
  class GetUserProfilesOptions
17
38
  # The email address
18
39
  attr_accessor :email
@@ -420,6 +441,119 @@ module DocuSign_Admin
420
441
  return data, status_code, headers
421
442
  end
422
443
 
444
+ # Returns user information using the userId for lookup.
445
+ # Required scopes: user_read
446
+ # @param organization_id The organization ID Guid
447
+ # @param user_id The user ID Guid
448
+ # @param DocuSign_Admin::GetUserDSProfileOptions Options for modifying the behavior of the function.
449
+ # @return [UsersDrilldownResponse]
450
+ def get_user_ds_profile(organization_id, user_id, options = DocuSign_Admin::GetUserDSProfileOptions.default)
451
+ data, _status_code, _headers = get_user_ds_profile_with_http_info(organization_id, user_id, options)
452
+ return data
453
+ end
454
+
455
+ # Returns user information using the userId for lookup.
456
+ # Required scopes: user_read
457
+ # @param organization_id The organization ID Guid
458
+ # @param user_id The user ID Guid
459
+ # @param DocuSign_Admin::GetUserDSProfileOptions Options for modifying the behavior of the function.
460
+ # @return [Array<(UsersDrilldownResponse, Fixnum, Hash)>] UsersDrilldownResponse data, response status code and response headers
461
+ def get_user_ds_profile_with_http_info(organization_id, user_id, options = DocuSign_Admin::GetUserDSProfileOptions.default)
462
+ if @api_client.config.debugging
463
+ @api_client.config.logger.debug "Calling API: UsersApi.get_user_ds_profile ..."
464
+ end
465
+ # verify the required parameter 'organization_id' is set
466
+ fail ArgumentError, "Missing the required parameter 'organization_id' when calling UsersApi.get_user_ds_profile" if organization_id.nil?
467
+ # verify the required parameter 'user_id' is set
468
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersApi.get_user_ds_profile" if user_id.nil?
469
+ # resource path
470
+ local_var_path = "/v2.1/organizations/{organizationId}/users/{userId}/dsprofile".sub('{format}','json').sub('{' + 'organizationId' + '}', organization_id.to_s).sub('{' + 'userId' + '}', user_id.to_s)
471
+
472
+ # query parameters
473
+ query_params = {}
474
+ query_params[:'sort'] = options.sort if !options.sort.nil?
475
+
476
+ # header parameters
477
+ header_params = {}
478
+ # HTTP header 'Accept' (if needed)
479
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
480
+ # HTTP header 'Content-Type'
481
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
482
+
483
+ # form parameters
484
+ form_params = {}
485
+
486
+ # http body (model)
487
+ post_body = nil
488
+ auth_names = []
489
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
490
+ :header_params => header_params,
491
+ :query_params => query_params,
492
+ :form_params => form_params,
493
+ :body => post_body,
494
+ :auth_names => auth_names,
495
+ :return_type => 'UsersDrilldownResponse')
496
+ if @api_client.config.debugging
497
+ @api_client.config.logger.debug "API called: UsersApi#get_user_ds_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
498
+ end
499
+ return data, status_code, headers
500
+ end
501
+
502
+ # Returns DS user profile information.
503
+ # Required scopes: user_read
504
+ # @param organization_id The organization ID Guid
505
+ # @param DocuSign_Admin::GetUserDSProfilesByEmailOptions Options for modifying the behavior of the function.
506
+ # @return [UsersDrilldownResponse]
507
+ def get_user_ds_profiles_by_email(organization_id, options = DocuSign_Admin::GetUserDSProfilesByEmailOptions.default)
508
+ data, _status_code, _headers = get_user_ds_profiles_by_email_with_http_info(organization_id, options)
509
+ return data
510
+ end
511
+
512
+ # Returns DS user profile information.
513
+ # Required scopes: user_read
514
+ # @param organization_id The organization ID Guid
515
+ # @param DocuSign_Admin::GetUserDSProfilesByEmailOptions Options for modifying the behavior of the function.
516
+ # @return [Array<(UsersDrilldownResponse, Fixnum, Hash)>] UsersDrilldownResponse data, response status code and response headers
517
+ def get_user_ds_profiles_by_email_with_http_info(organization_id, options = DocuSign_Admin::GetUserDSProfilesByEmailOptions.default)
518
+ if @api_client.config.debugging
519
+ @api_client.config.logger.debug "Calling API: UsersApi.get_user_ds_profiles_by_email ..."
520
+ end
521
+ # verify the required parameter 'organization_id' is set
522
+ fail ArgumentError, "Missing the required parameter 'organization_id' when calling UsersApi.get_user_ds_profiles_by_email" if organization_id.nil?
523
+ # resource path
524
+ local_var_path = "/v2.1/organizations/{organizationId}/users/dsprofile".sub('{format}','json').sub('{' + 'organizationId' + '}', organization_id.to_s)
525
+
526
+ # query parameters
527
+ query_params = {}
528
+ query_params[:'email'] = options.email if !options.email.nil?
529
+ query_params[:'sort'] = options.sort if !options.sort.nil?
530
+
531
+ # header parameters
532
+ header_params = {}
533
+ # HTTP header 'Accept' (if needed)
534
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
535
+ # HTTP header 'Content-Type'
536
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
537
+
538
+ # form parameters
539
+ form_params = {}
540
+
541
+ # http body (model)
542
+ post_body = nil
543
+ auth_names = []
544
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
545
+ :header_params => header_params,
546
+ :query_params => query_params,
547
+ :form_params => form_params,
548
+ :body => post_body,
549
+ :auth_names => auth_names,
550
+ :return_type => 'UsersDrilldownResponse')
551
+ if @api_client.config.debugging
552
+ @api_client.config.logger.debug "API called: UsersApi#get_user_ds_profiles_by_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
553
+ end
554
+ return data, status_code, headers
555
+ end
556
+
423
557
  # Returns user information.
424
558
  # Required scopes: user_read
425
559
  # @param organization_id The organization ID Guid
@@ -1,9 +1,9 @@
1
1
  =begin
2
- #DocuSign REST API
2
+ #DocuSign Admin API
3
3
 
4
- #The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
4
+ #An API for an organization administrator to manage organizations, accounts and users
5
5
 
6
- OpenAPI spec version: v2
6
+ OpenAPI spec version: v2.1
7
7
  Contact: devcenter@docusign.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
 
@@ -16,6 +16,7 @@ require 'tempfile'
16
16
  require 'typhoeus'
17
17
  require 'uri'
18
18
  require 'jwt'
19
+ require 'addressable/uri'
19
20
 
20
21
  module DocuSign_Admin
21
22
  class ApiClient
@@ -34,7 +35,7 @@ module DocuSign_Admin
34
35
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
35
36
  def initialize(config = Configuration.default)
36
37
  @config = config
37
- @user_agent = "Swagger-Codegen/#{VERSION}/ruby"
38
+ @user_agent = "Swagger-Codegen/1.2.0/ruby"
38
39
  @default_headers = {
39
40
  'Content-Type' => "application/json",
40
41
  'User-Agent' => @user_agent
@@ -105,11 +106,7 @@ module DocuSign_Admin
105
106
 
106
107
  # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
107
108
  _verify_ssl_host = @config.verify_ssl_host ? 2 : 0
108
-
109
- if header_params['Content-Type'] == 'multipart/form-data'
110
- header_params['Content-Disposition'] = 'form-data; name=file; filename=file.csv'
111
- end
112
-
109
+
113
110
  req_opts = {
114
111
  :method => http_method,
115
112
  :headers => header_params,
@@ -263,8 +260,8 @@ module DocuSign_Admin
263
260
  def build_request_url(path, opts)
264
261
  # Add leading and trailing slashes to path
265
262
  path = "/#{path}".gsub(/\/+/, '/')
266
- return URI.encode("https://" + self.get_oauth_base_path + path) if opts[:oauth]
267
- URI.encode(@config.base_url + path)
263
+ return Addressable::URI.encode("https://" + self.get_oauth_base_path + path) if opts[:oauth]
264
+ Addressable::URI.encode(@config.base_url + path)
268
265
  end
269
266
 
270
267
  # Builds the HTTP request body
@@ -277,7 +274,6 @@ module DocuSign_Admin
277
274
  # http form
278
275
  if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
279
276
  header_params['Content-Type'] == 'multipart/form-data'
280
-
281
277
  data = {}
282
278
  form_params.each do |key, value|
283
279
  case value
@@ -285,7 +281,8 @@ module DocuSign_Admin
285
281
  # let typhoeus handle File, Array and nil parameters
286
282
  data[key] = value
287
283
  else
288
- if key == 'file.csv'
284
+ if header_params['Content-Type'] == 'multipart/form-data'
285
+ header_params['Content-Disposition'] = 'form-data; name=file; filename=' + key
289
286
  data = value
290
287
  else
291
288
  data[key] = value.to_s
@@ -400,8 +397,11 @@ module DocuSign_Admin
400
397
  # Helper method to set oauth base path
401
398
  # @param [String] oauth_base_path if passed nil it will determined from base_path
402
399
  def set_oauth_base_path(oauth_base_path=nil)
403
- self.oauth_base_path = oauth_base_path if oauth_base_path
404
- return if self.oauth_base_path
400
+ if oauth_base_path
401
+ raise ArgumentError.new('OAuth base path should only include domain name (without https://)') if oauth_base_path.include? "//"
402
+ self.oauth_base_path = oauth_base_path
403
+ return
404
+ end
405
405
 
406
406
  # did we need this check as we can determine it from base path
407
407
  #raise ArgumentError.new('oAuthBasePath cannot be empty') unless oauth_base_path
@@ -421,6 +421,7 @@ module DocuSign_Admin
421
421
  if !self.oauth_base_path
422
422
  self.set_oauth_base_path()
423
423
  end
424
+
424
425
  self.oauth_base_path
425
426
  end
426
427
 
@@ -488,6 +489,7 @@ module DocuSign_Admin
488
489
  }
489
490
  data, status_code, headers = self.call_api("POST", "/oauth/token", params)
490
491
 
492
+
491
493
  raise ApiError.new('Some error accrued during process') if data.nil?
492
494
 
493
495
  self.set_default_header('Authorization', data.token_type + ' ' + data.access_token)
@@ -578,13 +580,14 @@ module DocuSign_Admin
578
580
  :return_type => 'OAuth::OAuthToken',
579
581
  :oauth => true
580
582
  }
581
- data, status_code, headers = self.call_api("POST", '/oauth/token', params)
582
- abort(data.inspect)
583
+
584
+ token, status_code, headers = self.call_api("POST", '/oauth/token', params)
583
585
 
584
- end
586
+ if status_code == 200
587
+ self.default_headers.store('Authorization', "#{token.token_type} #{token.access_token}")
585
588
 
586
- def set_access_token(token_obj)
587
- self.default_headers['Authorization'] = token_obj.access_token
589
+ token
590
+ end
588
591
  end
589
592
 
590
593
  # Helper method to add default header params
@@ -1,9 +1,9 @@
1
1
  =begin
2
- #DocuSign Organization Administration API
2
+ #DocuSign Admin API
3
3
 
4
4
  #An API for an organization administrator to manage organizations, accounts and users
5
5
 
6
- OpenAPI spec version: v2
6
+ OpenAPI spec version: v2.1
7
7
  Contact: devcenter@docusign.com
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
9
 
@@ -1058,4 +1058,4 @@ module DocuSign_Admin
1058
1058
 
1059
1059
  end
1060
1060
  end
1061
- end
1061
+ end
@@ -15,17 +15,21 @@ module DocuSign_Admin
15
15
  class DSGroupUsersRemoveRequest
16
16
  attr_accessor :user_ids
17
17
 
18
+ attr_accessor :user_emails
19
+
18
20
  # Attribute mapping from ruby-style variable name to JSON key.
19
21
  def self.attribute_map
20
22
  {
21
- :'user_ids' => :'user_ids'
23
+ :'user_ids' => :'user_ids',
24
+ :'user_emails' => :'user_emails'
22
25
  }
23
26
  end
24
27
 
25
28
  # Attribute type mapping.
26
29
  def self.swagger_types
27
30
  {
28
- :'user_ids' => :'Array<String>'
31
+ :'user_ids' => :'Array<String>',
32
+ :'user_emails' => :'Array<String>'
29
33
  }
30
34
  end
31
35
 
@@ -42,23 +46,24 @@ module DocuSign_Admin
42
46
  self.user_ids = value
43
47
  end
44
48
  end
49
+
50
+ if attributes.has_key?(:'user_emails')
51
+ if (value = attributes[:'user_emails']).is_a?(Array)
52
+ self.user_emails = value
53
+ end
54
+ end
45
55
  end
46
56
 
47
57
  # Show invalid properties with the reasons. Usually used together with valid?
48
58
  # @return Array for valid properties with the reasons
49
59
  def list_invalid_properties
50
60
  invalid_properties = Array.new
51
- if @user_ids.nil?
52
- invalid_properties.push('invalid value for "user_ids", user_ids cannot be nil.')
53
- end
54
-
55
61
  invalid_properties
56
62
  end
57
63
 
58
64
  # Check to see if the all the properties in the model are valid
59
65
  # @return true if the model is valid
60
66
  def valid?
61
- return false if @user_ids.nil?
62
67
  true
63
68
  end
64
69
 
@@ -67,7 +72,8 @@ module DocuSign_Admin
67
72
  def ==(o)
68
73
  return true if self.equal?(o)
69
74
  self.class == o.class &&
70
- user_ids == o.user_ids
75
+ user_ids == o.user_ids &&
76
+ user_emails == o.user_emails
71
77
  end
72
78
 
73
79
  # @see the `==` method
@@ -79,7 +85,7 @@ module DocuSign_Admin
79
85
  # Calculates hash code according to all attributes.
80
86
  # @return [Fixnum] Hash code
81
87
  def hash
82
- [user_ids].hash
88
+ [user_ids, user_emails].hash
83
89
  end
84
90
 
85
91
  # Builds the object from hash
@@ -0,0 +1,183 @@
1
+ =begin
2
+ #DocuSign Admin API
3
+
4
+ #An API for an organization administrator to manage organizations, accounts and users
5
+
6
+ OpenAPI spec version: v2.1
7
+ Contact: devcenter@docusign.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module DocuSign_Admin
15
+ class IndividualMembershipDataRedactionRequest
16
+ attr_accessor :user_id
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :'user_id' => :'user_id'
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.swagger_types
27
+ {
28
+ :'user_id' => :'String'
29
+ }
30
+ end
31
+
32
+ # Initializes the object
33
+ # @param [Hash] attributes Model attributes in the form of hash
34
+ def initialize(attributes = {})
35
+ return unless attributes.is_a?(Hash)
36
+
37
+ # convert string to symbol for hash key
38
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
39
+
40
+ if attributes.has_key?(:'user_id')
41
+ self.user_id = attributes[:'user_id']
42
+ end
43
+ end
44
+
45
+ # Show invalid properties with the reasons. Usually used together with valid?
46
+ # @return Array for valid properties with the reasons
47
+ def list_invalid_properties
48
+ invalid_properties = Array.new
49
+ invalid_properties
50
+ end
51
+
52
+ # Check to see if the all the properties in the model are valid
53
+ # @return true if the model is valid
54
+ def valid?
55
+ true
56
+ end
57
+
58
+ # Checks equality by comparing each attribute.
59
+ # @param [Object] Object to be compared
60
+ def ==(o)
61
+ return true if self.equal?(o)
62
+ self.class == o.class &&
63
+ user_id == o.user_id
64
+ end
65
+
66
+ # @see the `==` method
67
+ # @param [Object] Object to be compared
68
+ def eql?(o)
69
+ self == o
70
+ end
71
+
72
+ # Calculates hash code according to all attributes.
73
+ # @return [Fixnum] Hash code
74
+ def hash
75
+ [user_id].hash
76
+ end
77
+
78
+ # Builds the object from hash
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ # @return [Object] Returns the model itself
81
+ def build_from_hash(attributes)
82
+ return nil unless attributes.is_a?(Hash)
83
+ self.class.swagger_types.each_pair do |key, type|
84
+ if type =~ /\AArray<(.*)>/i
85
+ # check to ensure the input is an array given that the attribute
86
+ # is documented as an array but the input is not
87
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
88
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
89
+ end
90
+ elsif !attributes[self.class.attribute_map[key]].nil?
91
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
92
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
93
+ end
94
+
95
+ self
96
+ end
97
+
98
+ # Deserializes the data based on type
99
+ # @param string type Data type
100
+ # @param string value Value to be deserialized
101
+ # @return [Object] Deserialized data
102
+ def _deserialize(type, value)
103
+ case type.to_sym
104
+ when :DateTime
105
+ DateTime.parse(value)
106
+ when :Date
107
+ Date.parse(value)
108
+ when :String
109
+ value.to_s
110
+ when :Integer
111
+ value.to_i
112
+ when :Float
113
+ value.to_f
114
+ when :BOOLEAN
115
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
116
+ true
117
+ else
118
+ false
119
+ end
120
+ when :Object
121
+ # generic object (usually a Hash), return directly
122
+ value
123
+ when /\AArray<(?<inner_type>.+)>\z/
124
+ inner_type = Regexp.last_match[:inner_type]
125
+ value.map { |v| _deserialize(inner_type, v) }
126
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
127
+ k_type = Regexp.last_match[:k_type]
128
+ v_type = Regexp.last_match[:v_type]
129
+ {}.tap do |hash|
130
+ value.each do |k, v|
131
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
132
+ end
133
+ end
134
+ else # model
135
+ temp_model = DocuSign_Admin.const_get(type).new
136
+ temp_model.build_from_hash(value)
137
+ end
138
+ end
139
+
140
+ # Returns the string representation of the object
141
+ # @return [String] String presentation of the object
142
+ def to_s
143
+ to_hash.to_s
144
+ end
145
+
146
+ # to_body is an alias to to_hash (backward compatibility)
147
+ # @return [Hash] Returns the object in the form of hash
148
+ def to_body
149
+ to_hash
150
+ end
151
+
152
+ # Returns the object in the form of hash
153
+ # @return [Hash] Returns the object in the form of hash
154
+ def to_hash
155
+ hash = {}
156
+ self.class.attribute_map.each_pair do |attr, param|
157
+ value = self.send(attr)
158
+ next if value.nil?
159
+ hash[param] = _to_hash(value)
160
+ end
161
+ hash
162
+ end
163
+
164
+ # Outputs non-array value in the form of hash
165
+ # For object, use to_hash. Otherwise, just return the value
166
+ # @param [Object] value Any valid value
167
+ # @return [Hash] Returns the value in the form of hash
168
+ def _to_hash(value)
169
+ if value.is_a?(Array)
170
+ value.compact.map { |v| _to_hash(v) }
171
+ elsif value.is_a?(Hash)
172
+ {}.tap do |hash|
173
+ value.each { |k, v| hash[k] = _to_hash(v) }
174
+ end
175
+ elsif value.respond_to? :to_hash
176
+ value.to_hash
177
+ else
178
+ value
179
+ end
180
+ end
181
+
182
+ end
183
+ end