ultracart_api 4.1.226 → 4.1.227

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95c3131895afcb281803e49d636846ec15358a684552f90cab1b880e15cd1355
4
- data.tar.gz: ab6bdf275099e086dd4d36ce07cb705894ab7d0b9b9fcd410041d92ff93bd921
3
+ metadata.gz: 9cebb20eb6b5e4505c97751fdc80c2ef40598ac560a4f3b35e7787468c22af6e
4
+ data.tar.gz: dc802f516b52ca2d4da126b1407ba78b926f62e8e6573abc1bd8bf9bb91e2a22
5
5
  SHA512:
6
- metadata.gz: c53f4efbd29f1be9d09b314f9ae2080436116dc33aea108454a482b337ade38506fd89aa3da59419225155cb5070dc0e222993aa0c1098e60ed980ca36a561fe
7
- data.tar.gz: e42f873a047fb0b2dc7dc3e8a3eaeb107d6d0498ee482462a5214e98228ad1d9d332ec54a7137fc98a7bff32cc384af9d6be3769b76ebebcc70d4b4f92b263b3
6
+ metadata.gz: 46669da4eceeb6072c7c791e0cc9a9dc51860654714711e65fa9c4713ef0fb7d682898682f217bfece4aa4ba261de6b463d115d7abb429ee3d9208f3c609f320
7
+ data.tar.gz: 612105c33ada9046e36a7295f6c6196dbcb15a807c236fc740f12ba7286ee5a6b15cc576b4af5c7f48236ee20b83ba4cfd27c7e54a8d4b543223b7874c97b407
data/README.md CHANGED
@@ -7,7 +7,7 @@ Note: Every method has a sample for every language. See https://github.com/Ultr
7
7
  This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
8
8
 
9
9
  - API version: 2.0.0
10
- - Package version: 4.1.226
10
+ - Package version: 4.1.227
11
11
  - Build package: org.openapitools.codegen.languages.RubyClientCodegen
