docusign_rooms 1.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +66 -0
  3. data/Gemfile +7 -0
  4. data/Gemfile.lock +71 -0
  5. data/LICENSE +21 -0
  6. data/README.md +80 -0
  7. data/Rakefile +8 -0
  8. data/docusign_rooms-1.0.0.pre.alpha.gem +0 -0
  9. data/docusign_rooms.gemspec +45 -0
  10. data/git_push.sh +55 -0
  11. data/lib/.DS_Store +0 -0
  12. data/lib/docusign_rooms.rb +193 -0
  13. data/lib/docusign_rooms/.DS_Store +0 -0
  14. data/lib/docusign_rooms/api/accounts_api.rb +73 -0
  15. data/lib/docusign_rooms/api/activity_types_api.rb +69 -0
  16. data/lib/docusign_rooms/api/closing_statuses_api.rb +69 -0
  17. data/lib/docusign_rooms/api/contact_sides_api.rb +69 -0
  18. data/lib/docusign_rooms/api/countries_api.rb +69 -0
  19. data/lib/docusign_rooms/api/currencies_api.rb +69 -0
  20. data/lib/docusign_rooms/api/documents_api.rb +200 -0
  21. data/lib/docusign_rooms/api/e_sign_permission_profiles_api.rb +73 -0
  22. data/lib/docusign_rooms/api/external_form_fill_sessions_api.rb +79 -0
  23. data/lib/docusign_rooms/api/fields_api.rb +92 -0
  24. data/lib/docusign_rooms/api/financing_types_api.rb +69 -0
  25. data/lib/docusign_rooms/api/form_details_api.rb +77 -0
  26. data/lib/docusign_rooms/api/form_groups_api.rb +89 -0
  27. data/lib/docusign_rooms/api/form_libraries_api.rb +158 -0
  28. data/lib/docusign_rooms/api/offices_api.rb +310 -0
  29. data/lib/docusign_rooms/api/origins_of_leads_api.rb +69 -0
  30. data/lib/docusign_rooms/api/property_types_api.rb +69 -0
  31. data/lib/docusign_rooms/api/regions_api.rb +306 -0
  32. data/lib/docusign_rooms/api/roles_api.rb +328 -0
  33. data/lib/docusign_rooms/api/room_contact_types_api.rb +69 -0
  34. data/lib/docusign_rooms/api/room_folders_api.rb +93 -0
  35. data/lib/docusign_rooms/api/room_templates_api.rb +97 -0
  36. data/lib/docusign_rooms/api/rooms_api.rb +1146 -0
  37. data/lib/docusign_rooms/api/seller_decision_types_api.rb +69 -0
  38. data/lib/docusign_rooms/api/special_circumstance_types_api.rb +69 -0
  39. data/lib/docusign_rooms/api/states_api.rb +69 -0
  40. data/lib/docusign_rooms/api/task_date_types_api.rb +69 -0
  41. data/lib/docusign_rooms/api/task_list_templates_api.rb +89 -0
  42. data/lib/docusign_rooms/api/task_lists_api.rb +188 -0
  43. data/lib/docusign_rooms/api/task_responsibility_types_api.rb +69 -0
  44. data/lib/docusign_rooms/api/task_statuses_api.rb +69 -0
  45. data/lib/docusign_rooms/api/time_zones_api.rb +69 -0
  46. data/lib/docusign_rooms/api/transaction_sides_api.rb +69 -0
  47. data/lib/docusign_rooms/api/users_api.rb +908 -0
  48. data/lib/docusign_rooms/client/.DS_Store +0 -0
  49. data/lib/docusign_rooms/client/api_client.rb +590 -0
  50. data/lib/docusign_rooms/client/api_error.rb +37 -0
  51. data/lib/docusign_rooms/client/auth/oauth.rb +1061 -0
  52. data/lib/docusign_rooms/configuration.rb +202 -0
  53. data/lib/docusign_rooms/models/account_summary.rb +262 -0
  54. data/lib/docusign_rooms/models/activity_type.rb +192 -0
  55. data/lib/docusign_rooms/models/api_error.rb +192 -0
  56. data/lib/docusign_rooms/models/assignable_roles.rb +239 -0
  57. data/lib/docusign_rooms/models/classic_admin_to_invite.rb +216 -0
  58. data/lib/docusign_rooms/models/classic_agent_to_invite.rb +240 -0
  59. data/lib/docusign_rooms/models/classic_manager_permissions.rb +291 -0
  60. data/lib/docusign_rooms/models/classic_manager_to_invite.rb +338 -0
  61. data/lib/docusign_rooms/models/closing_status.rb +192 -0
  62. data/lib/docusign_rooms/models/contact_side.rb +192 -0
  63. data/lib/docusign_rooms/models/country.rb +192 -0
  64. data/lib/docusign_rooms/models/currency.rb +192 -0
  65. data/lib/docusign_rooms/models/custom_data.rb +192 -0
  66. data/lib/docusign_rooms/models/depends_on.rb +192 -0
  67. data/lib/docusign_rooms/models/designated_office.rb +188 -0
  68. data/lib/docusign_rooms/models/designated_region.rb +188 -0
  69. data/lib/docusign_rooms/models/document.rb +265 -0
  70. data/lib/docusign_rooms/models/document_user.rb +291 -0
  71. data/lib/docusign_rooms/models/document_user_for_create.rb +188 -0
  72. data/lib/docusign_rooms/models/e_sign_account_role_settings.rb +183 -0
  73. data/lib/docusign_rooms/models/e_sign_permission_profile.rb +201 -0
  74. data/lib/docusign_rooms/models/e_sign_permission_profile_list.rb +185 -0
  75. data/lib/docusign_rooms/models/external_form_fill_session.rb +183 -0
  76. data/lib/docusign_rooms/models/external_form_fill_session_for_create.rb +211 -0
  77. data/lib/docusign_rooms/models/field.rb +248 -0
  78. data/lib/docusign_rooms/models/field_configuration.rb +259 -0
  79. data/lib/docusign_rooms/models/field_data.rb +185 -0
  80. data/lib/docusign_rooms/models/field_data_for_create.rb +185 -0
  81. data/lib/docusign_rooms/models/field_data_for_update.rb +185 -0
  82. data/lib/docusign_rooms/models/field_set.rb +203 -0
  83. data/lib/docusign_rooms/models/financing_type.rb +192 -0
  84. data/lib/docusign_rooms/models/form_details.rb +246 -0
  85. data/lib/docusign_rooms/models/form_for_add.rb +188 -0
  86. data/lib/docusign_rooms/models/form_group_summary.rb +201 -0
  87. data/lib/docusign_rooms/models/form_group_summary_list.rb +230 -0
  88. data/lib/docusign_rooms/models/form_library_summary.rb +201 -0
  89. data/lib/docusign_rooms/models/form_library_summary_list.rb +230 -0
  90. data/lib/docusign_rooms/models/form_summary.rb +201 -0
  91. data/lib/docusign_rooms/models/form_summary_list.rb +230 -0
  92. data/lib/docusign_rooms/models/global_activity_types.rb +185 -0
  93. data/lib/docusign_rooms/models/global_closing_statuses.rb +185 -0
  94. data/lib/docusign_rooms/models/global_contact_sides.rb +185 -0
  95. data/lib/docusign_rooms/models/global_countries.rb +185 -0
  96. data/lib/docusign_rooms/models/global_currencies.rb +185 -0
  97. data/lib/docusign_rooms/models/global_financing_types.rb +185 -0
  98. data/lib/docusign_rooms/models/global_origins_of_leads.rb +185 -0
  99. data/lib/docusign_rooms/models/global_property_types.rb +185 -0
  100. data/lib/docusign_rooms/models/global_room_contact_types.rb +185 -0
  101. data/lib/docusign_rooms/models/global_seller_decision_types.rb +185 -0
  102. data/lib/docusign_rooms/models/global_special_circumstance_types.rb +185 -0
  103. data/lib/docusign_rooms/models/global_states.rb +185 -0
  104. data/lib/docusign_rooms/models/global_task_date_types.rb +185 -0
  105. data/lib/docusign_rooms/models/global_task_responsibility_types.rb +185 -0
  106. data/lib/docusign_rooms/models/global_task_statuses.rb +185 -0
  107. data/lib/docusign_rooms/models/global_time_zones.rb +185 -0
  108. data/lib/docusign_rooms/models/global_transaction_sides.rb +185 -0
  109. data/lib/docusign_rooms/models/locked_out_details.rb +188 -0
  110. data/lib/docusign_rooms/models/nullable_field_data.rb +185 -0
  111. data/lib/docusign_rooms/models/nullable_permissions.rb +660 -0
  112. data/lib/docusign_rooms/models/office.rb +287 -0
  113. data/lib/docusign_rooms/models/office_for_create.rb +269 -0
  114. data/lib/docusign_rooms/models/office_reference_count.rb +192 -0
  115. data/lib/docusign_rooms/models/office_reference_count_list.rb +185 -0
  116. data/lib/docusign_rooms/models/office_summary.rb +282 -0
  117. data/lib/docusign_rooms/models/office_summary_list.rb +230 -0
  118. data/lib/docusign_rooms/models/origin_of_lead.rb +192 -0
  119. data/lib/docusign_rooms/models/permissions.rb +660 -0
  120. data/lib/docusign_rooms/models/property_type.rb +192 -0
  121. data/lib/docusign_rooms/models/region.rb +206 -0
  122. data/lib/docusign_rooms/models/region_reference_count.rb +192 -0
  123. data/lib/docusign_rooms/models/region_reference_count_list.rb +185 -0
  124. data/lib/docusign_rooms/models/region_summary.rb +201 -0
  125. data/lib/docusign_rooms/models/region_summary_list.rb +230 -0
  126. data/lib/docusign_rooms/models/role.rb +246 -0
  127. data/lib/docusign_rooms/models/role_for_create.rb +201 -0
  128. data/lib/docusign_rooms/models/role_for_update.rb +201 -0
  129. data/lib/docusign_rooms/models/role_summary.rb +228 -0
  130. data/lib/docusign_rooms/models/role_summary_list.rb +230 -0
  131. data/lib/docusign_rooms/models/room.rb +282 -0
  132. data/lib/docusign_rooms/models/room_contact_type.rb +192 -0
  133. data/lib/docusign_rooms/models/room_document.rb +246 -0
  134. data/lib/docusign_rooms/models/room_document_list.rb +230 -0
  135. data/lib/docusign_rooms/models/room_folder.rb +201 -0
  136. data/lib/docusign_rooms/models/room_folder_list.rb +230 -0
  137. data/lib/docusign_rooms/models/room_for_create.rb +248 -0
  138. data/lib/docusign_rooms/models/room_invite.rb +240 -0
  139. data/lib/docusign_rooms/models/room_invite_response.rb +237 -0
  140. data/lib/docusign_rooms/models/room_picture.rb +183 -0
  141. data/lib/docusign_rooms/models/room_summary.rb +273 -0
  142. data/lib/docusign_rooms/models/room_summary_list.rb +230 -0
  143. data/lib/docusign_rooms/models/room_template.rb +201 -0
  144. data/lib/docusign_rooms/models/room_templates_summary_list.rb +230 -0
  145. data/lib/docusign_rooms/models/room_user.rb +246 -0
  146. data/lib/docusign_rooms/models/room_user_for_update.rb +192 -0
  147. data/lib/docusign_rooms/models/room_user_removal_detail.rb +183 -0
  148. data/lib/docusign_rooms/models/room_user_summary.rb +237 -0
  149. data/lib/docusign_rooms/models/room_users_result.rb +230 -0
  150. data/lib/docusign_rooms/models/select_list_field_option.rb +201 -0
  151. data/lib/docusign_rooms/models/seller_decision_type.rb +192 -0
  152. data/lib/docusign_rooms/models/special_circumstance_type.rb +192 -0
  153. data/lib/docusign_rooms/models/state.rb +192 -0
  154. data/lib/docusign_rooms/models/task_date_type.rb +192 -0
  155. data/lib/docusign_rooms/models/task_list.rb +275 -0
  156. data/lib/docusign_rooms/models/task_list_for_create.rb +183 -0
  157. data/lib/docusign_rooms/models/task_list_summary.rb +264 -0
  158. data/lib/docusign_rooms/models/task_list_summary_list.rb +185 -0
  159. data/lib/docusign_rooms/models/task_list_template.rb +210 -0
  160. data/lib/docusign_rooms/models/task_list_template_list.rb +230 -0
  161. data/lib/docusign_rooms/models/task_responsibility_type.rb +192 -0
  162. data/lib/docusign_rooms/models/task_status.rb +192 -0
  163. data/lib/docusign_rooms/models/task_summary.rb +291 -0
  164. data/lib/docusign_rooms/models/time_zone.rb +192 -0
  165. data/lib/docusign_rooms/models/transaction_side.rb +192 -0
  166. data/lib/docusign_rooms/models/user.rb +338 -0
  167. data/lib/docusign_rooms/models/user_for_update.rb +188 -0
  168. data/lib/docusign_rooms/models/user_summary.rb +307 -0
  169. data/lib/docusign_rooms/models/user_summary_list.rb +230 -0
  170. data/lib/docusign_rooms/models/user_to_invite.rb +337 -0
  171. data/lib/docusign_rooms/version.rb +14 -0
  172. data/tests/Gemfile +5 -0
  173. data/tests/Gemfile.lock +42 -0
  174. data/tests/docs/Test.pdf +0 -0
  175. data/tests/docs/private.pem +27 -0
  176. data/tests/spec/unit_tests_using_jwt_spec.rb +125 -0
  177. metadata +420 -0
@@ -0,0 +1,37 @@
1
+ =begin
2
+ #DocuSign REST API
3
+
4
+ #The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
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_Rooms
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_Rooms
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_Rooms.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_Rooms.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_Rooms.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_Rooms.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_Rooms.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