ultracart_api 3.9.1 → 3.9.4

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -6
  3. data/docs/Browser.md +10 -0
  4. data/docs/BrowserDevice.md +8 -0
  5. data/docs/BrowserOS.md +12 -0
  6. data/docs/BrowserUserAgent.md +11 -0
  7. data/docs/Cart.md +1 -0
  8. data/docs/CustomerLoyalty.md +2 -0
  9. data/docs/DistributionCenter.md +1 -0
  10. data/docs/EmailCommseqPostcard.md +2 -0
  11. data/docs/EmailCommseqWebhookSendTestResponse.md +14 -0
  12. data/docs/EmailDomain.md +1 -0
  13. data/docs/GiftCertificate.md +2 -0
  14. data/docs/ItemTax.md +1 -0
  15. data/docs/OrderCheckout.md +2 -0
  16. data/docs/OrderItem.md +1 -0
  17. data/docs/StorefrontApi.md +2 -2
  18. data/docs/TaxProviderUltraCartState.md +3 -0
  19. data/docs/TaxState.md +3 -0
  20. data/lib/ultracart_api/api/storefront_api.rb +3 -3
  21. data/lib/ultracart_api/models/browser.rb +202 -0
  22. data/lib/ultracart_api/models/browser_device.rb +184 -0
  23. data/lib/ultracart_api/models/browser_os.rb +220 -0
  24. data/lib/ultracart_api/models/browser_user_agent.rb +211 -0
  25. data/lib/ultracart_api/models/cart.rb +11 -1
  26. data/lib/ultracart_api/models/customer_loyalty.rb +21 -1
  27. data/lib/ultracart_api/models/customer_tag.rb +5 -5
  28. data/lib/ultracart_api/models/distribution_center.rb +11 -1
  29. data/lib/ultracart_api/models/email_commseq_postcard.rb +21 -1
  30. data/lib/ultracart_api/models/email_commseq_webhook_send_test_response.rb +242 -0
  31. data/lib/ultracart_api/models/email_domain.rb +10 -1
  32. data/lib/ultracart_api/models/gift_certificate.rb +36 -1
  33. data/lib/ultracart_api/models/item_tax.rb +45 -1
  34. data/lib/ultracart_api/models/order_checkout.rb +20 -1
  35. data/lib/ultracart_api/models/order_item.rb +45 -1
  36. data/lib/ultracart_api/models/tax_provider_ultra_cart_state.rb +31 -1
  37. data/lib/ultracart_api/models/tax_state.rb +31 -1
  38. data/lib/ultracart_api/models/user.rb +15 -0
  39. data/lib/ultracart_api/version.rb +1 -1
  40. data/lib/ultracart_api.rb +5 -0
  41. metadata +12 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 712bf0471253bf7a1e158a9bb195be9c21a76540aa7c876fb67e6e7100ebc036
4
- data.tar.gz: 1ee3ed296ba6e3e740256894a04aed3837953b3eb0461bf1f15785766571a4ae
3
+ metadata.gz: 668a2eddb005ed4e289e5f78f9829126b20cc61b5479106f39598c53226fe826
4
+ data.tar.gz: 0d0542597bd1be0968a76b6ebe35cfe58dd0ae164234abdbd6ad31669e54e3e8
5
5
  SHA512:
6
- metadata.gz: 98c9eb555e6ec5884c5ed82c219e10bc6c3bc14acb583ecde03b364074e9df5619ec2741ccb1529cdc45c1b1ac2635fb57ff3e82beca1178e5eab537469b805b
7
- data.tar.gz: ba674c5eda0a756924e1690c104727ad3254fe7b347dd23d1c11b5309a2a6a4ec08bcc0a305784e89e99e2eb227f26f5e5c14612fd268040d5b6bb4540919c3b
6
+ metadata.gz: 830dd2d91674e02810988cfca429dd4eea8b17275dfb4c69d1b2a8715005195f907ab33aa41b987c7e4fcb458d801e71322cd439bfe3de2663c0d4e883ab3e43
7
+ data.tar.gz: 966c221aa8334f7fc44a2bacf81e9a0a454a516e38d3ae3078dc804ffd5d132cb8e860d0fdf074ba703b234676a7ce877fa9b44068d335f32841d46cb4c3a4ce
data/README.md CHANGED
@@ -7,7 +7,7 @@ UltraCart REST API Version 2
7
7
  This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
