sezzle_client 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +611 -0
  4. data/Rakefile +8 -0
  5. data/docs/Address.md +14 -0
  6. data/docs/AllOfSessionCustomer.md +13 -0
  7. data/docs/AllOfSessionOrder.md +18 -0
  8. data/docs/Authorization.md +14 -0
  9. data/docs/BearerAuthenticationApi.md +52 -0
  10. data/docs/Body.md +8 -0
  11. data/docs/Body1.md +7 -0
  12. data/docs/Body2.md +6 -0
  13. data/docs/Body3.md +8 -0
  14. data/docs/Body4.md +8 -0
  15. data/docs/Capture.md +8 -0
  16. data/docs/Customer.md +13 -0
  17. data/docs/CustomerApi.md +269 -0
  18. data/docs/Discount.md +8 -0
  19. data/docs/Error.md +6 -0
  20. data/docs/ErrorInner.md +10 -0
  21. data/docs/InlineResponse200.md +10 -0
  22. data/docs/InlineResponse2001.md +15 -0
  23. data/docs/InlineResponse2002.md +9 -0
  24. data/docs/InlineResponse2003.md +15 -0
  25. data/docs/InlineResponse2004.md +8 -0
  26. data/docs/InlineResponse2005.md +12 -0
  27. data/docs/InlineResponse2006.md +7 -0
  28. data/docs/InlineResponse2007.md +14 -0
  29. data/docs/InlineResponse2008.md +8 -0
  30. data/docs/InlineResponse2009.md +7 -0
  31. data/docs/InlineResponse200Order.md +10 -0
  32. data/docs/InlineResponse201.md +9 -0
  33. data/docs/InlineResponse2011.md +10 -0
  34. data/docs/InlineResponse2011Order.md +9 -0
  35. data/docs/InlineResponse2011Tokenize.md +10 -0
  36. data/docs/InstallmentPlan.md +6 -0
  37. data/docs/Intent.md +6 -0
  38. data/docs/LineItem.md +10 -0
  39. data/docs/Link.md +9 -0
  40. data/docs/Notification.md +9 -0
  41. data/docs/Order.md +15 -0
  42. data/docs/OrderApi.md +391 -0
  43. data/docs/OrderAuthorization.md +12 -0
  44. data/docs/Payout.md +6 -0
  45. data/docs/PayoutInner.md +12 -0
  46. data/docs/Price.md +8 -0
  47. data/docs/Refund.md +8 -0
  48. data/docs/ReportsApi.md +230 -0
  49. data/docs/Session.md +10 -0
  50. data/docs/SessionApi.md +113 -0
  51. data/docs/SessionCancelUrl.md +8 -0
  52. data/docs/SessionStatus.md +8 -0
  53. data/docs/Token.md +10 -0
  54. data/docs/TokenApi.md +110 -0
  55. data/docs/Webhook.md +8 -0
  56. data/docs/WebhooksApi.md +157 -0
  57. data/git_push.sh +55 -0
  58. data/lib/sezzle_client.rb +90 -0
  59. data/lib/sezzle_client/api/bearer_authentication_api.rb +76 -0
  60. data/lib/sezzle_client/api/customer_api.rb +295 -0
  61. data/lib/sezzle_client/api/order_api.rb +430 -0
  62. data/lib/sezzle_client/api/reports_api.rb +253 -0
  63. data/lib/sezzle_client/api/session_api.rb +132 -0
  64. data/lib/sezzle_client/api/token_api.rb +126 -0
  65. data/lib/sezzle_client/api/webhooks_api.rb +178 -0
  66. data/lib/sezzle_client/api_client.rb +388 -0
  67. data/lib/sezzle_client/api_error.rb +57 -0
  68. data/lib/sezzle_client/configuration.rb +205 -0
  69. data/lib/sezzle_client/models/address.rb +297 -0
  70. data/lib/sezzle_client/models/all_of_session_customer.rb +260 -0
  71. data/lib/sezzle_client/models/all_of_session_order.rb +314 -0
  72. data/lib/sezzle_client/models/authorization.rb +281 -0
  73. data/lib/sezzle_client/models/body.rb +215 -0
  74. data/lib/sezzle_client/models/body_1.rb +206 -0
  75. data/lib/sezzle_client/models/body_2.rb +197 -0
  76. data/lib/sezzle_client/models/body_3.rb +215 -0
  77. data/lib/sezzle_client/models/body_4.rb +215 -0
  78. data/lib/sezzle_client/models/capture.rb +215 -0
  79. data/lib/sezzle_client/models/customer.rb +260 -0
  80. data/lib/sezzle_client/models/discount.rb +225 -0
  81. data/lib/sezzle_client/models/error.rb +201 -0
  82. data/lib/sezzle_client/models/error_inner.rb +233 -0
  83. data/lib/sezzle_client/models/inline_response_200.rb +239 -0
  84. data/lib/sezzle_client/models/inline_response_200_1.rb +286 -0
  85. data/lib/sezzle_client/models/inline_response_200_2.rb +226 -0
  86. data/lib/sezzle_client/models/inline_response_200_3.rb +284 -0
  87. data/lib/sezzle_client/models/inline_response_200_4.rb +215 -0
  88. data/lib/sezzle_client/models/inline_response_200_5.rb +257 -0
  89. data/lib/sezzle_client/models/inline_response_200_6.rb +206 -0
  90. data/lib/sezzle_client/models/inline_response_200_7.rb +277 -0
  91. data/lib/sezzle_client/models/inline_response_200_8.rb +217 -0
  92. data/lib/sezzle_client/models/inline_response_200_9.rb +206 -0
  93. data/lib/sezzle_client/models/inline_response_200_order.rb +235 -0
  94. data/lib/sezzle_client/models/inline_response_201.rb +224 -0
  95. data/lib/sezzle_client/models/inline_response_201_1.rb +235 -0
  96. data/lib/sezzle_client/models/inline_response_201_1_order.rb +226 -0
  97. data/lib/sezzle_client/models/inline_response_201_1_tokenize.rb +235 -0
  98. data/lib/sezzle_client/models/installment_plan.rb +28 -0
  99. data/lib/sezzle_client/models/intent.rb +28 -0
  100. data/lib/sezzle_client/models/line_item.rb +253 -0
  101. data/lib/sezzle_client/models/link.rb +224 -0
  102. data/lib/sezzle_client/models/notification.rb +224 -0
  103. data/lib/sezzle_client/models/order.rb +284 -0
  104. data/lib/sezzle_client/models/order_authorization.rb +257 -0
  105. data/lib/sezzle_client/models/payout.rb +201 -0
  106. data/lib/sezzle_client/models/payout_inner.rb +251 -0
  107. data/lib/sezzle_client/models/price.rb +225 -0
  108. data/lib/sezzle_client/models/refund.rb +215 -0
  109. data/lib/sezzle_client/models/session.rb +243 -0
  110. data/lib/sezzle_client/models/session_cancel_url.rb +215 -0
  111. data/lib/sezzle_client/models/session_status.rb +217 -0
  112. data/lib/sezzle_client/models/token.rb +235 -0
  113. data/lib/sezzle_client/models/webhook.rb +222 -0
  114. data/lib/sezzle_client/version.rb +14 -0
  115. data/sezzle_client.gemspec +38 -0
  116. data/spec/.DS_Store +0 -0
  117. data/spec/api/bearer_authentication_api_spec.rb +45 -0
  118. data/spec/api/customer_api_spec.rb +91 -0
  119. data/spec/api/order_api_spec.rb +119 -0
  120. data/spec/api/reports_api_spec.rb +84 -0
  121. data/spec/api/session_api_spec.rb +57 -0
  122. data/spec/api/token_api_spec.rb +56 -0
  123. data/spec/api/webhooks_api_spec.rb +66 -0
  124. data/spec/api_client_spec.rb +225 -0
  125. data/spec/base_object_spec.rb +109 -0
  126. data/spec/configuration_spec.rb +41 -0
  127. data/spec/models/address_spec.rb +82 -0
  128. data/spec/models/all_of_session_customer_spec.rb +76 -0
  129. data/spec/models/all_of_session_order_spec.rb +106 -0
  130. data/spec/models/authorization_spec.rb +82 -0
  131. data/spec/models/body_1_spec.rb +40 -0
  132. data/spec/models/body_2_spec.rb +34 -0
  133. data/spec/models/body_3_spec.rb +46 -0
  134. data/spec/models/body_4_spec.rb +46 -0
  135. data/spec/models/body_spec.rb +46 -0
  136. data/spec/models/capture_spec.rb +46 -0
  137. data/spec/models/customer_spec.rb +76 -0
  138. data/spec/models/discount_spec.rb +46 -0
  139. data/spec/models/error_inner_spec.rb +58 -0
  140. data/spec/models/error_spec.rb +34 -0
  141. data/spec/models/inline_response_200_1_spec.rb +88 -0
  142. data/spec/models/inline_response_200_2_spec.rb +52 -0
  143. data/spec/models/inline_response_200_3_spec.rb +88 -0
  144. data/spec/models/inline_response_200_4_spec.rb +46 -0
  145. data/spec/models/inline_response_200_5_spec.rb +70 -0
  146. data/spec/models/inline_response_200_6_spec.rb +40 -0
  147. data/spec/models/inline_response_200_7_spec.rb +82 -0
  148. data/spec/models/inline_response_200_8_spec.rb +46 -0
  149. data/spec/models/inline_response_200_9_spec.rb +40 -0
  150. data/spec/models/inline_response_200_order_spec.rb +58 -0
  151. data/spec/models/inline_response_200_spec.rb +58 -0
  152. data/spec/models/inline_response_201_1_order_spec.rb +52 -0
  153. data/spec/models/inline_response_201_1_spec.rb +58 -0
  154. data/spec/models/inline_response_201_1_tokenize_spec.rb +58 -0
  155. data/spec/models/inline_response_201_spec.rb +52 -0
  156. data/spec/models/installment_plan_spec.rb +34 -0
  157. data/spec/models/intent_spec.rb +34 -0
  158. data/spec/models/line_item_spec.rb +58 -0
  159. data/spec/models/link_spec.rb +52 -0
  160. data/spec/models/notification_spec.rb +52 -0
  161. data/spec/models/order_authorization_spec.rb +70 -0
  162. data/spec/models/order_spec.rb +88 -0
  163. data/spec/models/payout_inner_spec.rb +70 -0
  164. data/spec/models/payout_spec.rb +34 -0
  165. data/spec/models/price_spec.rb +46 -0
  166. data/spec/models/refund_spec.rb +46 -0
  167. data/spec/models/session_cancel_url_spec.rb +46 -0
  168. data/spec/models/session_spec.rb +58 -0
  169. data/spec/models/session_status_spec.rb +46 -0
  170. data/spec/models/token_spec.rb +58 -0
  171. data/spec/models/webhook_spec.rb +46 -0
  172. data/spec/spec_helper.rb +110 -0
  173. metadata +331 -0
