square_connect 2.0.2.69 → 2.1.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +133 -21
- data/docs/ChargeRequest.md +1 -1
- data/docs/CheckoutApi.md +8 -6
- data/docs/CustomersApi.md +389 -0
- data/docs/Device.md +11 -0
- data/docs/LocationsApi.md +55 -0
- data/docs/TransactionsApi.md +417 -0
- data/docs/V1AdjustInventoryRequest.md +12 -0
- data/docs/V1BankAccount.md +17 -0
- data/docs/V1CashDrawerEvent.md +15 -0
- data/docs/V1CashDrawerShift.md +28 -0
- data/docs/V1Category.md +11 -0
- data/docs/V1CreateRefundRequest.md +14 -0
- data/docs/V1Discount.md +16 -0
- data/docs/V1Employee.md +21 -0
- data/docs/V1EmployeeRole.md +15 -0
- data/docs/V1EmployeesApi.md +915 -0
- data/docs/V1Fee.md +18 -0
- data/docs/V1InventoryEntry.md +11 -0
- data/docs/V1Item.md +23 -0
- data/docs/V1ItemImage.md +11 -0
- data/docs/V1ItemsApi.md +2297 -0
- data/docs/V1LocationApi.md +102 -0
- data/docs/V1LocationsApi.md +102 -0
- data/docs/V1Merchant.md +26 -0
- data/docs/V1MerchantLocationDetails.md +12 -0
- data/docs/V1ModifierList.md +13 -0
- data/docs/V1ModifierOption.md +15 -0
- data/docs/V1Money.md +13 -0
- data/docs/V1Order.md +34 -0
- data/docs/V1OrderHistoryEntry.md +11 -0
- data/docs/V1Page.md +13 -0
- data/docs/V1PageCell.md +15 -0
- data/docs/V1Payment.md +33 -0
- data/docs/V1PaymentDiscount.md +12 -0
- data/docs/V1PaymentItemDetail.md +13 -0
- data/docs/V1PaymentItemization.md +23 -0
- data/docs/V1PaymentModifier.md +12 -0
- data/docs/V1PaymentTax.md +15 -0
- data/docs/V1PhoneNumber.md +13 -0
- data/docs/V1Refund.md +16 -0
- data/docs/V1Settlement.md +15 -0
- data/docs/V1SettlementEntry.md +13 -0
- data/docs/V1Tender.md +22 -0
- data/docs/V1Timecard.md +20 -0
- data/docs/V1TimecardEvent.md +14 -0
- data/docs/V1TransactionsApi.md +650 -0
- data/docs/V1UpdateModifierListRequest.md +11 -0
- data/docs/V1UpdateOrderRequest.md +14 -0
- data/docs/V1Variation.md +20 -0
- data/lib/.DS_Store +0 -0
- data/lib/square_connect.rb +46 -5
- data/lib/square_connect/.DS_Store +0 -0
- data/lib/square_connect/api/checkout_api.rb +4 -9
- data/lib/square_connect/api/{customer_api.rb → customers_api.rb} +150 -61
- data/lib/square_connect/api/{location_api.rb → locations_api.rb} +7 -12
- data/lib/square_connect/api/{transaction_api.rb → transactions_api.rb} +169 -65
- data/lib/square_connect/api/v1_employees_api.rb +974 -0
- data/lib/square_connect/api/v1_items_api.rb +2365 -0
- data/lib/square_connect/api/v1_locations_api.rb +118 -0
- data/lib/square_connect/api/v1_transactions_api.rb +707 -0
- data/lib/square_connect/api_client.rb +1 -1
- data/lib/square_connect/models/charge_request.rb +1 -1
- data/lib/square_connect/models/device.rb +196 -0
- data/lib/square_connect/models/v1_adjust_inventory_request.rb +206 -0
- data/lib/square_connect/models/v1_bank_account.rb +289 -0
- data/lib/square_connect/models/v1_cash_drawer_event.rb +269 -0
- data/lib/square_connect/models/v1_cash_drawer_shift.rb +403 -0
- data/lib/square_connect/models/v1_category.rb +196 -0
- data/lib/square_connect/models/v1_create_refund_request.rb +274 -0
- data/lib/square_connect/models/v1_discount.rb +291 -0
- data/lib/square_connect/models/v1_employee.rb +323 -0
- data/lib/square_connect/models/v1_employee_role.rb +269 -0
- data/lib/square_connect/models/v1_fee.rb +335 -0
- data/lib/square_connect/models/v1_inventory_entry.rb +196 -0
- data/lib/square_connect/models/v1_item.rb +379 -0
- data/lib/square_connect/models/v1_item_image.rb +196 -0
- data/lib/square_connect/models/v1_merchant.rb +372 -0
- data/lib/square_connect/models/v1_merchant_location_details.rb +186 -0
- data/lib/square_connect/models/v1_modifier_list.rb +251 -0
- data/lib/square_connect/models/v1_modifier_option.rb +236 -0
- data/lib/square_connect/models/v1_money.rb +229 -0
- data/lib/square_connect/models/v1_order.rb +463 -0
- data/lib/square_connect/models/v1_order_history_entry.rb +229 -0
- data/lib/square_connect/models/v1_page.rb +218 -0
- data/lib/square_connect/models/v1_page_cell.rb +261 -0
- data/lib/square_connect/models/v1_payment.rb +423 -0
- data/lib/square_connect/models/v1_payment_discount.rb +206 -0
- data/lib/square_connect/models/v1_payment_item_detail.rb +216 -0
- data/lib/square_connect/models/v1_payment_itemization.rb +355 -0
- data/lib/square_connect/models/v1_payment_modifier.rb +206 -0
- data/lib/square_connect/models/v1_payment_tax.rb +271 -0
- data/lib/square_connect/models/v1_phone_number.rb +206 -0
- data/lib/square_connect/models/v1_refund.rb +279 -0
- data/lib/square_connect/models/v1_settlement.rb +271 -0
- data/lib/square_connect/models/v1_settlement_entry.rb +249 -0
- data/lib/square_connect/models/v1_tender.rb +363 -0
- data/lib/square_connect/models/v1_timecard.rb +271 -0
- data/lib/square_connect/models/v1_timecard_event.rb +259 -0
- data/lib/square_connect/models/v1_update_modifier_list_request.rb +229 -0
- data/lib/square_connect/models/v1_update_order_request.rb +264 -0
- data/lib/square_connect/models/v1_variation.rb +331 -0
- data/lib/square_connect/version.rb +1 -1
- data/spec/.DS_Store +0 -0
- data/spec/api/checkout_api_spec.rb +4 -12
- data/spec/api/{customer_api_spec.rb → customers_api_spec.rb} +39 -41
- data/spec/api/{location_api_spec.rb → locations_api_spec.rb} +9 -15
- data/spec/api/{transaction_api_spec.rb → transactions_api_spec.rb} +43 -41
- data/spec/api/v1_employees_api_spec.rb +250 -0
- data/spec/api/v1_items_api_spec.rb +568 -0
- data/spec/api/v1_locations_api_spec.rb +54 -0
- data/spec/api/v1_transactions_api_spec.rb +186 -0
- data/spec/models/address_spec.rb +22 -81
- data/spec/models/capture_transaction_request_spec.rb +3 -6
- data/spec/models/capture_transaction_response_spec.rb +4 -11
- data/spec/models/card_brand_spec.rb +3 -6
- data/spec/models/card_spec.rb +14 -41
- data/spec/models/charge_request_spec.rb +14 -61
- data/spec/models/charge_response_spec.rb +5 -16
- data/spec/models/checkout_spec.rb +12 -51
- data/spec/models/country_spec.rb +3 -6
- data/spec/models/create_checkout_request_spec.rb +10 -41
- data/spec/models/create_checkout_response_spec.rb +5 -16
- data/spec/models/create_customer_card_request_spec.rb +6 -21
- data/spec/models/create_customer_card_response_spec.rb +5 -16
- data/spec/models/create_customer_request_spec.rb +12 -51
- data/spec/models/create_customer_response_spec.rb +5 -16
- data/spec/models/create_order_request_line_item_spec.rb +6 -21
- data/spec/models/create_order_request_order_spec.rb +5 -16
- data/spec/models/create_order_request_spec.rb +5 -16
- data/spec/models/create_refund_request_spec.rb +7 -26
- data/spec/models/create_refund_response_spec.rb +5 -16
- data/spec/models/currency_spec.rb +3 -6
- data/spec/models/customer_group_info_spec.rb +5 -16
- data/spec/models/customer_preferences_spec.rb +4 -11
- data/spec/models/customer_spec.rb +18 -81
- data/spec/models/delete_customer_card_request_spec.rb +3 -6
- data/spec/models/delete_customer_card_response_spec.rb +4 -11
- data/spec/models/delete_customer_request_spec.rb +3 -6
- data/spec/models/delete_customer_response_spec.rb +4 -11
- data/spec/models/device_spec.rb +45 -0
- data/spec/models/error_category_spec.rb +3 -6
- data/spec/models/error_code_spec.rb +3 -6
- data/spec/models/error_spec.rb +15 -26
- data/spec/models/list_customers_request_spec.rb +4 -11
- data/spec/models/list_customers_response_spec.rb +6 -21
- data/spec/models/list_locations_request_spec.rb +3 -6
- data/spec/models/list_locations_response_spec.rb +5 -16
- data/spec/models/list_refunds_request_spec.rb +11 -26
- data/spec/models/list_refunds_response_spec.rb +6 -21
- data/spec/models/list_transactions_request_spec.rb +11 -26
- data/spec/models/list_transactions_response_spec.rb +6 -21
- data/spec/models/location_capability_spec.rb +3 -6
- data/spec/models/location_spec.rb +12 -31
- data/spec/models/money_spec.rb +9 -16
- data/spec/models/order_line_item_spec.rb +8 -31
- data/spec/models/order_spec.rb +8 -31
- data/spec/models/refund_spec.rb +16 -51
- data/spec/models/refund_status_spec.rb +3 -6
- data/spec/models/retrieve_customer_request_spec.rb +3 -6
- data/spec/models/retrieve_customer_response_spec.rb +5 -16
- data/spec/models/retrieve_transaction_request_spec.rb +3 -6
- data/spec/models/retrieve_transaction_response_spec.rb +5 -16
- data/spec/models/sort_order_spec.rb +3 -6
- data/spec/models/tender_card_details_entry_method_spec.rb +3 -6
- data/spec/models/tender_card_details_spec.rb +14 -21
- data/spec/models/tender_card_details_status_spec.rb +3 -6
- data/spec/models/tender_cash_details_spec.rb +5 -16
- data/spec/models/tender_spec.rb +18 -61
- data/spec/models/tender_type_spec.rb +3 -6
- data/spec/models/transaction_product_spec.rb +3 -6
- data/spec/models/transaction_spec.rb +17 -56
- data/spec/models/update_customer_request_spec.rb +12 -51
- data/spec/models/update_customer_response_spec.rb +5 -16
- data/spec/models/v1_adjust_inventory_request_spec.rb +51 -0
- data/spec/models/v1_bank_account_spec.rb +85 -0
- data/spec/models/v1_cash_drawer_event_spec.rb +73 -0
- data/spec/models/v1_cash_drawer_shift_spec.rb +151 -0
- data/spec/models/v1_category_spec.rb +45 -0
- data/spec/models/v1_create_refund_request_spec.rb +67 -0
- data/spec/models/v1_discount_spec.rb +83 -0
- data/spec/models/v1_employee_role_spec.rb +73 -0
- data/spec/models/v1_employee_spec.rb +97 -0
- data/spec/models/v1_fee_spec.rb +103 -0
- data/spec/models/v1_inventory_entry_spec.rb +45 -0
- data/spec/models/v1_item_image_spec.rb +45 -0
- data/spec/models/v1_item_spec.rb +129 -0
- data/spec/models/v1_merchant_location_details_spec.rb +39 -0
- data/spec/models/v1_merchant_spec.rb +131 -0
- data/spec/models/v1_modifier_list_spec.rb +61 -0
- data/spec/models/v1_modifier_option_spec.rb +69 -0
- data/spec/models/v1_money_spec.rb +49 -0
- data/spec/models/v1_order_history_entry_spec.rb +49 -0
- data/spec/models/v1_order_spec.rb +187 -0
- data/spec/models/v1_page_cell_spec.rb +77 -0
- data/spec/models/v1_page_spec.rb +57 -0
- data/spec/models/v1_payment_discount_spec.rb +51 -0
- data/spec/models/v1_payment_item_detail_spec.rb +57 -0
- data/spec/models/v1_payment_itemization_spec.rb +121 -0
- data/spec/models/v1_payment_modifier_spec.rb +51 -0
- data/spec/models/v1_payment_spec.rb +177 -0
- data/spec/models/v1_payment_tax_spec.rb +73 -0
- data/spec/models/v1_phone_number_spec.rb +45 -0
- data/spec/models/v1_refund_spec.rb +79 -0
- data/spec/models/v1_settlement_entry_spec.rb +61 -0
- data/spec/models/v1_settlement_spec.rb +73 -0
- data/spec/models/v1_tender_spec.rb +123 -0
- data/spec/models/v1_timecard_event_spec.rb +67 -0
- data/spec/models/v1_timecard_spec.rb +87 -0
- data/spec/models/v1_update_modifier_list_request_spec.rb +49 -0
- data/spec/models/v1_update_order_request_spec.rb +67 -0
- data/spec/models/v1_variation_spec.rb +107 -0
- data/spec/models/void_transaction_request_spec.rb +3 -6
- data/spec/models/void_transaction_response_spec.rb +4 -11
- data/spec/spec_helper.rb +10 -0
- data/square_connect-2.0.2.gem +0 -0
- data/square_connect-2.1.0.gem +0 -0
- data/square_connect-2.1.0beta.gem +0 -0
- data/square_connect.gemspec +1 -1
- data/travis-ci/accounts.enc +0 -0
- metadata +197 -26
- data/docs/CustomerApi.md +0 -267
- data/docs/CustomerCardApi.md +0 -116
- data/docs/LocationApi.md +0 -56
- data/docs/RefundApi.md +0 -126
- data/docs/TransactionApi.md +0 -285
- data/lib/square_connect/api/customer_card_api.rb +0 -144
- data/lib/square_connect/api/refund_api.rb +0 -159
- data/spec/api/customer_card_api_spec.rb +0 -71
- data/spec/api/refund_api_spec.rb +0 -75
@@ -0,0 +1,196 @@
|
|
1
|
+
=begin
|
2
|
+
#Square Connect API
|
3
|
+
|
4
|
+
OpenAPI spec version: 2.0
|
5
|
+
Contact: developers@squareup.com
|
6
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
|
+
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'date'
|
11
|
+
|
12
|
+
module SquareConnect
|
13
|
+
|
14
|
+
class V1ItemImage
|
15
|
+
# The image's unique ID.
|
16
|
+
attr_accessor :id
|
17
|
+
|
18
|
+
# The image's publicly accessible URL.
|
19
|
+
attr_accessor :url
|
20
|
+
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'id' => :'id',
|
26
|
+
:'url' => :'url'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Attribute type mapping.
|
31
|
+
def self.swagger_types
|
32
|
+
{
|
33
|
+
:'id' => :'String',
|
34
|
+
:'url' => :'String'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Initializes the object
|
39
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
40
|
+
def initialize(attributes = {})
|
41
|
+
return unless attributes.is_a?(Hash)
|
42
|
+
|
43
|
+
# convert string to symbol for hash key
|
44
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
45
|
+
|
46
|
+
if attributes.has_key?(:'id')
|
47
|
+
self.id = attributes[:'id']
|
48
|
+
end
|
49
|
+
|
50
|
+
if attributes.has_key?(:'url')
|
51
|
+
self.url = attributes[:'url']
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
57
|
+
# @return Array for valid properies with the reasons
|
58
|
+
def list_invalid_properties
|
59
|
+
invalid_properties = Array.new
|
60
|
+
return invalid_properties
|
61
|
+
end
|
62
|
+
|
63
|
+
# Check to see if the all the properties in the model are valid
|
64
|
+
# @return true if the model is valid
|
65
|
+
def valid?
|
66
|
+
return true
|
67
|
+
end
|
68
|
+
|
69
|
+
# Checks equality by comparing each attribute.
|
70
|
+
# @param [Object] Object to be compared
|
71
|
+
def ==(o)
|
72
|
+
return true if self.equal?(o)
|
73
|
+
self.class == o.class &&
|
74
|
+
id == o.id &&
|
75
|
+
url == o.url
|
76
|
+
end
|
77
|
+
|
78
|
+
# @see the `==` method
|
79
|
+
# @param [Object] Object to be compared
|
80
|
+
def eql?(o)
|
81
|
+
self == o
|
82
|
+
end
|
83
|
+
|
84
|
+
# Calculates hash code according to all attributes.
|
85
|
+
# @return [Fixnum] Hash code
|
86
|
+
def hash
|
87
|
+
[id, url].hash
|
88
|
+
end
|
89
|
+
|
90
|
+
# Builds the object from hash
|
91
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
92
|
+
# @return [Object] Returns the model itself
|
93
|
+
def build_from_hash(attributes)
|
94
|
+
return nil unless attributes.is_a?(Hash)
|
95
|
+
self.class.swagger_types.each_pair do |key, type|
|
96
|
+
if type =~ /\AArray<(.*)>/i
|
97
|
+
# check to ensure the input is an array given that the the attribute
|
98
|
+
# is documented as an array but the input is not
|
99
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
100
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
101
|
+
end
|
102
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
103
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
104
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
105
|
+
end
|
106
|
+
|
107
|
+
self
|
108
|
+
end
|
109
|
+
|
110
|
+
# Deserializes the data based on type
|
111
|
+
# @param string type Data type
|
112
|
+
# @param string value Value to be deserialized
|
113
|
+
# @return [Object] Deserialized data
|
114
|
+
def _deserialize(type, value)
|
115
|
+
case type.to_sym
|
116
|
+
when :DateTime
|
117
|
+
DateTime.parse(value)
|
118
|
+
when :Date
|
119
|
+
Date.parse(value)
|
120
|
+
when :String
|
121
|
+
value.to_s
|
122
|
+
when :Integer
|
123
|
+
value.to_i
|
124
|
+
when :Float
|
125
|
+
value.to_f
|
126
|
+
when :BOOLEAN
|
127
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
128
|
+
true
|
129
|
+
else
|
130
|
+
false
|
131
|
+
end
|
132
|
+
when :Object
|
133
|
+
# generic object (usually a Hash), return directly
|
134
|
+
value
|
135
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
136
|
+
inner_type = Regexp.last_match[:inner_type]
|
137
|
+
value.map { |v| _deserialize(inner_type, v) }
|
138
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
139
|
+
k_type = Regexp.last_match[:k_type]
|
140
|
+
v_type = Regexp.last_match[:v_type]
|
141
|
+
{}.tap do |hash|
|
142
|
+
value.each do |k, v|
|
143
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
else # model
|
147
|
+
temp_model = SquareConnect.const_get(type).new
|
148
|
+
temp_model.build_from_hash(value)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
# Returns the string representation of the object
|
153
|
+
# @return [String] String presentation of the object
|
154
|
+
def to_s
|
155
|
+
to_hash.to_s
|
156
|
+
end
|
157
|
+
|
158
|
+
# to_body is an alias to to_hash (backward compatibility)
|
159
|
+
# @return [Hash] Returns the object in the form of hash
|
160
|
+
def to_body
|
161
|
+
to_hash
|
162
|
+
end
|
163
|
+
|
164
|
+
# Returns the object in the form of hash
|
165
|
+
# @return [Hash] Returns the object in the form of hash
|
166
|
+
def to_hash
|
167
|
+
hash = {}
|
168
|
+
self.class.attribute_map.each_pair do |attr, param|
|
169
|
+
value = self.send(attr)
|
170
|
+
next if value.nil?
|
171
|
+
hash[param] = _to_hash(value)
|
172
|
+
end
|
173
|
+
hash
|
174
|
+
end
|
175
|
+
|
176
|
+
# Outputs non-array value in the form of hash
|
177
|
+
# For object, use to_hash. Otherwise, just return the value
|
178
|
+
# @param [Object] value Any valid value
|
179
|
+
# @return [Hash] Returns the value in the form of hash
|
180
|
+
def _to_hash(value)
|
181
|
+
if value.is_a?(Array)
|
182
|
+
value.compact.map{ |v| _to_hash(v) }
|
183
|
+
elsif value.is_a?(Hash)
|
184
|
+
{}.tap do |hash|
|
185
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
186
|
+
end
|
187
|
+
elsif value.respond_to? :to_hash
|
188
|
+
value.to_hash
|
189
|
+
else
|
190
|
+
value
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
195
|
+
|
196
|
+
end
|
@@ -0,0 +1,372 @@
|
|
1
|
+
=begin
|
2
|
+
#Square Connect API
|
3
|
+
|
4
|
+
OpenAPI spec version: 2.0
|
5
|
+
Contact: developers@squareup.com
|
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 fields that are included in the response body of a request to the **RetrieveBusiness** endpoint.
|
14
|
+
class V1Merchant
|
15
|
+
# The merchant account's unique identifier.
|
16
|
+
attr_accessor :id
|
17
|
+
|
18
|
+
# The name associated with the merchant account.
|
19
|
+
attr_accessor :name
|
20
|
+
|
21
|
+
# The email address associated with the merchant account.
|
22
|
+
attr_accessor :email
|
23
|
+
|
24
|
+
# Indicates whether the merchant account corresponds to a single-location account (LOCATION) or a business account (BUSINESS). This value is almost always LOCATION.
|
25
|
+
attr_accessor :account_type
|
26
|
+
|
27
|
+
# Capabilities that are enabled for the merchant's Square account. Capabilities that are not listed in this array are not enabled for the account.
|
28
|
+
attr_accessor :account_capabilities
|
29
|
+
|
30
|
+
# The country associated with the merchant account, in ISO 3166-1-alpha-2 format.
|
31
|
+
attr_accessor :country_code
|
32
|
+
|
33
|
+
# The language associated with the merchant account, in BCP 47 format.
|
34
|
+
attr_accessor :language_code
|
35
|
+
|
36
|
+
# The currency associated with the merchant account, in ISO 4217 format. For example, the currency code for US dollars is USD.
|
37
|
+
attr_accessor :currency_code
|
38
|
+
|
39
|
+
# The name of the merchant's business.
|
40
|
+
attr_accessor :business_name
|
41
|
+
|
42
|
+
# The address of the merchant's business.
|
43
|
+
attr_accessor :business_address
|
44
|
+
|
45
|
+
# The phone number of the merchant's business.
|
46
|
+
attr_accessor :business_phone
|
47
|
+
|
48
|
+
# The type of business operated by the merchant.
|
49
|
+
attr_accessor :business_type
|
50
|
+
|
51
|
+
# The merchant's shipping address.
|
52
|
+
attr_accessor :shipping_address_
|
53
|
+
|
54
|
+
attr_accessor :location_details
|
55
|
+
|
56
|
+
# The URL of the merchant's online store.
|
57
|
+
attr_accessor :market_url
|
58
|
+
|
59
|
+
class EnumAttributeValidator
|
60
|
+
attr_reader :datatype
|
61
|
+
attr_reader :allowable_values
|
62
|
+
|
63
|
+
def initialize(datatype, allowable_values)
|
64
|
+
@allowable_values = allowable_values.map do |value|
|
65
|
+
case datatype.to_s
|
66
|
+
when /Integer/i
|
67
|
+
value.to_i
|
68
|
+
when /Float/i
|
69
|
+
value.to_f
|
70
|
+
else
|
71
|
+
value
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def valid?(value)
|
77
|
+
!value || allowable_values.include?(value)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
82
|
+
def self.attribute_map
|
83
|
+
{
|
84
|
+
:'id' => :'id',
|
85
|
+
:'name' => :'name',
|
86
|
+
:'email' => :'email',
|
87
|
+
:'account_type' => :'account_type',
|
88
|
+
:'account_capabilities' => :'account_capabilities',
|
89
|
+
:'country_code' => :'country_code',
|
90
|
+
:'language_code' => :'language_code',
|
91
|
+
:'currency_code' => :'currency_code',
|
92
|
+
:'business_name' => :'business_name',
|
93
|
+
:'business_address' => :'business_address',
|
94
|
+
:'business_phone' => :'business_phone',
|
95
|
+
:'business_type' => :'business_type',
|
96
|
+
:'shipping_address_' => :'shipping_address ',
|
97
|
+
:'location_details' => :'location_details',
|
98
|
+
:'market_url' => :'market_url'
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
102
|
+
# Attribute type mapping.
|
103
|
+
def self.swagger_types
|
104
|
+
{
|
105
|
+
:'id' => :'String',
|
106
|
+
:'name' => :'String',
|
107
|
+
:'email' => :'String',
|
108
|
+
:'account_type' => :'String',
|
109
|
+
:'account_capabilities' => :'Array<String>',
|
110
|
+
:'country_code' => :'String',
|
111
|
+
:'language_code' => :'String',
|
112
|
+
:'currency_code' => :'String',
|
113
|
+
:'business_name' => :'String',
|
114
|
+
:'business_address' => :'Address',
|
115
|
+
:'business_phone' => :'V1PhoneNumber',
|
116
|
+
:'business_type' => :'String',
|
117
|
+
:'shipping_address_' => :'Address',
|
118
|
+
:'location_details' => :'V1MerchantLocationDetails',
|
119
|
+
:'market_url' => :'String'
|
120
|
+
}
|
121
|
+
end
|
122
|
+
|
123
|
+
# Initializes the object
|
124
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
125
|
+
def initialize(attributes = {})
|
126
|
+
return unless attributes.is_a?(Hash)
|
127
|
+
|
128
|
+
# convert string to symbol for hash key
|
129
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
130
|
+
|
131
|
+
if attributes.has_key?(:'id')
|
132
|
+
self.id = attributes[:'id']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.has_key?(:'name')
|
136
|
+
self.name = attributes[:'name']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.has_key?(:'email')
|
140
|
+
self.email = attributes[:'email']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.has_key?(:'account_type')
|
144
|
+
self.account_type = attributes[:'account_type']
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.has_key?(:'account_capabilities')
|
148
|
+
if (value = attributes[:'account_capabilities']).is_a?(Array)
|
149
|
+
self.account_capabilities = value
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.has_key?(:'country_code')
|
154
|
+
self.country_code = attributes[:'country_code']
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.has_key?(:'language_code')
|
158
|
+
self.language_code = attributes[:'language_code']
|
159
|
+
end
|
160
|
+
|
161
|
+
if attributes.has_key?(:'currency_code')
|
162
|
+
self.currency_code = attributes[:'currency_code']
|
163
|
+
end
|
164
|
+
|
165
|
+
if attributes.has_key?(:'business_name')
|
166
|
+
self.business_name = attributes[:'business_name']
|
167
|
+
end
|
168
|
+
|
169
|
+
if attributes.has_key?(:'business_address')
|
170
|
+
self.business_address = attributes[:'business_address']
|
171
|
+
end
|
172
|
+
|
173
|
+
if attributes.has_key?(:'business_phone')
|
174
|
+
self.business_phone = attributes[:'business_phone']
|
175
|
+
end
|
176
|
+
|
177
|
+
if attributes.has_key?(:'business_type')
|
178
|
+
self.business_type = attributes[:'business_type']
|
179
|
+
end
|
180
|
+
|
181
|
+
if attributes.has_key?(:'shipping_address ')
|
182
|
+
self.shipping_address_ = attributes[:'shipping_address ']
|
183
|
+
end
|
184
|
+
|
185
|
+
if attributes.has_key?(:'location_details')
|
186
|
+
self.location_details = attributes[:'location_details']
|
187
|
+
end
|
188
|
+
|
189
|
+
if attributes.has_key?(:'market_url')
|
190
|
+
self.market_url = attributes[:'market_url']
|
191
|
+
end
|
192
|
+
|
193
|
+
end
|
194
|
+
|
195
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
196
|
+
# @return Array for valid properies with the reasons
|
197
|
+
def list_invalid_properties
|
198
|
+
invalid_properties = Array.new
|
199
|
+
return invalid_properties
|
200
|
+
end
|
201
|
+
|
202
|
+
# Check to see if the all the properties in the model are valid
|
203
|
+
# @return true if the model is valid
|
204
|
+
def valid?
|
205
|
+
account_type_validator = EnumAttributeValidator.new('String', ["LOCATION", "BUSINESS"])
|
206
|
+
return false unless account_type_validator.valid?(@account_type)
|
207
|
+
business_type_validator = EnumAttributeValidator.new('String', ["ACCOUNTING", "APPAREL_AND_ACCESSORY_SHOPS", "ART_DEALERS_GALLERIES", "ART_DESIGN_AND_PHOTOGRAPHY", "BAR_CLUB_LOUNGE", "BEAUTY_AND_BARBER_SHOPS", "BOOK_STORES", "BUSINESS_SERVICES", "CATERING", "CHARITABLE_SOCIAL_SERVICE_ORGANIZATIONS", "CHARITIBLE_ORGS", "CLEANING_SERVICES", "COMPUTER_EQUIPMENT_SOFTWARE_MAINTENANCE_REPAIR_SERVICES", "CONSULTANT", "CONTRACTORS", "DELIVERY_SERVICES", "DENTISTRY", "EDUCATION", "FOOD_STORES_CONVENIENCE_STORES_AND_SPECIALTY_MARKETS", "FOOD_TRUCK_CART", "FURNITURE_HOME_AND_OFFICE_EQUIPMENT", "FURNITURE_HOME_GOODS", "HOTELS_AND_LODGING", "INDIVIDUAL_USE", "JEWELRY_AND_WATCHES", "LANDSCAPING_AND_HORTICULTURAL_SERVICES", "LANGUAGE_SCHOOLS", "LEGAL_SERVICES", "MEDICAL_PRACTITIONERS", "MEDICAL_SERVICES_AND_HEALTH_PRACTITIONERS", "MEMBERSHIP_ORGANIZATIONS", "MUSIC_AND_ENTERTAINMENT", "OTHER", "OUTDOOR_MARKETS", "PERSONAL_SERVICES", "POLITICAL_ORGANIZATIONS", "PROFESSIONAL_SERVICES", "REAL_ESTATE", "RECREATION_SERVICES", "REPAIR_SHOPS_AND_RELATED_SERVICES", "RESTAURANTS", "RETAIL_SHOPS", "SCHOOLS_AND_EDUCATIONAL_SERVICES", "SPORTING_GOODS", "TAXICABS_AND_LIMOUSINES", "TICKET_SALES", "TOURISM", "TRAVEL_TOURISM", "VETERINARY_SERVICES", "WEB_DEV_DESIGN"])
|
208
|
+
return false unless business_type_validator.valid?(@business_type)
|
209
|
+
return true
|
210
|
+
end
|
211
|
+
|
212
|
+
# Custom attribute writer method checking allowed values (enum).
|
213
|
+
# @param [Object] account_type Object to be assigned
|
214
|
+
def account_type=(account_type)
|
215
|
+
validator = EnumAttributeValidator.new('String', ["LOCATION", "BUSINESS"])
|
216
|
+
unless validator.valid?(account_type)
|
217
|
+
fail ArgumentError, "invalid value for 'account_type', must be one of #{validator.allowable_values}."
|
218
|
+
end
|
219
|
+
@account_type = account_type
|
220
|
+
end
|
221
|
+
|
222
|
+
# Custom attribute writer method checking allowed values (enum).
|
223
|
+
# @param [Object] business_type Object to be assigned
|
224
|
+
def business_type=(business_type)
|
225
|
+
validator = EnumAttributeValidator.new('String', ["ACCOUNTING", "APPAREL_AND_ACCESSORY_SHOPS", "ART_DEALERS_GALLERIES", "ART_DESIGN_AND_PHOTOGRAPHY", "BAR_CLUB_LOUNGE", "BEAUTY_AND_BARBER_SHOPS", "BOOK_STORES", "BUSINESS_SERVICES", "CATERING", "CHARITABLE_SOCIAL_SERVICE_ORGANIZATIONS", "CHARITIBLE_ORGS", "CLEANING_SERVICES", "COMPUTER_EQUIPMENT_SOFTWARE_MAINTENANCE_REPAIR_SERVICES", "CONSULTANT", "CONTRACTORS", "DELIVERY_SERVICES", "DENTISTRY", "EDUCATION", "FOOD_STORES_CONVENIENCE_STORES_AND_SPECIALTY_MARKETS", "FOOD_TRUCK_CART", "FURNITURE_HOME_AND_OFFICE_EQUIPMENT", "FURNITURE_HOME_GOODS", "HOTELS_AND_LODGING", "INDIVIDUAL_USE", "JEWELRY_AND_WATCHES", "LANDSCAPING_AND_HORTICULTURAL_SERVICES", "LANGUAGE_SCHOOLS", "LEGAL_SERVICES", "MEDICAL_PRACTITIONERS", "MEDICAL_SERVICES_AND_HEALTH_PRACTITIONERS", "MEMBERSHIP_ORGANIZATIONS", "MUSIC_AND_ENTERTAINMENT", "OTHER", "OUTDOOR_MARKETS", "PERSONAL_SERVICES", "POLITICAL_ORGANIZATIONS", "PROFESSIONAL_SERVICES", "REAL_ESTATE", "RECREATION_SERVICES", "REPAIR_SHOPS_AND_RELATED_SERVICES", "RESTAURANTS", "RETAIL_SHOPS", "SCHOOLS_AND_EDUCATIONAL_SERVICES", "SPORTING_GOODS", "TAXICABS_AND_LIMOUSINES", "TICKET_SALES", "TOURISM", "TRAVEL_TOURISM", "VETERINARY_SERVICES", "WEB_DEV_DESIGN"])
|
226
|
+
unless validator.valid?(business_type)
|
227
|
+
fail ArgumentError, "invalid value for 'business_type', must be one of #{validator.allowable_values}."
|
228
|
+
end
|
229
|
+
@business_type = business_type
|
230
|
+
end
|
231
|
+
|
232
|
+
# Checks equality by comparing each attribute.
|
233
|
+
# @param [Object] Object to be compared
|
234
|
+
def ==(o)
|
235
|
+
return true if self.equal?(o)
|
236
|
+
self.class == o.class &&
|
237
|
+
id == o.id &&
|
238
|
+
name == o.name &&
|
239
|
+
email == o.email &&
|
240
|
+
account_type == o.account_type &&
|
241
|
+
account_capabilities == o.account_capabilities &&
|
242
|
+
country_code == o.country_code &&
|
243
|
+
language_code == o.language_code &&
|
244
|
+
currency_code == o.currency_code &&
|
245
|
+
business_name == o.business_name &&
|
246
|
+
business_address == o.business_address &&
|
247
|
+
business_phone == o.business_phone &&
|
248
|
+
business_type == o.business_type &&
|
249
|
+
shipping_address_ == o.shipping_address_ &&
|
250
|
+
location_details == o.location_details &&
|
251
|
+
market_url == o.market_url
|
252
|
+
end
|
253
|
+
|
254
|
+
# @see the `==` method
|
255
|
+
# @param [Object] Object to be compared
|
256
|
+
def eql?(o)
|
257
|
+
self == o
|
258
|
+
end
|
259
|
+
|
260
|
+
# Calculates hash code according to all attributes.
|
261
|
+
# @return [Fixnum] Hash code
|
262
|
+
def hash
|
263
|
+
[id, name, email, account_type, account_capabilities, country_code, language_code, currency_code, business_name, business_address, business_phone, business_type, shipping_address_, location_details, market_url].hash
|
264
|
+
end
|
265
|
+
|
266
|
+
# Builds the object from hash
|
267
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
268
|
+
# @return [Object] Returns the model itself
|
269
|
+
def build_from_hash(attributes)
|
270
|
+
return nil unless attributes.is_a?(Hash)
|
271
|
+
self.class.swagger_types.each_pair do |key, type|
|
272
|
+
if type =~ /\AArray<(.*)>/i
|
273
|
+
# check to ensure the input is an array given that the the attribute
|
274
|
+
# is documented as an array but the input is not
|
275
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
276
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
277
|
+
end
|
278
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
279
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
280
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
281
|
+
end
|
282
|
+
|
283
|
+
self
|
284
|
+
end
|
285
|
+
|
286
|
+
# Deserializes the data based on type
|
287
|
+
# @param string type Data type
|
288
|
+
# @param string value Value to be deserialized
|
289
|
+
# @return [Object] Deserialized data
|
290
|
+
def _deserialize(type, value)
|
291
|
+
case type.to_sym
|
292
|
+
when :DateTime
|
293
|
+
DateTime.parse(value)
|
294
|
+
when :Date
|
295
|
+
Date.parse(value)
|
296
|
+
when :String
|
297
|
+
value.to_s
|
298
|
+
when :Integer
|
299
|
+
value.to_i
|
300
|
+
when :Float
|
301
|
+
value.to_f
|
302
|
+
when :BOOLEAN
|
303
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
304
|
+
true
|
305
|
+
else
|
306
|
+
false
|
307
|
+
end
|
308
|
+
when :Object
|
309
|
+
# generic object (usually a Hash), return directly
|
310
|
+
value
|
311
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
312
|
+
inner_type = Regexp.last_match[:inner_type]
|
313
|
+
value.map { |v| _deserialize(inner_type, v) }
|
314
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
315
|
+
k_type = Regexp.last_match[:k_type]
|
316
|
+
v_type = Regexp.last_match[:v_type]
|
317
|
+
{}.tap do |hash|
|
318
|
+
value.each do |k, v|
|
319
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
320
|
+
end
|
321
|
+
end
|
322
|
+
else # model
|
323
|
+
temp_model = SquareConnect.const_get(type).new
|
324
|
+
temp_model.build_from_hash(value)
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
# Returns the string representation of the object
|
329
|
+
# @return [String] String presentation of the object
|
330
|
+
def to_s
|
331
|
+
to_hash.to_s
|
332
|
+
end
|
333
|
+
|
334
|
+
# to_body is an alias to to_hash (backward compatibility)
|
335
|
+
# @return [Hash] Returns the object in the form of hash
|
336
|
+
def to_body
|
337
|
+
to_hash
|
338
|
+
end
|
339
|
+
|
340
|
+
# Returns the object in the form of hash
|
341
|
+
# @return [Hash] Returns the object in the form of hash
|
342
|
+
def to_hash
|
343
|
+
hash = {}
|
344
|
+
self.class.attribute_map.each_pair do |attr, param|
|
345
|
+
value = self.send(attr)
|
346
|
+
next if value.nil?
|
347
|
+
hash[param] = _to_hash(value)
|
348
|
+
end
|
349
|
+
hash
|
350
|
+
end
|
351
|
+
|
352
|
+
# Outputs non-array value in the form of hash
|
353
|
+
# For object, use to_hash. Otherwise, just return the value
|
354
|
+
# @param [Object] value Any valid value
|
355
|
+
# @return [Hash] Returns the value in the form of hash
|
356
|
+
def _to_hash(value)
|
357
|
+
if value.is_a?(Array)
|
358
|
+
value.compact.map{ |v| _to_hash(v) }
|
359
|
+
elsif value.is_a?(Hash)
|
360
|
+
{}.tap do |hash|
|
361
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
362
|
+
end
|
363
|
+
elsif value.respond_to? :to_hash
|
364
|
+
value.to_hash
|
365
|
+
else
|
366
|
+
value
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
370
|
+
end
|
371
|
+
|
372
|
+
end
|