8
8
 
9
9
  - API version: 2.0.0
10
- - Package version: 3.9.1
10
+ - Package version: 3.9.4
11
11
  - Build package: io.swagger.codegen.languages.RubyClientCodegen
12
12
  For more information, please visit [http://www.ultracart.com](http://www.ultracart.com)
13
13
 
@@ -24,15 +24,15 @@ gem build ultracart_api.gemspec
24
24
  Then either install the gem locally:
25
25
 
26
26
  ```shell
27
- gem install ./ultracart_api-3.9.1.gem
27
+ gem install ./ultracart_api-3.9.4.gem
28
28
  ```
29
- (for development, run `gem install --dev ./ultracart_api-3.9.1.gem` to install the development dependencies)
29
+ (for development, run `gem install --dev ./ultracart_api-3.9.4.gem` to install the development dependencies)
30
30
 
31
31
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
32
32
 
33
33
  Finally add this to the Gemfile:
34
34
 
35
- gem 'ultracart_api', '~> 3.9.1'
35
+ gem 'ultracart_api', '~> 3.9.4'
36
36
 
37
37
  ### Install from Git
38
38
 
@@ -465,6 +465,10 @@ Class | Method | HTTP request | Description
465
465
  - [UltracartClient::AutoOrdersResponse](docs/AutoOrdersResponse.md)
466
466
  - [UltracartClient::AvalaraConfig](docs/AvalaraConfig.md)
467
467
  - [UltracartClient::BaseResponse](docs/BaseResponse.md)
468
+ - [UltracartClient::Browser](docs/Browser.md)
469
+ - [UltracartClient::BrowserDevice](docs/BrowserDevice.md)
470
+ - [UltracartClient::BrowserOS](docs/BrowserOS.md)
471
+ - [UltracartClient::BrowserUserAgent](docs/BrowserUserAgent.md)
468
472
  - [UltracartClient::Cart](docs/Cart.md)
469
473
  - [UltracartClient::CartAffiliate](docs/CartAffiliate.md)
470
474
  - [UltracartClient::CartAffirmCheckoutResponse](docs/CartAffirmCheckoutResponse.md)
@@ -657,6 +661,7 @@ Class | Method | HTTP request | Description
657
661
  - [UltracartClient::EmailCommseqStepLog](docs/EmailCommseqStepLog.md)
658
662
  - [UltracartClient::EmailCommseqStepLogsResponse](docs/EmailCommseqStepLogsResponse.md)
659
663
  - [UltracartClient::EmailCommseqWebhookSendTestRequest](docs/EmailCommseqWebhookSendTestRequest.md)
664
+ - [UltracartClient::EmailCommseqWebhookSendTestResponse](docs/EmailCommseqWebhookSendTestResponse.md)
660
665
  - [UltracartClient::EmailCommseqsResponse](docs/EmailCommseqsResponse.md)
661
666
  - [UltracartClient::EmailCustomer](docs/EmailCustomer.md)
662
667
  - [UltracartClient::EmailCustomerEditorUrlResponse](docs/EmailCustomerEditorUrlResponse.md)
@@ -1113,8 +1118,6 @@ Class | Method | HTTP request | Description
1113
1118
  - customer_write: Allows you to write customer information.
1114
1119
  - fulfillment_read: Allows you to read fulfillment information.
1115
1120
  - fulfillment_write: Allows you to write fulfillment information.
1116
- - gift_certificate_read: Allows you to read gift certificate information.
1117
- - gift_certificate_write: Allows you to write gift certificate information.
1118
1121
  - integration_log_read: Allows you to read integration log information.
1119
1122
  - integration_log_write: Allows you to write integration log information.
1120
1123
  - order_read: Allows you to read order information.
@@ -1131,6 +1134,8 @@ Class | Method | HTTP request | Description
1131
1134
  - ultrabooks_write: 2 of 2 required to use UltraBooks
1132
1135
  - user_read: Allows you to read user information.
1133
1136
  - user_write: Allows you to write user information.
1137
+ - gift_certificate_read: Allows you to read gift certificate information.
1138
+ - gift_certificate_write: Allows you to write gift certificate information.
1134
1139
 
1135
1140
  ### ultraCartSimpleApiKey
1136
1141
 
@@ -1146,6 +1151,9 @@ Not every change is committed to every SDK.
1146
1151
 
1147
1152
  | Version | Date | Comments |
1148
1153
  | --: | :-: | --- |
1154
+ | 3.9.4 | 04/13/2022 | Added spf DNS record to the sending domain object |
1155
+ | 3.9.3 | 04/06/2022 | fix return object on send webhook test method |
1156
+ | 3.9.2 | 04/04/2022 | user.email field extended and postcard screenshot fields |
1149
1157
  | 3.9.1 | 03/03/2022 | javascript sdk package.json bug fix |
1150
1158
  | 3.9.0 | 03/03/2022 | removed ultra_cart_rest_api_v2.d.ts from javascript sdk because typescript sdk exists now |
1151
1159
  | 3.8.8 | 03/02/2022 | bug fix for ruby sdk, uri.escape deprecated in 3.x |
data/docs/Browser.md ADDED
@@ -0,0 +1,10 @@
1
+ # UltracartClient::Browser
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **device** | [**BrowserDevice**](BrowserDevice.md) | | [optional]
7
+ **os** | [**BrowserOS**](BrowserOS.md) | | [optional]
8
+ **user_agent** | [**BrowserUserAgent**](BrowserUserAgent.md) | | [optional]
9
+
10
+
@@ -0,0 +1,8 @@
1
+ # UltracartClient::BrowserDevice
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **family** | **String** | | [optional]
7
+
8
+
data/docs/BrowserOS.md ADDED
@@ -0,0 +1,12 @@
1
+ # UltracartClient::BrowserOS
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **family** | **String** | | [optional]
7
+ **major** | **String** | | [optional]
8
+ **minor** | **String** | | [optional]
9
+ **patch** | **String** | | [optional]
10
+ **patch_minor** | **String** | | [optional]
11
+
12
+
@@ -0,0 +1,11 @@
1
+ # UltracartClient::BrowserUserAgent
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **family** | **String** | | [optional]
7
+ **major** | **String** | | [optional]
8
+ **minor** | **String** | | [optional]
9
+ **patch** | **String** | | [optional]
10
+
11
+
data/docs/Cart.md CHANGED
@@ -4,6 +4,7 @@
4
4
  Name | Type | Description | Notes
5
5
  ------------ | ------------- | ------------- | -------------
6
6
  **affiliate** | [**CartAffiliate**](CartAffiliate.md) | | [optional]
7
+ **affiliate_network_pixel_oid** | **Integer** | The affiliate network pixel identifier associated with the cart | [optional]
7
8
  **base_currency_code** | **String** | The ISO-4217 three letter base currency code of the account | [optional]
8
9
  **billing** | [**CartBilling**](CartBilling.md) | | [optional]
9
10
  **buysafe** | [**CartBuysafe**](CartBuysafe.md) | | [optional]
@@ -4,6 +4,8 @@
4
4
  Name | Type | Description | Notes
5
5
  ------------ | ------------- | ------------- | -------------
6
6
  **current_points** | **Integer** | Current Points | [optional]
7
+ **internal_gift_certificate_balance** | **String** | Loyalty Cashback / Store credit balance (internal gift certificate balance) | [optional]
8
+ **internal_gift_certificate_oid** | **Integer** | Internal gift certificate oid used to tracking loyalty cashback / store credit. | [optional]
7
9
  **ledger_entries** | [**Array<CustomerLoyaltyLedger>**](CustomerLoyaltyLedger.md) | Ledger entries | [optional]
8
10
  **pending_points** | **Integer** | Pending Points | [optional]
9
11
  **redemptions** | [**Array<CustomerLoyaltyRedemption>**](CustomerLoyaltyRedemption.md) | Redemptions | [optional]
@@ -36,6 +36,7 @@ Name | Type | Description | Notes
36
36
  **shipment_cutoff_time_tuesday** | **String** | The time (EST) after which shipments will not be processed on Tuesday | [optional]
37
37
  **shipment_cutoff_time_wednesday** | **String** | The time (EST) after which shipments will not be processed on Wednesday | [optional]
38
38
  **state** | **String** | State of the distribution center | [optional]
39
+ **transmit_blank_costs** | **BOOLEAN** | True if monetary amounts should be zeroed before transmission | [optional]
39
40
  **transport** | **String** | Transport mechanism for this distribution center | [optional]
40
41
 
41
42
 
@@ -13,6 +13,8 @@ Name | Type | Description | Notes
13
13
  **postcard_container_cjson_last_modified_dts** | **String** | Timestamp the last time the container was modified. | [optional]
14
14
  **postcard_front_container_cjson** | **String** | Postcard front container cjson | [optional]
15
15
  **postcard_front_container_uuid** | **String** | Postcard front container uuid | [optional]
16
+ **screenshot_front_url** | **String** | URL for front screenshot | [optional]
17
+ **screenshot_small_full_url** | **String** | URL for back screenshot | [optional]
16
18
  **storefront_oid** | **Integer** | Storefront oid | [optional]
17
19
 
18
20
 
@@ -0,0 +1,14 @@
1
+ # UltracartClient::EmailCommseqWebhookSendTestResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **error** | [**Error**](Error.md) | | [optional]
7
+ **metadata** | [**ResponseMetadata**](ResponseMetadata.md) | | [optional]
8
+ **request** | **String** | HTTP Request | [optional]
9
+ **response** | **String** | HTTP Response | [optional]
10
+ **status_code** | **Integer** | HTTP Status Code | [optional]
11
+ **success** | **BOOLEAN** | Indicates if API call was successful | [optional]
12
+ **warning** | [**Warning**](Warning.md) | | [optional]
13
+
14
+
data/docs/EmailDomain.md CHANGED
@@ -11,6 +11,7 @@ Name | Type | Description | Notes
11
11
  **identity_status** | **String** | | [optional]
12
12
  **merchant_id** | **String** | | [optional]
13
13
  **provider** | **String** | | [optional]
14
+ **spf** | [**VerificationRecord**](VerificationRecord.md) | | [optional]
14
15
  **start_dkim_dts** | **String** | | [optional]
15
16
  **start_identity_dts** | **String** | | [optional]
16
17
  **verification** | [**VerificationRecord**](VerificationRecord.md) | | [optional]
@@ -5,10 +5,12 @@ Name | Type | Description | Notes
5
5
  ------------ | ------------- | ------------- | -------------
6
6
  **activated** | **BOOLEAN** | True if this gift certificate is activated and ready to apply to purchases. | [optional]
7
7
  **code** | **String** | The code used by the customer to purchase against this gift certificate. | [optional]
8
+ **customer_profile_oid** | **Integer** | This is the customer profile oid associated with this internally managed gift certificate. | [optional]
8
9
  **deleted** | **BOOLEAN** | True if this gift certificate was deleted. | [optional]
9
10
  **email** | **String** | Email of the customer associated with this gift certificate. | [optional]
10
11
  **expiration_dts** | **String** | Expiration date time. | [optional]
11
12
  **gift_certificate_oid** | **Integer** | Gift certificate oid. | [optional]
13
+ **internal** | **BOOLEAN** | This is an internally managed gift certificate associated with the loyalty cash rewards program. | [optional]
12
14
  **ledger_entries** | [**Array<GiftCertificateLedgerEntry>**](GiftCertificateLedgerEntry.md) | A list of all ledger activity for this gift certificate. | [optional]
13
15
  **merchant_id** | **String** | Merchant Id | [optional]
14
16
  **merchant_note** | **String** | A list of all ledger activity for this gift certificate. | [optional]
data/docs/ItemTax.md CHANGED
@@ -5,6 +5,7 @@ Name | Type | Description | Notes
5
5
  ------------ | ------------- | ------------- | -------------
6
6
  **exemptions** | [**Array<ItemTaxExemption>**](ItemTaxExemption.md) | Exemptions | [optional]
7
7
  **tax_free** | **BOOLEAN** | True if tax free | [optional]
8
+ **tax_product_type** | **String** | Tax product type | [optional]
8
9
  **taxable_cost** | **Float** | Taxable cost if different than regular cost | [optional]
9
10
 
10
11
 
@@ -3,6 +3,7 @@
3
3
  ## Properties
4
4
  Name | Type | Description | Notes
5
5
  ------------ | ------------- | ------------- | -------------
6
+ **browser** | [**Browser**](Browser.md) | | [optional]
6
7
  **comments** | **String** | Comments from the customer. Rarely used on the single page checkout. | [optional]
7
8
  **custom_field1** | **String** | Custom field 1 | [optional]
8
9
  **custom_field2** | **String** | Custom field 2 | [optional]
@@ -13,6 +14,7 @@ Name | Type | Description | Notes
13
14
  **custom_field7** | **String** | Custom field 7 | [optional]
14
15
  **customer_ip_address** | **String** | IP address of the customer when placing the order | [optional]
15
16
  **screen_branding_theme_code** | **String** | Screen branding theme code associated with the order (legacy checkout) | [optional]
17
+ **screen_size** | **String** | Screen size small, medium or large | [optional]
16
18
  **storefront_host_name** | **String** | StoreFront host name associated with the order | [optional]
17
19
  **upsell_path_code** | **String** | Upsell path code assigned during the checkout that the customer went through | [optional]
18
20
 
data/docs/OrderItem.md CHANGED
@@ -49,6 +49,7 @@ Name | Type | Description | Notes
49
49
  **special_product_type** | **String** | Special product type (USPS Media Mail) | [optional]
50
50
  **tags** | [**Array<OrderItemTag>**](OrderItemTag.md) | Tags | [optional]
51
51
  **tax_free** | **BOOLEAN** | True if the item is tax free | [optional]
52
+ **tax_product_type** | **String** | Type of product for tax purposes (self or UltraCart Managed taxes) | [optional]
52
53
  **taxable_cost** | [**Currency**](Currency.md) | | [optional]
53
54
  **total_cost_with_discount** | [**Currency**](Currency.md) | | [optional]
54
55
  **total_refunded** | [**Currency**](Currency.md) | | [optional]
@@ -7045,7 +7045,7 @@ Name | Type | Description | Notes
7045
7045
 
7046
7046
 
7047
7047
  # **send_webhook_test**
7048
- > EmailCommseqEmailSendTestResponse send_webhook_test(storefront_oid, email_commseq_webhook_test_request)
7048
+ > EmailCommseqWebhookSendTestResponse send_webhook_test(storefront_oid, email_commseq_webhook_test_request)
7049
7049
 
7050
7050
  Send webhook test
7051
7051
 
@@ -7082,7 +7082,7 @@ Name | Type | Description | Notes
7082
7082
 
7083
7083
  ### Return type
7084
7084
 
7085
- [**EmailCommseqEmailSendTestResponse**](EmailCommseqEmailSendTestResponse.md)
7085
+ [**EmailCommseqWebhookSendTestResponse**](EmailCommseqWebhookSendTestResponse.md)
7086
7086
 
7087
7087
  ### Authorization
7088
7088
 
@@ -4,6 +4,9 @@
4
4
  Name | Type | Description | Notes
5
5
  ------------ | ------------- | ------------- | -------------
6
6
  **enabled** | **BOOLEAN** | True if this state taxes are managed by UltraCart | [optional]
7
+ **exempt_digital_items** | **BOOLEAN** | True if digital items are exempt from sales tax in this state. | [optional]
8
+ **exempt_physical_items** | **BOOLEAN** | True if physical items are exempt from sales tax in this state. | [optional]
9
+ **exempt_service_items** | **BOOLEAN** | True if service items are exempt from sales tax in this state. | [optional]
7
10
  **state_code** | **String** | State Code (2 digits) | [optional]
8
11
  **state_name** | **String** | Fully spelled out state name | [optional]
9
12
  **tax_gift_charge** | **BOOLEAN** | True if gift charges should be taxed in this state. | [optional]
data/docs/TaxState.md CHANGED
@@ -10,6 +10,9 @@ Name | Type | Description | Notes
10
10
  **dont_collect_county** | **BOOLEAN** | Flag instructing engine to not collect county tax for this state | [optional]
11
11
  **dont_collect_postal_code** | **BOOLEAN** | Flag instructing engine to not collect postal code tax for this state | [optional]
12
12
  **dont_collect_state** | **BOOLEAN** | Flag instructing engine to not collect state tax for this state | [optional]
13
+ **exempt_digital_items** | **BOOLEAN** | True if digital items are exempt from sales tax in this state. | [optional]
14
+ **exempt_physical_items** | **BOOLEAN** | True if physical items are exempt from sales tax in this state. | [optional]
15
+ **exempt_service_items** | **BOOLEAN** | True if service items are exempt from sales tax in this state. | [optional]
13
16
  **state_code** | **String** | State code | [optional]
14
17
  **state_oid** | **Integer** | Tax record object identifier used internally by database | [optional]
15
18
  **tax_gift_charge** | **BOOLEAN** | True if taxation within this jurisdiction should charge tax on gift charge | [optional]
@@ -7871,7 +7871,7 @@ module UltracartClient
7871
7871
  # @param storefront_oid
7872
7872
  # @param email_commseq_webhook_test_request Email commseq webhook test request
7873
7873
  # @param [Hash] opts the optional parameters
7874
- # @return [EmailCommseqEmailSendTestResponse]
7874
+ # @return [EmailCommseqWebhookSendTestResponse]
7875
7875
  def send_webhook_test(storefront_oid, email_commseq_webhook_test_request, opts = {})
7876
7876
  data, _status_code, _headers = send_webhook_test_with_http_info(storefront_oid, email_commseq_webhook_test_request, opts)
7877
7877
  data
@@ -7881,7 +7881,7 @@ module UltracartClient
7881
7881
  # @param storefront_oid
7882
7882
  # @param email_commseq_webhook_test_request Email commseq webhook test request
7883
7883
  # @param [Hash] opts the optional parameters
7884
- # @return [Array<(EmailCommseqEmailSendTestResponse, Fixnum, Hash)>] EmailCommseqEmailSendTestResponse data, response status code and response headers
7884
+ # @return [Array<(EmailCommseqWebhookSendTestResponse, Fixnum, Hash)>] EmailCommseqWebhookSendTestResponse data, response status code and response headers
7885
7885
  def send_webhook_test_with_http_info(storefront_oid, email_commseq_webhook_test_request, opts = {})
7886
7886
  if @api_client.config.debugging
7887
7887
  @api_client.config.logger.debug 'Calling API: StorefrontApi.send_webhook_test ...'
@@ -7920,7 +7920,7 @@ module UltracartClient
7920
7920
  :form_params => form_params,
7921
7921
  :body => post_body,
7922
7922
  :auth_names => auth_names,
7923
- :return_type => 'EmailCommseqEmailSendTestResponse')
7923
+ :return_type => 'EmailCommseqWebhookSendTestResponse')
7924
7924
  if @api_client.config.debugging
