square_connect 2.0.2.69 → 2.1.0.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,216 @@
|
|
|
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 V1PaymentItemDetail
|
|
15
|
+
# The name of the item's merchant-defined category, if any.
|
|
16
|
+
attr_accessor :category_name
|
|
17
|
+
|
|
18
|
+
# The item's merchant-defined SKU, if any.
|
|
19
|
+
attr_accessor :sku
|
|
20
|
+
|
|
21
|
+
# The unique ID of the item purchased, if any.
|
|
22
|
+
attr_accessor :item_id
|
|
23
|
+
|
|
24
|
+
# The unique ID of the item variation purchased, if any.
|
|
25
|
+
attr_accessor :item_variation_id
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
29
|
+
def self.attribute_map
|
|
30
|
+
{
|
|
31
|
+
:'category_name' => :'category_name',
|
|
32
|
+
:'sku' => :'sku',
|
|
33
|
+
:'item_id' => :'item_id',
|
|
34
|
+
:'item_variation_id' => :'item_variation_id'
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Attribute type mapping.
|
|
39
|
+
def self.swagger_types
|
|
40
|
+
{
|
|
41
|
+
:'category_name' => :'String',
|
|
42
|
+
:'sku' => :'Float',
|
|
43
|
+
:'item_id' => :'String',
|
|
44
|
+
:'item_variation_id' => :'String'
|
|
45
|
+
}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Initializes the object
|
|
49
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
50
|
+
def initialize(attributes = {})
|
|
51
|
+
return unless attributes.is_a?(Hash)
|
|
52
|
+
|
|
53
|
+
# convert string to symbol for hash key
|
|
54
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
|
55
|
+
|
|
56
|
+
if attributes.has_key?(:'category_name')
|
|
57
|
+
self.category_name = attributes[:'category_name']
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
if attributes.has_key?(:'sku')
|
|
61
|
+
self.sku = attributes[:'sku']
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
if attributes.has_key?(:'item_id')
|
|
65
|
+
self.item_id = attributes[:'item_id']
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
if attributes.has_key?(:'item_variation_id')
|
|
69
|
+
self.item_variation_id = attributes[:'item_variation_id']
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
75
|
+
# @return Array for valid properies with the reasons
|
|
76
|
+
def list_invalid_properties
|
|
77
|
+
invalid_properties = Array.new
|
|
78
|
+
return invalid_properties
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Check to see if the all the properties in the model are valid
|
|
82
|
+
# @return true if the model is valid
|
|
83
|
+
def valid?
|
|
84
|
+
return true
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Checks equality by comparing each attribute.
|
|
88
|
+
# @param [Object] Object to be compared
|
|
89
|
+
def ==(o)
|
|
90
|
+
return true if self.equal?(o)
|
|
91
|
+
self.class == o.class &&
|
|
92
|
+
category_name == o.category_name &&
|
|
93
|
+
sku == o.sku &&
|
|
94
|
+
item_id == o.item_id &&
|
|
95
|
+
item_variation_id == o.item_variation_id
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# @see the `==` method
|
|
99
|
+
# @param [Object] Object to be compared
|
|
100
|
+
def eql?(o)
|
|
101
|
+
self == o
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Calculates hash code according to all attributes.
|
|
105
|
+
# @return [Fixnum] Hash code
|
|
106
|
+
def hash
|
|
107
|
+
[category_name, sku, item_id, item_variation_id].hash
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Builds the object from hash
|
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
112
|
+
# @return [Object] Returns the model itself
|
|
113
|
+
def build_from_hash(attributes)
|
|
114
|
+
return nil unless attributes.is_a?(Hash)
|
|
115
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
116
|
+
if type =~ /\AArray<(.*)>/i
|
|
117
|
+
# check to ensure the input is an array given that the the attribute
|
|
118
|
+
# is documented as an array but the input is not
|
|
119
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
120
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
|
121
|
+
end
|
|
122
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
123
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
124
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
self
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Deserializes the data based on type
|
|
131
|
+
# @param string type Data type
|
|
132
|
+
# @param string value Value to be deserialized
|
|
133
|
+
# @return [Object] Deserialized data
|
|
134
|
+
def _deserialize(type, value)
|
|
135
|
+
case type.to_sym
|
|
136
|
+
when :DateTime
|
|
137
|
+
DateTime.parse(value)
|
|
138
|
+
when :Date
|
|
139
|
+
Date.parse(value)
|
|
140
|
+
when :String
|
|
141
|
+
value.to_s
|
|
142
|
+
when :Integer
|
|
143
|
+
value.to_i
|
|
144
|
+
when :Float
|
|
145
|
+
value.to_f
|
|
146
|
+
when :BOOLEAN
|
|
147
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
148
|
+
true
|
|
149
|
+
else
|
|
150
|
+
false
|
|
151
|
+
end
|
|
152
|
+
when :Object
|
|
153
|
+
# generic object (usually a Hash), return directly
|
|
154
|
+
value
|
|
155
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
156
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
157
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
158
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
159
|
+
k_type = Regexp.last_match[:k_type]
|
|
160
|
+
v_type = Regexp.last_match[:v_type]
|
|
161
|
+
{}.tap do |hash|
|
|
162
|
+
value.each do |k, v|
|
|
163
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
else # model
|
|
167
|
+
temp_model = SquareConnect.const_get(type).new
|
|
168
|
+
temp_model.build_from_hash(value)
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Returns the string representation of the object
|
|
173
|
+
# @return [String] String presentation of the object
|
|
174
|
+
def to_s
|
|
175
|
+
to_hash.to_s
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
|
180
|
+
def to_body
|
|
181
|
+
to_hash
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Returns the object in the form of hash
|
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
|
186
|
+
def to_hash
|
|
187
|
+
hash = {}
|
|
188
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
189
|
+
value = self.send(attr)
|
|
190
|
+
next if value.nil?
|
|
191
|
+
hash[param] = _to_hash(value)
|
|
192
|
+
end
|
|
193
|
+
hash
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Outputs non-array value in the form of hash
|
|
197
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
198
|
+
# @param [Object] value Any valid value
|
|
199
|
+
# @return [Hash] Returns the value in the form of hash
|
|
200
|
+
def _to_hash(value)
|
|
201
|
+
if value.is_a?(Array)
|
|
202
|
+
value.compact.map{ |v| _to_hash(v) }
|
|
203
|
+
elsif value.is_a?(Hash)
|
|
204
|
+
{}.tap do |hash|
|
|
205
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
206
|
+
end
|
|
207
|
+
elsif value.respond_to? :to_hash
|
|
208
|
+
value.to_hash
|
|
209
|
+
else
|
|
210
|
+
value
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
end
|
|
@@ -0,0 +1,355 @@
|
|
|
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 V1PaymentItemization
|
|
15
|
+
# The item's name.
|
|
16
|
+
attr_accessor :name
|
|
17
|
+
|
|
18
|
+
# The quantity of the item purchased. This can be a decimal value.
|
|
19
|
+
attr_accessor :quantity
|
|
20
|
+
|
|
21
|
+
# The type of purchase that the itemization represents, such as an ITEM or CUSTOM_AMOUNT
|
|
22
|
+
attr_accessor :itemization_type
|
|
23
|
+
|
|
24
|
+
# Details of the item, including its unique identifier and the identifier of the item variation purchased.
|
|
25
|
+
attr_accessor :item_detail
|
|
26
|
+
|
|
27
|
+
# Notes entered by the merchant about the item at the time of payment, if any.
|
|
28
|
+
attr_accessor :notes
|
|
29
|
+
|
|
30
|
+
# The name of the item variation purchased, if any.
|
|
31
|
+
attr_accessor :item_variation_name
|
|
32
|
+
|
|
33
|
+
# The total cost of the item, including all taxes and discounts.
|
|
34
|
+
attr_accessor :total_money
|
|
35
|
+
|
|
36
|
+
# The cost of a single unit of this item.
|
|
37
|
+
attr_accessor :single_quantity_money
|
|
38
|
+
|
|
39
|
+
# The total cost of the itemization and its modifiers, not including taxes or discounts.
|
|
40
|
+
attr_accessor :gross_sales_money
|
|
41
|
+
|
|
42
|
+
# The total of all discounts applied to the itemization. This value is always negative or zero.
|
|
43
|
+
attr_accessor :discount_money
|
|
44
|
+
|
|
45
|
+
# The sum of gross_sales_money and discount_money.
|
|
46
|
+
attr_accessor :net_sales_money
|
|
47
|
+
|
|
48
|
+
# All taxes applied to this itemization.
|
|
49
|
+
attr_accessor :taxes
|
|
50
|
+
|
|
51
|
+
# All discounts applied to this itemization.
|
|
52
|
+
attr_accessor :discounts
|
|
53
|
+
|
|
54
|
+
# All modifier options applied to this itemization.
|
|
55
|
+
attr_accessor :modifiers
|
|
56
|
+
|
|
57
|
+
class EnumAttributeValidator
|
|
58
|
+
attr_reader :datatype
|
|
59
|
+
attr_reader :allowable_values
|
|
60
|
+
|
|
61
|
+
def initialize(datatype, allowable_values)
|
|
62
|
+
@allowable_values = allowable_values.map do |value|
|
|
63
|
+
case datatype.to_s
|
|
64
|
+
when /Integer/i
|
|
65
|
+
value.to_i
|
|
66
|
+
when /Float/i
|
|
67
|
+
value.to_f
|
|
68
|
+
else
|
|
69
|
+
value
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def valid?(value)
|
|
75
|
+
!value || allowable_values.include?(value)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
80
|
+
def self.attribute_map
|
|
81
|
+
{
|
|
82
|
+
:'name' => :'name',
|
|
83
|
+
:'quantity' => :'quantity',
|
|
84
|
+
:'itemization_type' => :'itemization_type',
|
|
85
|
+
:'item_detail' => :'item_detail',
|
|
86
|
+
:'notes' => :'notes',
|
|
87
|
+
:'item_variation_name' => :'item_variation_name',
|
|
88
|
+
:'total_money' => :'total_money',
|
|
89
|
+
:'single_quantity_money' => :'single_quantity_money',
|
|
90
|
+
:'gross_sales_money' => :'gross_sales_money',
|
|
91
|
+
:'discount_money' => :'discount_money',
|
|
92
|
+
:'net_sales_money' => :'net_sales_money',
|
|
93
|
+
:'taxes' => :'taxes',
|
|
94
|
+
:'discounts' => :'discounts',
|
|
95
|
+
:'modifiers' => :'modifiers'
|
|
96
|
+
}
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Attribute type mapping.
|
|
100
|
+
def self.swagger_types
|
|
101
|
+
{
|
|
102
|
+
:'name' => :'String',
|
|
103
|
+
:'quantity' => :'Float',
|
|
104
|
+
:'itemization_type' => :'String',
|
|
105
|
+
:'item_detail' => :'V1PaymentItemDetail',
|
|
106
|
+
:'notes' => :'String',
|
|
107
|
+
:'item_variation_name' => :'String',
|
|
108
|
+
:'total_money' => :'V1Money',
|
|
109
|
+
:'single_quantity_money' => :'V1Money',
|
|
110
|
+
:'gross_sales_money' => :'V1Money',
|
|
111
|
+
:'discount_money' => :'V1Money',
|
|
112
|
+
:'net_sales_money' => :'V1Money',
|
|
113
|
+
:'taxes' => :'Array<V1PaymentTax>',
|
|
114
|
+
:'discounts' => :'Array<V1PaymentDiscount>',
|
|
115
|
+
:'modifiers' => :'Array<V1PaymentModifier>'
|
|
116
|
+
}
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Initializes the object
|
|
120
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
121
|
+
def initialize(attributes = {})
|
|
122
|
+
return unless attributes.is_a?(Hash)
|
|
123
|
+
|
|
124
|
+
# convert string to symbol for hash key
|
|
125
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
|
126
|
+
|
|
127
|
+
if attributes.has_key?(:'name')
|
|
128
|
+
self.name = attributes[:'name']
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if attributes.has_key?(:'quantity')
|
|
132
|
+
self.quantity = attributes[:'quantity']
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
if attributes.has_key?(:'itemization_type')
|
|
136
|
+
self.itemization_type = attributes[:'itemization_type']
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
if attributes.has_key?(:'item_detail')
|
|
140
|
+
self.item_detail = attributes[:'item_detail']
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
if attributes.has_key?(:'notes')
|
|
144
|
+
self.notes = attributes[:'notes']
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
if attributes.has_key?(:'item_variation_name')
|
|
148
|
+
self.item_variation_name = attributes[:'item_variation_name']
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
if attributes.has_key?(:'total_money')
|
|
152
|
+
self.total_money = attributes[:'total_money']
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
if attributes.has_key?(:'single_quantity_money')
|
|
156
|
+
self.single_quantity_money = attributes[:'single_quantity_money']
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
if attributes.has_key?(:'gross_sales_money')
|
|
160
|
+
self.gross_sales_money = attributes[:'gross_sales_money']
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
if attributes.has_key?(:'discount_money')
|
|
164
|
+
self.discount_money = attributes[:'discount_money']
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
if attributes.has_key?(:'net_sales_money')
|
|
168
|
+
self.net_sales_money = attributes[:'net_sales_money']
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
if attributes.has_key?(:'taxes')
|
|
172
|
+
if (value = attributes[:'taxes']).is_a?(Array)
|
|
173
|
+
self.taxes = value
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
if attributes.has_key?(:'discounts')
|
|
178
|
+
if (value = attributes[:'discounts']).is_a?(Array)
|
|
179
|
+
self.discounts = value
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
if attributes.has_key?(:'modifiers')
|
|
184
|
+
if (value = attributes[:'modifiers']).is_a?(Array)
|
|
185
|
+
self.modifiers = value
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
192
|
+
# @return Array for valid properies with the reasons
|
|
193
|
+
def list_invalid_properties
|
|
194
|
+
invalid_properties = Array.new
|
|
195
|
+
return invalid_properties
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Check to see if the all the properties in the model are valid
|
|
199
|
+
# @return true if the model is valid
|
|
200
|
+
def valid?
|
|
201
|
+
itemization_type_validator = EnumAttributeValidator.new('String', ["ITEM", "CUSTOM_AMOUNT", "GIFT_CARD_ACTIVATION", "GIFT_CARD_RELOAD", "GIFT_CARD_UNKNOWN", "OTHER"])
|
|
202
|
+
return false unless itemization_type_validator.valid?(@itemization_type)
|
|
203
|
+
return true
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
207
|
+
# @param [Object] itemization_type Object to be assigned
|
|
208
|
+
def itemization_type=(itemization_type)
|
|
209
|
+
validator = EnumAttributeValidator.new('String', ["ITEM", "CUSTOM_AMOUNT", "GIFT_CARD_ACTIVATION", "GIFT_CARD_RELOAD", "GIFT_CARD_UNKNOWN", "OTHER"])
|
|
210
|
+
unless validator.valid?(itemization_type)
|
|
211
|
+
fail ArgumentError, "invalid value for 'itemization_type', must be one of #{validator.allowable_values}."
|
|
212
|
+
end
|
|
213
|
+
@itemization_type = itemization_type
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# Checks equality by comparing each attribute.
|
|
217
|
+
# @param [Object] Object to be compared
|
|
218
|
+
def ==(o)
|
|
219
|
+
return true if self.equal?(o)
|
|
220
|
+
self.class == o.class &&
|
|
221
|
+
name == o.name &&
|
|
222
|
+
quantity == o.quantity &&
|
|
223
|
+
itemization_type == o.itemization_type &&
|
|
224
|
+
item_detail == o.item_detail &&
|
|
225
|
+
notes == o.notes &&
|
|
226
|
+
item_variation_name == o.item_variation_name &&
|
|
227
|
+
total_money == o.total_money &&
|
|
228
|
+
single_quantity_money == o.single_quantity_money &&
|
|
229
|
+
gross_sales_money == o.gross_sales_money &&
|
|
230
|
+
discount_money == o.discount_money &&
|
|
231
|
+
net_sales_money == o.net_sales_money &&
|
|
232
|
+
taxes == o.taxes &&
|
|
233
|
+
discounts == o.discounts &&
|
|
234
|
+
modifiers == o.modifiers
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# @see the `==` method
|
|
238
|
+
# @param [Object] Object to be compared
|
|
239
|
+
def eql?(o)
|
|
240
|
+
self == o
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# Calculates hash code according to all attributes.
|
|
244
|
+
# @return [Fixnum] Hash code
|
|
245
|
+
def hash
|
|
246
|
+
[name, quantity, itemization_type, item_detail, notes, item_variation_name, total_money, single_quantity_money, gross_sales_money, discount_money, net_sales_money, taxes, discounts, modifiers].hash
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# Builds the object from hash
|
|
250
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
251
|
+
# @return [Object] Returns the model itself
|
|
252
|
+
def build_from_hash(attributes)
|
|
253
|
+
return nil unless attributes.is_a?(Hash)
|
|
254
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
255
|
+
if type =~ /\AArray<(.*)>/i
|
|
256
|
+
# check to ensure the input is an array given that the the attribute
|
|
257
|
+
# is documented as an array but the input is not
|
|
258
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
259
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
|
260
|
+
end
|
|
261
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
262
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
263
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
self
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# Deserializes the data based on type
|
|
270
|
+
# @param string type Data type
|
|
271
|
+
# @param string value Value to be deserialized
|
|
272
|
+
# @return [Object] Deserialized data
|
|
273
|
+
def _deserialize(type, value)
|
|
274
|
+
case type.to_sym
|
|
275
|
+
when :DateTime
|
|
276
|
+
DateTime.parse(value)
|
|
277
|
+
when :Date
|
|
278
|
+
Date.parse(value)
|
|
279
|
+
when :String
|
|
280
|
+
value.to_s
|
|
281
|
+
when :Integer
|
|
282
|
+
value.to_i
|
|
283
|
+
when :Float
|
|
284
|
+
value.to_f
|
|
285
|
+
when :BOOLEAN
|
|
286
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
287
|
+
true
|
|
288
|
+
else
|
|
289
|
+
false
|
|
290
|
+
end
|
|
291
|
+
when :Object
|
|
292
|
+
# generic object (usually a Hash), return directly
|
|
293
|
+
value
|
|
294
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
295
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
296
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
297
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
298
|
+
k_type = Regexp.last_match[:k_type]
|
|
299
|
+
v_type = Regexp.last_match[:v_type]
|
|
300
|
+
{}.tap do |hash|
|
|
301
|
+
value.each do |k, v|
|
|
302
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
else # model
|
|
306
|
+
temp_model = SquareConnect.const_get(type).new
|
|
307
|
+
temp_model.build_from_hash(value)
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
# Returns the string representation of the object
|
|
312
|
+
# @return [String] String presentation of the object
|
|
313
|
+
def to_s
|
|
314
|
+
to_hash.to_s
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
318
|
+
# @return [Hash] Returns the object in the form of hash
|
|
319
|
+
def to_body
|
|
320
|
+
to_hash
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
# Returns the object in the form of hash
|
|
324
|
+
# @return [Hash] Returns the object in the form of hash
|
|
325
|
+
def to_hash
|
|
326
|
+
hash = {}
|
|
327
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
328
|
+
value = self.send(attr)
|
|
329
|
+
next if value.nil?
|
|
330
|
+
hash[param] = _to_hash(value)
|
|
331
|
+
end
|
|
332
|
+
hash
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
# Outputs non-array value in the form of hash
|
|
336
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
337
|
+
# @param [Object] value Any valid value
|
|
338
|
+
# @return [Hash] Returns the value in the form of hash
|
|
339
|
+
def _to_hash(value)
|
|
340
|
+
if value.is_a?(Array)
|
|
341
|
+
value.compact.map{ |v| _to_hash(v) }
|
|
342
|
+
elsif value.is_a?(Hash)
|
|
343
|
+
{}.tap do |hash|
|
|
344
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
345
|
+
end
|
|
346
|
+
elsif value.respond_to? :to_hash
|
|
347
|
+
value.to_hash
|
|
348
|
+
else
|
|
349
|
+
value
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
end
|