docusign_admin 1.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/LICENSE +21 -0
  4. data/README.md +51 -0
  5. data/Rakefile +8 -0
  6. data/docusign_admin.gemspec +45 -0
  7. data/git_push.sh +55 -0
  8. data/lib/docusign_admin/.DS_Store +0 -0
  9. data/lib/docusign_admin/api/accounts_api.rb +213 -0
  10. data/lib/docusign_admin/api/bulk_exports_api.rb +456 -0
  11. data/lib/docusign_admin/api/bulk_imports_api.rb +785 -0
  12. data/lib/docusign_admin/api/ds_groups_api.rb +472 -0
  13. data/lib/docusign_admin/api/identity_providers_api.rb +75 -0
  14. data/lib/docusign_admin/api/product_permission_profiles_api.rb +201 -0
  15. data/lib/docusign_admin/api/reserved_domains_api.rb +75 -0
  16. data/lib/docusign_admin/api/users_api.rb +650 -0
  17. data/lib/docusign_admin/client/.DS_Store +0 -0
  18. data/lib/docusign_admin/client/api_client.rb +597 -0
  19. data/lib/docusign_admin/client/api_error.rb +37 -0
  20. data/lib/docusign_admin/client/auth/oauth.rb +1061 -0
  21. data/lib/docusign_admin/configuration.rb +202 -0
  22. data/lib/docusign_admin/models/add_ds_group_and_users_response.rb +192 -0
  23. data/lib/docusign_admin/models/add_ds_group_users_response.rb +203 -0
  24. data/lib/docusign_admin/models/add_user_response.rb +257 -0
  25. data/lib/docusign_admin/models/add_user_response_account_properties.rb +232 -0
  26. data/lib/docusign_admin/models/certificate_response.rb +230 -0
  27. data/lib/docusign_admin/models/delete_membership_request.rb +188 -0
  28. data/lib/docusign_admin/models/delete_membership_response.rb +192 -0
  29. data/lib/docusign_admin/models/delete_memberships_request.rb +190 -0
  30. data/lib/docusign_admin/models/delete_memberships_response.rb +194 -0
  31. data/lib/docusign_admin/models/delete_response.rb +194 -0
  32. data/lib/docusign_admin/models/delete_user_identity_request.rb +190 -0
  33. data/lib/docusign_admin/models/domain_response.rb +241 -0
  34. data/lib/docusign_admin/models/domains_response.rb +185 -0
  35. data/lib/docusign_admin/models/ds_group_add_request.rb +197 -0
  36. data/lib/docusign_admin/models/ds_group_and_users_response.rb +192 -0
  37. data/lib/docusign_admin/models/ds_group_list_response.rb +221 -0
  38. data/lib/docusign_admin/models/ds_group_request.rb +188 -0
  39. data/lib/docusign_admin/models/ds_group_response.rb +273 -0
  40. data/lib/docusign_admin/models/ds_group_user_response.rb +246 -0
  41. data/lib/docusign_admin/models/ds_group_users_add_request.rb +190 -0
  42. data/lib/docusign_admin/models/ds_group_users_remove_request.rb +190 -0
  43. data/lib/docusign_admin/models/ds_group_users_response.rb +212 -0
  44. data/lib/docusign_admin/models/error_details.rb +192 -0
  45. data/lib/docusign_admin/models/force_activate_membership_request.rb +188 -0
  46. data/lib/docusign_admin/models/group_request.rb +206 -0
  47. data/lib/docusign_admin/models/identity_provider_response.rb +230 -0
  48. data/lib/docusign_admin/models/identity_providers_response.rb +185 -0
  49. data/lib/docusign_admin/models/link_response.rb +192 -0
  50. data/lib/docusign_admin/models/member_group_response.rb +201 -0
  51. data/lib/docusign_admin/models/member_groups_response.rb +194 -0
  52. data/lib/docusign_admin/models/membership_response.rb +266 -0
  53. data/lib/docusign_admin/models/new_account_user_request.rb +289 -0
  54. data/lib/docusign_admin/models/new_multi_product_user_add_request.rb +287 -0
  55. data/lib/docusign_admin/models/new_user_request.rb +285 -0
  56. data/lib/docusign_admin/models/new_user_request_account_properties.rb +226 -0
  57. data/lib/docusign_admin/models/new_user_response.rb +257 -0
  58. data/lib/docusign_admin/models/new_user_response_account_properties.rb +230 -0
  59. data/lib/docusign_admin/models/oasirr_error_details.rb +192 -0
  60. data/lib/docusign_admin/models/oasirr_organization_account_settings_error_data_response.rb +219 -0
  61. data/lib/docusign_admin/models/oetr_error_details.rb +192 -0
  62. data/lib/docusign_admin/models/org_export_selected_account.rb +183 -0
  63. data/lib/docusign_admin/models/org_export_selected_domain.rb +183 -0
  64. data/lib/docusign_admin/models/org_report_configuration_response.rb +203 -0
  65. data/lib/docusign_admin/models/org_report_create_response.rb +183 -0
  66. data/lib/docusign_admin/models/org_report_list_response.rb +185 -0
  67. data/lib/docusign_admin/models/org_report_list_response_org_report.rb +282 -0
  68. data/lib/docusign_admin/models/org_report_list_response_requestor.rb +192 -0
  69. data/lib/docusign_admin/models/org_report_request.rb +221 -0
  70. data/lib/docusign_admin/models/organization_account_request.rb +188 -0
  71. data/lib/docusign_admin/models/organization_account_response.rb +210 -0
  72. data/lib/docusign_admin/models/organization_account_settings_import_requestor_response.rb +210 -0
  73. data/lib/docusign_admin/models/organization_account_settings_import_response.rb +313 -0
  74. data/lib/docusign_admin/models/organization_account_settings_import_result_response.rb +239 -0
  75. data/lib/docusign_admin/models/organization_accounts_request.rb +185 -0
  76. data/lib/docusign_admin/models/organization_export_account.rb +183 -0
  77. data/lib/docusign_admin/models/organization_export_domain.rb +183 -0
  78. data/lib/docusign_admin/models/organization_export_request.rb +205 -0
  79. data/lib/docusign_admin/models/organization_export_requestor_response.rb +210 -0
  80. data/lib/docusign_admin/models/organization_export_response.rb +324 -0
  81. data/lib/docusign_admin/models/organization_export_task_response.rb +228 -0
  82. data/lib/docusign_admin/models/organization_exports_response.rb +185 -0
  83. data/lib/docusign_admin/models/organization_import_response.rb +414 -0
  84. data/lib/docusign_admin/models/organization_import_response_error_rollup.rb +192 -0
  85. data/lib/docusign_admin/models/organization_import_response_requestor.rb +210 -0
  86. data/lib/docusign_admin/models/organization_import_response_warning_rollup.rb +192 -0
  87. data/lib/docusign_admin/models/organization_imports_response.rb +185 -0
  88. data/lib/docusign_admin/models/organization_response.rb +310 -0
  89. data/lib/docusign_admin/models/organization_salesforce_account_managers_response.rb +228 -0
  90. data/lib/docusign_admin/models/organization_simple_id_object.rb +183 -0
  91. data/lib/docusign_admin/models/organization_user_response.rb +275 -0
  92. data/lib/docusign_admin/models/organization_users_response.rb +194 -0
  93. data/lib/docusign_admin/models/organizations_response.rb +185 -0
  94. data/lib/docusign_admin/models/osamr_contact.rb +201 -0
  95. data/lib/docusign_admin/models/paging_response_properties.rb +228 -0
  96. data/lib/docusign_admin/models/permission_profile_request.rb +197 -0
  97. data/lib/docusign_admin/models/permission_profile_response.rb +192 -0
  98. data/lib/docusign_admin/models/permission_profile_response2_1.rb +192 -0
  99. data/lib/docusign_admin/models/permissions_response.rb +185 -0
  100. data/lib/docusign_admin/models/product_permission_profile_request.rb +202 -0
  101. data/lib/docusign_admin/models/product_permission_profile_response.rb +212 -0
  102. data/lib/docusign_admin/models/product_permission_profiles_request.rb +190 -0
  103. data/lib/docusign_admin/models/product_permission_profiles_response.rb +185 -0
  104. data/lib/docusign_admin/models/remove_ds_group_users_response.rb +194 -0
  105. data/lib/docusign_admin/models/required_attribute_mapping_response.rb +210 -0
  106. data/lib/docusign_admin/models/saml2_identity_provider_response.rb +216 -0
  107. data/lib/docusign_admin/models/setting_response.rb +201 -0
  108. data/lib/docusign_admin/models/update_membership_request.rb +244 -0
  109. data/lib/docusign_admin/models/update_response.rb +183 -0
  110. data/lib/docusign_admin/models/update_user_email_request.rb +216 -0
  111. data/lib/docusign_admin/models/update_user_request.rb +303 -0
  112. data/lib/docusign_admin/models/update_users_email_request.rb +185 -0
  113. data/lib/docusign_admin/models/update_users_request.rb +185 -0
  114. data/lib/docusign_admin/models/user_drilldown_response.rb +340 -0
  115. data/lib/docusign_admin/models/user_identity_request.rb +183 -0
  116. data/lib/docusign_admin/models/user_identity_response.rb +219 -0
  117. data/lib/docusign_admin/models/user_product_permission_profiles_response.rb +203 -0
  118. data/lib/docusign_admin/models/user_update_response.rb +210 -0
  119. data/lib/docusign_admin/models/users_drilldown_response.rb +185 -0
  120. data/lib/docusign_admin/models/users_update_response.rb +194 -0
  121. data/lib/docusign_admin/version.rb +14 -0
  122. data/lib/docusign_admin.rb +148 -0
  123. data/tests/.DS_Store +0 -0
  124. data/tests/Gemfile +5 -0
  125. data/tests/docs/Test.pdf +0 -0
  126. data/tests/docs/organization_user_import.csv +2 -0
  127. data/tests/spec/unit_tests_using_jwt_spec.rb +231 -0
  128. metadata +370 -0
