payzu-pix 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +231 -0
  4. data/Rakefile +10 -0
  5. data/docs/AccountApi.md +141 -0
  6. data/docs/ApiErrorDetailsInner.md +20 -0
  7. data/docs/BankStatement.md +42 -0
  8. data/docs/BankStatementListResponse.md +20 -0
  9. data/docs/BankStatementListResponsePagination.md +22 -0
  10. data/docs/CallbackDetail.md +34 -0
  11. data/docs/CallbackListResponse.md +20 -0
  12. data/docs/CallbackListResponsePagination.md +22 -0
  13. data/docs/CallbackSecretResponse.md +20 -0
  14. data/docs/CallbacksApi.md +587 -0
  15. data/docs/Defense.md +30 -0
  16. data/docs/DefenseFilesInner.md +24 -0
  17. data/docs/DefenseHistoryEntry.md +28 -0
  18. data/docs/DefenseHistoryEntryFilesInner.md +22 -0
  19. data/docs/DepositPending.md +62 -0
  20. data/docs/DepositPendingListResponse.md +24 -0
  21. data/docs/DictConsultResponse.md +30 -0
  22. data/docs/DownloadUserReport200Response.md +20 -0
  23. data/docs/EnqueuedCallback.md +18 -0
  24. data/docs/EnqueuedCallbackEnqueued.md +22 -0
  25. data/docs/EnqueuedCallbackItem.md +22 -0
  26. data/docs/ErrorResponse.md +32 -0
  27. data/docs/GetUser200Response.md +46 -0
  28. data/docs/GetUser200ResponseDailyWithdrawLimit.md +24 -0
  29. data/docs/GetUser200ResponseServiceFee.md +28 -0
  30. data/docs/GetUserBalance200Response.md +20 -0
  31. data/docs/GetUserTransactionById200Response.md +94 -0
  32. data/docs/GetUserTransactionById200ResponseAllOfCallbackLogInner.md +26 -0
  33. data/docs/GetUserTransactionById200ResponseAllOfInfractionInner.md +24 -0
  34. data/docs/GetUserTransactions200Response.md +22 -0
  35. data/docs/InfractionDetail.md +40 -0
  36. data/docs/InfractionDetailTransaction.md +30 -0
  37. data/docs/InfractionListResponse.md +20 -0
  38. data/docs/InfractionListResponsePagination.md +24 -0
  39. data/docs/InfractionsApi.md +413 -0
  40. data/docs/InternalTransferApi.md +153 -0
  41. data/docs/KeysAndDICTApi.md +217 -0
  42. data/docs/ListUserReports200Response.md +22 -0
  43. data/docs/PixKeyInfo.md +36 -0
  44. data/docs/PixOperationsApi.md +299 -0
  45. data/docs/PostInternalTransferRequest.md +30 -0
  46. data/docs/PostPixQrcodeReadRequest.md +18 -0
  47. data/docs/PostPixRequest.md +32 -0
  48. data/docs/PostUserReportRequest.md +24 -0
  49. data/docs/PostWithdrawQrcodeRequest.md +28 -0
  50. data/docs/PostWithdrawRequest.md +30 -0
  51. data/docs/ProofResponse.md +18 -0
  52. data/docs/QRCodeReadResponse.md +38 -0
  53. data/docs/Refund.md +34 -0
  54. data/docs/RefundRequest.md +22 -0
  55. data/docs/RefundsApi.md +79 -0
  56. data/docs/ReportJob.md +30 -0
  57. data/docs/ReportJobAccepted.md +30 -0
  58. data/docs/ReportJobDetail.md +30 -0
  59. data/docs/ReportsApi.md +881 -0
  60. data/docs/ResendUserCallbackSingle200Response.md +18 -0
  61. data/docs/ResendUserCallbacks200Response.md +20 -0
  62. data/docs/ResendUserCallbacksRequest.md +28 -0
  63. data/docs/ResendWebhookCallbacksRequest.md +30 -0
  64. data/docs/RotateCallbackSecretResponse.md +18 -0
  65. data/docs/RotateSecretResponse.md +18 -0
  66. data/docs/SentWebhookDetail.md +40 -0
  67. data/docs/SentWebhookDetailResponse.md +18 -0
  68. data/docs/SentWebhooksQuantity.md +18 -0
  69. data/docs/Summary.md +26 -0
  70. data/docs/SummaryBlock.md +24 -0
  71. data/docs/SummaryBlockGroupedInner.md +20 -0
  72. data/docs/SummaryBlockStatuses.md +26 -0
  73. data/docs/SummaryStatus.md +22 -0
  74. data/docs/Transaction.md +90 -0
  75. data/docs/TransactionWithRefunds.md +92 -0
  76. data/docs/Webhook.md +30 -0
  77. data/docs/WebhookCreateRequest.md +24 -0
  78. data/docs/WebhookEventType.md +15 -0
  79. data/docs/WebhookListResponse.md +18 -0
  80. data/docs/WebhookUpdateRequest.md +22 -0
  81. data/docs/WebhookWithSecret.md +32 -0
  82. data/docs/WebhooksApi.md +574 -0
  83. data/docs/WithdrawalsApi.md +299 -0
  84. data/git_push.sh +57 -0
  85. data/lib/payzu-pix/api/account_api.rb +136 -0
  86. data/lib/payzu-pix/api/callbacks_api.rb +577 -0
  87. data/lib/payzu-pix/api/infractions_api.rb +452 -0
  88. data/lib/payzu-pix/api/internal_transfer_api.rb +164 -0
  89. data/lib/payzu-pix/api/keys_and_dict_api.rb +234 -0
  90. data/lib/payzu-pix/api/pix_operations_api.rb +300 -0
  91. data/lib/payzu-pix/api/refunds_api.rb +96 -0
  92. data/lib/payzu-pix/api/reports_api.rb +968 -0
  93. data/lib/payzu-pix/api/webhooks_api.rb +542 -0
  94. data/lib/payzu-pix/api/withdrawals_api.rb +305 -0
  95. data/lib/payzu-pix/api_client.rb +441 -0
  96. data/lib/payzu-pix/api_error.rb +58 -0
  97. data/lib/payzu-pix/api_model_base.rb +88 -0
  98. data/lib/payzu-pix/configuration.rb +392 -0
  99. data/lib/payzu-pix/models/api_error_details_inner.rb +192 -0
  100. data/lib/payzu-pix/models/bank_statement.rb +296 -0
  101. data/lib/payzu-pix/models/bank_statement_list_response.rb +159 -0
  102. data/lib/payzu-pix/models/bank_statement_list_response_pagination.rb +169 -0
  103. data/lib/payzu-pix/models/callback_detail.rb +228 -0
  104. data/lib/payzu-pix/models/callback_list_response.rb +159 -0
  105. data/lib/payzu-pix/models/callback_list_response_pagination.rb +169 -0
  106. data/lib/payzu-pix/models/callback_secret_response.rb +158 -0
  107. data/lib/payzu-pix/models/defense.rb +234 -0
  108. data/lib/payzu-pix/models/defense_files_inner.rb +179 -0
  109. data/lib/payzu-pix/models/defense_history_entry.rb +225 -0
  110. data/lib/payzu-pix/models/defense_history_entry_files_inner.rb +168 -0
  111. data/lib/payzu-pix/models/deposit_pending.rb +407 -0
  112. data/lib/payzu-pix/models/deposit_pending_list_response.rb +180 -0
  113. data/lib/payzu-pix/models/dict_consult_response.rb +231 -0
  114. data/lib/payzu-pix/models/download_user_report200_response.rb +158 -0
  115. data/lib/payzu-pix/models/enqueued_callback.rb +147 -0
  116. data/lib/payzu-pix/models/enqueued_callback_enqueued.rb +170 -0
  117. data/lib/payzu-pix/models/enqueued_callback_item.rb +190 -0
  118. data/lib/payzu-pix/models/error_response.rb +336 -0
  119. data/lib/payzu-pix/models/get_user200_response.rb +334 -0
  120. data/lib/payzu-pix/models/get_user200_response_daily_withdraw_limit.rb +180 -0
  121. data/lib/payzu-pix/models/get_user200_response_service_fee.rb +199 -0
  122. data/lib/payzu-pix/models/get_user_balance200_response.rb +158 -0
  123. data/lib/payzu-pix/models/get_user_transaction_by_id200_response.rb +595 -0
  124. data/lib/payzu-pix/models/get_user_transaction_by_id200_response_all_of_callback_log_inner.rb +188 -0
  125. data/lib/payzu-pix/models/get_user_transaction_by_id200_response_all_of_infraction_inner.rb +202 -0
  126. data/lib/payzu-pix/models/get_user_transactions200_response.rb +170 -0
  127. data/lib/payzu-pix/models/infraction_detail.rb +293 -0
  128. data/lib/payzu-pix/models/infraction_detail_transaction.rb +213 -0
  129. data/lib/payzu-pix/models/infraction_list_response.rb +159 -0
  130. data/lib/payzu-pix/models/infraction_list_response_pagination.rb +179 -0
  131. data/lib/payzu-pix/models/list_user_reports200_response.rb +170 -0
  132. data/lib/payzu-pix/models/pix_key_info.rb +263 -0
  133. data/lib/payzu-pix/models/post_internal_transfer_request.rb +377 -0
  134. data/lib/payzu-pix/models/post_pix_qrcode_read_request.rb +174 -0
  135. data/lib/payzu-pix/models/post_pix_request.rb +382 -0
  136. data/lib/payzu-pix/models/post_user_report_request.rb +238 -0
  137. data/lib/payzu-pix/models/post_withdraw_qrcode_request.rb +302 -0
  138. data/lib/payzu-pix/models/post_withdraw_request.rb +350 -0
  139. data/lib/payzu-pix/models/proof_response.rb +148 -0
  140. data/lib/payzu-pix/models/qr_code_read_response.rb +283 -0
  141. data/lib/payzu-pix/models/refund.rb +257 -0
  142. data/lib/payzu-pix/models/refund_request.rb +215 -0
  143. data/lib/payzu-pix/models/report_job.rb +234 -0
  144. data/lib/payzu-pix/models/report_job_accepted.rb +237 -0
  145. data/lib/payzu-pix/models/report_job_detail.rb +237 -0
  146. data/lib/payzu-pix/models/resend_user_callback_single200_response.rb +148 -0
  147. data/lib/payzu-pix/models/resend_user_callbacks200_response.rb +158 -0
  148. data/lib/payzu-pix/models/resend_user_callbacks_request.rb +262 -0
  149. data/lib/payzu-pix/models/resend_webhook_callbacks_request.rb +274 -0
  150. data/lib/payzu-pix/models/rotate_callback_secret_response.rb +148 -0
  151. data/lib/payzu-pix/models/rotate_secret_response.rb +148 -0
  152. data/lib/payzu-pix/models/sent_webhook_detail.rb +261 -0
  153. data/lib/payzu-pix/models/sent_webhook_detail_response.rb +164 -0
  154. data/lib/payzu-pix/models/sent_webhooks_quantity.rb +148 -0
  155. data/lib/payzu-pix/models/summary.rb +188 -0
  156. data/lib/payzu-pix/models/summary_block.rb +179 -0
  157. data/lib/payzu-pix/models/summary_block_grouped_inner.rb +158 -0
  158. data/lib/payzu-pix/models/summary_block_statuses.rb +189 -0
  159. data/lib/payzu-pix/models/summary_status.rb +168 -0
  160. data/lib/payzu-pix/models/transaction.rb +588 -0
  161. data/lib/payzu-pix/models/transaction_with_refunds.rb +583 -0
  162. data/lib/payzu-pix/models/webhook.rb +210 -0
  163. data/lib/payzu-pix/models/webhook_create_request.rb +201 -0
  164. data/lib/payzu-pix/models/webhook_event_type.rb +47 -0
  165. data/lib/payzu-pix/models/webhook_list_response.rb +150 -0
  166. data/lib/payzu-pix/models/webhook_update_request.rb +171 -0
  167. data/lib/payzu-pix/models/webhook_with_secret.rb +220 -0
  168. data/lib/payzu-pix/version.rb +15 -0
  169. data/lib/payzu-pix.rb +119 -0
  170. data/payzu-pix.gemspec +41 -0
  171. data/spec/spec_helper.rb +111 -0
  172. metadata +283 -0
