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,188 @@
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
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 DSGroupRequest
16
+ attr_accessor :ds_group_id
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :'ds_group_id' => :'ds_group_id'
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.swagger_types
27
+ {
28
+ :'ds_group_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?(:'ds_group_id')
41
+ self.ds_group_id = attributes[:'ds_group_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
+ if @ds_group_id.nil?
50
+ invalid_properties.push('invalid value for "ds_group_id", ds_group_id cannot be nil.')
51
+ end
52
+
53
+ invalid_properties
54
+ end
55
+
56
+ # Check to see if the all the properties in the model are valid
57
+ # @return true if the model is valid
58
+ def valid?
59
+ return false if @ds_group_id.nil?
60
+ true
61
+ end
62
+
63
+ # Checks equality by comparing each attribute.
64
+ # @param [Object] Object to be compared
65
+ def ==(o)
66
+ return true if self.equal?(o)
67
+ self.class == o.class &&
68
+ ds_group_id == o.ds_group_id
69
+ end
70
+
71
+ # @see the `==` method
72
+ # @param [Object] Object to be compared
73
+ def eql?(o)
74
+ self == o
75
+ end
76
+
77
+ # Calculates hash code according to all attributes.
78
+ # @return [Fixnum] Hash code
79
+ def hash
80
+ [ds_group_id].hash
81
+ end
82
+
83
+ # Builds the object from hash
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ # @return [Object] Returns the model itself
86
+ def build_from_hash(attributes)
87
+ return nil unless attributes.is_a?(Hash)
88
+ self.class.swagger_types.each_pair do |key, type|
89
+ if type =~ /\AArray<(.*)>/i
90
+ # check to ensure the input is an array given that the attribute
91
+ # is documented as an array but the input is not
92
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
93
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
94
+ end
95
+ elsif !attributes[self.class.attribute_map[key]].nil?
96
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
97
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
98
+ end
99
+
100
+ self
101
+ end
102
+
103
+ # Deserializes the data based on type
104
+ # @param string type Data type
105
+ # @param string value Value to be deserialized
106
+ # @return [Object] Deserialized data
107
+ def _deserialize(type, value)
108
+ case type.to_sym
109
+ when :DateTime
110
+ DateTime.parse(value)
111
+ when :Date
112
+ Date.parse(value)
113
+ when :String
114
+ value.to_s
115
+ when :Integer
116
+ value.to_i
117
+ when :Float
118
+ value.to_f
119
+ when :BOOLEAN
120
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
121
+ true
122
+ else
123
+ false
124
+ end
125
+ when :Object
126
+ # generic object (usually a Hash), return directly
127
+ value
128
+ when /\AArray<(?<inner_type>.+)>\z/
129
+ inner_type = Regexp.last_match[:inner_type]
130
+ value.map { |v| _deserialize(inner_type, v) }
131
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
132
+ k_type = Regexp.last_match[:k_type]
133
+ v_type = Regexp.last_match[:v_type]
134
+ {}.tap do |hash|
135
+ value.each do |k, v|
136
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
137
+ end
138
+ end
139
+ else # model
140
+ temp_model = DocuSign_Admin.const_get(type).new
141
+ temp_model.build_from_hash(value)
142
+ end
143
+ end
144
+
145
+ # Returns the string representation of the object
146
+ # @return [String] String presentation of the object
147
+ def to_s
148
+ to_hash.to_s
149
+ end
150
+
151
+ # to_body is an alias to to_hash (backward compatibility)
152
+ # @return [Hash] Returns the object in the form of hash
153
+ def to_body
154
+ to_hash
155
+ end
156
+
157
+ # Returns the object in the form of hash
158
+ # @return [Hash] Returns the object in the form of hash
159
+ def to_hash
160
+ hash = {}
161
+ self.class.attribute_map.each_pair do |attr, param|
162
+ value = self.send(attr)
163
+ next if value.nil?
164
+ hash[param] = _to_hash(value)
165
+ end
166
+ hash
167
+ end
168
+
169
+ # Outputs non-array value in the form of hash
170
+ # For object, use to_hash. Otherwise, just return the value
171
+ # @param [Object] value Any valid value
172
+ # @return [Hash] Returns the value in the form of hash
173
+ def _to_hash(value)
174
+ if value.is_a?(Array)
175
+ value.compact.map { |v| _to_hash(v) }
176
+ elsif value.is_a?(Hash)
177
+ {}.tap do |hash|
178
+ value.each { |k, v| hash[k] = _to_hash(v) }
179
+ end
180
+ elsif value.respond_to? :to_hash
181
+ value.to_hash
182
+ else
183
+ value
184
+ end
185
+ end
186
+
187
+ end
188
+ end
@@ -0,0 +1,273 @@
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
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 DSGroupResponse
16
+ attr_accessor :ds_group_id
17
+
18
+ attr_accessor :account_id
19
+
20
+ attr_accessor :source_product_name
21
+
22
+ attr_accessor :group_id
23
+
24
+ attr_accessor :group_name
25
+
26
+ attr_accessor :description
27
+
28
+ attr_accessor :is_admin
29
+
30
+ attr_accessor :last_modified_on
31
+
32
+ attr_accessor :user_count
33
+
34
+ attr_accessor :external_account_id
35
+
36
+ attr_accessor :account_name
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'ds_group_id' => :'ds_group_id',
42
+ :'account_id' => :'account_id',
43
+ :'source_product_name' => :'source_product_name',
44
+ :'group_id' => :'group_id',
45
+ :'group_name' => :'group_name',
46
+ :'description' => :'description',
47
+ :'is_admin' => :'is_admin',
48
+ :'last_modified_on' => :'last_modified_on',
49
+ :'user_count' => :'user_count',
50
+ :'external_account_id' => :'external_account_id',
51
+ :'account_name' => :'account_name'
52
+ }
53
+ end
54
+
55
+ # Attribute type mapping.
56
+ def self.swagger_types
57
+ {
58
+ :'ds_group_id' => :'String',
59
+ :'account_id' => :'String',
60
+ :'source_product_name' => :'String',
61
+ :'group_id' => :'String',
62
+ :'group_name' => :'String',
63
+ :'description' => :'String',
64
+ :'is_admin' => :'BOOLEAN',
65
+ :'last_modified_on' => :'DateTime',
66
+ :'user_count' => :'Integer',
67
+ :'external_account_id' => :'Integer',
68
+ :'account_name' => :'String'
69
+ }
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ return unless attributes.is_a?(Hash)
76
+
77
+ # convert string to symbol for hash key
78
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
79
+
80
+ if attributes.has_key?(:'ds_group_id')
81
+ self.ds_group_id = attributes[:'ds_group_id']
82
+ end
83
+
84
+ if attributes.has_key?(:'account_id')
85
+ self.account_id = attributes[:'account_id']
86
+ end
87
+
88
+ if attributes.has_key?(:'source_product_name')
89
+ self.source_product_name = attributes[:'source_product_name']
90
+ end
91
+
92
+ if attributes.has_key?(:'group_id')
93
+ self.group_id = attributes[:'group_id']
94
+ end
95
+
96
+ if attributes.has_key?(:'group_name')
97
+ self.group_name = attributes[:'group_name']
98
+ end
99
+
100
+ if attributes.has_key?(:'description')
101
+ self.description = attributes[:'description']
102
+ end
103
+
104
+ if attributes.has_key?(:'is_admin')
105
+ self.is_admin = attributes[:'is_admin']
106
+ end
107
+
108
+ if attributes.has_key?(:'last_modified_on')
109
+ self.last_modified_on = attributes[:'last_modified_on']
110
+ end
111
+
112
+ if attributes.has_key?(:'user_count')
113
+ self.user_count = attributes[:'user_count']
114
+ end
115
+
116
+ if attributes.has_key?(:'external_account_id')
117
+ self.external_account_id = attributes[:'external_account_id']
118
+ end
119
+
120
+ if attributes.has_key?(:'account_name')
121
+ self.account_name = attributes[:'account_name']
122
+ end
123
+ end
124
+
125
+ # Show invalid properties with the reasons. Usually used together with valid?
126
+ # @return Array for valid properties with the reasons
127
+ def list_invalid_properties
128
+ invalid_properties = Array.new
129
+ invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ true
136
+ end
137
+
138
+ # Checks equality by comparing each attribute.
139
+ # @param [Object] Object to be compared
140
+ def ==(o)
141
+ return true if self.equal?(o)
142
+ self.class == o.class &&
143
+ ds_group_id == o.ds_group_id &&
144
+ account_id == o.account_id &&
145
+ source_product_name == o.source_product_name &&
146
+ group_id == o.group_id &&
147
+ group_name == o.group_name &&
148
+ description == o.description &&
149
+ is_admin == o.is_admin &&
150
+ last_modified_on == o.last_modified_on &&
151
+ user_count == o.user_count &&
152
+ external_account_id == o.external_account_id &&
153
+ account_name == o.account_name
154
+ end
155
+
156
+ # @see the `==` method
157
+ # @param [Object] Object to be compared
158
+ def eql?(o)
159
+ self == o
160
+ end
161
+
162
+ # Calculates hash code according to all attributes.
163
+ # @return [Fixnum] Hash code
164
+ def hash
165
+ [ds_group_id, account_id, source_product_name, group_id, group_name, description, is_admin, last_modified_on, user_count, external_account_id, account_name].hash
166
+ end
167
+
168
+ # Builds the object from hash
169
+ # @param [Hash] attributes Model attributes in the form of hash
170
+ # @return [Object] Returns the model itself
171
+ def build_from_hash(attributes)
172
+ return nil unless attributes.is_a?(Hash)
173
+ self.class.swagger_types.each_pair do |key, type|
174
+ if type =~ /\AArray<(.*)>/i
175
+ # check to ensure the input is an array given that the attribute
176
+ # is documented as an array but the input is not
177
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
178
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
179
+ end
180
+ elsif !attributes[self.class.attribute_map[key]].nil?
181
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
182
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
183
+ end
184
+
185
+ self
186
+ end
187
+
188
+ # Deserializes the data based on type
189
+ # @param string type Data type
190
+ # @param string value Value to be deserialized
191
+ # @return [Object] Deserialized data
192
+ def _deserialize(type, value)
193
+ case type.to_sym
194
+ when :DateTime
195
+ DateTime.parse(value)
196
+ when :Date
197
+ Date.parse(value)
198
+ when :String
199
+ value.to_s
200
+ when :Integer
201
+ value.to_i
202
+ when :Float
203
+ value.to_f
204
+ when :BOOLEAN
205
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
206
+ true
207
+ else
208
+ false
209
+ end
210
+ when :Object
211
+ # generic object (usually a Hash), return directly
212
+ value
213
+ when /\AArray<(?<inner_type>.+)>\z/
214
+ inner_type = Regexp.last_match[:inner_type]
215
+ value.map { |v| _deserialize(inner_type, v) }
216
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
217
+ k_type = Regexp.last_match[:k_type]
218
+ v_type = Regexp.last_match[:v_type]
219
+ {}.tap do |hash|
220
+ value.each do |k, v|
221
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
222
+ end
223
+ end
224
+ else # model
225
+ temp_model = DocuSign_Admin.const_get(type).new
226
+ temp_model.build_from_hash(value)
227
+ end
228
+ end
229
+
230
+ # Returns the string representation of the object
231
+ # @return [String] String presentation of the object
232
+ def to_s
233
+ to_hash.to_s
234
+ end
235
+
236
+ # to_body is an alias to to_hash (backward compatibility)
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_body
239
+ to_hash
240
+ end
241
+
242
+ # Returns the object in the form of hash
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_hash
245
+ hash = {}
246
+ self.class.attribute_map.each_pair do |attr, param|
247
+ value = self.send(attr)
248
+ next if value.nil?
249
+ hash[param] = _to_hash(value)
250
+ end
251
+ hash
252
+ end
253
+
254
+ # Outputs non-array value in the form of hash
255
+ # For object, use to_hash. Otherwise, just return the value
256
+ # @param [Object] value Any valid value
257
+ # @return [Hash] Returns the value in the form of hash
258
+ def _to_hash(value)
259
+ if value.is_a?(Array)
260
+ value.compact.map { |v| _to_hash(v) }
261
+ elsif value.is_a?(Hash)
262
+ {}.tap do |hash|
263
+ value.each { |k, v| hash[k] = _to_hash(v) }
264
+ end
265
+ elsif value.respond_to? :to_hash
266
+ value.to_hash
267
+ else
268
+ value
269
+ end
270
+ end
271
+
272
+ end
273
+ end