square_connect 2.20190710.0.321 → 2.20190724.0.325

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +5 -0
  3. data/README.md +8 -2
  4. data/docs/CatalogItem.md +2 -1
  5. data/docs/CatalogItemOption.md +17 -0
  6. data/docs/CatalogItemOptionForItem.md +12 -0
  7. data/docs/CatalogItemOptionValue.md +17 -0
  8. data/docs/CatalogItemOptionValueForItemVariation.md +13 -0
  9. data/docs/CatalogItemProductType.md +1 -1
  10. data/docs/CatalogItemVariation.md +1 -0
  11. data/docs/CatalogObject.md +2 -0
  12. data/docs/CatalogObjectType.md +3 -0
  13. data/docs/CatalogQuery.md +2 -0
  14. data/docs/CatalogQueryItemVariationsForItemOptionValues.md +12 -0
  15. data/docs/CatalogQueryItemsForItemOptions.md +12 -0
  16. data/lib/square_connect.rb +6 -0
  17. data/lib/square_connect/api_client.rb +1 -1
  18. data/lib/square_connect/models/catalog_item.rb +17 -5
  19. data/lib/square_connect/models/catalog_item_option.rb +238 -0
  20. data/lib/square_connect/models/catalog_item_option_for_item.rb +186 -0
  21. data/lib/square_connect/models/catalog_item_option_value.rb +236 -0
  22. data/lib/square_connect/models/catalog_item_option_value_for_item_variation.rb +196 -0
  23. data/lib/square_connect/models/catalog_item_variation.rb +13 -1
  24. data/lib/square_connect/models/catalog_object.rb +24 -4
  25. data/lib/square_connect/models/catalog_object_type.rb +3 -0
  26. data/lib/square_connect/models/catalog_query.rb +24 -4
  27. data/lib/square_connect/models/catalog_query_item_variations_for_item_option_values.rb +188 -0
  28. data/lib/square_connect/models/catalog_query_items_for_item_options.rb +188 -0
  29. data/lib/square_connect/version.rb +1 -1
  30. data/spec/models/catalog_item_option_for_item_spec.rb +39 -0
  31. data/spec/models/catalog_item_option_spec.rb +69 -0
  32. data/spec/models/catalog_item_option_value_for_item_variation_spec.rb +45 -0
  33. data/spec/models/catalog_item_option_value_spec.rb +69 -0
  34. data/spec/models/catalog_query_item_variations_for_item_option_values_spec.rb +39 -0
  35. data/spec/models/catalog_query_items_for_item_options_spec.rb +39 -0
  36. metadata +26 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18859f855d1baefc2c748115d7ed8c9d36110ac8535f1ccb11973558e40125d7
4
- data.tar.gz: c52a038d30c7290fba1532f51c9ad82205d51659020f459934952cf103ae0142
3
+ metadata.gz: 5f81ce5506df0dc9ee3814901e34ad5db294260c926077931c2784b193eeceab
4
+ data.tar.gz: 9acfb905d67b80bf6557fb77e68262b9668337c05c4c47308cc87adc28efd67e
5
5
  SHA512:
6
- metadata.gz: 88979e2eeb33a34da275418df013e51a070e8c67908b3cc481251ddd6317e800b93cd35630846418614cb419601dd5602c1013e5284b570a45e8fb376a2ce5bd
7
- data.tar.gz: d73d34bf2c7dc9b4677b4c21ff943ea12b9613c386b977d35cb510b82f5536bb0c32b94a83145de5c8e7a90145c876bf1d8eb004af3fc1de293117ed143efa9f
6
+ metadata.gz: 43e374c72ea48241b23405323fb3b4dd0173a8f4b0223d44b610c1605dbd1d23f700a1621fdedc5a0dedac0780f6968a580060f72aa38d569c05b875728cab9c
7
+ data.tar.gz: 2cd26bff31b85c5c500d1c71ae9806121679bdcefbd21ed30e963c2eb63f7b6af8219de7519955f876246717b1717d09315739e244a5f53bc37c1c1700329c91
data/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## Version 2.20190724.0 (2019-07-24)
4
+
5
+ * **BETA releases**:
6
+ * Catalog API: supports item options with datatypes and enums for item options and item option values.
7
+
3
8
  ## Version 2.20190710.0 (2019-07-10)
