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