square_connect 2.0.0 → 2.0.2.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -0
  3. data/README.md +151 -9
  4. data/Rakefile +8 -0
  5. data/docs/Address.md +26 -0
  6. data/docs/CaptureTransactionRequest.md +11 -0
  7. data/docs/CaptureTransactionResponse.md +12 -0
  8. data/docs/Card.md +18 -0
  9. data/docs/CardBrand.md +20 -0
  10. data/docs/ChargeRequest.md +22 -0
  11. data/docs/ChargeResponse.md +13 -0
  12. data/docs/Checkout.md +20 -0
  13. data/docs/CheckoutApi.md +62 -0
  14. data/docs/Country.md +261 -0
  15. data/docs/CreateCheckoutRequest.md +18 -0
  16. data/docs/CreateCheckoutResponse.md +13 -0
  17. data/docs/CreateCustomerCardRequest.md +14 -0
  18. data/docs/CreateCustomerCardResponse.md +13 -0
  19. data/docs/CreateCustomerRequest.md +20 -0
  20. data/docs/CreateCustomerResponse.md +13 -0
  21. data/docs/CreateOrderRequest.md +13 -0
  22. data/docs/CreateOrderRequestLineItem.md +14 -0
  23. data/docs/CreateOrderRequestOrder.md +13 -0
  24. data/docs/CreateRefundRequest.md +15 -0
  25. data/docs/CreateRefundResponse.md +13 -0
  26. data/docs/Currency.md +191 -0
  27. data/docs/Customer.md +26 -0
  28. data/docs/CustomerApi.md +267 -0
  29. data/docs/CustomerCardApi.md +116 -0
  30. data/docs/CustomerGroupInfo.md +13 -0
  31. data/docs/CustomerPreferences.md +12 -0
  32. data/docs/DeleteCustomerCardRequest.md +11 -0
  33. data/docs/DeleteCustomerCardResponse.md +12 -0
  34. data/docs/DeleteCustomerRequest.md +11 -0
  35. data/docs/DeleteCustomerResponse.md +12 -0
  36. data/docs/Error.md +15 -0
  37. data/docs/ErrorCategory.md +17 -0
  38. data/docs/ErrorCode.md +83 -0
  39. data/docs/ListCustomersRequest.md +12 -0
  40. data/docs/ListCustomersResponse.md +14 -0
  41. data/docs/ListLocationsRequest.md +11 -0
  42. data/docs/ListLocationsResponse.md +13 -0
  43. data/docs/ListRefundsRequest.md +15 -0
  44. data/docs/ListRefundsResponse.md +14 -0
  45. data/docs/ListTransactionsRequest.md +15 -0
  46. data/docs/ListTransactionsResponse.md +14 -0
  47. data/docs/Location.md +16 -0
  48. data/docs/LocationApi.md +56 -0
  49. data/docs/LocationCapability.md +12 -0
  50. data/docs/Money.md +13 -0
  51. data/docs/Order.md +16 -0
  52. data/docs/OrderLineItem.md +16 -0
  53. data/docs/Refund.md +20 -0
  54. data/docs/RefundApi.md +126 -0
  55. data/docs/RefundStatus.md +15 -0
  56. data/docs/RetrieveCustomerRequest.md +11 -0
  57. data/docs/RetrieveCustomerResponse.md +13 -0
  58. data/docs/RetrieveTransactionRequest.md +11 -0
  59. data/docs/RetrieveTransactionResponse.md +13 -0
  60. data/docs/SortOrder.md +13 -0
  61. data/docs/Tender.md +22 -0
  62. data/docs/TenderCardDetails.md +14 -0
  63. data/docs/TenderCardDetailsEntryMethod.md +16 -0
  64. data/docs/TenderCardDetailsStatus.md +15 -0
  65. data/docs/TenderCashDetails.md +13 -0
  66. data/docs/TenderType.md +17 -0
  67. data/docs/Transaction.md +21 -0
  68. data/docs/TransactionApi.md +285 -0
  69. data/docs/TransactionProduct.md +19 -0
  70. data/docs/UpdateCustomerRequest.md +20 -0
  71. data/docs/UpdateCustomerResponse.md +13 -0
  72. data/docs/VoidTransactionRequest.md +11 -0
  73. data/docs/VoidTransactionResponse.md +12 -0
  74. data/lib/square_connect.rb +33 -16
  75. data/lib/square_connect/api/checkout_api.rb +82 -0
  76. data/lib/square_connect/api/customer_api.rb +121 -162
  77. data/lib/square_connect/api/customer_card_api.rb +31 -50
  78. data/lib/square_connect/api/location_api.rb +12 -20
  79. data/lib/square_connect/api/refund_api.rb +70 -90
  80. data/lib/square_connect/api/transaction_api.rb +119 -165
  81. data/lib/square_connect/api_client.rb +64 -17
  82. data/lib/square_connect/api_error.rb +7 -3
  83. data/lib/square_connect/configuration.rb +31 -1
  84. data/lib/square_connect/models/address.rb +149 -78
  85. data/lib/square_connect/models/capture_transaction_request.rb +176 -0
  86. data/lib/square_connect/models/capture_transaction_response.rb +54 -26
  87. data/lib/square_connect/models/card.rb +98 -52
  88. data/lib/square_connect/models/card_brand.rb +12 -133
  89. data/lib/square_connect/models/charge_request.rb +106 -67
  90. data/lib/square_connect/models/charge_response.rb +57 -30
  91. data/lib/square_connect/models/checkout.rb +266 -0
  92. data/lib/square_connect/models/country.rb +253 -133
  93. data/lib/square_connect/models/create_checkout_request.rb +316 -0
  94. data/lib/square_connect/models/create_checkout_response.rb +198 -0
  95. data/lib/square_connect/models/create_customer_card_request.rb +66 -35
  96. data/lib/square_connect/models/create_customer_card_response.rb +58 -31
  97. data/lib/square_connect/models/create_customer_request.rb +79 -59
  98. data/lib/square_connect/models/create_customer_response.rb +58 -31
  99. data/lib/square_connect/models/create_order_request.rb +234 -0
  100. data/lib/square_connect/models/create_order_request_line_item.rb +268 -0
  101. data/lib/square_connect/models/create_order_request_order.rb +219 -0
  102. data/lib/square_connect/models/create_refund_request.rb +79 -39
  103. data/lib/square_connect/models/create_refund_response.rb +57 -30
  104. data/lib/square_connect/models/currency.rb +183 -133
  105. data/lib/square_connect/models/customer.rb +130 -77
  106. data/lib/square_connect/models/customer_group_info.rb +206 -0
  107. data/lib/square_connect/models/customer_preferences.rb +186 -0
  108. data/lib/square_connect/models/delete_customer_card_request.rb +176 -0
  109. data/lib/square_connect/models/delete_customer_card_response.rb +55 -27
  110. data/lib/square_connect/models/delete_customer_request.rb +176 -0
  111. data/lib/square_connect/models/delete_customer_response.rb +55 -27
  112. data/lib/square_connect/models/error.rb +107 -45
  113. data/lib/square_connect/models/error_category.rb +9 -133
  114. data/lib/square_connect/models/error_code.rb +75 -133
  115. data/lib/square_connect/models/list_customers_request.rb +55 -27
  116. data/lib/square_connect/models/list_customers_response.rb +61 -35
  117. data/lib/square_connect/models/list_locations_request.rb +176 -0
  118. data/lib/square_connect/models/list_locations_response.rb +57 -30
  119. data/lib/square_connect/models/list_refunds_request.rb +91 -42
  120. data/lib/square_connect/models/list_refunds_response.rb +59 -33
  121. data/lib/square_connect/models/list_transactions_request.rb +91 -42
  122. data/lib/square_connect/models/list_transactions_response.rb +59 -33
  123. data/lib/square_connect/models/location.rb +86 -41
  124. data/lib/square_connect/models/location_capability.rb +4 -133
  125. data/lib/square_connect/models/money.rb +85 -34
  126. data/lib/square_connect/models/order.rb +228 -0
  127. data/lib/square_connect/models/order_line_item.rb +226 -0
  128. data/lib/square_connect/models/refund.rb +138 -59
  129. data/lib/square_connect/models/refund_status.rb +7 -133
  130. data/lib/square_connect/models/retrieve_customer_request.rb +176 -0
  131. data/lib/square_connect/models/retrieve_customer_response.rb +58 -31
  132. data/lib/square_connect/models/retrieve_transaction_request.rb +176 -0
  133. data/lib/square_connect/models/retrieve_transaction_response.rb +57 -30
  134. data/lib/square_connect/models/sort_order.rb +5 -133
  135. data/lib/square_connect/models/tender.rb +112 -65
  136. data/lib/square_connect/models/tender_card_details.rb +93 -40
  137. data/lib/square_connect/models/tender_card_details_entry_method.rb +8 -133
  138. data/lib/square_connect/models/tender_card_details_status.rb +7 -133
  139. data/lib/square_connect/models/tender_cash_details.rb +58 -31
  140. data/lib/square_connect/models/tender_type.rb +9 -133
  141. data/lib/square_connect/models/transaction.rb +132 -56
  142. data/lib/square_connect/models/transaction_product.rb +11 -133
  143. data/lib/square_connect/models/update_customer_request.rb +79 -59
  144. data/lib/square_connect/models/update_customer_response.rb +58 -31
  145. data/lib/square_connect/models/void_transaction_request.rb +176 -0
  146. data/lib/square_connect/models/void_transaction_response.rb +54 -26
  147. data/lib/square_connect/version.rb +2 -3
  148. data/spec/api/checkout_api_spec.rb +53 -0
  149. data/spec/api/customer_api_spec.rb +121 -0
  150. data/spec/api/customer_card_api_spec.rb +71 -0
  151. data/spec/api/location_api_spec.rb +58 -0
  152. data/spec/api/refund_api_spec.rb +75 -0
  153. data/spec/api/transaction_api_spec.rb +128 -0
  154. data/spec/api_client_spec.rb +226 -0
  155. data/spec/configuration_spec.rb +42 -0
  156. data/spec/models/address_spec.rb +186 -0
  157. data/spec/models/capture_transaction_request_spec.rb +36 -0
  158. data/spec/models/capture_transaction_response_spec.rb +46 -0
  159. data/spec/models/card_brand_spec.rb +36 -0
  160. data/spec/models/card_spec.rb +106 -0
  161. data/spec/models/charge_request_spec.rb +146 -0
  162. data/spec/models/charge_response_spec.rb +56 -0
  163. data/spec/models/checkout_spec.rb +126 -0
  164. data/spec/models/country_spec.rb +36 -0
  165. data/spec/models/create_checkout_request_spec.rb +106 -0
  166. data/spec/models/create_checkout_response_spec.rb +56 -0
  167. data/spec/models/create_customer_card_request_spec.rb +66 -0
  168. data/spec/models/create_customer_card_response_spec.rb +56 -0
  169. data/spec/models/create_customer_request_spec.rb +126 -0
  170. data/spec/models/create_customer_response_spec.rb +56 -0
  171. data/spec/models/create_order_request_line_item_spec.rb +66 -0
  172. data/spec/models/create_order_request_order_spec.rb +56 -0
  173. data/spec/models/create_order_request_spec.rb +56 -0
  174. data/spec/models/create_refund_request_spec.rb +76 -0
  175. data/spec/models/create_refund_response_spec.rb +56 -0
  176. data/spec/models/currency_spec.rb +36 -0
  177. data/spec/models/customer_group_info_spec.rb +56 -0
  178. data/spec/models/customer_preferences_spec.rb +46 -0
  179. data/spec/models/customer_spec.rb +186 -0
  180. data/spec/models/delete_customer_card_request_spec.rb +36 -0
  181. data/spec/models/delete_customer_card_response_spec.rb +46 -0
  182. data/spec/models/delete_customer_request_spec.rb +36 -0
  183. data/spec/models/delete_customer_response_spec.rb +46 -0
  184. data/spec/models/error_category_spec.rb +36 -0
  185. data/spec/models/error_code_spec.rb +36 -0
  186. data/spec/models/error_spec.rb +76 -0
  187. data/spec/models/list_customers_request_spec.rb +46 -0
  188. data/spec/models/list_customers_response_spec.rb +66 -0
  189. data/spec/models/list_locations_request_spec.rb +36 -0
  190. data/spec/models/list_locations_response_spec.rb +56 -0
  191. data/spec/models/list_refunds_request_spec.rb +76 -0
  192. data/spec/models/list_refunds_response_spec.rb +66 -0
  193. data/spec/models/list_transactions_request_spec.rb +76 -0
  194. data/spec/models/list_transactions_response_spec.rb +66 -0
  195. data/spec/models/location_capability_spec.rb +36 -0
  196. data/spec/models/location_spec.rb +86 -0
  197. data/spec/models/money_spec.rb +56 -0
  198. data/spec/models/order_line_item_spec.rb +86 -0
  199. data/spec/models/order_spec.rb +86 -0
  200. data/spec/models/refund_spec.rb +126 -0
  201. data/spec/models/refund_status_spec.rb +36 -0
  202. data/spec/models/retrieve_customer_request_spec.rb +36 -0
  203. data/spec/models/retrieve_customer_response_spec.rb +56 -0
  204. data/spec/models/retrieve_transaction_request_spec.rb +36 -0
  205. data/spec/models/retrieve_transaction_response_spec.rb +56 -0
  206. data/spec/models/sort_order_spec.rb +36 -0
  207. data/spec/models/tender_card_details_entry_method_spec.rb +36 -0
  208. data/spec/models/tender_card_details_spec.rb +66 -0
  209. data/spec/models/tender_card_details_status_spec.rb +36 -0
  210. data/spec/models/tender_cash_details_spec.rb +56 -0
  211. data/spec/models/tender_spec.rb +146 -0
  212. data/spec/models/tender_type_spec.rb +36 -0
  213. data/spec/models/transaction_product_spec.rb +36 -0
  214. data/spec/models/transaction_spec.rb +136 -0
  215. data/spec/models/update_customer_request_spec.rb +126 -0
  216. data/spec/models/update_customer_response_spec.rb +56 -0
  217. data/spec/models/void_transaction_request_spec.rb +36 -0
  218. data/spec/models/void_transaction_response_spec.rb +46 -0
  219. data/spec/spec_helper.rb +115 -0
  220. data/square_connect.gemspec +22 -11
  221. data/travis-ci/accounts.enc +0 -0
  222. metadata +264 -31