12
12
  - For more information, please visit [http://www.ultracart.com/api/](http://www.ultracart.com/api/)
13
13
 
@@ -16,7 +16,7 @@ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-g
16
16
  gemfile:
17
17
 
18
18
  ```shell
19
- gem 'ultracart_api', '4.1.226'
19
+ gem 'ultracart_api', '4.1.227'
20
20
  ```
21
21
 
22
22
  install:
@@ -584,6 +584,7 @@ Class | Method | HTTP request | Description
584
584
  *UltracartClient::SfvbApi* | [**get_sfvb_sequence**](docs/SfvbApi.md#get_sfvb_sequence) | **GET** /sfvb/storefronts/{storefront_oid}/sequences/{sequence_uuid} | Get a campaign's or flow's steps as a tree
585
585
  *UltracartClient::SfvbApi* | [**get_sfvb_server_log**](docs/SfvbApi.md#get_sfvb_server_log) | **GET** /sfvb/storefronts/{storefront_oid}/logs/{log_id} | Get one storefront render log
586
586
  *UltracartClient::SfvbApi* | [**get_sfvb_site_attributes**](docs/SfvbApi.md#get_sfvb_site_attributes) | **GET** /sfvb/storefronts/{storefront_oid}/attributes | Read a storefront's site attributes
587
+ *UltracartClient::SfvbApi* | [**get_sfvb_sitemaps**](docs/SfvbApi.md#get_sfvb_sitemaps) | **GET** /sfvb/storefronts/{storefront_oid}/sitemaps | Read a storefront's sitemaps and robots.txt
587
588
  *UltracartClient::SfvbApi* | [**get_sfvb_smart_attribution**](docs/SfvbApi.md#get_sfvb_smart_attribution) | **GET** /sfvb/storefronts/{storefront_oid}/smart_attribution | Read a storefront's Smart Attribution configuration
588
589
  *UltracartClient::SfvbApi* | [**get_sfvb_test_orders**](docs/SfvbApi.md#get_sfvb_test_orders) | **GET** /sfvb/storefronts/{storefront_oid}/test_orders | List recent test orders
589
590
  *UltracartClient::SfvbApi* | [**get_sfvb_theme**](docs/SfvbApi.md#get_sfvb_theme) | **GET** /sfvb/storefronts/{storefront_oid}/themes/{theme_oid} | Get a theme
@@ -2145,6 +2146,7 @@ Class | Method | HTTP request | Description
2145
2146
  - [UltracartClient::SfvbRedirectsResponse](docs/SfvbRedirectsResponse.md)
2146
2147
  - [UltracartClient::SfvbRenderRequest](docs/SfvbRenderRequest.md)
2147
2148
  - [UltracartClient::SfvbRenderResponse](docs/SfvbRenderResponse.md)
2149
+ - [UltracartClient::SfvbRobotsTxt](docs/SfvbRobotsTxt.md)
2148
2150
  - [UltracartClient::SfvbSecretHandle](docs/SfvbSecretHandle.md)
2149
2151
  - [UltracartClient::SfvbSecretKind](docs/SfvbSecretKind.md)
2150
2152
  - [UltracartClient::SfvbSecretKindsResponse](docs/SfvbSecretKindsResponse.md)
@@ -2170,6 +2172,9 @@ Class | Method | HTTP request | Description
2170
2172
  - [UltracartClient::SfvbSiteAttributeUpdate](docs/SfvbSiteAttributeUpdate.md)
2171
2173
  - [UltracartClient::SfvbSiteAttributeUpdateRequest](docs/SfvbSiteAttributeUpdateRequest.md)
2172
2174
  - [UltracartClient::SfvbSiteAttributesResponse](docs/SfvbSiteAttributesResponse.md)
2175
+ - [UltracartClient::SfvbSitemap](docs/SfvbSitemap.md)
2176
+ - [UltracartClient::SfvbSitemapFile](docs/SfvbSitemapFile.md)
2177
+ - [UltracartClient::SfvbSitemapsResponse](docs/SfvbSitemapsResponse.md)
2173
2178
  - [UltracartClient::SfvbSmartAttribution](docs/SfvbSmartAttribution.md)
2174
2179
  - [UltracartClient::SfvbSmartAttributionPlatform](docs/SfvbSmartAttributionPlatform.md)
2175
2180
  - [UltracartClient::SfvbSmartAttributionRequest](docs/SfvbSmartAttributionRequest.md)
@@ -2403,6 +2408,7 @@ Not every change is committed to every SDK.
2403
2408
 
2404
2409
  | Version | Date | Comments |
2405
2410
  | --: | :-: | --- |
2411
+ | 4.1.227 | 11/04/2026 | sfvb internal testing |
2406
2412
  | 4.1.226 | 11/04/2026 | sfvb internal testing |
2407
2413
  | 4.1.225 | 11/03/2026 | sfvb internal testing |
2408
2414
  | 4.1.224 | 11/03/2026 | sfvb internal testing |
data/docs/SfvbApi.md CHANGED
@@ -112,6 +112,7 @@ All URIs are relative to *https://secure.ultracart.com/rest/v2*
112
112
  | [**get_sfvb_sequence**](SfvbApi.md#get_sfvb_sequence) | **GET** /sfvb/storefronts/{storefront_oid}/sequences/{sequence_uuid} | Get a campaign's or flow's steps as a tree |
113
113
  | [**get_sfvb_server_log**](SfvbApi.md#get_sfvb_server_log) | **GET** /sfvb/storefronts/{storefront_oid}/logs/{log_id} | Get one storefront render log |
114
114
  | [**get_sfvb_site_attributes**](SfvbApi.md#get_sfvb_site_attributes) | **GET** /sfvb/storefronts/{storefront_oid}/attributes | Read a storefront's site attributes |
115
+ | [**get_sfvb_sitemaps**](SfvbApi.md#get_sfvb_sitemaps) | **GET** /sfvb/storefronts/{storefront_oid}/sitemaps | Read a storefront's sitemaps and robots.txt |
115
116
  | [**get_sfvb_smart_attribution**](SfvbApi.md#get_sfvb_smart_attribution) | **GET** /sfvb/storefronts/{storefront_oid}/smart_attribution | Read a storefront's Smart Attribution configuration |
116
117
  | [**get_sfvb_test_orders**](SfvbApi.md#get_sfvb_test_orders) | **GET** /sfvb/storefronts/{storefront_oid}/test_orders | List recent test orders |
117
118
  | [**get_sfvb_theme**](SfvbApi.md#get_sfvb_theme) | **GET** /sfvb/storefronts/{storefront_oid}/themes/{theme_oid} | Get a theme |
@@ -6104,6 +6105,59 @@ end
6104
6105
  - **Accept**: application/json
6105
6106
 
6106
6107
 
6108
+ ## get_sfvb_sitemaps
6109
+
6110
+ > <SfvbSitemapsResponse> get_sfvb_sitemaps(storefront_oid)
6111
+
6112
+ Read a storefront's sitemaps and robots.txt
6113
+
6114
+ The sitemaps the admin SEO Sitemaps screen lists, with their child files and build times, the Sitemap lines robots.txt serves, and whether Prevent Indexing is on. Read only. The files are rebuilt nightly, so a page change shows in them after the next build.
6115
+
6116
+
6117
+ ### Examples
6118
+
6119
+
6120
+ (No example for this operation).
6121
+
6122
+
6123
+ #### Using the get_sfvb_sitemaps_with_http_info variant
6124
+
6125
+ This returns an Array which contains the response data, status code and headers.
6126
+
6127
+ > <Array(<SfvbSitemapsResponse>, Integer, Hash)> get_sfvb_sitemaps_with_http_info(storefront_oid)
6128
+
6129
+ ```ruby
6130
+ begin
6131
+ # Read a storefront's sitemaps and robots.txt
6132
+ data, status_code, headers = api_instance.get_sfvb_sitemaps_with_http_info(storefront_oid)
6133
+ p status_code # => 2xx
6134
+ p headers # => { ... }
6135
+ p data # => <SfvbSitemapsResponse>
6136
+ rescue UltracartClient::ApiError => e
6137
+ puts "Error when calling SfvbApi->get_sfvb_sitemaps_with_http_info: #{e}"
6138
+ end
6139
+ ```
6140
+
6141
+ ### Parameters
6142
+
6143
+ | Name | Type | Description | Notes |
6144
+ | ---- | ---- | ----------- | ----- |
6145
+ | **storefront_oid** | **Integer** | | |
6146
+
6147
+ ### Return type
6148
+
6149
+ [**SfvbSitemapsResponse**](SfvbSitemapsResponse.md)
6150
+
6151
+ ### Authorization
6152
+
6153
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
6154
+
6155
+ ### HTTP request headers
6156
+
6157
+ - **Content-Type**: Not defined
6158
+ - **Accept**: application/json
6159
+
6160
+
6107
6161
  ## get_sfvb_smart_attribution
6108
6162
 
6109
6163
  > <SfvbSmartAttribution> get_sfvb_smart_attribution(storefront_oid)
@@ -0,0 +1,22 @@
1
+ # UltracartClient::SfvbRobotsTxt
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **custom_file** | **Boolean** | True when the merchant has their own /robots.txt file, which is served after UltraCart&#39;s entries. | [optional] |
8
+ | **sitemap_lines** | **Array&lt;String&gt;** | The Sitemap lines it serves, UltraCart&#39;s own first, then any in the merchant&#39;s own robots.txt file. | [optional] |
9
+ | **url** | **String** | The robots.txt URL on the storefront&#39;s host. | [optional] |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'ultracart_api'
15
+
16
+ instance = UltracartClient::SfvbRobotsTxt.new(
17
+ custom_file: null,
18
+ sitemap_lines: null,
19
+ url: null
20
+ )
21
+ ```
22
+
@@ -0,0 +1,28 @@
1
+ # UltracartClient::SfvbSitemap
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **child_files** | [**Array&lt;SfvbSitemapFile&gt;**](SfvbSitemapFile.md) | For an index, the child files it lists, in order. | [optional] |
8
+ | **format** | **String** | sitemaps.org (the index to register with Google Search Console and Bing), google-0.84 (the older Google schema) or urllist (a plain URL list). | [optional] |
9
+ | **last_built** | **String** | When the nightly build last wrote the sitemap, as ISO 8601. | [optional] |
10
+ | **path** | **String** | The sitemap&#39;s path on the storefront. | [optional] |
11
+ | **size_bytes** | **Integer** | The file&#39;s size in bytes. | [optional] |
12
+ | **url** | **String** | The sitemap&#39;s https URL, the one to register. | [optional] |
13
+
14
+ ## Example
15
+
16
+ ```ruby
17
+ require 'ultracart_api'
18
+
19
+ instance = UltracartClient::SfvbSitemap.new(
20
+ child_files: null,
21
+ format: null,
22
+ last_built: null,
23
+ path: null,
24
+ size_bytes: null,
25
+ url: null
26
+ )
27
+ ```
28
+
@@ -0,0 +1,24 @@
1
+ # UltracartClient::SfvbSitemapFile
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **last_built** | **String** | When the nightly build last wrote the file, as ISO 8601. | [optional] |
8
+ | **path** | **String** | The file&#39;s path on the storefront, such as /sitemapsdotorg1.xml.gz. | [optional] |
9
+ | **size_bytes** | **Integer** | The file&#39;s size in bytes, compressed for a .gz file. | [optional] |
10
+ | **url** | **String** | The file&#39;s https URL on the storefront&#39;s host. | [optional] |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'ultracart_api'
16
+
17
+ instance = UltracartClient::SfvbSitemapFile.new(
18
+ last_built: null,
19
+ path: null,
20
+ size_bytes: null,
21
+ url: null
22
+ )
23
+ ```
24
+
@@ -0,0 +1,28 @@
1
+ # UltracartClient::SfvbSitemapsResponse
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **host** | **String** | The host the sitemaps are built for. | [optional] |
8
+ | **notes** | **Array&lt;String&gt;** | What a person should know about these sitemaps, such as when they are rebuilt. | [optional] |
9
+ | **prevent_indexing** | **Boolean** | True when the storefront&#39;s Prevent Indexing setting is on. The sitemaps are still served, but every page tells search engines not to index it. | [optional] |
10
+ | **robots_txt** | [**SfvbRobotsTxt**](SfvbRobotsTxt.md) | | [optional] |
11
+ | **sitemaps** | [**Array&lt;SfvbSitemap&gt;**](SfvbSitemap.md) | The sitemaps that exist, sitemaps.org first. Empty until the nightly build has run. | [optional] |
12
+ | **storefront_oid** | **Integer** | The storefront. | [optional] |
13
+
14
+ ## Example
15
+
16
+ ```ruby
17
+ require 'ultracart_api'
18
+
19
+ instance = UltracartClient::SfvbSitemapsResponse.new(
20
+ host: null,
21
+ notes: null,
22
+ prevent_indexing: null,
23
+ robots_txt: null,
24
+ sitemaps: null,
25
+ storefront_oid: null
26
+ )
27
+ ```
28
+
@@ -7762,6 +7762,70 @@ module UltracartClient
7762
7762
  return data, status_code, headers
7763
7763
  end
7764
7764
 
7765
+ # Read a storefront's sitemaps and robots.txt
7766
+ # The sitemaps the admin SEO Sitemaps screen lists, with their child files and build times, the Sitemap lines robots.txt serves, and whether Prevent Indexing is on. Read only. The files are rebuilt nightly, so a page change shows in them after the next build.
7767
+ # @param storefront_oid [Integer]
7768
+ # @param [Hash] opts the optional parameters
7769
+ # @return [SfvbSitemapsResponse]
7770
+ def get_sfvb_sitemaps(storefront_oid, opts = {})
7771
+ data, _status_code, _headers = get_sfvb_sitemaps_with_http_info(storefront_oid, opts)
7772
+ data
7773
+ end
7774
+
7775
+ # Read a storefront&#39;s sitemaps and robots.txt
7776
+ # The sitemaps the admin SEO Sitemaps screen lists, with their child files and build times, the Sitemap lines robots.txt serves, and whether Prevent Indexing is on. Read only. The files are rebuilt nightly, so a page change shows in them after the next build.
7777
+ # @param storefront_oid [Integer]
7778
+ # @param [Hash] opts the optional parameters
7779
+ # @return [Array<(SfvbSitemapsResponse, Integer, Hash)>] SfvbSitemapsResponse data, response status code and response headers
7780
+ def get_sfvb_sitemaps_with_http_info(storefront_oid, opts = {})
7781
+ if @api_client.config.debugging
7782
+ @api_client.config.logger.debug 'Calling API: SfvbApi.get_sfvb_sitemaps ...'
7783
+ end
7784
+ # verify the required parameter 'storefront_oid' is set
7785
+ if @api_client.config.client_side_validation && storefront_oid.nil?
7786
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling SfvbApi.get_sfvb_sitemaps"
7787
+ end
7788
+ # resource path
7789
+ local_var_path = '/sfvb/storefronts/{storefront_oid}/sitemaps'.sub('{' + 'storefront_oid' + '}', CGI.escape(storefront_oid.to_s))
7790
+
7791
+ # query parameters
7792
+ query_params = opts[:query_params] || {}
7793
+
7794
+ # header parameters
7795
+ header_params = opts[:header_params] || {}
7796
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
7797
+ # HTTP header 'Accept' (if needed)
7798
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
7799
+
7800
+ # form parameters
7801
+ form_params = opts[:form_params] || {}
7802
+
7803
+ # http body (model)
7804
+ post_body = opts[:debug_body]
7805
+
7806
+ # return_type
7807
+ return_type = opts[:debug_return_type] || 'SfvbSitemapsResponse'
7808
+
7809
+ # auth_names
7810
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
7811
+
7812
+ new_options = opts.merge(
7813
+ :operation => :"SfvbApi.get_sfvb_sitemaps",
7814
+ :header_params => header_params,
7815
+ :query_params => query_params,
7816
+ :form_params => form_params,
7817
+ :body => post_body,
7818
+ :auth_names => auth_names,
7819
+ :return_type => return_type
7820
+ )
7821
+
7822
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
7823
+ if @api_client.config.debugging
7824
+ @api_client.config.logger.debug "API called: SfvbApi#get_sfvb_sitemaps\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
7825
+ end
7826
+ return data, status_code, headers
7827
+ end
7828
+
7765
7829
  # Read a storefront's Smart Attribution configuration
7766
7830
  # The mode, model, global credit split, lookback and platforms, the platforms detected from the tracking integrations that are not configured yet, and the hash_sha256 a change or delete sends back as If-Match. When configured is false the values are the defaults an enable would save.
7767
7831
  # @param storefront_oid [Integer]
@@ -0,0 +1,242 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class SfvbRobotsTxt
18
+ # True when the merchant has their own /robots.txt file, which is served after UltraCart's entries.
19
+ attr_accessor :custom_file
20
+
21
+ # The Sitemap lines it serves, UltraCart's own first, then any in the merchant's own robots.txt file.
22
+ attr_accessor :sitemap_lines
23
+
24
+ # The robots.txt URL on the storefront's host.
25
+ attr_accessor :url
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'custom_file' => :'custom_file',
31
+ :'sitemap_lines' => :'sitemap_lines',
32
+ :'url' => :'url'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'custom_file' => :'Boolean',
45
+ :'sitemap_lines' => :'Array<String>',
46
+ :'url' => :'String'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbRobotsTxt` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbRobotsTxt`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'custom_file')
72
+ self.custom_file = attributes[:'custom_file']
73
+ end
74
+
75
+ if attributes.key?(:'sitemap_lines')
76
+ if (value = attributes[:'sitemap_lines']).is_a?(Array)
77
+ self.sitemap_lines = value
78
+ end
79
+ end
80
+
81
+ if attributes.key?(:'url')
82
+ self.url = attributes[:'url']
83
+ end
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ invalid_properties = Array.new
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ true
97
+ end
98
+
99
+ # Checks equality by comparing each attribute.
100
+ # @param [Object] Object to be compared
101
+ def ==(o)
102
+ return true if self.equal?(o)
103
+ self.class == o.class &&
104
+ custom_file == o.custom_file &&
105
+ sitemap_lines == o.sitemap_lines &&
106
+ url == o.url
107
+ end
108
+
109
+ # @see the `==` method
110
+ # @param [Object] Object to be compared
111
+ def eql?(o)
112
+ self == o
113
+ end
114
+
115
+ # Calculates hash code according to all attributes.
116
+ # @return [Integer] Hash code
117
+ def hash
118
+ [custom_file, sitemap_lines, url].hash
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def self.build_from_hash(attributes)
125
+ new.build_from_hash(attributes)
126
+ end
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def build_from_hash(attributes)
132
+ return nil unless attributes.is_a?(Hash)
133
+ attributes = attributes.transform_keys(&:to_sym)
134
+ self.class.openapi_types.each_pair do |key, type|
135
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
136
+ self.send("#{key}=", nil)
137
+ elsif type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
141
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ end
146
+ end
147
+
148
+ self
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def _deserialize(type, value)
156
+ case type.to_sym
157
+ when :Time
158
+ Time.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :Boolean
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ # models (e.g. Pet) or oneOf
189
+ klass = UltracartClient.const_get(type)
190
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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
+ if value.nil?
213
+ is_nullable = self.class.openapi_nullable.include?(attr)
214
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
215
+ end
216
+
217
+ hash[param] = _to_hash(value)
218
+ end
219
+ hash
220
+ end
221
+
222
+ # Outputs non-array value in the form of hash
223
+ # For object, use to_hash. Otherwise, just return the value
224
+ # @param [Object] value Any valid value
225
+ # @return [Hash] Returns the value in the form of hash
226
+ def _to_hash(value)
227
+ if value.is_a?(Array)
228
+ value.compact.map { |v| _to_hash(v) }
229
+ elsif value.is_a?(Hash)
230
+ {}.tap do |hash|
231
+ value.each { |k, v| hash[k] = _to_hash(v) }
232
+ end
233
+ elsif value.respond_to? :to_hash
234
+ value.to_hash
235
+ else
236
+ value
237
+ end
238
+ end
239
+
240
+ end
241
+
242
+ end