@@ -0,0 +1,37 @@
1
+ =begin
2
+ #DocuSign Organization Administration API
3
+
4
+ #An API for an organization administrator to manage organizations, accounts and users
5
+
6
+ OpenAPI spec version: v2
7
+ Contact: devcenter@docusign.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ module DocuSign_Admin
13
+ class ApiError < StandardError
14
+ attr_reader :code, :response_headers, :response_body
15
+
16
+ # Usage examples:
17
+ # ApiError.new
18
+ # ApiError.new("message")
19
+ # ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
20
+ # ApiError.new(:code => 404, :message => "Not Found")
21
+ def initialize(arg = nil)
22
+ if arg.is_a? Hash
23
+ if arg.key?(:message) || arg.key?('message')
24
+ super(arg[:message] || arg['message'])
25
+ else
26
+ super arg
27
+ end
28
+
29
+ arg.each do |k, v|
30
+ instance_variable_set "@#{k}", v
31
+ end
32
+ else
33
+ super arg
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,1061 @@
1
+ require 'date'
2
+
3
+ module DocuSign_Admin
4
+ class OAuth
5
+ # create and send envelopes, and obtain links for starting signing sessions.
6
+ SCOPE_SIGNATURE = "signature"
7
+ # obtain a refresh token with an extended lifetime.
8
+ SCOPE_EXTENDED = "extended"
9
+ # obtain access to the user’s account when the user is not present.
10
+ SCOPE_IMPERSONATION = "impersonation"
11
+
12
+ # OAuth Base path constants
13
+ # Demo server base path
14
+ DEMO_OAUTH_BASE_PATH = "account-d.docusign.com"
15
+ # Production server base path
16
+ PRODUCTION_OAUTH_BASE_PATH = "account.docusign.com"
17
+ # Stage server base path
18
+ STAGE_OAUTH_BASE_PATH = "account-s.docusign.com"
19
+ # JWT Grant Type
20
+ GRANT_TYPE_JWT = "urn:ietf:params:oauth:grant-type:jwt-bearer"
21
+
22
+ # Contains account Information.
23
+ class Account
24
+ # The account ID.
25
+ attr_accessor :account_id
26
+
27
+ # The name of the current account.
28
+ attr_accessor :account_name
29
+
30
+ # either account is default or no.
31
+ attr_accessor :is_default
32
+
33
+ # Reserved: TBD
34
+ attr_accessor :base_uri
35
+
36
+ # Reserved: TBD
37
+ attr_accessor :organization
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'account_id' => :'account_id',
43
+ :'account_name' => :'account_name',
44
+ :'is_default' => :'is_default',
45
+ :'base_uri' => :'base_uri',
46
+ :'organization' => :'organization',
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.swagger_types
52
+ {
53
+ :'account_id' => :'String',
54
+ :'account_name' => :'String',
55
+ :'is_default' => :'String',
56
+ :'base_uri' => :'String',
57
+ :'organization' => :'Organization'
58
+ }
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ return unless attributes.is_a?(Hash)
65
+
66
+ # convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
68
+
69
+ if attributes.has_key?(:'account_id')
70
+ self.account_id = attributes[:'account_id']
71
+ end
72
+
73
+ if attributes.has_key?(:'account_name')
74
+ self.account_name = attributes[:'account_name']
75
+ end
76
+
77
+ if attributes.has_key?(:'is_default')
78
+ self.is_default = attributes[:'is_default']
79
+ end
80
+
81
+ if attributes.has_key?(:'base_uri')
82
+ self.base_uri = attributes[:'base_uri']
83
+ end
84
+
85
+ if attributes.has_key?(:'organization')
86
+ self.organization = attributes['organization']
87
+ end
88
+ end
89
+
90
+ # Show invalid properties with the reasons. Usually used together with valid?
91
+ # @return Array for valid properies with the reasons
92
+ def list_invalid_properties
93
+ invalid_properties = Array.new
94
+ return invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ return true
101
+ end
102
+
103
+ # Checks equality by comparing each attribute.
104
+ # @param [Object] Object to be compared
105
+ def ==(o)
106
+ return true if self.equal?(o)
107
+ self.class == o.class &&
108
+ account_id == o.account_id &&
109
+ account_name == o.account_name &&
110
+ is_default == o.is_default &&
111
+ base_uri == o.base_uri &&
112
+ organization == o.organization
113
+ end
114
+
115
+ # @see the `==` method
116
+ # @param [Object] Object to be compared
117
+ def eql?(o)
118
+ self == o
119
+ end
120
+
121
+ # Calculates hash code according to all attributes.
122
+ # @return [Fixnum] Hash code
123
+ def hash
124
+ [account_id, account_name, is_default, base_uri, organization].hash
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ self.class.swagger_types.each_pair do |key, type|
133
+ if type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
137
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
138
+ end
139
+ elsif !attributes[self.class.attribute_map[key]].nil?
140
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
142
+ end
143
+
144
+ self
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def _deserialize(type, value)
152
+ case type.to_sym
153
+ when :DateTime
154
+ DateTime.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :BOOLEAN
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ #there is bug with ruby while searching for constraint which is under 2 modules
185
+ temp_model = DocuSign_Admin.const_get('OAuth').const_get(type).new
186
+ temp_model.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ next if value.nil?
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ # Outputs non-array value in the form of hash
215
+ # For object, use to_hash. Otherwise, just return the value
216
+ # @param [Object] value Any valid value
217
+ # @return [Hash] Returns the value in the form of hash
218
+ def _to_hash(value)
219
+ if value.is_a?(Array)
220
+ value.compact.map{ |v| _to_hash(v) }
221
+ elsif value.is_a?(Hash)
222
+ {}.tap do |hash|
223
+ value.each { |k, v| hash[k] = _to_hash(v) }
224
+ end
225
+ elsif value.respond_to? :to_hash
226
+ value.to_hash
227
+ else
228
+ value
229
+ end
230
+ end
231
+
232
+ end
233
+
234
+ class Link
235
+ # Link rel
236
+ attr_accessor :rel
237
+
238
+ # Link href
239
+ attr_accessor :href
240
+
241
+ # Attribute mapping from ruby-style variable name to JSON key.
242
+ def self.attribute_map
243
+ {
244
+ :'rel' => :'rel',
245
+ :'href' => :'href'
246
+ }
247
+ end
248
+
249
+ # Attribute type mapping.
250
+ def self.swagger_types
251
+ {
252
+ :'rel' => :'String',
253
+ :'href' => :'String'
254
+ }
255
+ end
256
+
257
+ # Initializes the object
258
+ # @param [Hash] attributes Model attributes in the form of hash
259
+ def initialize(attributes = {})
260
+ return unless attributes.is_a?(Hash)
261
+
262
+ # convert string to symbol for hash key
263
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
264
+
265
+ if attributes.has_key?(:'rel')
266
+ self.rel = attributes[:'rel']
267
+ end
268
+
269
+ if attributes.has_key?(:'href')
270
+ self.href = attributes[:'href']
271
+ end
272
+ end
273
+
274
+ # Show invalid properties with the reasons. Usually used together with valid?
275
+ # @return Array for valid properies with the reasons
276
+ def list_invalid_properties
277
+ invalid_properties = Array.new
278
+ return invalid_properties
279
+ end
280
+
281
+ # Check to see if the all the properties in the model are valid
282
+ # @return true if the model is valid
283
+ def valid?
284
+ return true
285
+ end
286
+
287
+ # Checks equality by comparing each attribute.
288
+ # @param [Object] Object to be compared
289
+ def ==(o)
290
+ return true if self.equal?(o)
291
+ self.class == o.class &&
292
+ rel == o.rel &&
293
+ href == o.href
294
+ end
295
+
296
+ # @see the `==` method
297
+ # @param [Object] Object to be compared
298
+ def eql?(o)
299
+ self == o
300
+ end
301
+
302
+ # Calculates hash code according to all attributes.
303
+ # @return [Fixnum] Hash code
304
+ def hash
305
+ [rel, href].hash
306
+ end
307
+
308
+ # Builds the object from hash
309
+ # @param [Hash] attributes Model attributes in the form of hash
310
+ # @return [Object] Returns the model itself
311
+ def build_from_hash(attributes)
312
+ return nil unless attributes.is_a?(Hash)
313
+ self.class.swagger_types.each_pair do |key, type|
314
+ if type =~ /\AArray<(.*)>/i
315
+ # check to ensure the input is an array given that the the attribute
316
+ # is documented as an array but the input is not
317
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
318
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
319
+ end
320
+ elsif !attributes[self.class.attribute_map[key]].nil?
321
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
322
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
323
+ end
324
+
325
+ self
326
+ end
327
+
328
+ # Deserializes the data based on type
329
+ # @param string type Data type
330
+ # @param string value Value to be deserialized
331
+ # @return [Object] Deserialized data
332
+ def _deserialize(type, value)
333
+ case type.to_sym
334
+ when :DateTime
335
+ DateTime.parse(value)
336
+ when :Date
337
+ Date.parse(value)
338
+ when :String
339
+ value.to_s
340
+ when :Integer
341
+ value.to_i
342
+ when :Float
343
+ value.to_f
344
+ when :BOOLEAN
345
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
346
+ true
347
+ else
348
+ false
349
+ end
350
+ when :Object
351
+ # generic object (usually a Hash), return directly
352
+ value
353
+ when /\AArray<(?<inner_type>.+)>\z/
354
+ inner_type = Regexp.last_match[:inner_type]
355
+ value.map { |v| _deserialize(inner_type, v) }
356
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
357
+ k_type = Regexp.last_match[:k_type]
358
+ v_type = Regexp.last_match[:v_type]
359
+ {}.tap do |hash|
360
+ value.each do |k, v|
361
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
362
+ end
363
+ end
364
+ else # model
365
+ temp_model = DocuSign_Admin.const_get(type).new
366
+ temp_model.build_from_hash(value)
367
+ end
368
+ end
369
+
370
+ # Returns the string representation of the object
371
+ # @return [String] String presentation of the object
372
+ def to_s
373
+ to_hash.to_s
374
+ end
375
+
376
+ # to_body is an alias to to_hash (backward compatibility)
377
+ # @return [Hash] Returns the object in the form of hash
378
+ def to_body
379
+ to_hash
380
+ end
381
+
382
+ # Returns the object in the form of hash
383
+ # @return [Hash] Returns the object in the form of hash
384
+ def to_hash
385
+ hash = {}
386
+ self.class.attribute_map.each_pair do |attr, param|
387
+ value = self.send(attr)
388
+ next if value.nil?
389
+ hash[param] = _to_hash(value)
390
+ end
391
+ hash
392
+ end
393
+
394
+ # Outputs non-array value in the form of hash
395
+ # For object, use to_hash. Otherwise, just return the value
396
+ # @param [Object] value Any valid value
397
+ # @return [Hash] Returns the value in the form of hash
398
+ def _to_hash(value)
399
+ if value.is_a?(Array)
400
+ value.compact.map{ |v| _to_hash(v) }
401
+ elsif value.is_a?(Hash)
402
+ {}.tap do |hash|
403
+ value.each { |k, v| hash[k] = _to_hash(v) }
404
+ end
405
+ elsif value.respond_to? :to_hash
406
+ value.to_hash
407
+ else
408
+ value
409
+ end
410
+ end
411
+
412
+ end
413
+
414
+ class OAuthToken
415
+ # The account ID.
416
+ attr_accessor :access_token
417
+
418
+ #
419
+ attr_accessor :data
420
+
421
+ #
422
+ attr_accessor :expires_in
423
+
424
+ # Reserved: TBD
425
+ attr_accessor :refresh_token
426
+
427
+ # Reserved: TBD
428
+ attr_accessor :scope
429
+
430
+ # Reserved: TBD
431
+ attr_accessor :token_type
432
+
433
+ # Attribute mapping from ruby-style variable name to JSON key.
434
+ def self.attribute_map
435
+ {
436
+ :'access_token' => :'access_token',
437
+ :'data' => :'data',
438
+ :'expires_in' => :'expires_in',
439
+ :'refresh_token' => :'refresh_token',
440
+ :'scope' => :'scope',
441
+ :'token_type' => :'token_type'
442
+ }
443
+ end
444
+
445
+ # Attribute type mapping.
446
+ def self.swagger_types
447
+ {
448
+ :'access_token' => :'String',
449
+ :'expires_in' => :'String',
450
+ :'refresh_token' => :'String',
451
+ :'scope' => :'String',
452
+ :'data' => :'Array<NameValue>',
453
+ :'token_type' => :'String'
454
+ }
455
+ end
456
+
457
+ # Initializes the object
458
+ # @param [Hash] attributes Model attributes in the form of hash
459
+ def initialize(attributes = {})
460
+ return unless attributes.is_a?(Hash)
461
+
462
+ # convert string to symbol for hash key
463
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
464
+
465
+ if attributes.has_key?(:'accessToken')
466
+ self.access_token = attributes[:'accessToken']
467
+ end
468
+
469
+ if attributes.has_key?(:'scope')
470
+ self.scope = attributes[:'scope']
471
+ end
472
+
473
+ if attributes.has_key?(:'refreshToken')
474
+ self.refresh_token = attributes[:'refreshToken']
475
+ end
476
+
477
+ if attributes.has_key?(:'expiresIn')
478
+ self.expires_in = attributes[:'expiresIn']
479
+ end
480
+
481
+ if attributes.has_key?(:'tokenType')
482
+ self.token_type = attributes[:'tokenType']
483
+ end
484
+
485
+ if attributes.has_key?(:'data')
486
+ if (value = attributes[:'data']).is_a?(Array)
487
+ self.data = value
488
+ end
489
+ end
490
+ end
491
+
492
+ # Show invalid properties with the reasons. Usually used together with valid?
493
+ # @return Array for valid properies with the reasons
494
+ def list_invalid_properties
495
+ invalid_properties = Array.new
496
+ return invalid_properties
497
+ end
498
+
499
+ # Check to see if the all the properties in the model are valid
500
+ # @return true if the model is valid
501
+ def valid?
502
+ return true
503
+ end
504
+
505
+ # Checks equality by comparing each attribute.
506
+ # @param [Object] Object to be compared
507
+ def ==(o)
508
+ return true if self.equal?(o)
509
+ self.class == o.class &&
510
+ access_token == o.access_token &&
511
+ data == o.data &&
512
+ expires_in == o.expires_in &&
513
+ refresh_token == o.refresh_token &&
514
+ token_type == o.token_type &&
515
+ scope == o.scope
516
+ end
517
+
518
+ # @see the `==` method
519
+ # @param [Object] Object to be compared
520
+ def eql?(o)
521
+ self == o
522
+ end
523
+
524
+ # Calculates hash code according to all attributes.
525
+ # @return [Fixnum] Hash code
526
+ def hash
527
+ [expires_in, data, access_token, refresh_token, scope, token_type].hash
528
+ end
529
+
530
+ # Builds the object from hash
531
+ # @param [Hash] attributes Model attributes in the form of hash
532
+ # @return [Object] Returns the model itself
533
+ def build_from_hash(attributes)
534
+ return nil unless attributes.is_a?(Hash)
535
+ self.class.swagger_types.each_pair do |key, type|
536
+ if type =~ /\AArray<(.*)>/i
537
+ # check to ensure the input is an array given that the the attribute
538
+ # is documented as an array but the input is not
539
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
540
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
541
+ end
542
+ elsif !attributes[self.class.attribute_map[key]].nil?
543
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
544
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
545
+ end
546
+
547
+ self
548
+ end
549
+
550
+ # Deserializes the data based on type
551
+ # @param string type Data type
552
+ # @param string value Value to be deserialized
553
+ # @return [Object] Deserialized data
554
+ def _deserialize(type, value)
555
+ case type.to_sym
556
+ when :DateTime
557
+ DateTime.parse(value)
558
+ when :Date
559
+ Date.parse(value)
560
+ when :String
561
+ value.to_s
562
+ when :Integer
563
+ value.to_i
564
+ when :Float
565
+ value.to_f
566
+ when :BOOLEAN
567
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
568
+ true
569
+ else
570
+ false
571
+ end
572
+ when :Object
573
+ # generic object (usually a Hash), return directly
574
+ value
575
+ when /\AArray<(?<inner_type>.+)>\z/
576
+ inner_type = Regexp.last_match[:inner_type]
577
+ value.map { |v| _deserialize(inner_type, v) }
578
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
579
+ k_type = Regexp.last_match[:k_type]
580
+ v_type = Regexp.last_match[:v_type]
581
+ {}.tap do |hash|
582
+ value.each do |k, v|
583
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
584
+ end
585
+ end
586
+ else # model
587
+ temp_model = DocuSign_Admin.const_get(type).new
588
+ temp_model.build_from_hash(value)
589
+ end
590
+ end
591
+
592
+ # Returns the string representation of the object
593
+ # @return [String] String presentation of the object
594
+ def to_s
595
+ to_hash.to_s
596
+ end
597
+
598
+ # to_body is an alias to to_hash (backward compatibility)
599
+ # @return [Hash] Returns the object in the form of hash
600
+ def to_body
601
+ to_hash
602
+ end
603
+
604
+ # Returns the object in the form of hash
605
+ # @return [Hash] Returns the object in the form of hash
606
+ def to_hash
607
+ hash = {}
608
+ self.class.attribute_map.each_pair do |attr, param|
609
+ value = self.send(attr)
610
+ next if value.nil?
611
+ hash[param] = _to_hash(value)
612
+ end
613
+ hash
614
+ end
615
+
616
+ # Outputs non-array value in the form of hash
617
+ # For object, use to_hash. Otherwise, just return the value
618
+ # @param [Object] value Any valid value
619
+ # @return [Hash] Returns the value in the form of hash
620
+ def _to_hash(value)
621
+ if value.is_a?(Array)
622
+ value.compact.map{ |v| _to_hash(v) }
623
+ elsif value.is_a?(Hash)
624
+ {}.tap do |hash|
625
+ value.each { |k, v| hash[k] = _to_hash(v) }
626
+ end
627
+ elsif value.respond_to? :to_hash
628
+ value.to_hash
629
+ else
630
+ value
631
+ end
632
+ end
633
+
634
+ end
635
+
636
+ class Organization
637
+ # The account ID.
638
+ attr_accessor :organization_id
639
+
640
+ # The name of the current account.
641
+ attr_accessor :links
642
+
643
+ # Attribute mapping from ruby-style variable name to JSON key.
644
+ def self.attribute_map
645
+ {
646
+ :'organization_id' => :'organization_id',
647
+ :'links' => :'links'
648
+ }
649
+ end
650
+
651
+ # Attribute type mapping.
652
+ def self.swagger_types
653
+ {
654
+ :'organization_id' => :'String',
655
+ :'links' => :'Array<OAuth::Link>'
656
+ }
657
+ end
658
+
659
+ # Initializes the object
660
+ # @param [Hash] attributes Model attributes in the form of hash
661
+ def initialize(attributes = {})
662
+ return unless attributes.is_a?(Hash)
663
+
664
+ # convert string to symbol for hash key
665
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
666
+
667
+ if attributes.has_key?(:'organizationId')
668
+ self.organization_id = attributes[:'organizationId']
669
+ end
670
+
671
+ if attributes.has_key?(:'links')
672
+ if (value = attributes[:'links']).is_a?(Array)
673
+ self.links = value
674
+ end
675
+ end
676
+ end
677
+
678
+ # Show invalid properties with the reasons. Usually used together with valid?
679
+ # @return Array for valid properies with the reasons
680
+ def list_invalid_properties
681
+ invalid_properties = Array.new
682
+ return invalid_properties
683
+ end
684
+
685
+ # Check to see if the all the properties in the model are valid
686
+ # @return true if the model is valid
687
+ def valid?
688
+ return true
689
+ end
690
+
691
+ # Checks equality by comparing each attribute.
692
+ # @param [Object] Object to be compared
693
+ def ==(o)
694
+ return true if self.equal?(o)
695
+ self.class == o.class &&
696
+ links == o.links &&
697
+ organization_id == o.organization_id
698
+ end
699
+
700
+ # @see the `==` method
701
+ # @param [Object] Object to be compared
702
+ def eql?(o)
703
+ self == o
704
+ end
705
+
706
+ # Calculates hash code according to all attributes.
707
+ # @return [Fixnum] Hash code
708
+ def hash
709
+ [links, organization_id].hash
710
+ end
711
+
712
+ # Builds the object from hash
713
+ # @param [Hash] attributes Model attributes in the form of hash
714
+ # @return [Object] Returns the model itself
715
+ def build_from_hash(attributes)
716
+ return nil unless attributes.is_a?(Hash)
717
+ self.class.swagger_types.each_pair do |key, type|
718
+ if type =~ /\AArray<(.*)>/i
719
+ # check to ensure the input is an array given that the the attribute
720
+ # is documented as an array but the input is not
721
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
722
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
723
+ end
724
+ elsif !attributes[self.class.attribute_map[key]].nil?
725
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
726
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
727
+ end
728
+
729
+ self
730
+ end
731
+
732
+ # Deserializes the data based on type
733
+ # @param string type Data type
734
+ # @param string value Value to be deserialized
735
+ # @return [Object] Deserialized data
736
+ def _deserialize(type, value)
737
+ case type.to_sym
738
+ when :DateTime
739
+ DateTime.parse(value)
740
+ when :Date
741
+ Date.parse(value)
742
+ when :String
743
+ value.to_s
744
+ when :Integer
745
+ value.to_i
746
+ when :Float
747
+ value.to_f
748
+ when :BOOLEAN
749
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
750
+ true
751
+ else
752
+ false
753
+ end
754
+ when :Object
755
+ # generic object (usually a Hash), return directly
756
+ value
757
+ when /\AArray<(?<inner_type>.+)>\z/
758
+ inner_type = Regexp.last_match[:inner_type]
759
+ value.map { |v| _deserialize(inner_type, v) }
760
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
761
+ k_type = Regexp.last_match[:k_type]
762
+ v_type = Regexp.last_match[:v_type]
763
+ {}.tap do |hash|
764
+ value.each do |k, v|
765
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
766
+ end
767
+ end
768
+ else # model
769
+ temp_model = DocuSign_Admin.const_get(type).new
770
+ temp_model.build_from_hash(value)
771
+ end
772
+ end
773
+
774
+ # Returns the string representation of the object
775
+ # @return [String] String presentation of the object
776
+ def to_s
777
+ to_hash.to_s
778
+ end
779
+
780
+ # to_body is an alias to to_hash (backward compatibility)
781
+ # @return [Hash] Returns the object in the form of hash
782
+ def to_body
783
+ to_hash
784
+ end
785
+
786
+ # Returns the object in the form of hash
787
+ # @return [Hash] Returns the object in the form of hash
788
+ def to_hash
789
+ hash = {}
790
+ self.class.attribute_map.each_pair do |attr, param|
791
+ value = self.send(attr)
792
+ next if value.nil?
793
+ hash[param] = _to_hash(value)
794
+ end
795
+ hash
796
+ end
797
+
798
+ # Outputs non-array value in the form of hash
799
+ # For object, use to_hash. Otherwise, just return the value
800
+ # @param [Object] value Any valid value
801
+ # @return [Hash] Returns the value in the form of hash
802
+ def _to_hash(value)
803
+ if value.is_a?(Array)
804
+ value.compact.map{ |v| _to_hash(v) }
805
+ elsif value.is_a?(Hash)
806
+ {}.tap do |hash|
807
+ value.each { |k, v| hash[k] = _to_hash(v) }
808
+ end
809
+ elsif value.respond_to? :to_hash
810
+ value.to_hash
811
+ else
812
+ value
813
+ end
814
+ end
815
+
816
+ end
817
+
818
+ class UserInfo
819
+ #
820
+ attr_accessor :sub
821
+
822
+ #
823
+ attr_accessor :email
824
+
825
+ attr_accessor :error_details
826
+
827
+ #
828
+ attr_accessor :accounts
829
+
830
+ #
831
+ attr_accessor :name
832
+
833
+ #
834
+ attr_accessor :given_name
835
+
836
+ #
837
+ attr_accessor :family_name
838
+
839
+ #
840
+ attr_accessor :created
841
+
842
+
843
+ # Attribute mapping from ruby-style variable name to JSON key.
844
+ def self.attribute_map
845
+ {
846
+ :'sub' => :'sub',
847
+ :'email' => :'email',
848
+ :'error_details' => :'error_details',
849
+ :'accounts' => :'accounts',
850
+ :'name' => :'name',
851
+ :'given_name' => :'given_name',
852
+ :'family_name' => :'family_name',
853
+ :'created' => :'created'
854
+ }
855
+ end
856
+
857
+ # Attribute type mapping.
858
+ def self.swagger_types
859
+ {
860
+ :'sub' => :'String',
861
+ :'email' => :'String',
862
+ :'error_details' => :'ErrorDetails',
863
+ :'accounts' => :'Array<OAuth::Account>',
864
+ :'name' => :'String',
865
+ :'given_name' => :'String',
866
+ :'family_name' => :'String',
867
+ :'created' => :'String'
868
+ }
869
+ end
870
+
871
+ # Initializes the object
872
+ # @param [Hash] attributes Model attributes in the form of hash
873
+ def initialize(attributes = {})
874
+ return unless attributes.is_a?(Hash)
875
+
876
+ # convert string to symbol for hash key
877
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
878
+
879
+ if attributes.has_key?(:'sub')
880
+ self.sub = attributes[:'sub']
881
+ end
882
+
883
+ if attributes.has_key?(:'email')
884
+ self.email = attributes[:'email']
885
+ end
886
+
887
+ if attributes.has_key?(:'errorDetails')
888
+ self.error_details = attributes[:'errorDetails']
889
+ end
890
+
891
+ if attributes.has_key?(:'accounts')
892
+ if (value = attributes[:'accounts']).is_a?(Array)
893
+ self.accounts = value
894
+ end
895
+ end
896
+
897
+ if attributes.has_key?(:'name')
898
+ self.name = attributes[:'name']
899
+ end
900
+
901
+ if attributes.has_key?(:'givenName')
902
+ self.given_name = attributes[:'givenName']
903
+ end
904
+
905
+ if attributes.has_key?(:'familyName')
906
+ self.family_name = attributes[:'familyName']
907
+ end
908
+
909
+ if attributes.has_key?(:'created')
910
+ self.created = attributes[:'created']
911
+ end
912
+
913
+ end
914
+
915
+ # Show invalid properties with the reasons. Usually used together with valid?
916
+ # @return Array for valid properies with the reasons
917
+ def list_invalid_properties
918
+ invalid_properties = Array.new
919
+ return invalid_properties
920
+ end
921
+
922
+ # Check to see if the all the properties in the model are valid
923
+ # @return true if the model is valid
924
+ def valid?
925
+ return true
926
+ end
927
+
928
+ # Checks equality by comparing each attribute.
929
+ # @param [Object] Object to be compared
930
+ def ==(o)
931
+ return true if self.equal?(o)
932
+ self.class == o.class &&
933
+ sub == o.sub &&
934
+ email == o.email &&
935
+ error_details == o.error_details &&
936
+ accounts == o.accounts &&
937
+ name == o.name &&
938
+ family_name == o.family_name &&
939
+ given_name == o.given_name &&
940
+ created == o.created
941
+ end
942
+
943
+ # @see the `==` method
944
+ # @param [Object] Object to be compared
945
+ def eql?(o)
946
+ self == o
947
+ end
948
+
949
+ # Calculates hash code according to all attributes.
950
+ # @return [Fixnum] Hash code
951
+ def hash
952
+ [sub, email, error_details, accounts, name, family_name, given_name, created].hash
953
+ end
954
+
955
+ # Builds the object from hash
956
+ # @param [Hash] attributes Model attributes in the form of hash
957
+ # @return [Object] Returns the model itself
958
+ def build_from_hash(attributes)
959
+ return nil unless attributes.is_a?(Hash)
960
+ self.class.swagger_types.each_pair do |key, type|
961
+ if type =~ /\AArray<(.*)>/i
962
+ # check to ensure the input is an array given that the the attribute
963
+ # is documented as an array but the input is not
964
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
965
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
966
+ end
967
+ elsif !attributes[self.class.attribute_map[key]].nil?
968
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
969
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
970
+ end
971
+
972
+ self
973
+ end
974
+
975
+ # Deserializes the data based on type
976
+ # @param string type Data type
977
+ # @param string value Value to be deserialized
978
+ # @return [Object] Deserialized data
979
+ def _deserialize(type, value)
980
+ case type.to_sym
981
+ when :DateTime
982
+ DateTime.parse(value)
983
+ when :Date
984
+ Date.parse(value)
985
+ when :String
986
+ value.to_s
987
+ when :Integer
988
+ value.to_i
989
+ when :Float
990
+ value.to_f
991
+ when :BOOLEAN
992
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
993
+ true
994
+ else
995
+ false
996
+ end
997
+ when :Object
998
+ # generic object (usually a Hash), return directly
999
+ value
1000
+ when /\AArray<(?<inner_type>.+)>\z/
1001
+ inner_type = Regexp.last_match[:inner_type]
1002
+ value.map { |v| _deserialize(inner_type, v) }
1003
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
1004
+ k_type = Regexp.last_match[:k_type]
1005
+ v_type = Regexp.last_match[:v_type]
1006
+ {}.tap do |hash|
1007
+ value.each do |k, v|
1008
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
1009
+ end
1010
+ end
1011
+ else # model
1012
+ temp_model = DocuSign_Admin.const_get(type).new
1013
+ temp_model.build_from_hash(value)
1014
+ end
1015
+ end
1016
+
1017
+ # Returns the string representation of the object
1018
+ # @return [String] String presentation of the object
1019
+ def to_s
1020
+ to_hash.to_s
1021
+ end
1022
+
1023
+ # to_body is an alias to to_hash (backward compatibility)
1024
+ # @return [Hash] Returns the object in the form of hash
1025
+ def to_body
1026
+ to_hash
1027
+ end
1028
+
1029
+ # Returns the object in the form of hash
1030
+ # @return [Hash] Returns the object in the form of hash
1031
+ def to_hash
1032
+ hash = {}
1033
+ self.class.attribute_map.each_pair do |attr, param|
1034
+ value = self.send(attr)
1035
+ next if value.nil?
1036
+ hash[param] = _to_hash(value)
1037
+ end
1038
+ hash
1039
+ end
1040
+
1041
+ # Outputs non-array value in the form of hash
1042
+ # For object, use to_hash. Otherwise, just return the value
1043
+ # @param [Object] value Any valid value
1044
+ # @return [Hash] Returns the value in the form of hash
1045
+ def _to_hash(value)
1046
+ if value.is_a?(Array)
1047
+ value.compact.map{ |v| _to_hash(v) }
1048
+ elsif value.is_a?(Hash)
1049
+ {}.tap do |hash|
1050
+ value.each { |k, v| hash[k] = _to_hash(v) }
1051
+ end
1052
+ elsif value.respond_to? :to_hash
1053
+ value.to_hash
1054
+ else
1055
+ value
1056
+ end
1057
+ end
1058
+
1059
+ end
1060
+ end
1061
+ end