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