square_connect 2.20190410.1.300 → 2.20190508.0.304

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +10 -0
  3. data/README.md +32 -1
  4. data/docs/BatchRetrieveOrdersResponse.md +1 -0
  5. data/docs/BusinessHours.md +12 -0
  6. data/docs/BusinessHoursPeriod.md +14 -0
  7. data/docs/ChargeRequest.md +3 -3
  8. data/docs/CreateOrderRequest.md +1 -1
  9. data/docs/CreateOrderRequestTax.md +1 -1
  10. data/docs/DayOfWeek.md +18 -0
  11. data/docs/ErrorCode.md +2 -0
  12. data/docs/InventoryAdjustment.md +1 -1
  13. data/docs/InventoryCount.md +2 -2
  14. data/docs/InventoryPhysicalCount.md +2 -2
  15. data/docs/InventoryTransfer.md +1 -1
  16. data/docs/Location.md +1 -0
  17. data/docs/MeasurementUnit.md +16 -0
  18. data/docs/MeasurementUnitArea.md +19 -0
  19. data/docs/MeasurementUnitCustom.md +13 -0
  20. data/docs/MeasurementUnitLength.md +19 -0
  21. data/docs/MeasurementUnitVolume.md +22 -0
  22. data/docs/MeasurementUnitWeight.md +17 -0
  23. data/docs/Order.md +12 -1
  24. data/docs/OrderEntry.md +13 -0
  25. data/docs/OrderLineItem.md +5 -2
  26. data/docs/OrderLineItemDiscount.md +2 -1
  27. data/docs/OrderLineItemModifier.md +2 -1
  28. data/docs/OrderLineItemTax.md +1 -0
  29. data/docs/OrderMoneyAmounts.md +16 -0
  30. data/docs/OrderQuantityUnit.md +13 -0
  31. data/docs/OrderReturn.md +18 -0
  32. data/docs/OrderReturnDiscount.md +20 -0
  33. data/docs/OrderReturnLineItem.md +28 -0
  34. data/docs/OrderReturnLineItemModifier.md +17 -0
  35. data/docs/OrderReturnTax.md +19 -0
  36. data/docs/OrderRoundingAdjustment.md +14 -0
  37. data/docs/OrderSource.md +1 -1
  38. data/docs/OrderState.md +14 -0
  39. data/docs/OrdersApi.md +54 -1
  40. data/docs/SearchOrdersCustomerFilter.md +12 -0
  41. data/docs/SearchOrdersDateTimeFilter.md +14 -0
  42. data/docs/SearchOrdersFilter.md +16 -0
  43. data/docs/SearchOrdersFulfillmentFilter.md +13 -0
  44. data/docs/SearchOrdersQuery.md +13 -0
  45. data/docs/SearchOrdersRequest.md +16 -0
  46. data/docs/SearchOrdersResponse.md +16 -0
  47. data/docs/SearchOrdersSort.md +13 -0
  48. data/docs/SearchOrdersSortField.md +14 -0
  49. data/docs/SearchOrdersSourceFilter.md +12 -0
  50. data/docs/SearchOrdersStateFilter.md +12 -0
  51. data/docs/TransactionsApi.md +1 -1
  52. data/lib/square_connect.rb +30 -0
  53. data/lib/square_connect/api/apple_pay_api.rb +1 -1
  54. data/lib/square_connect/api/catalog_api.rb +11 -11
  55. data/lib/square_connect/api/checkout_api.rb +1 -1
  56. data/lib/square_connect/api/customers_api.rb +8 -8
  57. data/lib/square_connect/api/employees_api.rb +2 -2
  58. data/lib/square_connect/api/inventory_api.rb +7 -7
  59. data/lib/square_connect/api/labor_api.rb +14 -14
  60. data/lib/square_connect/api/locations_api.rb +1 -1
  61. data/lib/square_connect/api/mobile_authorization_api.rb +1 -1
  62. data/lib/square_connect/api/o_auth_api.rb +3 -3
  63. data/lib/square_connect/api/orders_api.rb +59 -4
  64. data/lib/square_connect/api/reporting_api.rb +2 -2
  65. data/lib/square_connect/api/transactions_api.rb +9 -9
  66. data/lib/square_connect/api/v1_employees_api.rb +16 -16
  67. data/lib/square_connect/api/v1_items_api.rb +40 -40
  68. data/lib/square_connect/api/v1_locations_api.rb +2 -2
  69. data/lib/square_connect/api/v1_transactions_api.rb +11 -11
  70. data/lib/square_connect/api_client.rb +1 -1
  71. data/lib/square_connect/models/batch_retrieve_orders_response.rb +16 -4
  72. data/lib/square_connect/models/business_hours.rb +188 -0
  73. data/lib/square_connect/models/business_hours_period.rb +239 -0
  74. data/lib/square_connect/models/charge_request.rb +3 -3
  75. data/lib/square_connect/models/create_order_request.rb +1 -1
  76. data/lib/square_connect/models/create_order_request_tax.rb +1 -1
  77. data/lib/square_connect/models/day_of_week.rb +24 -0
  78. data/lib/square_connect/models/error.rb +2 -2
  79. data/lib/square_connect/models/error_code.rb +2 -0
  80. data/lib/square_connect/models/inventory_adjustment.rb +1 -1
  81. data/lib/square_connect/models/inventory_count.rb +2 -2
  82. data/lib/square_connect/models/inventory_physical_count.rb +2 -2
  83. data/lib/square_connect/models/inventory_transfer.rb +1 -1
  84. data/lib/square_connect/models/location.rb +14 -4
  85. data/lib/square_connect/models/measurement_unit.rb +295 -0
  86. data/lib/square_connect/models/measurement_unit_area.rb +25 -0
  87. data/lib/square_connect/models/measurement_unit_custom.rb +206 -0
  88. data/lib/square_connect/models/measurement_unit_length.rb +25 -0
  89. data/lib/square_connect/models/measurement_unit_volume.rb +28 -0
  90. data/lib/square_connect/models/measurement_unit_weight.rb +23 -0
  91. data/lib/square_connect/models/order.rb +151 -2
  92. data/lib/square_connect/models/order_entry.rb +196 -0
  93. data/lib/square_connect/models/order_line_item.rb +54 -8
  94. data/lib/square_connect/models/order_line_item_discount.rb +28 -2
  95. data/lib/square_connect/models/order_line_item_modifier.rb +28 -2
  96. data/lib/square_connect/models/order_line_item_tax.rb +27 -1
  97. data/lib/square_connect/models/order_money_amounts.rb +226 -0
  98. data/lib/square_connect/models/order_quantity_unit.rb +196 -0
  99. data/lib/square_connect/models/order_return.rb +268 -0
  100. data/lib/square_connect/models/order_return_discount.rb +391 -0
  101. data/lib/square_connect/models/order_return_line_item.rb +481 -0
  102. data/lib/square_connect/models/order_return_line_item_modifier.rb +300 -0
  103. data/lib/square_connect/models/order_return_tax.rb +381 -0
  104. data/lib/square_connect/models/order_rounding_adjustment.rb +222 -0
  105. data/lib/square_connect/models/order_source.rb +1 -1
  106. data/lib/square_connect/models/order_state.rb +20 -0
  107. data/lib/square_connect/models/search_orders_customer_filter.rb +188 -0
  108. data/lib/square_connect/models/search_orders_date_time_filter.rb +206 -0
  109. data/lib/square_connect/models/search_orders_filter.rb +226 -0
  110. data/lib/square_connect/models/search_orders_fulfillment_filter.rb +226 -0
  111. data/lib/square_connect/models/search_orders_query.rb +196 -0
  112. data/lib/square_connect/models/search_orders_request.rb +244 -0
  113. data/lib/square_connect/models/search_orders_response.rb +234 -0
  114. data/lib/square_connect/models/search_orders_sort.rb +246 -0
  115. data/lib/square_connect/models/search_orders_sort_field.rb +20 -0
  116. data/lib/square_connect/models/search_orders_source_filter.rb +188 -0
  117. data/lib/square_connect/models/search_orders_state_filter.rb +214 -0
  118. data/lib/square_connect/version.rb +1 -1
  119. data/spec/models/business_hours_period_spec.rb +55 -0
  120. data/spec/models/business_hours_spec.rb +39 -0
  121. data/spec/models/day_of_week_spec.rb +33 -0
  122. data/spec/models/measurement_unit_area_spec.rb +33 -0
  123. data/spec/models/measurement_unit_custom_spec.rb +45 -0
  124. data/spec/models/measurement_unit_length_spec.rb +33 -0
  125. data/spec/models/measurement_unit_spec.rb +79 -0
  126. data/spec/models/measurement_unit_volume_spec.rb +33 -0
  127. data/spec/models/measurement_unit_weight_spec.rb +33 -0
  128. data/spec/models/order_entry_spec.rb +45 -0
  129. data/spec/models/order_money_amounts_spec.rb +63 -0
  130. data/spec/models/order_quantity_unit_spec.rb +45 -0
  131. data/spec/models/order_return_discount_spec.rb +95 -0
  132. data/spec/models/order_return_line_item_modifier_spec.rb +69 -0
  133. data/spec/models/order_return_line_item_spec.rb +135 -0
  134. data/spec/models/order_return_spec.rb +75 -0
  135. data/spec/models/order_return_tax_spec.rb +89 -0
  136. data/spec/models/order_rounding_adjustment_spec.rb +51 -0
  137. data/spec/models/order_state_spec.rb +33 -0
  138. data/spec/models/search_orders_customer_filter_spec.rb +39 -0
  139. data/spec/models/search_orders_date_time_filter_spec.rb +51 -0
  140. data/spec/models/search_orders_filter_spec.rb +63 -0
  141. data/spec/models/search_orders_fulfillment_filter_spec.rb +53 -0
  142. data/spec/models/search_orders_query_spec.rb +45 -0
  143. data/spec/models/search_orders_request_spec.rb +63 -0
  144. data/spec/models/search_orders_response_spec.rb +63 -0
  145. data/spec/models/search_orders_sort_field_spec.rb +33 -0
  146. data/spec/models/search_orders_sort_spec.rb +53 -0
  147. data/spec/models/search_orders_source_filter_spec.rb +39 -0
  148. data/spec/models/search_orders_state_filter_spec.rb +43 -0
  149. metadata +122 -2