7925
7925
  @api_client.config.logger.debug "API called: StorefrontApi#send_webhook_test\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
7926
7926
  end
@@ -0,0 +1,202 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class Browser
17
+ attr_accessor :device
18
+
19
+ attr_accessor :os
20
+
21
+ attr_accessor :user_agent
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'device' => :'device',
27
+ :'os' => :'os',
28
+ :'user_agent' => :'user_agent'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'device' => :'BrowserDevice',
36
+ :'os' => :'BrowserOS',
37
+ :'user_agent' => :'BrowserUserAgent'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ return unless attributes.is_a?(Hash)
45
+
46
+ # convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
48
+
49
+ if attributes.has_key?(:'device')
50
+ self.device = attributes[:'device']
51
+ end
52
+
53
+ if attributes.has_key?(:'os')
54
+ self.os = attributes[:'os']
55
+ end
56
+
57
+ if attributes.has_key?(:'user_agent')
58
+ self.user_agent = attributes[:'user_agent']
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
66
+ invalid_properties
67
+ end
68
+
69
+ # Check to see if the all the properties in the model are valid
70
+ # @return true if the model is valid
71
+ def valid?
72
+ true
73
+ end
74
+
75
+ # Checks equality by comparing each attribute.
76
+ # @param [Object] Object to be compared
77
+ def ==(o)
78
+ return true if self.equal?(o)
79
+ self.class == o.class &&
80
+ device == o.device &&
81
+ os == o.os &&
82
+ user_agent == o.user_agent
83
+ end
84
+
85
+ # @see the `==` method
86
+ # @param [Object] Object to be compared
87
+ def eql?(o)
88
+ self == o
89
+ end
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Fixnum] Hash code
93
+ def hash
94
+ [device, os, user_agent].hash
95
+ end
96
+
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def build_from_hash(attributes)
101
+ return nil unless attributes.is_a?(Hash)
102
+ self.class.swagger_types.each_pair do |key, type|
103
+ if type =~ /\AArray<(.*)>/i
104
+ # check to ensure the input is an array given that the attribute
105
+ # is documented as an array but the input is not
106
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
107
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
108
+ end
109
+ elsif !attributes[self.class.attribute_map[key]].nil?
110
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
111
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
112
+ end
113
+
114
+ self
115
+ end
116
+
117
+ # Deserializes the data based on type
118
+ # @param string type Data type
119
+ # @param string value Value to be deserialized
120
+ # @return [Object] Deserialized data
121
+ def _deserialize(type, value)
122
+ case type.to_sym
123
+ when :DateTime
124
+ DateTime.parse(value)
125
+ when :Date
126
+ Date.parse(value)
127
+ when :String
128
+ value.to_s
129
+ when :Integer
130
+ value.to_i
131
+ when :Float
132
+ value.to_f
133
+ when :BOOLEAN
134
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
135
+ true
136
+ else
137
+ false
138
+ end
139
+ when :Object
140
+ # generic object (usually a Hash), return directly
141
+ value
142
+ when /\AArray<(?<inner_type>.+)>\z/
143
+ inner_type = Regexp.last_match[:inner_type]
144
+ value.map { |v| _deserialize(inner_type, v) }
145
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
146
+ k_type = Regexp.last_match[:k_type]
147
+ v_type = Regexp.last_match[:v_type]
148
+ {}.tap do |hash|
149
+ value.each do |k, v|
150
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
151
+ end
152
+ end
153
+ else # model
154
+ temp_model = UltracartClient.const_get(type).new
155
+ temp_model.build_from_hash(value)
156
+ end
157
+ end
158
+
159
+ # Returns the string representation of the object
160
+ # @return [String] String presentation of the object
161
+ def to_s
162
+ to_hash.to_s
163
+ end
164
+
165
+ # to_body is an alias to to_hash (backward compatibility)
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_body
168
+ to_hash
169
+ end
170
+
171
+ # Returns the object in the form of hash
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_hash
174
+ hash = {}
175
+ self.class.attribute_map.each_pair do |attr, param|
176
+ value = self.send(attr)
177
+ next if value.nil?
178
+ hash[param] = _to_hash(value)
179
+ end
180
+ hash
181
+ end
182
+
183
+ # Outputs non-array value in the form of hash
184
+ # For object, use to_hash. Otherwise, just return the value
185
+ # @param [Object] value Any valid value
186
+ # @return [Hash] Returns the value in the form of hash
187
+ def _to_hash(value)
188
+ if value.is_a?(Array)
189
+ value.compact.map { |v| _to_hash(v) }
190
+ elsif value.is_a?(Hash)
191
+ {}.tap do |hash|
192
+ value.each { |k, v| hash[k] = _to_hash(v) }
193
+ end
194
+ elsif value.respond_to? :to_hash
195
+ value.to_hash
196
+ else
197
+ value
198
+ end
199
+ end
200
+
201
+ end
202
+ end