@@ -0,0 +1,226 @@
1
+ =begin
2
+ #Sezzle API
3
+
4
+ #The Sezzle API is intended for merchants interested in accepting Sezzle Pay as a payment option.
5
+
6
+ OpenAPI spec version: 2.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.25
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module SezzleClient
15
+ class InlineResponse2011Order
16
+ attr_accessor :uuid
17
+
18
+ attr_accessor :checkout_url
19
+
20
+ attr_accessor :links
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'uuid' => :'uuid',
26
+ :'checkout_url' => :'checkout_url',
27
+ :'links' => :'links'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'uuid' => :'Object',
35
+ :'checkout_url' => :'Object',
36
+ :'links' => :'Object'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SezzleClient::InlineResponse2011Order` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SezzleClient::InlineResponse2011Order`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'uuid')
62
+ self.uuid = attributes[:'uuid']
63
+ end
64
+
65
+ if attributes.key?(:'checkout_url')
66
+ self.checkout_url = attributes[:'checkout_url']
67
+ end
68
+
69
+ if attributes.key?(:'links')
70
+ if (value = attributes[:'links']).is_a?(Array)
71
+ self.links = value
72
+ end
73
+ end
74
+ end
75
+
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properties with the reasons
78
+ def list_invalid_properties
79
+ invalid_properties = Array.new
80
+ invalid_properties
81
+ end
82
+
83
+ # Check to see if the all the properties in the model are valid
84
+ # @return true if the model is valid
85
+ def valid?
86
+ true
87
+ end
88
+
89
+ # Checks equality by comparing each attribute.
90
+ # @param [Object] Object to be compared
91
+ def ==(o)
92
+ return true if self.equal?(o)
93
+ self.class == o.class &&
94
+ uuid == o.uuid &&
95
+ checkout_url == o.checkout_url &&
96
+ links == o.links
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Integer] Hash code
107
+ def hash
108
+ [uuid, checkout_url, links].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def self.build_from_hash(attributes)
115
+ new.build_from_hash(attributes)
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.openapi_types.each_pair do |key, type|
124
+ if type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
133
+ self.send("#{key}=", nil)
134
+ end
135
+ end
136
+
137
+ self
138
+ end
139
+
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
144
+ def _deserialize(type, value)
145
+ case type.to_sym
146
+ when :DateTime
147
+ DateTime.parse(value)
148
+ when :Date
149
+ Date.parse(value)
150
+ when :String
151
+ value.to_s
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :Boolean
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ SezzleClient.const_get(type).build_from_hash(value)
178
+ end
179
+ end
180
+
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # to_body is an alias to to_hash (backward compatibility)
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_body
190
+ to_hash
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = self.send(attr)
199
+ if value.nil?
200
+ is_nullable = self.class.openapi_nullable.include?(attr)
201
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
202
+ end
203
+
204
+ hash[param] = _to_hash(value)
205
+ end
206
+ hash
207
+ end
208
+
209
+ # Outputs non-array value in the form of hash
210
+ # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.compact.map { |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to? :to_hash
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end end
226
+ end
@@ -0,0 +1,235 @@
1
+ =begin
2
+ #Sezzle API
3
+
4
+ #The Sezzle API is intended for merchants interested in accepting Sezzle Pay as a payment option.
5
+
6
+ OpenAPI spec version: 2.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 3.0.25
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module SezzleClient
15
+ class InlineResponse2011Tokenize
16
+ attr_accessor :token
17
+
18
+ attr_accessor :expiration
19
+
20
+ attr_accessor :approval_url
21
+
22
+ attr_accessor :links
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'token' => :'token',
28
+ :'expiration' => :'expiration',
29
+ :'approval_url' => :'approval_url',
30
+ :'links' => :'links'
31
+ }
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'token' => :'Object',
38
+ :'expiration' => :'Object',
39
+ :'approval_url' => :'Object',
40
+ :'links' => :'Object'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SezzleClient::InlineResponse2011Tokenize` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SezzleClient::InlineResponse2011Tokenize`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'token')
66
+ self.token = attributes[:'token']
67
+ end
68
+
69
+ if attributes.key?(:'expiration')
70
+ self.expiration = attributes[:'expiration']
71
+ end
72
+
73
+ if attributes.key?(:'approval_url')
74
+ self.approval_url = attributes[:'approval_url']
75
+ end
76
+
77
+ if attributes.key?(:'links')
78
+ if (value = attributes[:'links']).is_a?(Array)
79
+ self.links = value
80
+ end
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ token == o.token &&
103
+ expiration == o.expiration &&
104
+ approval_url == o.approval_url &&
105
+ links == o.links
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Integer] Hash code
116
+ def hash
117
+ [token, expiration, approval_url, links].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def self.build_from_hash(attributes)
124
+ new.build_from_hash(attributes)
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.openapi_types.each_pair do |key, type|
133
+ if type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that 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
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
142
+ self.send("#{key}=", nil)
143
+ end
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :DateTime
156
+ DateTime.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :Boolean
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ SezzleClient.const_get(type).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
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end end
235
+ end