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
@@ -30,7 +30,7 @@ module SquareConnect
|
|
30
30
|
@config = config
|
31
31
|
|
32
32
|
# Construct user agent string. Returns slightly different string for JRuby
|
33
|
-
@user_agent = "Square-Connect-Ruby/2.0
|
33
|
+
@user_agent = "Square-Connect-Ruby/2.1.0"
|
34
34
|
|
35
35
|
@default_headers = {
|
36
36
|
'Content-Type' => "application/json",
|
@@ -24,7 +24,7 @@ module SquareConnect
|
|
24
24
|
# The ID of the customer card on file to charge. Do not provide a value for this field if you provide a value for `card_nonce`. If you provide this value, you _must_ also provide a value for `customer_id`.
|
25
25
|
attr_accessor :customer_card_id
|
26
26
|
|
27
|
-
# If `true`, the request will only perform an Auth on the provided card. You can then later perform either a Capture (with the [CaptureTransaction](#endpoint-capturetransaction) endpoint) or a Void (with the [
|
27
|
+
# If `true`, the request will only perform an Auth on the provided card. You can then later perform either a Capture (with the [CaptureTransaction](#endpoint-capturetransaction) endpoint) or a Void (with the [VoidTransaction](#endpoint-voidtransaction) endpoint). Default value: `false`
|
28
28
|
attr_accessor :delay_capture
|
29
29
|
|
30
30
|
# An optional ID you can associate with the transaction for your own purposes (such as to associate the transaction with an entity ID in your own database). This value cannot exceed 40 characters.
|
@@ -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 Device
|
15
|
+
# The device's Square-issued ID.
|
16
|
+
attr_accessor :id
|
17
|
+
|
18
|
+
# The device's merchant-specified name.
|
19
|
+
attr_accessor :name
|
20
|
+
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'id' => :'id',
|
26
|
+
:'name' => :'name'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Attribute type mapping.
|
31
|
+
def self.swagger_types
|
32
|
+
{
|
33
|
+
:'id' => :'String',
|
34
|
+
:'name' => :'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?(:'name')
|
51
|
+
self.name = attributes[:'name']
|
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
|
+
name == o.name
|
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, name].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,206 @@
|
|
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 V1AdjustInventoryRequest
|
15
|
+
# The number to adjust the variation's quantity by.
|
16
|
+
attr_accessor :quantity_delta
|
17
|
+
|
18
|
+
# The reason for the inventory adjustment.
|
19
|
+
attr_accessor :adjustment_type
|
20
|
+
|
21
|
+
# A note about the inventory adjustment.
|
22
|
+
attr_accessor :memo
|
23
|
+
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'quantity_delta' => :'quantity_delta',
|
29
|
+
:'adjustment_type' => :'adjustment_type',
|
30
|
+
:'memo' => :'memo'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.swagger_types
|
36
|
+
{
|
37
|
+
:'quantity_delta' => :'Float',
|
38
|
+
:'adjustment_type' => :'Float',
|
39
|
+
:'memo' => :'String'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# Initializes the object
|
44
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
45
|
+
def initialize(attributes = {})
|
46
|
+
return unless attributes.is_a?(Hash)
|
47
|
+
|
48
|
+
# convert string to symbol for hash key
|
49
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
50
|
+
|
51
|
+
if attributes.has_key?(:'quantity_delta')
|
52
|
+
self.quantity_delta = attributes[:'quantity_delta']
|
53
|
+
end
|
54
|
+
|
55
|
+
if attributes.has_key?(:'adjustment_type')
|
56
|
+
self.adjustment_type = attributes[:'adjustment_type']
|
57
|
+
end
|
58
|
+
|
59
|
+
if attributes.has_key?(:'memo')
|
60
|
+
self.memo = attributes[:'memo']
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
+
# @return Array for valid properies with the reasons
|
67
|
+
def list_invalid_properties
|
68
|
+
invalid_properties = Array.new
|
69
|
+
return invalid_properties
|
70
|
+
end
|
71
|
+
|
72
|
+
# Check to see if the all the properties in the model are valid
|
73
|
+
# @return true if the model is valid
|
74
|
+
def valid?
|
75
|
+
return true
|
76
|
+
end
|
77
|
+
|
78
|
+
# Checks equality by comparing each attribute.
|
79
|
+
# @param [Object] Object to be compared
|
80
|
+
def ==(o)
|
81
|
+
return true if self.equal?(o)
|
82
|
+
self.class == o.class &&
|
83
|
+
quantity_delta == o.quantity_delta &&
|
84
|
+
adjustment_type == o.adjustment_type &&
|
85
|
+
memo == o.memo
|
86
|
+
end
|
87
|
+
|
88
|
+
# @see the `==` method
|
89
|
+
# @param [Object] Object to be compared
|
90
|
+
def eql?(o)
|
91
|
+
self == o
|
92
|
+
end
|
93
|
+
|
94
|
+
# Calculates hash code according to all attributes.
|
95
|
+
# @return [Fixnum] Hash code
|
96
|
+
def hash
|
97
|
+
[quantity_delta, adjustment_type, memo].hash
|
98
|
+
end
|
99
|
+
|
100
|
+
# Builds the object from hash
|
101
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
102
|
+
# @return [Object] Returns the model itself
|
103
|
+
def build_from_hash(attributes)
|
104
|
+
return nil unless attributes.is_a?(Hash)
|
105
|
+
self.class.swagger_types.each_pair do |key, type|
|
106
|
+
if type =~ /\AArray<(.*)>/i
|
107
|
+
# check to ensure the input is an array given that the the attribute
|
108
|
+
# is documented as an array but the input is not
|
109
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
110
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
111
|
+
end
|
112
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
113
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
114
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
115
|
+
end
|
116
|
+
|
117
|
+
self
|
118
|
+
end
|
119
|
+
|
120
|
+
# Deserializes the data based on type
|
121
|
+
# @param string type Data type
|
122
|
+
# @param string value Value to be deserialized
|
123
|
+
# @return [Object] Deserialized data
|
124
|
+
def _deserialize(type, value)
|
125
|
+
case type.to_sym
|
126
|
+
when :DateTime
|
127
|
+
DateTime.parse(value)
|
128
|
+
when :Date
|
129
|
+
Date.parse(value)
|
130
|
+
when :String
|
131
|
+
value.to_s
|
132
|
+
when :Integer
|
133
|
+
value.to_i
|
134
|
+
when :Float
|
135
|
+
value.to_f
|
136
|
+
when :BOOLEAN
|
137
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
138
|
+
true
|
139
|
+
else
|
140
|
+
false
|
141
|
+
end
|
142
|
+
when :Object
|
143
|
+
# generic object (usually a Hash), return directly
|
144
|
+
value
|
145
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
146
|
+
inner_type = Regexp.last_match[:inner_type]
|
147
|
+
value.map { |v| _deserialize(inner_type, v) }
|
148
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
149
|
+
k_type = Regexp.last_match[:k_type]
|
150
|
+
v_type = Regexp.last_match[:v_type]
|
151
|
+
{}.tap do |hash|
|
152
|
+
value.each do |k, v|
|
153
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
else # model
|
157
|
+
temp_model = SquareConnect.const_get(type).new
|
158
|
+
temp_model.build_from_hash(value)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
# Returns the string representation of the object
|
163
|
+
# @return [String] String presentation of the object
|
164
|
+
def to_s
|
165
|
+
to_hash.to_s
|
166
|
+
end
|
167
|
+
|
168
|
+
# to_body is an alias to to_hash (backward compatibility)
|
169
|
+
# @return [Hash] Returns the object in the form of hash
|
170
|
+
def to_body
|
171
|
+
to_hash
|
172
|
+
end
|
173
|
+
|
174
|
+
# Returns the object in the form of hash
|
175
|
+
# @return [Hash] Returns the object in the form of hash
|
176
|
+
def to_hash
|
177
|
+
hash = {}
|
178
|
+
self.class.attribute_map.each_pair do |attr, param|
|
179
|
+
value = self.send(attr)
|
180
|
+
next if value.nil?
|
181
|
+
hash[param] = _to_hash(value)
|
182
|
+
end
|
183
|
+
hash
|
184
|
+
end
|
185
|
+
|
186
|
+
# Outputs non-array value in the form of hash
|
187
|
+
# For object, use to_hash. Otherwise, just return the value
|
188
|
+
# @param [Object] value Any valid value
|
189
|
+
# @return [Hash] Returns the value in the form of hash
|
190
|
+
def _to_hash(value)
|
191
|
+
if value.is_a?(Array)
|
192
|
+
value.compact.map{ |v| _to_hash(v) }
|
193
|
+
elsif value.is_a?(Hash)
|
194
|
+
{}.tap do |hash|
|
195
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
196
|
+
end
|
197
|
+
elsif value.respond_to? :to_hash
|
198
|
+
value.to_hash
|
199
|
+
else
|
200
|
+
value
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
end
|
205
|
+
|
206
|
+
end
|
@@ -0,0 +1,289 @@
|
|
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 V1BankAccount
|
15
|
+
# The bank account's Square-issued ID.
|
16
|
+
attr_accessor :id
|
17
|
+
|
18
|
+
# The Square-issued ID of the merchant associated with the bank account.
|
19
|
+
attr_accessor :merchant_id
|
20
|
+
|
21
|
+
# The name of the bank that manages the account.
|
22
|
+
attr_accessor :bank_name
|
23
|
+
|
24
|
+
# The name associated with the bank account.
|
25
|
+
attr_accessor :name
|
26
|
+
|
27
|
+
# The bank account's routing number.
|
28
|
+
attr_accessor :routing_number
|
29
|
+
|
30
|
+
# The last few digits of the bank account number.
|
31
|
+
attr_accessor :account_number_suffix
|
32
|
+
|
33
|
+
# The currency code of the currency associated with the bank account, in ISO 4217 format. For example, the currency code for US dollars is USD.
|
34
|
+
attr_accessor :currency_code
|
35
|
+
|
36
|
+
# The bank account's type (for example, savings or checking).
|
37
|
+
attr_accessor :type
|
38
|
+
|
39
|
+
class EnumAttributeValidator
|
40
|
+
attr_reader :datatype
|
41
|
+
attr_reader :allowable_values
|
42
|
+
|
43
|
+
def initialize(datatype, allowable_values)
|
44
|
+
@allowable_values = allowable_values.map do |value|
|
45
|
+
case datatype.to_s
|
46
|
+
when /Integer/i
|
47
|
+
value.to_i
|
48
|
+
when /Float/i
|
49
|
+
value.to_f
|
50
|
+
else
|
51
|
+
value
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def valid?(value)
|
57
|
+
!value || allowable_values.include?(value)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
62
|
+
def self.attribute_map
|
63
|
+
{
|
64
|
+
:'id' => :'id',
|
65
|
+
:'merchant_id' => :'merchant_id',
|
66
|
+
:'bank_name' => :'bank_name',
|
67
|
+
:'name' => :'name',
|
68
|
+
:'routing_number' => :'routing_number',
|
69
|
+
:'account_number_suffix' => :'account_number_suffix',
|
70
|
+
:'currency_code' => :'currency_code',
|
71
|
+
:'type' => :'type'
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
# Attribute type mapping.
|
76
|
+
def self.swagger_types
|
77
|
+
{
|
78
|
+
:'id' => :'String',
|
79
|
+
:'merchant_id' => :'String',
|
80
|
+
:'bank_name' => :'String',
|
81
|
+
:'name' => :'String',
|
82
|
+
:'routing_number' => :'String',
|
83
|
+
:'account_number_suffix' => :'String',
|
84
|
+
:'currency_code' => :'String',
|
85
|
+
:'type' => :'String'
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
# Initializes the object
|
90
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
91
|
+
def initialize(attributes = {})
|
92
|
+
return unless attributes.is_a?(Hash)
|
93
|
+
|
94
|
+
# convert string to symbol for hash key
|
95
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
96
|
+
|
97
|
+
if attributes.has_key?(:'id')
|
98
|
+
self.id = attributes[:'id']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.has_key?(:'merchant_id')
|
102
|
+
self.merchant_id = attributes[:'merchant_id']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.has_key?(:'bank_name')
|
106
|
+
self.bank_name = attributes[:'bank_name']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.has_key?(:'name')
|
110
|
+
self.name = attributes[:'name']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.has_key?(:'routing_number')
|
114
|
+
self.routing_number = attributes[:'routing_number']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.has_key?(:'account_number_suffix')
|
118
|
+
self.account_number_suffix = attributes[:'account_number_suffix']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.has_key?(:'currency_code')
|
122
|
+
self.currency_code = attributes[:'currency_code']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.has_key?(:'type')
|
126
|
+
self.type = attributes[:'type']
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
132
|
+
# @return Array for valid properies with the reasons
|
133
|
+
def list_invalid_properties
|
134
|
+
invalid_properties = Array.new
|
135
|
+
return invalid_properties
|
136
|
+
end
|
137
|
+
|
138
|
+
# Check to see if the all the properties in the model are valid
|
139
|
+
# @return true if the model is valid
|
140
|
+
def valid?
|
141
|
+
type_validator = EnumAttributeValidator.new('String', ["BUSINESS_CHECKING", "CHECKING", "INVESTMENT", "LOAN", "SAVINGS", "OTHER"])
|
142
|
+
return false unless type_validator.valid?(@type)
|
143
|
+
return true
|
144
|
+
end
|
145
|
+
|
146
|
+
# Custom attribute writer method checking allowed values (enum).
|
147
|
+
# @param [Object] type Object to be assigned
|
148
|
+
def type=(type)
|
149
|
+
validator = EnumAttributeValidator.new('String', ["BUSINESS_CHECKING", "CHECKING", "INVESTMENT", "LOAN", "SAVINGS", "OTHER"])
|
150
|
+
unless validator.valid?(type)
|
151
|
+
fail ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
|
152
|
+
end
|
153
|
+
@type = type
|
154
|
+
end
|
155
|
+
|
156
|
+
# Checks equality by comparing each attribute.
|
157
|
+
# @param [Object] Object to be compared
|
158
|
+
def ==(o)
|
159
|
+
return true if self.equal?(o)
|
160
|
+
self.class == o.class &&
|
161
|
+
id == o.id &&
|
162
|
+
merchant_id == o.merchant_id &&
|
163
|
+
bank_name == o.bank_name &&
|
164
|
+
name == o.name &&
|
165
|
+
routing_number == o.routing_number &&
|
166
|
+
account_number_suffix == o.account_number_suffix &&
|
167
|
+
currency_code == o.currency_code &&
|
168
|
+
type == o.type
|
169
|
+
end
|
170
|
+
|
171
|
+
# @see the `==` method
|
172
|
+
# @param [Object] Object to be compared
|
173
|
+
def eql?(o)
|
174
|
+
self == o
|
175
|
+
end
|
176
|
+
|
177
|
+
# Calculates hash code according to all attributes.
|
178
|
+
# @return [Fixnum] Hash code
|
179
|
+
def hash
|
180
|
+
[id, merchant_id, bank_name, name, routing_number, account_number_suffix, currency_code, type].hash
|
181
|
+
end
|
182
|
+
|
183
|
+
# Builds the object from hash
|
184
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
185
|
+
# @return [Object] Returns the model itself
|
186
|
+
def build_from_hash(attributes)
|
187
|
+
return nil unless attributes.is_a?(Hash)
|
188
|
+
self.class.swagger_types.each_pair do |key, type|
|
189
|
+
if type =~ /\AArray<(.*)>/i
|
190
|
+
# check to ensure the input is an array given that the the attribute
|
191
|
+
# is documented as an array but the input is not
|
192
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
193
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
194
|
+
end
|
195
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
196
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
197
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
198
|
+
end
|
199
|
+
|
200
|
+
self
|
201
|
+
end
|
202
|
+
|
203
|
+
# Deserializes the data based on type
|
204
|
+
# @param string type Data type
|
205
|
+
# @param string value Value to be deserialized
|
206
|
+
# @return [Object] Deserialized data
|
207
|
+
def _deserialize(type, value)
|
208
|
+
case type.to_sym
|
209
|
+
when :DateTime
|
210
|
+
DateTime.parse(value)
|
211
|
+
when :Date
|
212
|
+
Date.parse(value)
|
213
|
+
when :String
|
214
|
+
value.to_s
|
215
|
+
when :Integer
|
216
|
+
value.to_i
|
217
|
+
when :Float
|
218
|
+
value.to_f
|
219
|
+
when :BOOLEAN
|
220
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
221
|
+
true
|
222
|
+
else
|
223
|
+
false
|
224
|
+
end
|
225
|
+
when :Object
|
226
|
+
# generic object (usually a Hash), return directly
|
227
|
+
value
|
228
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
229
|
+
inner_type = Regexp.last_match[:inner_type]
|
230
|
+
value.map { |v| _deserialize(inner_type, v) }
|
231
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
232
|
+
k_type = Regexp.last_match[:k_type]
|
233
|
+
v_type = Regexp.last_match[:v_type]
|
234
|
+
{}.tap do |hash|
|
235
|
+
value.each do |k, v|
|
236
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
237
|
+
end
|
238
|
+
end
|
239
|
+
else # model
|
240
|
+
temp_model = SquareConnect.const_get(type).new
|
241
|
+
temp_model.build_from_hash(value)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
# Returns the string representation of the object
|
246
|
+
# @return [String] String presentation of the object
|
247
|
+
def to_s
|
248
|
+
to_hash.to_s
|
249
|
+
end
|
250
|
+
|
251
|
+
# to_body is an alias to to_hash (backward compatibility)
|
252
|
+
# @return [Hash] Returns the object in the form of hash
|
253
|
+
def to_body
|
254
|
+
to_hash
|
255
|
+
end
|
256
|
+
|
257
|
+
# Returns the object in the form of hash
|
258
|
+
# @return [Hash] Returns the object in the form of hash
|
259
|
+
def to_hash
|
260
|
+
hash = {}
|
261
|
+
self.class.attribute_map.each_pair do |attr, param|
|
262
|
+
value = self.send(attr)
|
263
|
+
next if value.nil?
|
264
|
+
hash[param] = _to_hash(value)
|
265
|
+
end
|
266
|
+
hash
|
267
|
+
end
|
268
|
+
|
269
|
+
# Outputs non-array value in the form of hash
|
270
|
+
# For object, use to_hash. Otherwise, just return the value
|
271
|
+
# @param [Object] value Any valid value
|
272
|
+
# @return [Hash] Returns the value in the form of hash
|
273
|
+
def _to_hash(value)
|
274
|
+
if value.is_a?(Array)
|
275
|
+
value.compact.map{ |v| _to_hash(v) }
|
276
|
+
elsif value.is_a?(Hash)
|
277
|
+
{}.tap do |hash|
|
278
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
279
|
+
end
|
280
|
+
elsif value.respond_to? :to_hash
|
281
|
+
value.to_hash
|
282
|
+
else
|
283
|
+
value
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
end
|
288
|
+
|
289
|
+
end
|