@@ -0,0 +1,225 @@
1
+ =begin
2
+ #PayZu Pix API
3
+
4
+ #REST API for Pix operations on the PayZu platform, deposits, withdrawals, internal transfers, infractions, reports, and callback inspection. All amounts are in BRL (reais) unless explicitly noted. Authentication uses a Bearer token issued during onboarding. ## SDKs oficiais - Node.js: `npm install payzu-pix` - Python: `pip install payzu-pix` - PHP: `composer require payzu/pix` - Ruby: `gem install payzu-pix` - Java: `br.com.payzu:payzu-pix` (Maven Central) - Go: `go get github.com/PayZuAI/payzu-sdks/go/v2` Repo: https://github.com/PayZuAI/payzu-sdks
5
+
6
+ The version of the OpenAPI document: 1.8.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PayZuPix
17
+ # Defense recorded in the infraction history, without the infractionId field.
18
+ class DefenseHistoryEntry < ApiModelBase
19
+ # Defense identifier.
20
+ attr_accessor :id
21
+
22
+ # Defense text
23
+ attr_accessor :defense
24
+
25
+ # Defense status
26
+ attr_accessor :status
27
+
28
+ # Moment the defense was recorded at PayZu, saved together with the uploaded files.
29
+ attr_accessor :created_at
30
+
31
+ # Moment of the last change to the defense.
32
+ attr_accessor :updated_at
33
+
34
+ # Files sent with the defense, with name, type and size in bytes.
35
+ attr_accessor :files
36
+
37
+ class EnumAttributeValidator
38
+ attr_reader :datatype
39
+ attr_reader :allowable_values
40
+
41
+ def initialize(datatype, allowable_values)
42
+ @allowable_values = allowable_values.map do |value|
43
+ case datatype.to_s
44
+ when /Integer/i
45
+ value.to_i
46
+ when /Float/i
47
+ value.to_f
48
+ else
49
+ value
50
+ end
51
+ end
52
+ end
53
+
54
+ def valid?(value)
55
+ !value || allowable_values.include?(value)
56
+ end
57
+ end
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ {
62
+ :'id' => :'id',
63
+ :'defense' => :'defense',
64
+ :'status' => :'status',
65
+ :'created_at' => :'createdAt',
66
+ :'updated_at' => :'updatedAt',
67
+ :'files' => :'files'
68
+ }
69
+ end
70
+
71
+ # Returns attribute mapping this model knows about
72
+ def self.acceptable_attribute_map
73
+ attribute_map
74
+ end
75
+
76
+ # Returns all the JSON keys this model knows about
77
+ def self.acceptable_attributes
78
+ acceptable_attribute_map.values
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.openapi_types
83
+ {
84
+ :'id' => :'String',
85
+ :'defense' => :'String',
86
+ :'status' => :'String',
87
+ :'created_at' => :'Time',
88
+ :'updated_at' => :'Time',
89
+ :'files' => :'Array<DefenseHistoryEntryFilesInner>'
90
+ }
91
+ end
92
+
93
+ # List of attributes with nullable: true
94
+ def self.openapi_nullable
95
+ Set.new([
96
+ ])
97
+ end
98
+
99
+ # Initializes the object
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ def initialize(attributes = {})
102
+ if (!attributes.is_a?(Hash))
103
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PayZuPix::DefenseHistoryEntry` initialize method"
104
+ end
105
+
106
+ # check to see if the attribute exists and convert string to symbol for hash key
107
+ acceptable_attribute_map = self.class.acceptable_attribute_map
108
+ attributes = attributes.each_with_object({}) { |(k, v), h|
109
+ if (!acceptable_attribute_map.key?(k.to_sym))
110
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PayZuPix::DefenseHistoryEntry`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
111
+ end
112
+ h[k.to_sym] = v
113
+ }
114
+
115
+ if attributes.key?(:'id')
116
+ self.id = attributes[:'id']
117
+ end
118
+
119
+ if attributes.key?(:'defense')
120
+ self.defense = attributes[:'defense']
121
+ end
122
+
123
+ if attributes.key?(:'status')
124
+ self.status = attributes[:'status']
125
+ end
126
+
127
+ if attributes.key?(:'created_at')
128
+ self.created_at = attributes[:'created_at']
129
+ end
130
+
131
+ if attributes.key?(:'updated_at')
132
+ self.updated_at = attributes[:'updated_at']
133
+ end
134
+
135
+ if attributes.key?(:'files')
136
+ if (value = attributes[:'files']).is_a?(Array)
137
+ self.files = value
138
+ end
139
+ end
140
+ end
141
+
142
+ # Show invalid properties with the reasons. Usually used together with valid?
143
+ # @return Array for valid properties with the reasons
144
+ def list_invalid_properties
145
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
146
+ invalid_properties = Array.new
147
+ invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ warn '[DEPRECATED] the `valid?` method is obsolete'
154
+ status_validator = EnumAttributeValidator.new('String', ["PENDING", "DEFENDED"])
155
+ return false unless status_validator.valid?(@status)
156
+ true
157
+ end
158
+
159
+ # Checks equality by comparing each attribute.
160
+ # @param [Object] Object to be compared
161
+ def ==(o)
162
+ return true if self.equal?(o)
163
+ self.class == o.class &&
164
+ id == o.id &&
165
+ defense == o.defense &&
166
+ status == o.status &&
167
+ created_at == o.created_at &&
168
+ updated_at == o.updated_at &&
169
+ files == o.files
170
+ end
171
+
172
+ # @see the `==` method
173
+ # @param [Object] Object to be compared
174
+ def eql?(o)
175
+ self == o
176
+ end
177
+
178
+ # Calculates hash code according to all attributes.
179
+ # @return [Integer] Hash code
180
+ def hash
181
+ [id, defense, status, created_at, updated_at, files].hash
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def self.build_from_hash(attributes)
188
+ return nil unless attributes.is_a?(Hash)
189
+ attributes = attributes.transform_keys(&:to_sym)
190
+ transformed_hash = {}
191
+ openapi_types.each_pair do |key, type|
192
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
193
+ transformed_hash["#{key}"] = nil
194
+ elsif type =~ /\AArray<(.*)>/i
195
+ # check to ensure the input is an array given that the attribute
196
+ # is documented as an array but the input is not
197
+ if attributes[attribute_map[key]].is_a?(Array)
198
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
199
+ end
200
+ elsif !attributes[attribute_map[key]].nil?
201
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
202
+ end
203
+ end
204
+ new(transformed_hash)
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ if value.nil?
214
+ is_nullable = self.class.openapi_nullable.include?(attr)
215
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
216
+ end
217
+
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ end
224
+
225
+ end
@@ -0,0 +1,168 @@
1
+ =begin
2
+ #PayZu Pix API
3
+
4
+ #REST API for Pix operations on the PayZu platform, deposits, withdrawals, internal transfers, infractions, reports, and callback inspection. All amounts are in BRL (reais) unless explicitly noted. Authentication uses a Bearer token issued during onboarding. ## SDKs oficiais - Node.js: `npm install payzu-pix` - Python: `pip install payzu-pix` - PHP: `composer require payzu/pix` - Ruby: `gem install payzu-pix` - Java: `br.com.payzu:payzu-pix` (Maven Central) - Go: `go get github.com/PayZuAI/payzu-sdks/go/v2` Repo: https://github.com/PayZuAI/payzu-sdks
5
+
6
+ The version of the OpenAPI document: 1.8.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PayZuPix
17
+ class DefenseHistoryEntryFilesInner < ApiModelBase
18
+ # Name of the file sent with the defense.
19
+ attr_accessor :name
20
+
21
+ # MIME type of the file, provided on upload, for example application/pdf or image/png.
22
+ attr_accessor :mime_type
23
+
24
+ # Size of the file in bytes.
25
+ attr_accessor :size
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'name' => :'name',
31
+ :'mime_type' => :'mimeType',
32
+ :'size' => :'size'
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'name' => :'String',
50
+ :'mime_type' => :'String',
51
+ :'size' => :'Integer'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PayZuPix::DefenseHistoryEntryFilesInner` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PayZuPix::DefenseHistoryEntryFilesInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'name')
78
+ self.name = attributes[:'name']
79
+ end
80
+
81
+ if attributes.key?(:'mime_type')
82
+ self.mime_type = attributes[:'mime_type']
83
+ end
84
+
85
+ if attributes.key?(:'size')
86
+ self.size = attributes[:'size']
87
+ end
88
+ end
89
+
90
+ # Show invalid properties with the reasons. Usually used together with valid?
91
+ # @return Array for valid properties with the reasons
92
+ def list_invalid_properties
93
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
94
+ invalid_properties = Array.new
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ warn '[DEPRECATED] the `valid?` method is obsolete'
102
+ true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ name == o.name &&
111
+ mime_type == o.mime_type &&
112
+ size == o.size
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 [Integer] Hash code
123
+ def hash
124
+ [name, mime_type, size].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 self.build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ attributes = attributes.transform_keys(&:to_sym)
133
+ transformed_hash = {}
134
+ openapi_types.each_pair do |key, type|
135
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
136
+ transformed_hash["#{key}"] = nil
137
+ elsif type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[attribute_map[key]].is_a?(Array)
141
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
142
+ end
143
+ elsif !attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
145
+ end
146
+ end
147
+ new(transformed_hash)
148
+ end
149
+
150
+ # Returns the object in the form of hash
151
+ # @return [Hash] Returns the object in the form of hash
152
+ def to_hash
153
+ hash = {}
154
+ self.class.attribute_map.each_pair do |attr, param|
155
+ value = self.send(attr)
156
+ if value.nil?
157
+ is_nullable = self.class.openapi_nullable.include?(attr)
158
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
159
+ end
160
+
161
+ hash[param] = _to_hash(value)
162
+ end
163
+ hash
164
+ end
165
+
166
+ end
167
+
168
+ end