@@ -1,147 +1,267 @@
1
1
  =begin
2
- Square Connect API
2
+ #Square Connect API
3
3
 
4
4
  OpenAPI spec version: 2.0
5
5
 
6
6
  Generated by: https://github.com/swagger-api/swagger-codegen.git
7
7
 
8
-
9
8
  =end
10
9
 
11
10
  require 'date'
12
11
 
13
12
  module SquareConnect
14
- #
15
13
  class Country
16
- # Attribute mapping from ruby-style variable name to JSON key.
17
- def self.attribute_map
18
- {
19
-
20
- }
21
- end
22
-
23
- # Attribute type mapping.
24
- def self.swagger_types
25
- {
26
-
27
- }
28
- end
29
-
30
- def initialize(attributes = {})
31
- return unless attributes.is_a?(Hash)
32
-
33
- # convert string to symbol for hash key
34
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
35
-
36
-
37
- end
38
-
39
- # Check equality by comparing each attribute.
40
- def ==(o)
41
- return true if self.equal?(o)
42
- self.class == o.class
43
- end
44
-
45
- # @see the `==` method
46
- def eql?(o)
47
- self == o
48
- end
49
-
50
- # Calculate hash code according to all attributes.
51
- def hash
52
- [].hash
53
- end
54
-
55
- # build the object from hash
56
- def build_from_hash(attributes)
57
- return nil unless attributes.is_a?(Hash)
58
- self.class.swagger_types.each_pair do |key, type|
59
- if type =~ /^Array<(.*)>/i
60
- if attributes[self.class.attribute_map[key]].is_a?(Array)
61
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
62
- else
63
- #TODO show warning in debug mode
64
- end
65
- elsif !attributes[self.class.attribute_map[key]].nil?
66
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
67
- else
68
- # data not found in attributes(hash), not an issue as the data can be optional
69
- end
70
- end
71
-
72
- self
73
- end
74
-
75
- def _deserialize(type, value)
76
- case type.to_sym
77
- when :DateTime
78
- DateTime.parse(value)
79
- when :Date
80
- Date.parse(value)
81
- when :String
82
- value.to_s
83
- when :Integer
84
- value.to_i
85
- when :Float
86
- value.to_f
87
- when :BOOLEAN
88
- if value.to_s =~ /^(true|t|yes|y|1)$/i
89
- true
90
- else
91
- false
92
- end
93
- when /\AArray<(?<inner_type>.+)>\z/
94
- inner_type = Regexp.last_match[:inner_type]
95
- value.map { |v| _deserialize(inner_type, v) }
96
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
97
- k_type = Regexp.last_match[:k_type]
98
- v_type = Regexp.last_match[:v_type]
99
- {}.tap do |hash|
100
- value.each do |k, v|
101
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
102
- end
103
- end
104
- else # model
105
- _model = SquareConnect.const_get(type).new
106
- _model.build_from_hash(value)
107
- end
108
- end
109
-
110
- def to_s
111
- to_hash.to_s
112
- end
113
-
114
- # to_body is an alias to to_body (backward compatibility))
115
- def to_body
116
- to_hash
117
- end
118
-
119
- # return the object in the form of hash
120
- def to_hash
121
- hash = {}
122
- self.class.attribute_map.each_pair do |attr, param|
123
- value = self.send(attr)
124
- next if value.nil?
125
- hash[param] = _to_hash(value)
126
- end
127
- hash
128
- end
129
-
130
- # Method to output non-array value in the form of hash
131
- # For object, use to_hash. Otherwise, just return the value
132
- def _to_hash(value)
133
- if value.is_a?(Array)
134
- value.compact.map{ |v| _to_hash(v) }
135
- elsif value.is_a?(Hash)
136
- {}.tap do |hash|
137
- value.each { |k, v| hash[k] = _to_hash(v) }
138
- end
139
- elsif value.respond_to? :to_hash
140
- value.to_hash
141
- else
142
- value
143
- end
144
- end
145
-
14
+
15
+ ZZ = "ZZ".freeze
16
+ AD = "AD".freeze
17
+ AE = "AE".freeze
18
+ AF = "AF".freeze
19
+ AG = "AG".freeze
20
+ AI = "AI".freeze
21
+ AL = "AL".freeze
22
+ AM = "AM".freeze
23
+ AO = "AO".freeze
24
+ AQ = "AQ".freeze
25
+ AR = "AR".freeze
26
+ AS = "AS".freeze
27
+ AT = "AT".freeze
28
+ AU = "AU".freeze
29
+ AW = "AW".freeze
30
+ AX = "AX".freeze
31
+ AZ = "AZ".freeze
32
+ BA = "BA".freeze
33
+ BB = "BB".freeze
34
+ BD = "BD".freeze
35
+ BE = "BE".freeze
36
+ BF = "BF".freeze
37
+ BG = "BG".freeze
38
+ BH = "BH".freeze
39
+ BI = "BI".freeze
40
+ BJ = "BJ".freeze
41
+ BL = "BL".freeze
42
+ BM = "BM".freeze
43
+ BN = "BN".freeze
44
+ BO = "BO".freeze
45
+ BQ = "BQ".freeze
46
+ BR = "BR".freeze
47
+ BS = "BS".freeze
48
+ BT = "BT".freeze
49
+ BV = "BV".freeze
50
+ BW = "BW".freeze
51
+ BY = "BY".freeze
52
+ BZ = "BZ".freeze
53
+ CA = "CA".freeze
54
+ CC = "CC".freeze
55
+ CD = "CD".freeze
56
+ CF = "CF".freeze
57
+ CG = "CG".freeze
58
+ CH = "CH".freeze
59
+ CI = "CI".freeze
60
+ CK = "CK".freeze
61
+ CL = "CL".freeze
62
+ CM = "CM".freeze
63
+ CN = "CN".freeze
64
+ CO = "CO".freeze
65
+ CR = "CR".freeze
66
+ CU = "CU".freeze
67
+ CV = "CV".freeze
68
+ CW = "CW".freeze
69
+ CX = "CX".freeze
70
+ CY = "CY".freeze
71
+ CZ = "CZ".freeze
72
+ DE = "DE".freeze
73
+ DJ = "DJ".freeze
74
+ DK = "DK".freeze
75
+ DM = "DM".freeze
76
+ DO = "DO".freeze
77
+ DZ = "DZ".freeze
78
+ EC = "EC".freeze
79
+ EE = "EE".freeze
80
+ EG = "EG".freeze
81
+ EH = "EH".freeze
82
+ ER = "ER".freeze
83
+ ES = "ES".freeze
84
+ ET = "ET".freeze
85
+ FI = "FI".freeze
86
+ FJ = "FJ".freeze
87
+ FK = "FK".freeze
88
+ FM = "FM".freeze
89
+ FO = "FO".freeze
90
+ FR = "FR".freeze
91
+ GA = "GA".freeze
92
+ GB = "GB".freeze
93
+ GD = "GD".freeze
94
+ GE = "GE".freeze
95
+ GF = "GF".freeze
96
+ GG = "GG".freeze
97
+ GH = "GH".freeze
98
+ GI = "GI".freeze
99
+ GL = "GL".freeze
100
+ GM = "GM".freeze
101
+ GN = "GN".freeze
102
+ GP = "GP".freeze
103
+ GQ = "GQ".freeze
104
+ GR = "GR".freeze
105
+ GS = "GS".freeze
106
+ GT = "GT".freeze
107
+ GU = "GU".freeze
108
+ GW = "GW".freeze
109
+ GY = "GY".freeze
110
+ HK = "HK".freeze
111
+ HM = "HM".freeze
112
+ HN = "HN".freeze
113
+ HR = "HR".freeze
114
+ HT = "HT".freeze
115
+ HU = "HU".freeze
116
+ ID = "ID".freeze
117
+ IE = "IE".freeze
118
+ IL = "IL".freeze
119
+ IM = "IM".freeze
120
+ IN = "IN".freeze
121
+ IO = "IO".freeze
122
+ IQ = "IQ".freeze
123
+ IR = "IR".freeze
124
+ IS = "IS".freeze
125
+ IT = "IT".freeze
126
+ JE = "JE".freeze
127
+ JM = "JM".freeze
128
+ JO = "JO".freeze
129
+ JP = "JP".freeze
130
+ KE = "KE".freeze
131
+ KG = "KG".freeze
132
+ KH = "KH".freeze
133
+ KI = "KI".freeze
134
+ KM = "KM".freeze
135
+ KN = "KN".freeze
136
+ KP = "KP".freeze
137
+ KR = "KR".freeze
138
+ KW = "KW".freeze
139
+ KY = "KY".freeze
140
+ KZ = "KZ".freeze
141
+ LA = "LA".freeze
142
+ LB = "LB".freeze
143
+ LC = "LC".freeze
144
+ LI = "LI".freeze
145
+ LK = "LK".freeze
146
+ LR = "LR".freeze
147
+ LS = "LS".freeze
148
+ LT = "LT".freeze
149
+ LU = "LU".freeze
150
+ LV = "LV".freeze
151
+ LY = "LY".freeze
152
+ MA = "MA".freeze
153
+ MC = "MC".freeze
154
+ MD = "MD".freeze
155
+ ME = "ME".freeze
156
+ MF = "MF".freeze
157
+ MG = "MG".freeze
158
+ MH = "MH".freeze
159
+ MK = "MK".freeze
160
+ ML = "ML".freeze
161
+ MM = "MM".freeze
162
+ MN = "MN".freeze
163
+ MO = "MO".freeze
164
+ MP = "MP".freeze
165
+ MQ = "MQ".freeze
166
+ MR = "MR".freeze
167
+ MS = "MS".freeze
168
+ MT = "MT".freeze
169
+ MU = "MU".freeze
170
+ MV = "MV".freeze
171
+ MW = "MW".freeze
172
+ MX = "MX".freeze
173
+ MY = "MY".freeze
174
+ MZ = "MZ".freeze
175
+ NA = "NA".freeze
176
+ NC = "NC".freeze
177
+ NE = "NE".freeze
178
+ NF = "NF".freeze
179
+ NG = "NG".freeze
180
+ NI = "NI".freeze
181
+ NL = "NL".freeze
182
+ NO = "NO".freeze
183
+ NP = "NP".freeze
184
+ NR = "NR".freeze
185
+ NU = "NU".freeze
186
+ NZ = "NZ".freeze
187
+ OM = "OM".freeze
188
+ PA = "PA".freeze
189
+ PE = "PE".freeze
190
+ PF = "PF".freeze
191
+ PG = "PG".freeze
192
+ PH = "PH".freeze
193
+ PK = "PK".freeze
194
+ PL = "PL".freeze
195
+ PM = "PM".freeze
196
+ PN = "PN".freeze
197
+ PR = "PR".freeze
198
+ PS = "PS".freeze
199
+ PT = "PT".freeze
200
+ PW = "PW".freeze
201
+ PY = "PY".freeze
202
+ QA = "QA".freeze
203
+ RE = "RE".freeze
204
+ RO = "RO".freeze
205
+ RS = "RS".freeze
206
+ RU = "RU".freeze
207
+ RW = "RW".freeze
208
+ SA = "SA".freeze
209
+ SB = "SB".freeze
210
+ SC = "SC".freeze
211
+ SD = "SD".freeze
212
+ SE = "SE".freeze
213
+ SG = "SG".freeze
214
+ SH = "SH".freeze
215
+ SI = "SI".freeze
216
+ SJ = "SJ".freeze
217
+ SK = "SK".freeze
218
+ SL = "SL".freeze
219
+ SM = "SM".freeze
220
+ SN = "SN".freeze
221
+ SO = "SO".freeze
222
+ SR = "SR".freeze
223
+ SS = "SS".freeze
224
+ ST = "ST".freeze
225
+ SV = "SV".freeze
226
+ SX = "SX".freeze
227
+ SY = "SY".freeze
228
+ SZ = "SZ".freeze
229
+ TC = "TC".freeze
230
+ TD = "TD".freeze
231
+ TF = "TF".freeze
232
+ TG = "TG".freeze
233
+ TH = "TH".freeze
234
+ TJ = "TJ".freeze
235
+ TK = "TK".freeze
236
+ TL = "TL".freeze
237
+ TM = "TM".freeze
238
+ TN = "TN".freeze
239
+ TO = "TO".freeze
240
+ TR = "TR".freeze
241
+ TT = "TT".freeze
242
+ TV = "TV".freeze
243
+ TW = "TW".freeze
244
+ TZ = "TZ".freeze
245
+ UA = "UA".freeze
246
+ UG = "UG".freeze
247
+ UM = "UM".freeze
248
+ US = "US".freeze
249
+ UY = "UY".freeze
250
+ UZ = "UZ".freeze
251
+ VA = "VA".freeze
252
+ VC = "VC".freeze
253
+ VE = "VE".freeze
254
+ VG = "VG".freeze
255
+ VI = "VI".freeze
256
+ VN = "VN".freeze
257
+ VU = "VU".freeze
258
+ WF = "WF".freeze
259
+ WS = "WS".freeze
260
+ YE = "YE".freeze
261
+ YT = "YT".freeze
262
+ ZA = "ZA".freeze
263
+ ZM = "ZM".freeze
264
+ ZW = "ZW".freeze
146
265
  end