4
9
 
5
10
  * **Retired functionality** — The `CatalogItem.image_url` field (deprecated under `Square-Version` YYYYMMDD) is retired and no longer included in Connect SDKs.
data/README.md CHANGED
@@ -10,7 +10,7 @@ for the specification and template files we used to generate this.
10
10
  This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
11
11
 
12
12
  - API version: 2.0
13
- - Package version: 2.20190710.0
13
+ - Package version: 2.20190724.0
14
14
  - Build package: io.swagger.codegen.languages.RubyClientCodegen
15
15
 
16
16
  For more information, please visit [https://squareup.com/developers](https://squareup.com/developers)
@@ -252,6 +252,10 @@ Class | Method | HTTP request | Description
252
252
  - [SquareConnect::CatalogInfoResponseLimits](docs/CatalogInfoResponseLimits.md)
253
253
  - [SquareConnect::CatalogItem](docs/CatalogItem.md)
254
254
  - [SquareConnect::CatalogItemModifierListInfo](docs/CatalogItemModifierListInfo.md)
255
+ - [SquareConnect::CatalogItemOption](docs/CatalogItemOption.md)
256
+ - [SquareConnect::CatalogItemOptionForItem](docs/CatalogItemOptionForItem.md)
257
+ - [SquareConnect::CatalogItemOptionValue](docs/CatalogItemOptionValue.md)
258
+ - [SquareConnect::CatalogItemOptionValueForItemVariation](docs/CatalogItemOptionValueForItemVariation.md)
255
259
  - [SquareConnect::CatalogItemProductType](docs/CatalogItemProductType.md)
256
260
  - [SquareConnect::CatalogItemVariation](docs/CatalogItemVariation.md)
257
261
  - [SquareConnect::CatalogMeasurementUnit](docs/CatalogMeasurementUnit.md)
@@ -267,6 +271,8 @@ Class | Method | HTTP request | Description
267
271
  - [SquareConnect::CatalogProductSet](docs/CatalogProductSet.md)
268
272
  - [SquareConnect::CatalogQuery](docs/CatalogQuery.md)
269
273
  - [SquareConnect::CatalogQueryExact](docs/CatalogQueryExact.md)
274
+ - [SquareConnect::CatalogQueryItemVariationsForItemOptionValues](docs/CatalogQueryItemVariationsForItemOptionValues.md)
275
+ - [SquareConnect::CatalogQueryItemsForItemOptions](docs/CatalogQueryItemsForItemOptions.md)
270
276
  - [SquareConnect::CatalogQueryItemsForModifierList](docs/CatalogQueryItemsForModifierList.md)
271
277
  - [SquareConnect::CatalogQueryItemsForTax](docs/CatalogQueryItemsForTax.md)
272
278
  - [SquareConnect::CatalogQueryPrefix](docs/CatalogQueryPrefix.md)
@@ -678,7 +684,7 @@ Class | Method | HTTP request | Description
678
684
  - EMPLOYEES_WRITE: __HTTP Method__: `POST`, `PUT`, `DELETE` Grants write access to employee profile information. For example, to create and modify employee profiles.
679
685
  - INVENTORY_READ: __HTTP Method__: `GET` Grants read access to inventory information. For example, to call the RetrieveInventoryCount endpoint.
680
686
  - INVENTORY_WRITE: __HTTP Method__: `POST`, `PUT`, `DELETE` Grants write access to inventory information. For example, to call the BatchChangeInventory endpoint.
681
- - ITEMS_READ: __HTTP Method__: `GET` Grants read access to business and location information. For example, to obtain a location ID for subsequent activity.
687
+ - ITEMS_READ: __HTTP Method__: `GET` Grants read access to product catalog information. For example, to get an item or a list of items.
682
688
  - ITEMS_WRITE: __HTTP Method__: `POST`, `PUT`, `DELETE` Grants write access to product catalog information. For example, to modify or add to a product catalog.
683
689
  - MERCHANT_PROFILE_READ: __HTTP Method__: `GET` Grants read access to business and location information. For example, to obtain a location ID for subsequent activity.
684
690
  - ORDERS_READ: __HTTP Method__: `GET` Grants read access to order information. For example, to call the BatchRetrieveOrders endpoint.
@@ -18,7 +18,8 @@ Name | Type | Description | Notes
18
18
  **tax_ids** | **Array<String>** | A set of IDs indicating the [CatalogTax](#type-catalogtax)es that are enabled for this item. When updating an item, any taxes listed here will be added to the item. [CatalogTax](#type-catalogtax)es may also be added to or deleted from an item using `UpdateItemTaxes`. | [optional]
19
19
  **modifier_list_info** | [**Array<CatalogItemModifierListInfo>**](CatalogItemModifierListInfo.md) | A set of [CatalogItemModifierListInfo](#type-catalogitemmodifierlistinfo) objects representing the modifier lists that apply to this item, along with the overrides and min and max limits that are specific to this item. [CatalogModifierList](#type-catalogmodifierlist)s may also be added to or deleted from an item using `UpdateItemModifierLists`. | [optional]
20
20
  **variations** | [**Array<CatalogObject>**](CatalogObject.md) | A list of [CatalogObject](#type-catalogobject)s containing the [CatalogItemVariation](#type-catalogitemvariation)s for this item. Maximum: 250 item variations | [optional]
21
- **product_type** | **String** | The product type of the item. May not be changed once an item has been created. Only items of product type `REGULAR` may be created by this API; items with other product types are read-only. See [CatalogItemProductType](#type-catalogitemproducttype) for possible values | [optional]
21
+ **product_type** | **String** | The product type of the item. May not be changed once an item has been created. Only items of product type `REGULAR` or `APPOINTMENTS_SERVICE` may be created by this API; items with other product types are read-only. See [CatalogItemProductType](#type-catalogitemproducttype) for possible values | [optional]
22
22
  **skip_modifier_screen** | **BOOLEAN** | If `false`, the Square Point of Sale app will present the [CatalogItem](#type-catalogitem)'s details screen immediately, allowing the merchant to choose [CatalogModifier](#type-catalogmodifier)s before adding the item to the cart. This is the default behavior. If `true`, the Square Point of Sale app will immediately add the item to the cart with the pre-selected modifiers, and merchants can edit modifiers by drilling down onto the item's details. Third-party clients are encouraged to implement similar behaviors. | [optional]
23
+ **item_options** | [**Array<CatalogItemOptionForItem>**](CatalogItemOptionForItem.md) | List of item options IDs for this item. Used to manage and group item variations in a specified order. Maximum: 6 item options. | [optional]
23
24
 
24
25
 
@@ -0,0 +1,17 @@
1
+ # SquareConnect::CatalogItemOption
2
+
3
+ ### Description
4
+
5
+ A group of variations for a [CatalogItem](#type-catalogitem)'s.
6
+
7
+ ## Properties
8
+ Name | Type | Description | Notes
9
+ ------------ | ------------- | ------------- | -------------
10
+ **name** | **String** | The item option's display name for the seller. Must be unique across all item options. Searchable. | [optional]
11
+ **display_name** | **String** | The item option's display name for the customer. Searchable. | [optional]
12
+ **description** | **String** | The item option's human-readable description. Displays for in the Square Point of Sale app for the seller and in the Online Store or on receipts for the buyer. | [optional]
13
+ **show_colors** | **BOOLEAN** | If true, display colors for entries in `values` when present. | [optional]
14
+ **values** | [**Array<CatalogObject>**](CatalogObject.md) | A list of [CatalogObject](#type-catalogobject)s containing the [CatalogItemOptionValue](#type-catalogitemoptionvalue)s for this item. | [optional]
15
+ **item_count** | **Integer** | The number of [CatalogItem](#type-catalogitem)s currently associated with this item option. Present only if the `include_counts` was specified in the request. Any count over 100 will be returned as `100`. | [optional]
16
+
17
+
@@ -0,0 +1,12 @@
1
+ # SquareConnect::CatalogItemOptionForItem
2
+
3
+ ### Description
4
+
5
+ A list of item option values that can be assigned to item variations. For example, a t-shirt item may offer a color option or a size option.
6
+
7
+ ## Properties
8
+ Name | Type | Description | Notes
9
+ ------------ | ------------- | ------------- | -------------
10
+ **item_option_id** | **String** | The unique id of the item option, used to form the dimensions of the item option matrix in a specified order. | [optional]
11
+
12
+
@@ -0,0 +1,17 @@
1
+ # SquareConnect::CatalogItemOptionValue
2
+
3
+ ### Description
4
+
5
+ An enumerated value that can link a [CatalogItemVariation(#type-catalogitemvariation) to an item option as one of its item option values.
6
+
7
+ ## Properties
8
+ Name | Type | Description | Notes
9
+ ------------ | ------------- | ------------- | -------------
10
+ **item_option_id** | **String** | Unique ID of the associated item option. | [optional]
11
+ **name** | **String** | Name of this item option value. Searchable. | [optional]
12
+ **description** | **String** | The option value's human-readable description. | [optional]
13
+ **color** | **String** | The HTML color for this value in the format #FFRRGGBB or #RRGGBB (e.g., \"#ff8d4e85\"). Only displayed if parent Item Option's `show_colors` flag is enabled. value. | [optional]
14
+ **ordinal** | **Integer** | Determines where this option value appears in a list of option values. | [optional]
15
+ **item_variation_count** | **Integer** | The number of [CatalogItemVariation(#type-catalogitemvariation)s that currently make use of this Item Option value. Present only if `retrieve_counts` was specified on the request used to retrieve the parent Item Option of this value. Maximum: 100 counts. | [optional]
16
+
17
+
@@ -0,0 +1,13 @@
1
+ # SquareConnect::CatalogItemOptionValueForItemVariation
2
+
3
+ ### Description
4
+
5
+ A [CatalogItemOptionValue](#type-catalogitemoptionvalue) links an item variation to an item option as an item option value. For example, a t-shirt item may offer a color option and a size option. An item option value would represent each variation of t-shirt: For example, “Color:Red, Size:Small” or “Color:Blue, Size:Medium”.
6
+
7
+ ## Properties
8
+ Name | Type | Description | Notes
9
+ ------------ | ------------- | ------------- | -------------
10
+ **item_option_id** | **String** | The unique id of an item option. | [optional]
11
+ **item_option_value_id** | **String** | The unique id of the selected value for the item option. | [optional]
12
+
13
+
@@ -2,7 +2,7 @@
2
2
 
3
3
  ### Description
4
4
 
5
- The type of a [CatalogItem](#type-catalogitem). Connect V2 only allows the creation of `REGULAR` items.
5
+ The type of a [CatalogItem](#type-catalogitem). Connect V2 only allows the creation of `REGULAR` or `APPOINTMENTS_SERVICE` items.
6
6
 
7
7
  ## Properties
8
8
  Name | Type
@@ -20,6 +20,7 @@ Name | Type | Description | Notes
20
20
  **inventory_alert_threshold** | **Integer** | If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type` is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. This value is always an integer. | [optional]
21
21
  **user_data** | **String** | Arbitrary user metadata to associate with the item variation. Cannot exceed 255 characters. Searchable. | [optional]
22
22
  **service_duration** | **Integer** | If the [CatalogItem](#type-catalogitem) that owns this item variation is of type `APPOINTMENTS_SERVICE`, then this is the duration of the service in milliseconds. For example, a 30 minute appointment would have the value `1800000`, which is equal to 30 (minutes) * 60 (seconds per minute) * 1000 (milliseconds per second). | [optional]
23
+ **item_option_values** | [**Array<CatalogItemOptionValueForItemVariation>**](CatalogItemOptionValueForItemVariation.md) | List of item option values associated with this item variation. Listed in the same order as the item options of the parent item. | [optional]
23
24
  **measurement_unit_id** | **String** | ID of the ‘CatalogMeasurementUnit’ that is used to measure the quantity sold of this item variation. If left unset, the item will be sold in whole quantities. | [optional]
24
25
 
25
26
 
@@ -29,5 +29,7 @@ Name | Type | Description | Notes
29
29
  **pricing_rule_data** | [**CatalogPricingRule**](CatalogPricingRule.md) | Structured data for a [CatalogPricingRule](#type-catalogpricingrule), set for CatalogObjects of type `PRICING_RULE`. | [optional]
30
30
  **image_data** | [**CatalogImage**](CatalogImage.md) | Structured data for a [CatalogImage](#type-catalogimage), set for CatalogObjects of type `IMAGE`. | [optional]
31
31
  **measurement_unit_data** | [**CatalogMeasurementUnit**](CatalogMeasurementUnit.md) | Structured data for a [CatalogMeasurementUnit](#type-catalogmeasurementunit), set for CatalogObjects of type `MEASUREMENT_UNIT`. | [optional]
32
+ **item_option_data** | [**CatalogItemOption**](CatalogItemOption.md) | Structured data for a [CatalogItemOption](#type-catalogitemoption), set for CatalogObjects of type `ITEM_OPTION`. | [optional]
33
+ **item_option_value_data** | [**CatalogItemOptionValue**](CatalogItemOptionValue.md) | Structured data for a [CatalogItemOptionValue](#type-catalogitemoptionvalue), set for CatalogObjects of type `ITEM_OPTION_VAL`. | [optional]
32
34
 
33
35
 
@@ -18,5 +18,8 @@ Name | Type
18
18
  **PRICING_RULE** | string
19
19
  **PRODUCT_SET** | string
20
20
  **TIME_PERIOD** | string
21
+ **MEASUREMENT_UNIT** | string
22
+ **ITEM_OPTION** | string
23
+ **ITEM_OPTION_VAL** | string
21
24
 
22
25
 
@@ -14,5 +14,7 @@ Name | Type | Description | Notes
14
14
  **text_query** | [**CatalogQueryText**](CatalogQueryText.md) | A query that returns only objects whose searchable attributes contain all of the given keywords as prefixes. For example, if a [CatalogItem](#type-catalogitem) contains attributes `{\"name\": \"t-shirt\"}` and `{\"description\": \"Small, Purple\"}`, it will be matched by the query `{\"keywords\": [\"shirt\", \"sma\", \"purp\"]}`. | [optional]
15
15
  **items_for_tax_query** | [**CatalogQueryItemsForTax**](CatalogQueryItemsForTax.md) | A query that returns all [CatalogItem](#type-catalogitem)s that have any of the given [CatalogTax](#type-catalogtax)es enabled. | [optional]
16
16
  **items_for_modifier_list_query** | [**CatalogQueryItemsForModifierList**](CatalogQueryItemsForModifierList.md) | A query that returns all [CatalogItem](#type-catalogitem)s that have any of the given [CatalogModifierList](#type-catalogmodifierlist)s enabled. | [optional]
17
+ **items_for_item_options_query** | [**CatalogQueryItemsForItemOptions**](CatalogQueryItemsForItemOptions.md) | A query that returns all [CatalogItem](#type-catalogitem)s that have all of the given [CatalogItemOption](#type-catalogitemoption)s. | [optional]
18
+ **item_variations_for_item_option_values_query** | [**CatalogQueryItemVariationsForItemOptionValues**](CatalogQueryItemVariationsForItemOptionValues.md) | A query that returns all [CatalogItemVariation](#type-catalogitemvariations)s that have all of the given [CatalogItemOption](#type-catalogitemoption) values. | [optional]
17
19
 
18
20
 
@@ -0,0 +1,12 @@
1
+ # SquareConnect::CatalogQueryItemVariationsForItemOptionValues
2
+
3
+ ### Description
4
+
5
+
6
+
7
+ ## Properties
8
+ Name | Type | Description | Notes
9
+ ------------ | ------------- | ------------- | -------------
10
+ **item_option_value_ids** | **Array<String>** | A set of [CatalogItemOptionValue](#type-catalogitemoptionvalue) IDs to be used to find associated [CatalogItemVariation](#type-catalogitemvariation)s. All ItemVariations that contain all of the given Item Option Values (in any order) will be returned. | [optional]
11
+
12
+
@@ -0,0 +1,12 @@
1
+ # SquareConnect::CatalogQueryItemsForItemOptions
2
+
3
+ ### Description
4
+
5
+
6
+
7
+ ## Properties
8
+ Name | Type | Description | Notes
9
+ ------------ | ------------- | ------------- | -------------
10
+ **item_option_ids** | **Array<String>** | A set of [CatalogItemOption](#type-catalogitemoption) IDs to be used to find associated [CatalogItem](#type-catalogitem)s. All Items that contain all of the given Item Options (in any order) will be returned. | [optional]
11
+
12
+
@@ -49,6 +49,10 @@ require 'square_connect/models/catalog_info_response'
49
49
  require 'square_connect/models/catalog_info_response_limits'
50
50
  require 'square_connect/models/catalog_item'
51
51
  require 'square_connect/models/catalog_item_modifier_list_info'
52
+ require 'square_connect/models/catalog_item_option'
53
+ require 'square_connect/models/catalog_item_option_for_item'
54
+ require 'square_connect/models/catalog_item_option_value'
55
+ require 'square_connect/models/catalog_item_option_value_for_item_variation'
52
56
  require 'square_connect/models/catalog_item_product_type'
53
57
  require 'square_connect/models/catalog_item_variation'
54
58
  require 'square_connect/models/catalog_measurement_unit'
@@ -64,6 +68,8 @@ require 'square_connect/models/catalog_pricing_type'
64
68
  require 'square_connect/models/catalog_product_set'
65
69
  require 'square_connect/models/catalog_query'
66
70
  require 'square_connect/models/catalog_query_exact'
71
+ require 'square_connect/models/catalog_query_item_variations_for_item_option_values'
72
+ require 'square_connect/models/catalog_query_items_for_item_options'
67
73
  require 'square_connect/models/catalog_query_items_for_modifier_list'
68
74
  require 'square_connect/models/catalog_query_items_for_tax'
69
75
  require 'square_connect/models/catalog_query_prefix'
@@ -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.20190710.0"
33
+ @user_agent = "Square-Connect-Ruby/2.20190724.0"
34
34
 
35
35
  @default_headers = {
36
36
  'Content-Type' => "application/json",
@@ -45,12 +45,15 @@ module SquareConnect
45
45
  # A list of [CatalogObject](#type-catalogobject)s containing the [CatalogItemVariation](#type-catalogitemvariation)s for this item. Maximum: 250 item variations
46
46
  attr_accessor :variations
47
47
 
48
- # The product type of the item. May not be changed once an item has been created. Only items of product type `REGULAR` may be created by this API; items with other product types are read-only. See [CatalogItemProductType](#type-catalogitemproducttype) for possible values
48
+ # The product type of the item. May not be changed once an item has been created. Only items of product type `REGULAR` or `APPOINTMENTS_SERVICE` may be created by this API; items with other product types are read-only. See [CatalogItemProductType](#type-catalogitemproducttype) for possible values
49
49
  attr_accessor :product_type
50
50
 
51
51
  # If `false`, the Square Point of Sale app will present the [CatalogItem](#type-catalogitem)'s details screen immediately, allowing the merchant to choose [CatalogModifier](#type-catalogmodifier)s before adding the item to the cart. This is the default behavior. If `true`, the Square Point of Sale app will immediately add the item to the cart with the pre-selected modifiers, and merchants can edit modifiers by drilling down onto the item's details. Third-party clients are encouraged to implement similar behaviors.
52
52
  attr_accessor :skip_modifier_screen
53
53
 
54
+ # List of item options IDs for this item. Used to manage and group item variations in a specified order. Maximum: 6 item options.
55
+ attr_accessor :item_options
56
+
54
57
 
55
58
  # Attribute mapping from ruby-style variable name to JSON key.
56
59
  def self.attribute_map
@@ -67,7 +70,8 @@ module SquareConnect
67
70
  :'modifier_list_info' => :'modifier_list_info',
68
71
  :'variations' => :'variations',
69
72
  :'product_type' => :'product_type',
70
- :'skip_modifier_screen' => :'skip_modifier_screen'
73
+ :'skip_modifier_screen' => :'skip_modifier_screen',
74
+ :'item_options' => :'item_options'
71
75
  }
72
76
  end
73
77
 
@@ -86,7 +90,8 @@ module SquareConnect
86
90
  :'modifier_list_info' => :'Array<CatalogItemModifierListInfo>',
87
91
  :'variations' => :'Array<CatalogObject>',
88
92
  :'product_type' => :'String',
89
- :'skip_modifier_screen' => :'BOOLEAN'
93
+ :'skip_modifier_screen' => :'BOOLEAN',
94
+ :'item_options' => :'Array<CatalogItemOptionForItem>'
90
95
  }
91
96
  end
92
97
 
@@ -156,6 +161,12 @@ module SquareConnect
156
161
  self.skip_modifier_screen = attributes[:'skip_modifier_screen']
157
162
  end
158
163
 
164
+ if attributes.has_key?(:'item_options')
165
+ if (value = attributes[:'item_options']).is_a?(Array)
166
+ self.item_options = value
167
+ end
168
+ end
169
+
159
170
  end
160
171
 
161
172
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -188,7 +199,8 @@ module SquareConnect
188
199
  modifier_list_info == o.modifier_list_info &&
189
200
  variations == o.variations &&
190
201
  product_type == o.product_type &&
191
- skip_modifier_screen == o.skip_modifier_screen
202
+ skip_modifier_screen == o.skip_modifier_screen &&
203
+ item_options == o.item_options
192
204
  end
193
205
 
194
206
  # @see the `==` method
@@ -200,7 +212,7 @@ module SquareConnect
200
212
  # Calculates hash code according to all attributes.
201
213
  # @return [Fixnum] Hash code
202
214
  def hash
203
- [name, description, abbreviation, label_color, available_online, available_for_pickup, available_electronically, category_id, tax_ids, modifier_list_info, variations, product_type, skip_modifier_screen].hash
215
+ [name, description, abbreviation, label_color, available_online, available_for_pickup, available_electronically, category_id, tax_ids, modifier_list_info, variations, product_type, skip_modifier_screen, item_options].hash
204
216
  end
205
217
 
206
218
  # Builds the object from hash
@@ -0,0 +1,238 @@
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 group of variations for a [CatalogItem](#type-catalogitem)'s.
14
+ class CatalogItemOption
15
+ # The item option's display name for the seller. Must be unique across all item options. Searchable.
16
+ attr_accessor :name
17
+
18
+ # The item option's display name for the customer. Searchable.
19
+ attr_accessor :display_name
20
+
21
+ # The item option's human-readable description. Displays for in the Square Point of Sale app for the seller and in the Online Store or on receipts for the buyer.
22
+ attr_accessor :description
23
+
24
+ # If true, display colors for entries in `values` when present.
25
+ attr_accessor :show_colors
26
+
27
+ # A list of [CatalogObject](#type-catalogobject)s containing the [CatalogItemOptionValue](#type-catalogitemoptionvalue)s for this item.
28
+ attr_accessor :values
29
+
30
+ # The number of [CatalogItem](#type-catalogitem)s currently associated with this item option. Present only if the `include_counts` was specified in the request. Any count over 100 will be returned as `100`.
31
+ attr_accessor :item_count
32
+
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'name' => :'name',
38
+ :'display_name' => :'display_name',
39
+ :'description' => :'description',
40
+ :'show_colors' => :'show_colors',
41
+ :'values' => :'values',
42
+ :'item_count' => :'item_count'
43
+ }
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.swagger_types
48
+ {
49
+ :'name' => :'String',
50
+ :'display_name' => :'String',
51
+ :'description' => :'String',
52
+ :'show_colors' => :'BOOLEAN',
53
+ :'values' => :'Array<CatalogObject>',
54
+ :'item_count' => :'Integer'
55
+ }
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ return unless attributes.is_a?(Hash)
62
+
63
+ # convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
65
+
66
+ if attributes.has_key?(:'name')
67
+ self.name = attributes[:'name']
68
+ end
69
+
70
+ if attributes.has_key?(:'display_name')
71
+ self.display_name = attributes[:'display_name']
72
+ end
73
+
74
+ if attributes.has_key?(:'description')
75
+ self.description = attributes[:'description']
76
+ end
77
+
78
+ if attributes.has_key?(:'show_colors')
79
+ self.show_colors = attributes[:'show_colors']
80
+ end
81
+
82
+ if attributes.has_key?(:'values')
83
+ if (value = attributes[:'values']).is_a?(Array)
84
+ self.values = value
85
+ end
86
+ end
87
+
88
+ if attributes.has_key?(:'item_count')
89
+ self.item_count = attributes[:'item_count']
90
+ end
91
+
92
+ end
93
+
94
+ # Show invalid properties with the reasons. Usually used together with valid?
95
+ # @return Array for valid properies with the reasons
96
+ def list_invalid_properties
97
+ invalid_properties = Array.new
98
+ return invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ return true
105
+ end
106
+
107
+ # Checks equality by comparing each attribute.
108
+ # @param [Object] Object to be compared
109
+ def ==(o)
110
+ return true if self.equal?(o)
111
+ self.class == o.class &&
112
+ name == o.name &&
113
+ display_name == o.display_name &&
114
+ description == o.description &&
115
+ show_colors == o.show_colors &&
116
+ values == o.values &&
117
+ item_count == o.item_count
118
+ end
119
+
120
+ # @see the `==` method
121
+ # @param [Object] Object to be compared
122
+ def eql?(o)
123
+ self == o
124
+ end
125
+
126
+ # Calculates hash code according to all attributes.
127
+ # @return [Fixnum] Hash code
128
+ def hash
129
+ [name, display_name, description, show_colors, values, item_count].hash
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ self.class.swagger_types.each_pair do |key, type|
138
+ if type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
143
+ end
144
+ elsif !attributes[self.class.attribute_map[key]].nil?
145
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
147
+ end
148
+
149
+ self
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def _deserialize(type, value)
157
+ case type.to_sym
158
+ when :DateTime
159
+ DateTime.parse(value)
160
+ when :Date
161
+ Date.parse(value)
162
+ when :String
163
+ value.to_s
164
+ when :Integer
165
+ value.to_i
166
+ when :Float
167
+ value.to_f
168
+ when :BOOLEAN
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
170
+ true
171
+ else
172
+ false
173
+ end
174
+ when :Object
175
+ # generic object (usually a Hash), return directly
176
+ value
177
+ when /\AArray<(?<inner_type>.+)>\z/
178
+ inner_type = Regexp.last_match[:inner_type]
179
+ value.map { |v| _deserialize(inner_type, v) }
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
181
+ k_type = Regexp.last_match[:k_type]
182
+ v_type = Regexp.last_match[:v_type]
183
+ {}.tap do |hash|
184
+ value.each do |k, v|
185
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
186
+ end
187
+ end
188
+ else # model
189
+ temp_model = SquareConnect.const_get(type).new
190
+ temp_model.build_from_hash(value)
191
+ end
192
+ end
193
+
194
+ # Returns the string representation of the object
195
+ # @return [String] String presentation of the object
196
+ def to_s
197
+ to_hash.to_s
198
+ end
199
+
200
+ # to_body is an alias to to_hash (backward compatibility)
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_body
203
+ to_hash
204
+ end
205
+
206
+ # Returns the object in the form of hash
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_hash
209
+ hash = {}
210
+ self.class.attribute_map.each_pair do |attr, param|
211
+ value = self.send(attr)
212
+ next if value.nil?
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map{ |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+
236
+ end
237
+
238
+ end