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.
- checksums.yaml +4 -4
- data/Gemfile +7 -0
- data/README.md +151 -9
- data/Rakefile +8 -0
- data/docs/Address.md +26 -0
- data/docs/CaptureTransactionRequest.md +11 -0
- data/docs/CaptureTransactionResponse.md +12 -0
- data/docs/Card.md +18 -0
- data/docs/CardBrand.md +20 -0
- data/docs/ChargeRequest.md +22 -0
- data/docs/ChargeResponse.md +13 -0
- data/docs/Checkout.md +20 -0
- data/docs/CheckoutApi.md +62 -0
- data/docs/Country.md +261 -0
- data/docs/CreateCheckoutRequest.md +18 -0
- data/docs/CreateCheckoutResponse.md +13 -0
- data/docs/CreateCustomerCardRequest.md +14 -0
- data/docs/CreateCustomerCardResponse.md +13 -0
- data/docs/CreateCustomerRequest.md +20 -0
- data/docs/CreateCustomerResponse.md +13 -0
- data/docs/CreateOrderRequest.md +13 -0
- data/docs/CreateOrderRequestLineItem.md +14 -0
- data/docs/CreateOrderRequestOrder.md +13 -0
- data/docs/CreateRefundRequest.md +15 -0
- data/docs/CreateRefundResponse.md +13 -0
- data/docs/Currency.md +191 -0
- data/docs/Customer.md +26 -0
- data/docs/CustomerApi.md +267 -0
- data/docs/CustomerCardApi.md +116 -0
- data/docs/CustomerGroupInfo.md +13 -0
- data/docs/CustomerPreferences.md +12 -0
- data/docs/DeleteCustomerCardRequest.md +11 -0
- data/docs/DeleteCustomerCardResponse.md +12 -0
- data/docs/DeleteCustomerRequest.md +11 -0
- data/docs/DeleteCustomerResponse.md +12 -0
- data/docs/Error.md +15 -0
- data/docs/ErrorCategory.md +17 -0
- data/docs/ErrorCode.md +83 -0
- data/docs/ListCustomersRequest.md +12 -0
- data/docs/ListCustomersResponse.md +14 -0
- data/docs/ListLocationsRequest.md +11 -0
- data/docs/ListLocationsResponse.md +13 -0
- data/docs/ListRefundsRequest.md +15 -0
- data/docs/ListRefundsResponse.md +14 -0
- data/docs/ListTransactionsRequest.md +15 -0
- data/docs/ListTransactionsResponse.md +14 -0
- data/docs/Location.md +16 -0
- data/docs/LocationApi.md +56 -0
- data/docs/LocationCapability.md +12 -0
- data/docs/Money.md +13 -0
- data/docs/Order.md +16 -0
- data/docs/OrderLineItem.md +16 -0
- data/docs/Refund.md +20 -0
- data/docs/RefundApi.md +126 -0
- data/docs/RefundStatus.md +15 -0
- data/docs/RetrieveCustomerRequest.md +11 -0
- data/docs/RetrieveCustomerResponse.md +13 -0
- data/docs/RetrieveTransactionRequest.md +11 -0
- data/docs/RetrieveTransactionResponse.md +13 -0
- data/docs/SortOrder.md +13 -0
- data/docs/Tender.md +22 -0
- data/docs/TenderCardDetails.md +14 -0
- data/docs/TenderCardDetailsEntryMethod.md +16 -0
- data/docs/TenderCardDetailsStatus.md +15 -0
- data/docs/TenderCashDetails.md +13 -0
- data/docs/TenderType.md +17 -0
- data/docs/Transaction.md +21 -0
- data/docs/TransactionApi.md +285 -0
- data/docs/TransactionProduct.md +19 -0
- data/docs/UpdateCustomerRequest.md +20 -0
- data/docs/UpdateCustomerResponse.md +13 -0
- data/docs/VoidTransactionRequest.md +11 -0
- data/docs/VoidTransactionResponse.md +12 -0
- data/lib/square_connect.rb +33 -16
- data/lib/square_connect/api/checkout_api.rb +82 -0
- data/lib/square_connect/api/customer_api.rb +121 -162
- data/lib/square_connect/api/customer_card_api.rb +31 -50
- data/lib/square_connect/api/location_api.rb +12 -20
- data/lib/square_connect/api/refund_api.rb +70 -90
- data/lib/square_connect/api/transaction_api.rb +119 -165
- data/lib/square_connect/api_client.rb +64 -17
- data/lib/square_connect/api_error.rb +7 -3
- data/lib/square_connect/configuration.rb +31 -1
- data/lib/square_connect/models/address.rb +149 -78
- data/lib/square_connect/models/capture_transaction_request.rb +176 -0
- data/lib/square_connect/models/capture_transaction_response.rb +54 -26
- data/lib/square_connect/models/card.rb +98 -52
- data/lib/square_connect/models/card_brand.rb +12 -133
- data/lib/square_connect/models/charge_request.rb +106 -67
- data/lib/square_connect/models/charge_response.rb +57 -30
- data/lib/square_connect/models/checkout.rb +266 -0
- data/lib/square_connect/models/country.rb +253 -133
- data/lib/square_connect/models/create_checkout_request.rb +316 -0
- data/lib/square_connect/models/create_checkout_response.rb +198 -0
- data/lib/square_connect/models/create_customer_card_request.rb +66 -35
- data/lib/square_connect/models/create_customer_card_response.rb +58 -31
- data/lib/square_connect/models/create_customer_request.rb +79 -59
- data/lib/square_connect/models/create_customer_response.rb +58 -31
- data/lib/square_connect/models/create_order_request.rb +234 -0
- data/lib/square_connect/models/create_order_request_line_item.rb +268 -0
- data/lib/square_connect/models/create_order_request_order.rb +219 -0
- data/lib/square_connect/models/create_refund_request.rb +79 -39
- data/lib/square_connect/models/create_refund_response.rb +57 -30
- data/lib/square_connect/models/currency.rb +183 -133
- data/lib/square_connect/models/customer.rb +130 -77
- data/lib/square_connect/models/customer_group_info.rb +206 -0
- data/lib/square_connect/models/customer_preferences.rb +186 -0
- data/lib/square_connect/models/delete_customer_card_request.rb +176 -0
- data/lib/square_connect/models/delete_customer_card_response.rb +55 -27
- data/lib/square_connect/models/delete_customer_request.rb +176 -0
- data/lib/square_connect/models/delete_customer_response.rb +55 -27
- data/lib/square_connect/models/error.rb +107 -45
- data/lib/square_connect/models/error_category.rb +9 -133
- data/lib/square_connect/models/error_code.rb +75 -133
- data/lib/square_connect/models/list_customers_request.rb +55 -27
- data/lib/square_connect/models/list_customers_response.rb +61 -35
- data/lib/square_connect/models/list_locations_request.rb +176 -0
- data/lib/square_connect/models/list_locations_response.rb +57 -30
- data/lib/square_connect/models/list_refunds_request.rb +91 -42
- data/lib/square_connect/models/list_refunds_response.rb +59 -33
- data/lib/square_connect/models/list_transactions_request.rb +91 -42
- data/lib/square_connect/models/list_transactions_response.rb +59 -33
- data/lib/square_connect/models/location.rb +86 -41
- data/lib/square_connect/models/location_capability.rb +4 -133
- data/lib/square_connect/models/money.rb +85 -34
- data/lib/square_connect/models/order.rb +228 -0
- data/lib/square_connect/models/order_line_item.rb +226 -0
- data/lib/square_connect/models/refund.rb +138 -59
- data/lib/square_connect/models/refund_status.rb +7 -133
- data/lib/square_connect/models/retrieve_customer_request.rb +176 -0
- data/lib/square_connect/models/retrieve_customer_response.rb +58 -31
- data/lib/square_connect/models/retrieve_transaction_request.rb +176 -0
- data/lib/square_connect/models/retrieve_transaction_response.rb +57 -30
- data/lib/square_connect/models/sort_order.rb +5 -133
- data/lib/square_connect/models/tender.rb +112 -65
- data/lib/square_connect/models/tender_card_details.rb +93 -40
- data/lib/square_connect/models/tender_card_details_entry_method.rb +8 -133
- data/lib/square_connect/models/tender_card_details_status.rb +7 -133
- data/lib/square_connect/models/tender_cash_details.rb +58 -31
- data/lib/square_connect/models/tender_type.rb +9 -133
- data/lib/square_connect/models/transaction.rb +132 -56
- data/lib/square_connect/models/transaction_product.rb +11 -133
- data/lib/square_connect/models/update_customer_request.rb +79 -59
- data/lib/square_connect/models/update_customer_response.rb +58 -31
- data/lib/square_connect/models/void_transaction_request.rb +176 -0
- data/lib/square_connect/models/void_transaction_response.rb +54 -26
- data/lib/square_connect/version.rb +2 -3
- data/spec/api/checkout_api_spec.rb +53 -0
- data/spec/api/customer_api_spec.rb +121 -0
- data/spec/api/customer_card_api_spec.rb +71 -0
- data/spec/api/location_api_spec.rb +58 -0
- data/spec/api/refund_api_spec.rb +75 -0
- data/spec/api/transaction_api_spec.rb +128 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/address_spec.rb +186 -0
- data/spec/models/capture_transaction_request_spec.rb +36 -0
- data/spec/models/capture_transaction_response_spec.rb +46 -0
- data/spec/models/card_brand_spec.rb +36 -0
- data/spec/models/card_spec.rb +106 -0
- data/spec/models/charge_request_spec.rb +146 -0
- data/spec/models/charge_response_spec.rb +56 -0
- data/spec/models/checkout_spec.rb +126 -0
- data/spec/models/country_spec.rb +36 -0
- data/spec/models/create_checkout_request_spec.rb +106 -0
- data/spec/models/create_checkout_response_spec.rb +56 -0
- data/spec/models/create_customer_card_request_spec.rb +66 -0
- data/spec/models/create_customer_card_response_spec.rb +56 -0
- data/spec/models/create_customer_request_spec.rb +126 -0
- data/spec/models/create_customer_response_spec.rb +56 -0
- data/spec/models/create_order_request_line_item_spec.rb +66 -0
- data/spec/models/create_order_request_order_spec.rb +56 -0
- data/spec/models/create_order_request_spec.rb +56 -0
- data/spec/models/create_refund_request_spec.rb +76 -0
- data/spec/models/create_refund_response_spec.rb +56 -0
- data/spec/models/currency_spec.rb +36 -0
- data/spec/models/customer_group_info_spec.rb +56 -0
- data/spec/models/customer_preferences_spec.rb +46 -0
- data/spec/models/customer_spec.rb +186 -0
- data/spec/models/delete_customer_card_request_spec.rb +36 -0
- data/spec/models/delete_customer_card_response_spec.rb +46 -0
- data/spec/models/delete_customer_request_spec.rb +36 -0
- data/spec/models/delete_customer_response_spec.rb +46 -0
- data/spec/models/error_category_spec.rb +36 -0
- data/spec/models/error_code_spec.rb +36 -0
- data/spec/models/error_spec.rb +76 -0
- data/spec/models/list_customers_request_spec.rb +46 -0
- data/spec/models/list_customers_response_spec.rb +66 -0
- data/spec/models/list_locations_request_spec.rb +36 -0
- data/spec/models/list_locations_response_spec.rb +56 -0
- data/spec/models/list_refunds_request_spec.rb +76 -0
- data/spec/models/list_refunds_response_spec.rb +66 -0
- data/spec/models/list_transactions_request_spec.rb +76 -0
- data/spec/models/list_transactions_response_spec.rb +66 -0
- data/spec/models/location_capability_spec.rb +36 -0
- data/spec/models/location_spec.rb +86 -0
- data/spec/models/money_spec.rb +56 -0
- data/spec/models/order_line_item_spec.rb +86 -0
- data/spec/models/order_spec.rb +86 -0
- data/spec/models/refund_spec.rb +126 -0
- data/spec/models/refund_status_spec.rb +36 -0
- data/spec/models/retrieve_customer_request_spec.rb +36 -0
- data/spec/models/retrieve_customer_response_spec.rb +56 -0
- data/spec/models/retrieve_transaction_request_spec.rb +36 -0
- data/spec/models/retrieve_transaction_response_spec.rb +56 -0
- data/spec/models/sort_order_spec.rb +36 -0
- data/spec/models/tender_card_details_entry_method_spec.rb +36 -0
- data/spec/models/tender_card_details_spec.rb +66 -0
- data/spec/models/tender_card_details_status_spec.rb +36 -0
- data/spec/models/tender_cash_details_spec.rb +56 -0
- data/spec/models/tender_spec.rb +146 -0
- data/spec/models/tender_type_spec.rb +36 -0
- data/spec/models/transaction_product_spec.rb +36 -0
- data/spec/models/transaction_spec.rb +136 -0
- data/spec/models/update_customer_request_spec.rb +126 -0
- data/spec/models/update_customer_response_spec.rb +56 -0
- data/spec/models/void_transaction_request_spec.rb +36 -0
- data/spec/models/void_transaction_response_spec.rb +46 -0
- data/spec/spec_helper.rb +115 -0
- data/square_connect.gemspec +22 -11
- data/travis-ci/accounts.enc +0 -0
- metadata +264 -31
@@ -1,32 +1,29 @@
|
|
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
|
-
# Defines the fields that are included in the response body of
|
13
|
+
# Defines the fields that are included in the response body of a request to the [Charge](#endpoint-charge) endpoint. One of `errors` or `transaction` is present in a given response (never both).
|
15
14
|
class ChargeResponse
|
16
15
|
# Any errors that occurred during the request.
|
17
16
|
attr_accessor :errors
|
18
17
|
|
19
|
-
# The
|
18
|
+
# The created transaction.
|
20
19
|
attr_accessor :transaction
|
21
20
|
|
21
|
+
|
22
22
|
# Attribute mapping from ruby-style variable name to JSON key.
|
23
23
|
def self.attribute_map
|
24
24
|
{
|
25
|
-
|
26
25
|
:'errors' => :'errors',
|
27
|
-
|
28
26
|
:'transaction' => :'transaction'
|
29
|
-
|
30
27
|
}
|
31
28
|
end
|
32
29
|
|
@@ -35,30 +32,44 @@ module SquareConnect
|
|
35
32
|
{
|
36
33
|
:'errors' => :'Array<Error>',
|
37
34
|
:'transaction' => :'Transaction'
|
38
|
-
|
39
35
|
}
|
40
36
|
end
|
41
37
|
|
38
|
+
# Initializes the object
|
39
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
42
40
|
def initialize(attributes = {})
|
43
41
|
return unless attributes.is_a?(Hash)
|
44
42
|
|
45
43
|
# convert string to symbol for hash key
|
46
|
-
attributes = attributes.
|
44
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
47
45
|
|
48
|
-
|
49
|
-
if attributes[:'errors']
|
46
|
+
if attributes.has_key?(:'errors')
|
50
47
|
if (value = attributes[:'errors']).is_a?(Array)
|
51
48
|
self.errors = value
|
52
49
|
end
|
53
50
|
end
|
54
|
-
|
55
|
-
if attributes
|
51
|
+
|
52
|
+
if attributes.has_key?(:'transaction')
|
56
53
|
self.transaction = attributes[:'transaction']
|
57
54
|
end
|
58
|
-
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
59
|
+
# @return Array for valid properies with the reasons
|
60
|
+
def list_invalid_properties
|
61
|
+
invalid_properties = Array.new
|
62
|
+
return invalid_properties
|
59
63
|
end
|
60
64
|
|
61
|
-
# Check
|
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
|
+
return true
|
69
|
+
end
|
70
|
+
|
71
|
+
# Checks equality by comparing each attribute.
|
72
|
+
# @param [Object] Object to be compared
|
62
73
|
def ==(o)
|
63
74
|
return true if self.equal?(o)
|
64
75
|
self.class == o.class &&
|
@@ -67,35 +78,41 @@ module SquareConnect
|
|
67
78
|
end
|
68
79
|
|
69
80
|
# @see the `==` method
|
81
|
+
# @param [Object] Object to be compared
|
70
82
|
def eql?(o)
|
71
83
|
self == o
|
72
84
|
end
|
73
85
|
|
74
|
-
#
|
86
|
+
# Calculates hash code according to all attributes.
|
87
|
+
# @return [Fixnum] Hash code
|
75
88
|
def hash
|
76
89
|
[errors, transaction].hash
|
77
90
|
end
|
78
91
|
|
79
|
-
#
|
92
|
+
# Builds the object from hash
|
93
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
94
|
+
# @return [Object] Returns the model itself
|
80
95
|
def build_from_hash(attributes)
|
81
96
|
return nil unless attributes.is_a?(Hash)
|
82
97
|
self.class.swagger_types.each_pair do |key, type|
|
83
|
-
if type =~
|
98
|
+
if type =~ /\AArray<(.*)>/i
|
99
|
+
# check to ensure the input is an array given that the the attribute
|
100
|
+
# is documented as an array but the input is not
|
84
101
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
85
102
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
86
|
-
else
|
87
|
-
#TODO show warning in debug mode
|
88
103
|
end
|
89
104
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
90
105
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
91
|
-
else
|
92
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
93
|
-
end
|
106
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
94
107
|
end
|
95
108
|
|
96
109
|
self
|
97
110
|
end
|
98
111
|
|
112
|
+
# Deserializes the data based on type
|
113
|
+
# @param string type Data type
|
114
|
+
# @param string value Value to be deserialized
|
115
|
+
# @return [Object] Deserialized data
|
99
116
|
def _deserialize(type, value)
|
100
117
|
case type.to_sym
|
101
118
|
when :DateTime
|
@@ -109,15 +126,18 @@ module SquareConnect
|
|
109
126
|
when :Float
|
110
127
|
value.to_f
|
111
128
|
when :BOOLEAN
|
112
|
-
if value.to_s =~
|
129
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
113
130
|
true
|
114
131
|
else
|
115
132
|
false
|
116
133
|
end
|
134
|
+
when :Object
|
135
|
+
# generic object (usually a Hash), return directly
|
136
|
+
value
|
117
137
|
when /\AArray<(?<inner_type>.+)>\z/
|
118
138
|
inner_type = Regexp.last_match[:inner_type]
|
119
139
|
value.map { |v| _deserialize(inner_type, v) }
|
120
|
-
when /\AHash<(?<k_type
|
140
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
121
141
|
k_type = Regexp.last_match[:k_type]
|
122
142
|
v_type = Regexp.last_match[:v_type]
|
123
143
|
{}.tap do |hash|
|
@@ -126,21 +146,25 @@ module SquareConnect
|
|
126
146
|
end
|
127
147
|
end
|
128
148
|
else # model
|
129
|
-
|
130
|
-
|
149
|
+
temp_model = SquareConnect.const_get(type).new
|
150
|
+
temp_model.build_from_hash(value)
|
131
151
|
end
|
132
152
|
end
|
133
153
|
|
154
|
+
# Returns the string representation of the object
|
155
|
+
# @return [String] String presentation of the object
|
134
156
|
def to_s
|
135
157
|
to_hash.to_s
|
136
158
|
end
|
137
159
|
|
138
|
-
# to_body is an alias to
|
160
|
+
# to_body is an alias to to_hash (backward compatibility)
|
161
|
+
# @return [Hash] Returns the object in the form of hash
|
139
162
|
def to_body
|
140
163
|
to_hash
|
141
164
|
end
|
142
165
|
|
143
|
-
#
|
166
|
+
# Returns the object in the form of hash
|
167
|
+
# @return [Hash] Returns the object in the form of hash
|
144
168
|
def to_hash
|
145
169
|
hash = {}
|
146
170
|
self.class.attribute_map.each_pair do |attr, param|
|
@@ -151,8 +175,10 @@ module SquareConnect
|
|
151
175
|
hash
|
152
176
|
end
|
153
177
|
|
154
|
-
#
|
178
|
+
# Outputs non-array value in the form of hash
|
155
179
|
# For object, use to_hash. Otherwise, just return the value
|
180
|
+
# @param [Object] value Any valid value
|
181
|
+
# @return [Hash] Returns the value in the form of hash
|
156
182
|
def _to_hash(value)
|
157
183
|
if value.is_a?(Array)
|
158
184
|
value.compact.map{ |v| _to_hash(v) }
|
@@ -168,4 +194,5 @@ module SquareConnect
|
|
168
194
|
end
|
169
195
|
|
170
196
|
end
|
197
|
+
|
171
198
|
end
|
@@ -0,0 +1,266 @@
|
|
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
|
+
# Square Checkout lets merchants accept online payments for supported payment types using a checkout workflow hosted on squareup.com.
|
14
|
+
class Checkout
|
15
|
+
# ID generated by Square Checkout when a new checkout is requested.
|
16
|
+
attr_accessor :id
|
17
|
+
|
18
|
+
# The URL that the buyer's browser should be redirected to after the checkout is completed.
|
19
|
+
attr_accessor :checkout_page_url
|
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.
|
34
|
+
attr_accessor :redirect_url
|
35
|
+
|
36
|
+
# Order to be checked out.
|
37
|
+
attr_accessor :order
|
38
|
+
|
39
|
+
# The time when the checkout was created, in RFC 3339 format.
|
40
|
+
attr_accessor :created_at
|
41
|
+
|
42
|
+
|
43
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
44
|
+
def self.attribute_map
|
45
|
+
{
|
46
|
+
:'id' => :'id',
|
47
|
+
:'checkout_page_url' => :'checkout_page_url',
|
48
|
+
:'ask_for_shipping_address' => :'ask_for_shipping_address',
|
49
|
+
:'merchant_support_email' => :'merchant_support_email',
|
50
|
+
:'pre_populate_buyer_email' => :'pre_populate_buyer_email',
|
51
|
+
:'pre_populate_shipping_address' => :'pre_populate_shipping_address',
|
52
|
+
:'redirect_url' => :'redirect_url',
|
53
|
+
:'order' => :'order',
|
54
|
+
:'created_at' => :'created_at'
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
# Attribute type mapping.
|
59
|
+
def self.swagger_types
|
60
|
+
{
|
61
|
+
:'id' => :'String',
|
62
|
+
:'checkout_page_url' => :'String',
|
63
|
+
:'ask_for_shipping_address' => :'BOOLEAN',
|
64
|
+
:'merchant_support_email' => :'String',
|
65
|
+
:'pre_populate_buyer_email' => :'String',
|
66
|
+
:'pre_populate_shipping_address' => :'Address',
|
67
|
+
:'redirect_url' => :'String',
|
68
|
+
:'order' => :'Order',
|
69
|
+
:'created_at' => :'String'
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
# Initializes the object
|
74
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
75
|
+
def initialize(attributes = {})
|
76
|
+
return unless attributes.is_a?(Hash)
|
77
|
+
|
78
|
+
# convert string to symbol for hash key
|
79
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
80
|
+
|
81
|
+
if attributes.has_key?(:'id')
|
82
|
+
self.id = attributes[:'id']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.has_key?(:'checkout_page_url')
|
86
|
+
self.checkout_page_url = attributes[:'checkout_page_url']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.has_key?(:'ask_for_shipping_address')
|
90
|
+
self.ask_for_shipping_address = attributes[:'ask_for_shipping_address']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.has_key?(:'merchant_support_email')
|
94
|
+
self.merchant_support_email = attributes[:'merchant_support_email']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.has_key?(:'pre_populate_buyer_email')
|
98
|
+
self.pre_populate_buyer_email = attributes[:'pre_populate_buyer_email']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.has_key?(:'pre_populate_shipping_address')
|
102
|
+
self.pre_populate_shipping_address = attributes[:'pre_populate_shipping_address']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.has_key?(:'redirect_url')
|
106
|
+
self.redirect_url = attributes[:'redirect_url']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.has_key?(:'order')
|
110
|
+
self.order = attributes[:'order']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.has_key?(:'created_at')
|
114
|
+
self.created_at = attributes[:'created_at']
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
120
|
+
# @return Array for valid properies with the reasons
|
121
|
+
def list_invalid_properties
|
122
|
+
invalid_properties = Array.new
|
123
|
+
return invalid_properties
|
124
|
+
end
|
125
|
+
|
126
|
+
# Check to see if the all the properties in the model are valid
|
127
|
+
# @return true if the model is valid
|
128
|
+
def valid?
|
129
|
+
return true
|
130
|
+
end
|
131
|
+
|
132
|
+
# Checks equality by comparing each attribute.
|
133
|
+
# @param [Object] Object to be compared
|
134
|
+
def ==(o)
|
135
|
+
return true if self.equal?(o)
|
136
|
+
self.class == o.class &&
|
137
|
+
id == o.id &&
|
138
|
+
checkout_page_url == o.checkout_page_url &&
|
139
|
+
ask_for_shipping_address == o.ask_for_shipping_address &&
|
140
|
+
merchant_support_email == o.merchant_support_email &&
|
141
|
+
pre_populate_buyer_email == o.pre_populate_buyer_email &&
|
142
|
+
pre_populate_shipping_address == o.pre_populate_shipping_address &&
|
143
|
+
redirect_url == o.redirect_url &&
|
144
|
+
order == o.order &&
|
145
|
+
created_at == o.created_at
|
146
|
+
end
|
147
|
+
|
148
|
+
# @see the `==` method
|
149
|
+
# @param [Object] Object to be compared
|
150
|
+
def eql?(o)
|
151
|
+
self == o
|
152
|
+
end
|
153
|
+
|
154
|
+
# Calculates hash code according to all attributes.
|
155
|
+
# @return [Fixnum] Hash code
|
156
|
+
def hash
|
157
|
+
[id, checkout_page_url, ask_for_shipping_address, merchant_support_email, pre_populate_buyer_email, pre_populate_shipping_address, redirect_url, order, created_at].hash
|
158
|
+
end
|
159
|
+
|
160
|
+
# Builds the object from hash
|
161
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
162
|
+
# @return [Object] Returns the model itself
|
163
|
+
def build_from_hash(attributes)
|
164
|
+
return nil unless attributes.is_a?(Hash)
|
165
|
+
self.class.swagger_types.each_pair do |key, type|
|
166
|
+
if type =~ /\AArray<(.*)>/i
|
167
|
+
# check to ensure the input is an array given that the the attribute
|
168
|
+
# is documented as an array but the input is not
|
169
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
170
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
171
|
+
end
|
172
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
173
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
174
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
175
|
+
end
|
176
|
+
|
177
|
+
self
|
178
|
+
end
|
179
|
+
|
180
|
+
# Deserializes the data based on type
|
181
|
+
# @param string type Data type
|
182
|
+
# @param string value Value to be deserialized
|
183
|
+
# @return [Object] Deserialized data
|
184
|
+
def _deserialize(type, value)
|
185
|
+
case type.to_sym
|
186
|
+
when :DateTime
|
187
|
+
DateTime.parse(value)
|
188
|
+
when :Date
|
189
|
+
Date.parse(value)
|
190
|
+
when :String
|
191
|
+
value.to_s
|
192
|
+
when :Integer
|
193
|
+
value.to_i
|
194
|
+
when :Float
|
195
|
+
value.to_f
|
196
|
+
when :BOOLEAN
|
197
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
198
|
+
true
|
199
|
+
else
|
200
|
+
false
|
201
|
+
end
|
202
|
+
when :Object
|
203
|
+
# generic object (usually a Hash), return directly
|
204
|
+
value
|
205
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
206
|
+
inner_type = Regexp.last_match[:inner_type]
|
207
|
+
value.map { |v| _deserialize(inner_type, v) }
|
208
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
209
|
+
k_type = Regexp.last_match[:k_type]
|
210
|
+
v_type = Regexp.last_match[:v_type]
|
211
|
+
{}.tap do |hash|
|
212
|
+
value.each do |k, v|
|
213
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
else # model
|
217
|
+
temp_model = SquareConnect.const_get(type).new
|
218
|
+
temp_model.build_from_hash(value)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
# Returns the string representation of the object
|
223
|
+
# @return [String] String presentation of the object
|
224
|
+
def to_s
|
225
|
+
to_hash.to_s
|
226
|
+
end
|
227
|
+
|
228
|
+
# to_body is an alias to to_hash (backward compatibility)
|
229
|
+
# @return [Hash] Returns the object in the form of hash
|
230
|
+
def to_body
|
231
|
+
to_hash
|
232
|
+
end
|
233
|
+
|
234
|
+
# Returns the object in the form of hash
|
235
|
+
# @return [Hash] Returns the object in the form of hash
|
236
|
+
def to_hash
|
237
|
+
hash = {}
|
238
|
+
self.class.attribute_map.each_pair do |attr, param|
|
239
|
+
value = self.send(attr)
|
240
|
+
next if value.nil?
|
241
|
+
hash[param] = _to_hash(value)
|
242
|
+
end
|
243
|
+
hash
|
244
|
+
end
|
245
|
+
|
246
|
+
# Outputs non-array value in the form of hash
|
247
|
+
# For object, use to_hash. Otherwise, just return the value
|
248
|
+
# @param [Object] value Any valid value
|
249
|
+
# @return [Hash] Returns the value in the form of hash
|
250
|
+
def _to_hash(value)
|
251
|
+
if value.is_a?(Array)
|
252
|
+
value.compact.map{ |v| _to_hash(v) }
|
253
|
+
elsif value.is_a?(Hash)
|
254
|
+
{}.tap do |hash|
|
255
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
256
|
+
end
|
257
|
+
elsif value.respond_to? :to_hash
|
258
|
+
value.to_hash
|
259
|
+
else
|
260
|
+
value
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
end
|
265
|
+
|
266
|
+
end
|