@@ -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
+ # A lightweight description of an [Order](#type-order) that is returned when `returned_entries` is true on a [SearchOrderRequest](#type-searchorderrequest)
14
+ class OrderEntry
15
+ # The id of the Order
16
+ attr_accessor :order_id
17
+
18
+ # The location id the Order belongs to.
19
+ attr_accessor :location_id
20
+
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'order_id' => :'order_id',
26
+ :'location_id' => :'location_id'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.swagger_types
32
+ {
33
+ :'order_id' => :'String',
34
+ :'location_id' => :'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?(:'order_id')
47
+ self.order_id = attributes[:'order_id']
48
+ end
49
+
50
+ if attributes.has_key?(:'location_id')
51
+ self.location_id = attributes[:'location_id']
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
+ order_id == o.order_id &&
75
+ location_id == o.location_id
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
+ [order_id, location_id].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
@@ -12,12 +12,18 @@ require 'date'
12
12
  module SquareConnect
13
13
  # Represents a line item in an order. Each line item describes a different product to purchase, with its own quantity and price details.
14
14
  class OrderLineItem
15
+ # The line item's Unique identifier, unique only within this order. This field is read-only.
16
+ attr_accessor :uid
17
+
15
18
  # The name of the line item.
16
19
  attr_accessor :name
17
20
 
18
- # The quantity purchased, as a string representation of a number. This string must have a positive integer value.
21
+ # The quantity purchased, formatted as a decimal number. For example: `\"3\"`. Line items with a `quantity_unit` can have non-integer quantities. For example: `\"1.70000\"`. Orders Hub and older versions of Connect do not support non-integer quantities. See [Decimal quantities with Orders hub and older versions of Connect](/more-apis/orders/overview#decimal-quantities).
19
22
  attr_accessor :quantity
20
23
 
24
+ # The unit and precision that this line item's quantity is measured in.
25
+ attr_accessor :quantity_unit
26
+
21
27
  # The note of the line item.
22
28
  attr_accessor :note
23
29
 
@@ -39,7 +45,10 @@ module SquareConnect
39
45
  # The base price for a single unit of the line item.
40
46
  attr_accessor :base_price_money
41
47
 
42
- # The gross sales amount of money calculated as (item base price + modifiers price) * quantity.
48
+ # The total price of all item variations sold in this line item. Calculated as `base_price_money` multiplied by `quantity`. Does not include modifiers.
49
+ attr_accessor :variation_total_price_money
50
+
51
+ # The amount of money made in gross sales for this line item. Calculated as the sum of the variation's total price and each modifier's total price.
43
52
  attr_accessor :gross_sales_money
44
53
 
45
54
  # The total tax amount of money to collect for the line item.
@@ -55,8 +64,10 @@ module SquareConnect
55
64
  # Attribute mapping from ruby-style variable name to JSON key.
56
65
  def self.attribute_map
57
66
  {
67
+ :'uid' => :'uid',
58
68
  :'name' => :'name',
59
69
  :'quantity' => :'quantity',
70
+ :'quantity_unit' => :'quantity_unit',
60
71
  :'note' => :'note',
61
72
  :'catalog_object_id' => :'catalog_object_id',
62
73
  :'variation_name' => :'variation_name',
@@ -64,6 +75,7 @@ module SquareConnect
64
75
  :'taxes' => :'taxes',
65
76
  :'discounts' => :'discounts',
66
77
  :'base_price_money' => :'base_price_money',
78
+ :'variation_total_price_money' => :'variation_total_price_money',
67
79
  :'gross_sales_money' => :'gross_sales_money',
68
80
  :'total_tax_money' => :'total_tax_money',
69
81
  :'total_discount_money' => :'total_discount_money',
@@ -74,8 +86,10 @@ module SquareConnect
74
86
  # Attribute type mapping.
75
87
  def self.swagger_types
76
88
  {
89
+ :'uid' => :'String',
77
90
  :'name' => :'String',
78
91
  :'quantity' => :'String',
92
+ :'quantity_unit' => :'OrderQuantityUnit',
79
93
  :'note' => :'String',
80
94
  :'catalog_object_id' => :'String',
81
95
  :'variation_name' => :'String',
@@ -83,6 +97,7 @@ module SquareConnect
83
97
  :'taxes' => :'Array<OrderLineItemTax>',
84
98
  :'discounts' => :'Array<OrderLineItemDiscount>',
85
99
  :'base_price_money' => :'Money',
100
+ :'variation_total_price_money' => :'Money',
86
101
  :'gross_sales_money' => :'Money',
87
102
  :'total_tax_money' => :'Money',
88
103
  :'total_discount_money' => :'Money',
@@ -98,6 +113,10 @@ module SquareConnect
98
113
  # convert string to symbol for hash key
99
114
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
100
115
 
116
+ if attributes.has_key?(:'uid')
117
+ self.uid = attributes[:'uid']
118
+ end
119
+
101
120
  if attributes.has_key?(:'name')
102
121
  self.name = attributes[:'name']
103
122
  end
@@ -106,6 +125,10 @@ module SquareConnect
106
125
  self.quantity = attributes[:'quantity']
107
126
  end
108
127
 
128
+ if attributes.has_key?(:'quantity_unit')
129
+ self.quantity_unit = attributes[:'quantity_unit']
130
+ end
131
+
109
132
  if attributes.has_key?(:'note')
110
133
  self.note = attributes[:'note']
111
134
  end
@@ -140,6 +163,10 @@ module SquareConnect
140
163
  self.base_price_money = attributes[:'base_price_money']
141
164
  end
142
165
 
166
+ if attributes.has_key?(:'variation_total_price_money')
167
+ self.variation_total_price_money = attributes[:'variation_total_price_money']
168
+ end
169
+
143
170
  if attributes.has_key?(:'gross_sales_money')
144
171
  self.gross_sales_money = attributes[:'gross_sales_money']
145
172
  end
@@ -162,6 +189,10 @@ module SquareConnect
162
189
  # @return Array for valid properies with the reasons
163
190
  def list_invalid_properties
164
191
  invalid_properties = Array.new
192
+ if !@uid.nil? && @uid.to_s.length > 60
193
+ invalid_properties.push("invalid value for 'uid', the character length must be smaller than or equal to 60.")
194
+ end
195
+
165
196
  if !@name.nil? && @name.to_s.length > 500
166
197
  invalid_properties.push("invalid value for 'name', the character length must be smaller than or equal to 500.")
167
198
  end
@@ -170,8 +201,8 @@ module SquareConnect
170
201
  invalid_properties.push("invalid value for 'quantity', quantity cannot be nil.")
171
202
  end
172
203
 
173
- if @quantity.to_s.length > 5
174
- invalid_properties.push("invalid value for 'quantity', the character length must be smaller than or equal to 5.")
204
+ if @quantity.to_s.length > 12
205
+ invalid_properties.push("invalid value for 'quantity', the character length must be smaller than or equal to 12.")
175
206
  end
176
207
 
177
208
  if @quantity.to_s.length < 1
@@ -196,9 +227,10 @@ module SquareConnect
196
227
  # Check to see if the all the properties in the model are valid
197
228
  # @return true if the model is valid
198
229
  def valid?
230
+ return false if !@uid.nil? && @uid.to_s.length > 60
199
231
  return false if !@name.nil? && @name.to_s.length > 500
200
232
  return false if @quantity.nil?
201
- return false if @quantity.to_s.length > 5
233
+ return false if @quantity.to_s.length > 12
202
234
  return false if @quantity.to_s.length < 1
203
235
  return false if !@note.nil? && @note.to_s.length > 500
204
236
  return false if !@catalog_object_id.nil? && @catalog_object_id.to_s.length > 192
@@ -206,6 +238,17 @@ module SquareConnect
206
238
  return true
207
239
  end
208
240
 
241
+ # Custom attribute writer method with validation
242
+ # @param [Object] uid Value to be assigned
243
+ def uid=(uid)
244
+
245
+ if !uid.nil? && uid.to_s.length > 60
246
+ fail ArgumentError, "invalid value for 'uid', the character length must be smaller than or equal to 60."
247
+ end
248
+
249
+ @uid = uid
250
+ end
251
+
209
252
  # Custom attribute writer method with validation
210
253
  # @param [Object] name Value to be assigned
211
254
  def name=(name)
@@ -224,8 +267,8 @@ module SquareConnect
224
267
  fail ArgumentError, "quantity cannot be nil"
225
268
  end
226
269
 
227
- if quantity.to_s.length > 5
228
- fail ArgumentError, "invalid value for 'quantity', the character length must be smaller than or equal to 5."
270
+ if quantity.to_s.length > 12
271
+ fail ArgumentError, "invalid value for 'quantity', the character length must be smaller than or equal to 12."
229
272
  end
230
273
 
231
274
  if quantity.to_s.length < 1
@@ -273,8 +316,10 @@ module SquareConnect
273
316
  def ==(o)
274
317
  return true if self.equal?(o)
275
318
  self.class == o.class &&
319
+ uid == o.uid &&
276
320
  name == o.name &&
277
321
  quantity == o.quantity &&
322
+ quantity_unit == o.quantity_unit &&
278
323
  note == o.note &&
279
324
  catalog_object_id == o.catalog_object_id &&
280
325
  variation_name == o.variation_name &&
@@ -282,6 +327,7 @@ module SquareConnect
282
327
  taxes == o.taxes &&
283
328
  discounts == o.discounts &&
284
329
  base_price_money == o.base_price_money &&
330
+ variation_total_price_money == o.variation_total_price_money &&
285
331
  gross_sales_money == o.gross_sales_money &&
286
332
  total_tax_money == o.total_tax_money &&
287
333
  total_discount_money == o.total_discount_money &&
@@ -297,7 +343,7 @@ module SquareConnect
297
343
  # Calculates hash code according to all attributes.
298
344
  # @return [Fixnum] Hash code
299
345
  def hash
300
- [name, quantity, note, catalog_object_id, variation_name, modifiers, taxes, discounts, base_price_money, gross_sales_money, total_tax_money, total_discount_money, total_money].hash
346
+ [uid, name, quantity, quantity_unit, note, catalog_object_id, variation_name, modifiers, taxes, discounts, base_price_money, variation_total_price_money, gross_sales_money, total_tax_money, total_discount_money, total_money].hash
301
347
  end
302
348
 
303
349
  # Builds the object from hash
@@ -12,6 +12,9 @@ require 'date'
12
12
  module SquareConnect
13
13
  # Represents a discount that applies to one or more line items in an order. Fixed-amount, order-level discounts are distributed across all non-zero line item totals. The amount distributed to each line item is relative to that item’s contribution to the order subtotal.
14
14
  class OrderLineItemDiscount
15
+ # The discount's Unique identifier, unique only within this order. This field is read-only.
16
+ attr_accessor :uid
17
+
15
18
  # The catalog object id referencing [CatalogDiscount](#type-catalogdiscount).
16
19
  attr_accessor :catalog_object_id
17
20
 
@@ -21,7 +24,7 @@ module SquareConnect
21
24
  # The type of the discount. If it is created by API, it would be either `FIXED_PERCENTAGE` or `FIXED_AMOUNT`. VARIABLE_* is not supported in API because the order is created at the time of sale and either percentage or amount has to be specified. See [OrderLineItemDiscountType](#type-orderlineitemdiscounttype) for possible values
22
25
  attr_accessor :type
23
26
 
24
- # The percentage of the tax, as a string representation of a decimal number. A value of `7.25` corresponds to a percentage of 7.25%. The percentage won't be set for an amount-based discount.
27
+ # The percentage of the discount, as a string representation of a decimal number. A value of `7.25` corresponds to a percentage of 7.25%. The percentage won't be set for an amount-based discount.
25
28
  attr_accessor :percentage
26
29
 
27
30
  # The total monetary amount of the applicable discount. If it is at order level, it is the value of the order level discount. If it is at line item level, it is the value of the line item level discount. The amount_money won't be set for a percentage-based discount.
@@ -58,6 +61,7 @@ module SquareConnect
58
61
  # Attribute mapping from ruby-style variable name to JSON key.
59
62
  def self.attribute_map
60
63
  {
64
+ :'uid' => :'uid',
61
65
  :'catalog_object_id' => :'catalog_object_id',
62
66
  :'name' => :'name',
63
67
  :'type' => :'type',
@@ -71,6 +75,7 @@ module SquareConnect
71
75
  # Attribute type mapping.
72
76
  def self.swagger_types
73
77
  {
78
+ :'uid' => :'String',
74
79
  :'catalog_object_id' => :'String',
75
80
  :'name' => :'String',
76
81
  :'type' => :'String',
@@ -89,6 +94,10 @@ module SquareConnect
89
94
  # convert string to symbol for hash key
90
95
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
91
96
 
97
+ if attributes.has_key?(:'uid')
98
+ self.uid = attributes[:'uid']
99
+ end
100
+
92
101
  if attributes.has_key?(:'catalog_object_id')
93
102
  self.catalog_object_id = attributes[:'catalog_object_id']
94
103
  end
@@ -123,6 +132,10 @@ module SquareConnect
123
132
  # @return Array for valid properies with the reasons
124
133
  def list_invalid_properties
125
134
  invalid_properties = Array.new
135
+ if !@uid.nil? && @uid.to_s.length > 60
136
+ invalid_properties.push("invalid value for 'uid', the character length must be smaller than or equal to 60.")
137
+ end
138
+
126
139
  if !@catalog_object_id.nil? && @catalog_object_id.to_s.length > 192
127
140
  invalid_properties.push("invalid value for 'catalog_object_id', the character length must be smaller than or equal to 192.")
128
141
  end
@@ -141,6 +154,7 @@ module SquareConnect
141
154
  # Check to see if the all the properties in the model are valid
142
155
  # @return true if the model is valid
143
156
  def valid?
157
+ return false if !@uid.nil? && @uid.to_s.length > 60
144
158
  return false if !@catalog_object_id.nil? && @catalog_object_id.to_s.length > 192
145
159
  return false if !@name.nil? && @name.to_s.length > 255
146
160
  type_validator = EnumAttributeValidator.new('String', ["UNKNOWN_DISCOUNT", "FIXED_PERCENTAGE", "FIXED_AMOUNT", "VARIABLE_PERCENTAGE", "VARIABLE_AMOUNT"])
@@ -151,6 +165,17 @@ module SquareConnect
151
165
  return true
152
166
  end
153
167
 
168
+ # Custom attribute writer method with validation
169
+ # @param [Object] uid Value to be assigned
170
+ def uid=(uid)
171
+
172
+ if !uid.nil? && uid.to_s.length > 60
173
+ fail ArgumentError, "invalid value for 'uid', the character length must be smaller than or equal to 60."
174
+ end
175
+
176
+ @uid = uid
177
+ end
178
+
154
179
  # Custom attribute writer method with validation
155
180
  # @param [Object] catalog_object_id Value to be assigned
156
181
  def catalog_object_id=(catalog_object_id)
@@ -209,6 +234,7 @@ module SquareConnect
209
234
  def ==(o)
210
235
  return true if self.equal?(o)
211
236
  self.class == o.class &&
237
+ uid == o.uid &&
212
238
  catalog_object_id == o.catalog_object_id &&
213
239
  name == o.name &&
214
240
  type == o.type &&
@@ -227,7 +253,7 @@ module SquareConnect
227
253
  # Calculates hash code according to all attributes.
228
254
  # @return [Fixnum] Hash code
229
255
  def hash
230
- [catalog_object_id, name, type, percentage, amount_money, applied_money, scope].hash
256
+ [uid, catalog_object_id, name, type, percentage, amount_money, applied_money, scope].hash
231
257
  end
232
258
 
233
259
  # Builds the object from hash