266
+
147
267
  end
@@ -0,0 +1,316 @@
1
+ =begin
2
+ #Square Connect API
3
+
4
+ OpenAPI spec version: 2.0
5
+
6
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
7
+
8
+ =end
9
+
10
+ require 'date'
11
+
12
+ module SquareConnect
13
+ # Defines the parameters that can be included in the body of a request to the [CreateCheckout](#endpoint-createcheckout) endpoint.
14
+ class CreateCheckoutRequest
15
+ # A unique string that identifies this checkout among others you've created. It can be any valid string but must be unique for every order sent to Square Checkout for a given location ID. The idempotency key is used to avoid processing the same order more than once. If you're unsure whether a particular checkout was created successfully, you can reattempt it with the same idempotency key and all the same other parameters without worrying about creating duplicates. We recommend using a random number/string generator native to the language you are working in to generate strings for your idempotency keys. See [Idempotency keys](#idempotencykeys) for more information.
16
+ attr_accessor :idempotency_key
17
+
18
+ # The order including line items to be checked out.
19
+ attr_accessor :order
20
+
21
+ # If `true`, Square Checkout will collect shipping information on your behalf and store that information with the transaction information in your Square Dashboard. Default is `false`.
22
+ attr_accessor :ask_for_shipping_address
23
+
24
+ # The email address to display on the Square Checkout confirmation page and confirmation email that the buyer can use to contact the merchant. If this value is not set, the confirmation page and email will display the primary email address associated with the merchant's Square account. Default is unset.
25
+ attr_accessor :merchant_support_email
26
+
27
+ # If provided, the buyer's email is pre-populated on the checkout page as an editable text field. Default is unset.
28
+ attr_accessor :pre_populate_buyer_email
29
+
30
+ # If provided, the buyer's shipping info is pre-populated on the checkout page as editable text fields. Default is unset.
31
+ attr_accessor :pre_populate_shipping_address
32
+
33
+ # The URL to redirect to after checkout is completed with `checkoutId`, Square's `orderId`, `transactionId`, and `referenceId` appended as URL parameters. For example, if the provided redirect_url is `http://www.example.com/order-complete`, a successful transaction redirects the customer to: `http://www.example.com/order-complete?checkoutId=xxxxxx&orderId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx` If you do not provide a redirect URL, Square Checkout will display an order confirmation page on your behalf; however Square strongly recommends that you provide a redirect URL so you can verify the transaction results and finalize the order through your existing/normal confirmation workflow. Default is unset.
34
+ attr_accessor :redirect_url
35
+
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'idempotency_key' => :'idempotency_key',
41
+ :'order' => :'order',
42
+ :'ask_for_shipping_address' => :'ask_for_shipping_address',
43
+ :'merchant_support_email' => :'merchant_support_email',
44
+ :'pre_populate_buyer_email' => :'pre_populate_buyer_email',
45
+ :'pre_populate_shipping_address' => :'pre_populate_shipping_address',
46
+ :'redirect_url' => :'redirect_url'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.swagger_types
52
+ {
53
+ :'idempotency_key' => :'String',
54
+ :'order' => :'CreateOrderRequestOrder',
55
+ :'ask_for_shipping_address' => :'BOOLEAN',
56
+ :'merchant_support_email' => :'String',
57
+ :'pre_populate_buyer_email' => :'String',
58
+ :'pre_populate_shipping_address' => :'Address',
59
+ :'redirect_url' => :'String'
60
+ }
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ return unless attributes.is_a?(Hash)
67
+
68
+ # convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
70
+
71
+ if attributes.has_key?(:'idempotency_key')
72
+ self.idempotency_key = attributes[:'idempotency_key']
73
+ end
74
+
75
+ if attributes.has_key?(:'order')
76
+ self.order = attributes[:'order']
77
+ end
78
+
79
+ if attributes.has_key?(:'ask_for_shipping_address')
80
+ self.ask_for_shipping_address = attributes[:'ask_for_shipping_address']
81
+ end
82
+
83
+ if attributes.has_key?(:'merchant_support_email')
84
+ self.merchant_support_email = attributes[:'merchant_support_email']
85
+ end
86
+
87
+ if attributes.has_key?(:'pre_populate_buyer_email')
88
+ self.pre_populate_buyer_email = attributes[:'pre_populate_buyer_email']
89
+ end
90
+
91
+ if attributes.has_key?(:'pre_populate_shipping_address')
92
+ self.pre_populate_shipping_address = attributes[:'pre_populate_shipping_address']
93
+ end
94
+
95
+ if attributes.has_key?(:'redirect_url')
96
+ self.redirect_url = attributes[:'redirect_url']
97
+ end
98
+
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properies with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = Array.new
105
+ if @idempotency_key.nil?
106
+ invalid_properties.push("invalid value for 'idempotency_key', idempotency_key cannot be nil.")
107
+ end
108
+
109
+ if @idempotency_key.to_s.length > 192
110
+ invalid_properties.push("invalid value for 'idempotency_key', the character length must be smaller than or equal to 192.")
111
+ end
112
+
113
+ if @idempotency_key.to_s.length < 1
114
+ invalid_properties.push("invalid value for 'idempotency_key', the character length must be great than or equal to 1.")
115
+ end
116
+
117
+ if @order.nil?
118
+ invalid_properties.push("invalid value for 'order', order cannot be nil.")
119
+ end
120
+
121
+ if !@merchant_support_email.nil? && @merchant_support_email.to_s.length > 254
122
+ invalid_properties.push("invalid value for 'merchant_support_email', the character length must be smaller than or equal to 254.")
123
+ end
124
+
125
+ if !@pre_populate_buyer_email.nil? && @pre_populate_buyer_email.to_s.length > 254
126
+ invalid_properties.push("invalid value for 'pre_populate_buyer_email', the character length must be smaller than or equal to 254.")
127
+ end
128
+
129
+ return invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ return false if @idempotency_key.nil?
136
+ return false if @idempotency_key.to_s.length > 192
137
+ return false if @idempotency_key.to_s.length < 1
138
+ return false if @order.nil?
139
+ return false if !@merchant_support_email.nil? && @merchant_support_email.to_s.length > 254
140
+ return false if !@pre_populate_buyer_email.nil? && @pre_populate_buyer_email.to_s.length > 254
141
+ return true
142
+ end
143
+
144
+ # Custom attribute writer method with validation
145
+ # @param [Object] idempotency_key Value to be assigned
146
+ def idempotency_key=(idempotency_key)
147
+ if idempotency_key.nil?
148
+ fail ArgumentError, "idempotency_key cannot be nil"
149
+ end
150
+
151
+ if idempotency_key.to_s.length > 192
152
+ fail ArgumentError, "invalid value for 'idempotency_key', the character length must be smaller than or equal to 192."
153
+ end
154
+
155
+ if idempotency_key.to_s.length < 1
156
+ fail ArgumentError, "invalid value for 'idempotency_key', the character length must be great than or equal to 1."
157
+ end
158
+
159
+ @idempotency_key = idempotency_key
160
+ end
161
+
162
+ # Custom attribute writer method with validation
163
+ # @param [Object] merchant_support_email Value to be assigned
164
+ def merchant_support_email=(merchant_support_email)
165
+
166
+ if !merchant_support_email.nil? && merchant_support_email.to_s.length > 254
167
+ fail ArgumentError, "invalid value for 'merchant_support_email', the character length must be smaller than or equal to 254."
168
+ end
169
+
170
+ @merchant_support_email = merchant_support_email
171
+ end
172
+
173
+ # Custom attribute writer method with validation
174
+ # @param [Object] pre_populate_buyer_email Value to be assigned
175
+ def pre_populate_buyer_email=(pre_populate_buyer_email)
176
+
177
+ if !pre_populate_buyer_email.nil? && pre_populate_buyer_email.to_s.length > 254
178
+ fail ArgumentError, "invalid value for 'pre_populate_buyer_email', the character length must be smaller than or equal to 254."
179
+ end
180
+
181
+ @pre_populate_buyer_email = pre_populate_buyer_email
182
+ end
183
+
184
+ # Checks equality by comparing each attribute.
185
+ # @param [Object] Object to be compared
186
+ def ==(o)
187
+ return true if self.equal?(o)
188
+ self.class == o.class &&
189
+ idempotency_key == o.idempotency_key &&
190
+ order == o.order &&
191
+ ask_for_shipping_address == o.ask_for_shipping_address &&
192
+ merchant_support_email == o.merchant_support_email &&
193
+ pre_populate_buyer_email == o.pre_populate_buyer_email &&
194
+ pre_populate_shipping_address == o.pre_populate_shipping_address &&
195
+ redirect_url == o.redirect_url
196
+ end
197
+
198
+ # @see the `==` method
199
+ # @param [Object] Object to be compared
200
+ def eql?(o)
201
+ self == o
202
+ end
203
+
204
+ # Calculates hash code according to all attributes.
205
+ # @return [Fixnum] Hash code
206
+ def hash
207
+ [idempotency_key, order, ask_for_shipping_address, merchant_support_email, pre_populate_buyer_email, pre_populate_shipping_address, redirect_url].hash
208
+ end
209
+
210
+ # Builds the object from hash
211
+ # @param [Hash] attributes Model attributes in the form of hash
212
+ # @return [Object] Returns the model itself
213
+ def build_from_hash(attributes)
214
+ return nil unless attributes.is_a?(Hash)
215
+ self.class.swagger_types.each_pair do |key, type|
216
+ if type =~ /\AArray<(.*)>/i
217
+ # check to ensure the input is an array given that the the attribute
218
+ # is documented as an array but the input is not
219
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
220
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
221
+ end
222
+ elsif !attributes[self.class.attribute_map[key]].nil?
223
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
224
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
225
+ end
226
+
227
+ self
228
+ end
229
+
230
+ # Deserializes the data based on type
231
+ # @param string type Data type
232
+ # @param string value Value to be deserialized
233
+ # @return [Object] Deserialized data
234
+ def _deserialize(type, value)
235
+ case type.to_sym
236
+ when :DateTime
237
+ DateTime.parse(value)
238
+ when :Date
239
+ Date.parse(value)
240
+ when :String
241
+ value.to_s
242
+ when :Integer
243
+ value.to_i
244
+ when :Float
245
+ value.to_f
246
+ when :BOOLEAN
247
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
248
+ true
249
+ else
250
+ false
251
+ end
252
+ when :Object
253
+ # generic object (usually a Hash), return directly
254
+ value
255
+ when /\AArray<(?<inner_type>.+)>\z/
256
+ inner_type = Regexp.last_match[:inner_type]
257
+ value.map { |v| _deserialize(inner_type, v) }
258
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
259
+ k_type = Regexp.last_match[:k_type]
260
+ v_type = Regexp.last_match[:v_type]
261
+ {}.tap do |hash|
262
+ value.each do |k, v|
263
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
264
+ end
265
+ end
266
+ else # model
267
+ temp_model = SquareConnect.const_get(type).new
268
+ temp_model.build_from_hash(value)
269
+ end
270
+ end
271
+
272
+ # Returns the string representation of the object
273
+ # @return [String] String presentation of the object
274
+ def to_s
275
+ to_hash.to_s
276
+ end
277
+
278
+ # to_body is an alias to to_hash (backward compatibility)
279
+ # @return [Hash] Returns the object in the form of hash
280
+ def to_body
281
+ to_hash
282
+ end
283
+
284
+ # Returns the object in the form of hash
285
+ # @return [Hash] Returns the object in the form of hash
286
+ def to_hash
287
+ hash = {}
288
+ self.class.attribute_map.each_pair do |attr, param|
289
+ value = self.send(attr)
290
+ next if value.nil?
291
+ hash[param] = _to_hash(value)
292
+ end
293
+ hash
294
+ end
295
+
296
+ # Outputs non-array value in the form of hash
297
+ # For object, use to_hash. Otherwise, just return the value
298
+ # @param [Object] value Any valid value
299
+ # @return [Hash] Returns the value in the form of hash
300
+ def _to_hash(value)
301
+ if value.is_a?(Array)
302
+ value.compact.map{ |v| _to_hash(v) }
303
+ elsif value.is_a?(Hash)
304
+ {}.tap do |hash|
305
+ value.each { |k, v| hash[k] = _to_hash(v) }
306
+ end
307
+ elsif value.respond_to? :to_hash
308
+ value.to_hash
309
+ else
310
+ value
311
+ end
312
+ end
313
+
314
+ end
315
+
316
+ end