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