late-sdk 0.0.880 → 0.0.882

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 (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -2
  3. data/docs/{CreateCtwaAd201Response.md → CreateMessagingAd201Response.md} +6 -6
  4. data/docs/CreatePost200Response.md +39 -12
  5. data/docs/MessagingAdsApi.md +18 -16
  6. data/docs/TikTokDryRunVerdict.md +22 -0
  7. data/docs/{CreatePost200ResponseTiktokInner.md → TikTokDryRunVerdictTiktokInner.md} +2 -2
  8. data/docs/TrackingTagsApi.md +7 -6
  9. data/docs/UpdateAdTrackingTags200Response.md +18 -0
  10. data/docs/UpdateGoogleBusinessLocationDetailsRequest.md +19 -1
  11. data/docs/UpdateGoogleBusinessLocationDetailsRequestAdWordsLocationExtensions.md +18 -0
  12. data/docs/UpdateGoogleBusinessLocationDetailsRequestLatlng.md +20 -0
  13. data/docs/UpdateGoogleBusinessLocationDetailsRequestMoreHoursInner.md +20 -0
  14. data/docs/UpdateGoogleBusinessLocationDetailsRequestOpenInfo.md +20 -0
  15. data/docs/UpdateGoogleBusinessLocationDetailsRequestServiceArea.md +22 -0
  16. data/docs/UpdateGoogleBusinessLocationDetailsRequestServiceAreaPlaces.md +18 -0
  17. data/docs/UpdateGoogleBusinessLocationDetailsRequestServiceAreaPlacesPlaceInfosInner.md +20 -0
  18. data/docs/UpdateGoogleBusinessLocationDetailsRequestStorefrontAddress.md +28 -0
  19. data/lib/zernio-sdk/api/messaging_ads_api.rb +13 -13
  20. data/lib/zernio-sdk/api/tracking_tags_api.rb +5 -5
  21. data/lib/zernio-sdk/models/{create_ctwa_ad201_response.rb → create_messaging_ad201_response.rb} +1 -1
  22. data/lib/zernio-sdk/models/create_post200_response.rb +74 -191
  23. data/lib/zernio-sdk/models/tik_tok_dry_run_verdict.rb +221 -0
  24. data/lib/zernio-sdk/models/{create_post200_response_tiktok_inner.rb → tik_tok_dry_run_verdict_tiktok_inner.rb} +3 -3
  25. data/lib/zernio-sdk/models/update_ad_tracking_tags200_response.rb +147 -0
  26. data/lib/zernio-sdk/models/update_google_business_location_details_request.rb +93 -4
  27. data/lib/zernio-sdk/models/update_google_business_location_details_request_ad_words_location_extensions.rb +148 -0
  28. data/lib/zernio-sdk/models/update_google_business_location_details_request_latlng.rb +157 -0
  29. data/lib/zernio-sdk/models/update_google_business_location_details_request_more_hours_inner.rb +159 -0
  30. data/lib/zernio-sdk/models/update_google_business_location_details_request_open_info.rb +191 -0
  31. data/lib/zernio-sdk/models/update_google_business_location_details_request_service_area.rb +201 -0
  32. data/lib/zernio-sdk/models/update_google_business_location_details_request_service_area_places.rb +149 -0
  33. data/lib/zernio-sdk/models/update_google_business_location_details_request_service_area_places_place_infos_inner.rb +158 -0
  34. data/lib/zernio-sdk/models/update_google_business_location_details_request_storefront_address.rb +198 -0
  35. data/lib/zernio-sdk/version.rb +1 -1
  36. data/lib/zernio-sdk.rb +12 -2
  37. data/openapi.yaml +154 -36
  38. data/spec/api/messaging_ads_api_spec.rb +3 -3
  39. data/spec/api/tracking_tags_api_spec.rb +1 -1
  40. data/spec/models/{create_ctwa_ad201_response_spec.rb → create_messaging_ad201_response_spec.rb} +2 -2
  41. data/spec/models/create_post200_response_spec.rb +5 -21
  42. data/spec/models/tik_tok_dry_run_verdict_spec.rb +48 -0
  43. data/spec/models/{create_post200_response_tiktok_inner_spec.rb → tik_tok_dry_run_verdict_tiktok_inner_spec.rb} +6 -6
  44. data/spec/models/update_ad_tracking_tags200_response_spec.rb +36 -0
  45. data/spec/models/update_google_business_location_details_request_ad_words_location_extensions_spec.rb +36 -0
  46. data/spec/models/update_google_business_location_details_request_latlng_spec.rb +42 -0
  47. data/spec/models/update_google_business_location_details_request_more_hours_inner_spec.rb +42 -0
  48. data/spec/models/update_google_business_location_details_request_open_info_spec.rb +46 -0
  49. data/spec/models/update_google_business_location_details_request_service_area_places_place_infos_inner_spec.rb +42 -0
  50. data/spec/models/update_google_business_location_details_request_service_area_places_spec.rb +36 -0
  51. data/spec/models/update_google_business_location_details_request_service_area_spec.rb +52 -0
  52. data/spec/models/update_google_business_location_details_request_spec.rb +54 -0
  53. data/spec/models/update_google_business_location_details_request_storefront_address_spec.rb +66 -0
  54. data/zernio-sdk-0.0.882.gem +0 -0
  55. metadata +50 -10
  56. data/zernio-sdk-0.0.880.gem +0 -0
@@ -23,17 +23,17 @@ module Zernio
23
23
  # Same shape and flow as POST /v1/ads/ctwa, but the CTA is CALL_NOW dialing `phoneNumber` via a tel: link. The ad set is destination_type PHONE_CALL optimizing QUALITY_CALL and the campaign objective defaults to OUTCOME_LEADS. Supports the same single-creative and multi-creative shapes as CTWA.
24
24
  # @param create_call_ad_request [CreateCallAdRequest]
25
25
  # @param [Hash] opts the optional parameters
26
- # @return [nil]
26
+ # @return [CreateMessagingAd201Response]
27
27
  def create_call_ad(create_call_ad_request, opts = {})
28
- create_call_ad_with_http_info(create_call_ad_request, opts)
29
- nil
28
+ data, _status_code, _headers = create_call_ad_with_http_info(create_call_ad_request, opts)
29
+ data
30
30
  end
31
31
 
32
32
  # Create Click-to-Call ad
33
33
  # Same shape and flow as POST /v1/ads/ctwa, but the CTA is CALL_NOW dialing `phoneNumber` via a tel: link. The ad set is destination_type PHONE_CALL optimizing QUALITY_CALL and the campaign objective defaults to OUTCOME_LEADS. Supports the same single-creative and multi-creative shapes as CTWA.
34
34
  # @param create_call_ad_request [CreateCallAdRequest]
35
35
  # @param [Hash] opts the optional parameters
36
- # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
36
+ # @return [Array<(CreateMessagingAd201Response, Integer, Hash)>] CreateMessagingAd201Response data, response status code and response headers
37
37
  def create_call_ad_with_http_info(create_call_ad_request, opts = {})
38
38
  if @api_client.config.debugging
39
39
  @api_client.config.logger.debug 'Calling API: MessagingAdsApi.create_call_ad ...'
@@ -65,7 +65,7 @@ module Zernio
65
65
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_call_ad_request)
66
66
 
67
67
  # return_type
68
- return_type = opts[:debug_return_type]
68
+ return_type = opts[:debug_return_type] || 'CreateMessagingAd201Response'
69
69
 
70
70
  # auth_names
71
71
  auth_names = opts[:debug_auth_names] || ['bearerAuth']
@@ -91,7 +91,7 @@ module Zernio
91
91
  # Deprecated: use POST /v1/ads/messaging with `destination: whatsapp`. This endpoint stays available for back-compat; no removal planned. Creates one or more Click-to-WhatsApp (CTWA) ads on Meta under a single campaign and ad set. When tapped, each ad opens a WhatsApp conversation with the business attached to the supplied Facebook Page. The full hierarchy (campaign, ad set, creative(s), ad(s)) is created and activated in one call. The CTA is locked to WHATSAPP_MESSAGE and the destination is hard-coded to api.whatsapp.com/send; Meta resolves the actual WhatsApp number from the Page-to-WA pairing configured in Page settings or Business Manager. Supports two mutually-exclusive shapes: - **Single-creative**: supply top-level `headline`, `body`, and one of `imageUrl` / `video`. Creates 1 campaign + 1 ad set + 1 ad. - **Multi-creative**: supply a `creatives[]` array with N entries (each carrying its own headline, body, and image/video). Creates 1 campaign + 1 ad set + N ads sharing budget and targeting so Meta A/Bs the creatives inside a single auction instead of fragmenting budget across N parallel campaigns. Recommended when launching multiple creative variants for the same campaign. **Attach shape.** Send `adSetId` (with either creative shape) to add the ads to an EXISTING messaging ad set instead of building a campaign, so the ad set keeps its learning phase, the way to refresh a CTWA creative without resetting delivery. The ad set then owns budget, targeting and schedule, so `budgetAmount`, `budgetType`, `endDate`, `objective`, `countries`, `interests` and `audienceId` are rejected with a 400 alongside it rather than silently dropped. The target ad set's `destination_type` must match the ad's destination (a WhatsApp ad needs a `WHATSAPP` ad set), otherwise Meta would accept an ad that never delivers. Prerequisites enforced by Meta (surfaced as platform_error on failure): the Facebook Page must be paired with a verified WhatsApp Business number, the WhatsApp Business Account must be business-verified, and the Meta access token must carry ads_management.
92
92
  # @param ctwa_ad_request_body [CtwaAdRequestBody]
93
93
  # @param [Hash] opts the optional parameters
94
- # @return [CreateCtwaAd201Response]
94
+ # @return [CreateMessagingAd201Response]
95
95
  def create_ctwa_ad(ctwa_ad_request_body, opts = {})
96
96
  data, _status_code, _headers = create_ctwa_ad_with_http_info(ctwa_ad_request_body, opts)
97
97
  data
@@ -101,7 +101,7 @@ module Zernio
101
101
  # Deprecated: use POST /v1/ads/messaging with &#x60;destination: whatsapp&#x60;. This endpoint stays available for back-compat; no removal planned. Creates one or more Click-to-WhatsApp (CTWA) ads on Meta under a single campaign and ad set. When tapped, each ad opens a WhatsApp conversation with the business attached to the supplied Facebook Page. The full hierarchy (campaign, ad set, creative(s), ad(s)) is created and activated in one call. The CTA is locked to WHATSAPP_MESSAGE and the destination is hard-coded to api.whatsapp.com/send; Meta resolves the actual WhatsApp number from the Page-to-WA pairing configured in Page settings or Business Manager. Supports two mutually-exclusive shapes: - **Single-creative**: supply top-level &#x60;headline&#x60;, &#x60;body&#x60;, and one of &#x60;imageUrl&#x60; / &#x60;video&#x60;. Creates 1 campaign + 1 ad set + 1 ad. - **Multi-creative**: supply a &#x60;creatives[]&#x60; array with N entries (each carrying its own headline, body, and image/video). Creates 1 campaign + 1 ad set + N ads sharing budget and targeting so Meta A/Bs the creatives inside a single auction instead of fragmenting budget across N parallel campaigns. Recommended when launching multiple creative variants for the same campaign. **Attach shape.** Send &#x60;adSetId&#x60; (with either creative shape) to add the ads to an EXISTING messaging ad set instead of building a campaign, so the ad set keeps its learning phase, the way to refresh a CTWA creative without resetting delivery. The ad set then owns budget, targeting and schedule, so &#x60;budgetAmount&#x60;, &#x60;budgetType&#x60;, &#x60;endDate&#x60;, &#x60;objective&#x60;, &#x60;countries&#x60;, &#x60;interests&#x60; and &#x60;audienceId&#x60; are rejected with a 400 alongside it rather than silently dropped. The target ad set&#39;s &#x60;destination_type&#x60; must match the ad&#39;s destination (a WhatsApp ad needs a &#x60;WHATSAPP&#x60; ad set), otherwise Meta would accept an ad that never delivers. Prerequisites enforced by Meta (surfaced as platform_error on failure): the Facebook Page must be paired with a verified WhatsApp Business number, the WhatsApp Business Account must be business-verified, and the Meta access token must carry ads_management.
102
102
  # @param ctwa_ad_request_body [CtwaAdRequestBody]
103
103
  # @param [Hash] opts the optional parameters
104
- # @return [Array<(CreateCtwaAd201Response, Integer, Hash)>] CreateCtwaAd201Response data, response status code and response headers
104
+ # @return [Array<(CreateMessagingAd201Response, Integer, Hash)>] CreateMessagingAd201Response data, response status code and response headers
105
105
  def create_ctwa_ad_with_http_info(ctwa_ad_request_body, opts = {})
106
106
  if @api_client.config.debugging
107
107
  @api_client.config.logger.debug 'Calling API: MessagingAdsApi.create_ctwa_ad ...'
@@ -133,7 +133,7 @@ module Zernio
133
133
  post_body = opts[:debug_body] || @api_client.object_to_http_body(ctwa_ad_request_body)
134
134
 
135
135
  # return_type
136
- return_type = opts[:debug_return_type] || 'CreateCtwaAd201Response'
136
+ return_type = opts[:debug_return_type] || 'CreateMessagingAd201Response'
137
137
 
138
138
  # auth_names
139
139
  auth_names = opts[:debug_auth_names] || ['bearerAuth']
@@ -159,17 +159,17 @@ module Zernio
159
159
  # Creates a click-to-message ad; `destination` selects where the tapped ad opens a conversation: WhatsApp, the Page's Messenger inbox or the linked Instagram account's Direct inbox. The ad set is created with the matching destination_type and CONVERSATIONS optimization; the campaign objective defaults to OUTCOME_ENGAGEMENT. Supports single-creative and multi-creative shapes. Supersedes POST /v1/ads/ctwa (deprecated, equivalent to `destination: whatsapp`).
160
160
  # @param create_messaging_ad_request [CreateMessagingAdRequest]
161
161
  # @param [Hash] opts the optional parameters
162
- # @return [nil]
162
+ # @return [CreateMessagingAd201Response]
163
163
  def create_messaging_ad(create_messaging_ad_request, opts = {})
164
- create_messaging_ad_with_http_info(create_messaging_ad_request, opts)
165
- nil
164
+ data, _status_code, _headers = create_messaging_ad_with_http_info(create_messaging_ad_request, opts)
165
+ data
166
166
  end
167
167
 
168
168
  # Create click-to-message ad (WhatsApp / Messenger / Instagram Direct)
169
169
  # Creates a click-to-message ad; &#x60;destination&#x60; selects where the tapped ad opens a conversation: WhatsApp, the Page&#39;s Messenger inbox or the linked Instagram account&#39;s Direct inbox. The ad set is created with the matching destination_type and CONVERSATIONS optimization; the campaign objective defaults to OUTCOME_ENGAGEMENT. Supports single-creative and multi-creative shapes. Supersedes POST /v1/ads/ctwa (deprecated, equivalent to &#x60;destination: whatsapp&#x60;).
170
170
  # @param create_messaging_ad_request [CreateMessagingAdRequest]
171
171
  # @param [Hash] opts the optional parameters
172
- # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
172
+ # @return [Array<(CreateMessagingAd201Response, Integer, Hash)>] CreateMessagingAd201Response data, response status code and response headers
173
173
  def create_messaging_ad_with_http_info(create_messaging_ad_request, opts = {})
174
174
  if @api_client.config.debugging
175
175
  @api_client.config.logger.debug 'Calling API: MessagingAdsApi.create_messaging_ad ...'
@@ -201,7 +201,7 @@ module Zernio
201
201
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_messaging_ad_request)
202
202
 
203
203
  # return_type
204
- return_type = opts[:debug_return_type]
204
+ return_type = opts[:debug_return_type] || 'CreateMessagingAd201Response'
205
205
 
206
206
  # auth_names
207
207
  auth_names = opts[:debug_auth_names] || ['bearerAuth']
@@ -599,10 +599,10 @@ module Zernio
599
599
  # @param ad_id [String]
600
600
  # @param update_ad_tracking_tags_request [UpdateAdTrackingTagsRequest]
601
601
  # @param [Hash] opts the optional parameters
602
- # @return [nil]
602
+ # @return [UpdateAdTrackingTags200Response]
603
603
  def update_ad_tracking_tags(ad_id, update_ad_tracking_tags_request, opts = {})
604
- update_ad_tracking_tags_with_http_info(ad_id, update_ad_tracking_tags_request, opts)
605
- nil
604
+ data, _status_code, _headers = update_ad_tracking_tags_with_http_info(ad_id, update_ad_tracking_tags_request, opts)
605
+ data
606
606
  end
607
607
 
608
608
  # Set ad tracking tags
@@ -610,7 +610,7 @@ module Zernio
610
610
  # @param ad_id [String]
611
611
  # @param update_ad_tracking_tags_request [UpdateAdTrackingTagsRequest]
612
612
  # @param [Hash] opts the optional parameters
613
- # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
613
+ # @return [Array<(UpdateAdTrackingTags200Response, Integer, Hash)>] UpdateAdTrackingTags200Response data, response status code and response headers
614
614
  def update_ad_tracking_tags_with_http_info(ad_id, update_ad_tracking_tags_request, opts = {})
615
615
  if @api_client.config.debugging
616
616
  @api_client.config.logger.debug 'Calling API: TrackingTagsApi.update_ad_tracking_tags ...'
@@ -646,7 +646,7 @@ module Zernio
646
646
  post_body = opts[:debug_body] || @api_client.object_to_http_body(update_ad_tracking_tags_request)
647
647
 
648
648
  # return_type
649
- return_type = opts[:debug_return_type]
649
+ return_type = opts[:debug_return_type] || 'UpdateAdTrackingTags200Response'
650
650
 
651
651
  # auth_names
652
652
  auth_names = opts[:debug_auth_names] || ['bearerAuth']
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Zernio
17
- module CreateCtwaAd201Response
17
+ module CreateMessagingAd201Response
18
18
  class << self
19
19
  # List of class defined in oneOf (OpenAPI v3)
20
20
  def openapi_one_of
@@ -14,208 +14,91 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Zernio
17
- class CreatePost200Response < ApiModelBase
18
- # Always true on this response
19
- attr_accessor :dry_run
20
-
21
- # True only when every evaluated TikTok account can publish now
22
- attr_accessor :can_publish
23
-
24
- # One verdict per `tiktok` entry in the request, in request order
25
- attr_accessor :tiktok
26
-
27
- # Attribute mapping from ruby-style variable name to JSON key.
28
- def self.attribute_map
29
- {
30
- :'dry_run' => :'dryRun',
31
- :'can_publish' => :'canPublish',
32
- :'tiktok' => :'tiktok'
33
- }
34
- end
35
-
36
- # Returns attribute mapping this model knows about
37
- def self.acceptable_attribute_map
38
- attribute_map
39
- end
40
-
41
- # Returns all the JSON keys this model knows about
42
- def self.acceptable_attributes
43
- acceptable_attribute_map.values
44
- end
45
-
46
- # Attribute type mapping.
47
- def self.openapi_types
48
- {
49
- :'dry_run' => :'Boolean',
50
- :'can_publish' => :'Boolean',
51
- :'tiktok' => :'Array<CreatePost200ResponseTiktokInner>'
52
- }
53
- end
54
-
55
- # List of attributes with nullable: true
56
- def self.openapi_nullable
57
- Set.new([
58
- ])
59
- end
60
-
61
- # Initializes the object
62
- # @param [Hash] attributes Model attributes in the form of hash
63
- def initialize(attributes = {})
64
- if (!attributes.is_a?(Hash))
65
- fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CreatePost200Response` initialize method"
66
- end
67
-
68
- # check to see if the attribute exists and convert string to symbol for hash key
69
- acceptable_attribute_map = self.class.acceptable_attribute_map
70
- attributes = attributes.each_with_object({}) { |(k, v), h|
71
- if (!acceptable_attribute_map.key?(k.to_sym))
72
- fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::CreatePost200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
- end
74
- h[k.to_sym] = v
75
- }
76
-
77
- if attributes.key?(:'dry_run')
78
- self.dry_run = attributes[:'dry_run']
79
- else
80
- self.dry_run = nil
17
+ module CreatePost200Response
18
+ class << self
19
+ # List of class defined in oneOf (OpenAPI v3)
20
+ def openapi_one_of
21
+ [
22
+ :'PostCreateResponse',
23
+ :'TikTokDryRunVerdict'
24
+ ]
81
25
  end
82
26
 
83
- if attributes.key?(:'can_publish')
84
- self.can_publish = attributes[:'can_publish']
85
- else
86
- self.can_publish = nil
87
- end
88
-
89
- if attributes.key?(:'tiktok')
90
- if (value = attributes[:'tiktok']).is_a?(Array)
91
- self.tiktok = value
27
+ # Builds the object
28
+ # @param [Mixed] Data to be matched against the list of oneOf items
29
+ # @return [Object] Returns the model or the data itself
30
+ def build(data)
31
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
32
+ # Note:
33
+ # - We do not attempt to check whether exactly one item matches.
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_one_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ return find_and_cast_into_type(klass, data)
42
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
43
+ end
92
44
  end
93
- else
94
- self.tiktok = nil
95
- end
96
- end
97
-
98
- # Show invalid properties with the reasons. Usually used together with valid?
99
- # @return Array for valid properties with the reasons
100
- def list_invalid_properties
101
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
102
- invalid_properties = Array.new
103
- if @dry_run.nil?
104
- invalid_properties.push('invalid value for "dry_run", dry_run cannot be nil.')
105
- end
106
45
 
107
- if @can_publish.nil?
108
- invalid_properties.push('invalid value for "can_publish", can_publish cannot be nil.')
46
+ openapi_one_of.include?(:AnyType) ? data : nil
109
47
  end
110
48
 
111
- if @tiktok.nil?
112
- invalid_properties.push('invalid value for "tiktok", tiktok cannot be nil.')
113
- end
114
-
115
- invalid_properties
116
- end
117
-
118
- # Check to see if the all the properties in the model are valid
119
- # @return true if the model is valid
120
- def valid?
121
- warn '[DEPRECATED] the `valid?` method is obsolete'
122
- return false if @dry_run.nil?
123
- return false if @can_publish.nil?
124
- return false if @tiktok.nil?
125
- true
126
- end
127
-
128
- # Custom attribute writer method with validation
129
- # @param [Object] dry_run Value to be assigned
130
- def dry_run=(dry_run)
131
- if dry_run.nil?
132
- fail ArgumentError, 'dry_run cannot be nil'
133
- end
134
-
135
- @dry_run = dry_run
136
- end
137
-
138
- # Custom attribute writer method with validation
139
- # @param [Object] can_publish Value to be assigned
140
- def can_publish=(can_publish)
141
- if can_publish.nil?
142
- fail ArgumentError, 'can_publish cannot be nil'
143
- end
144
-
145
- @can_publish = can_publish
146
- end
147
-
148
- # Custom attribute writer method with validation
149
- # @param [Object] tiktok Value to be assigned
150
- def tiktok=(tiktok)
151
- if tiktok.nil?
152
- fail ArgumentError, 'tiktok cannot be nil'
153
- end
154
-
155
- @tiktok = tiktok
156
- end
157
-
158
- # Checks equality by comparing each attribute.
159
- # @param [Object] Object to be compared
160
- def ==(o)
161
- return true if self.equal?(o)
162
- self.class == o.class &&
163
- dry_run == o.dry_run &&
164
- can_publish == o.can_publish &&
165
- tiktok == o.tiktok
166
- end
167
-
168
- # @see the `==` method
169
- # @param [Object] Object to be compared
170
- def eql?(o)
171
- self == o
172
- end
173
-
174
- # Calculates hash code according to all attributes.
175
- # @return [Integer] Hash code
176
- def hash
177
- [dry_run, can_publish, tiktok].hash
178
- end
179
-
180
- # Builds the object from hash
181
- # @param [Hash] attributes Model attributes in the form of hash
182
- # @return [Object] Returns the model itself
183
- def self.build_from_hash(attributes)
184
- return nil unless attributes.is_a?(Hash)
185
- attributes = attributes.transform_keys(&:to_sym)
186
- transformed_hash = {}
187
- openapi_types.each_pair do |key, type|
188
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
189
- transformed_hash["#{key}"] = nil
190
- elsif type =~ /\AArray<(.*)>/i
191
- # check to ensure the input is an array given that the attribute
192
- # is documented as an array but the input is not
193
- if attributes[attribute_map[key]].is_a?(Array)
194
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
49
+ private
50
+
51
+ SchemaMismatchError = Class.new(StandardError)
52
+
53
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
54
+ def find_and_cast_into_type(klass, data)
55
+ return if data.nil?
56
+
57
+ case klass.to_s
58
+ when 'Boolean'
59
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
60
+ when 'Float'
61
+ return data if data.instance_of?(Float)
62
+ when 'Integer'
63
+ return data if data.instance_of?(Integer)
64
+ when 'Time'
65
+ return Time.parse(data)
66
+ when 'Date'
67
+ return Date.iso8601(data)
68
+ when 'String'
69
+ return data if data.instance_of?(String)
70
+ when 'Object' # "type: object"
71
+ return data if data.instance_of?(Hash)
72
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
73
+ if data.instance_of?(Array)
74
+ sub_type = Regexp.last_match[:sub_type]
75
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
76
+ end
77
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
78
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
79
+ sub_type = Regexp.last_match[:sub_type]
80
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
81
+ end
82
+ else # model
83
+ const = Zernio.const_get(klass)
84
+ if const
85
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
86
+ model = const.build(data)
87
+ return model if model
88
+ else
89
+ # raise if data contains keys that are not known to the model
90
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
91
+ model = const.build_from_hash(data)
92
+ return model if model
93
+ end
195
94
  end
196
- elsif !attributes[attribute_map[key]].nil?
197
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
198
- end
199
- end
200
- new(transformed_hash)
201
- end
202
-
203
- # Returns the object in the form of hash
204
- # @return [Hash] Returns the object in the form of hash
205
- def to_hash
206
- hash = {}
207
- self.class.attribute_map.each_pair do |attr, param|
208
- value = self.send(attr)
209
- if value.nil?
210
- is_nullable = self.class.openapi_nullable.include?(attr)
211
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
95
  end
213
96
 
214
- hash[param] = _to_hash(value)
97
+ raise # if no match by now, raise
98
+ rescue
99
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
215
100
  end
216
- hash
217
101
  end
218
-
219
102
  end
220
103
 
221
104
  end
@@ -0,0 +1,221 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ class TikTokDryRunVerdict < ApiModelBase
18
+ # Always true on this response
19
+ attr_accessor :dry_run
20
+
21
+ # True only when every evaluated TikTok account can publish now
22
+ attr_accessor :can_publish
23
+
24
+ # One verdict per `tiktok` entry in the request, in request order
25
+ attr_accessor :tiktok
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'dry_run' => :'dryRun',
31
+ :'can_publish' => :'canPublish',
32
+ :'tiktok' => :'tiktok'
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'dry_run' => :'Boolean',
50
+ :'can_publish' => :'Boolean',
51
+ :'tiktok' => :'Array<TikTokDryRunVerdictTiktokInner>'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::TikTokDryRunVerdict` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::TikTokDryRunVerdict`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'dry_run')
78
+ self.dry_run = attributes[:'dry_run']
79
+ else
80
+ self.dry_run = nil
81
+ end
82
+
83
+ if attributes.key?(:'can_publish')
84
+ self.can_publish = attributes[:'can_publish']
85
+ else
86
+ self.can_publish = nil
87
+ end
88
+
89
+ if attributes.key?(:'tiktok')
90
+ if (value = attributes[:'tiktok']).is_a?(Array)
91
+ self.tiktok = value
92
+ end
93
+ else
94
+ self.tiktok = nil
95
+ end
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properties with the reasons
100
+ def list_invalid_properties
101
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
102
+ invalid_properties = Array.new
103
+ if @dry_run.nil?
104
+ invalid_properties.push('invalid value for "dry_run", dry_run cannot be nil.')
105
+ end
106
+
107
+ if @can_publish.nil?
108
+ invalid_properties.push('invalid value for "can_publish", can_publish cannot be nil.')
109
+ end
110
+
111
+ if @tiktok.nil?
112
+ invalid_properties.push('invalid value for "tiktok", tiktok cannot be nil.')
113
+ end
114
+
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ warn '[DEPRECATED] the `valid?` method is obsolete'
122
+ return false if @dry_run.nil?
123
+ return false if @can_publish.nil?
124
+ return false if @tiktok.nil?
125
+ true
126
+ end
127
+
128
+ # Custom attribute writer method with validation
129
+ # @param [Object] dry_run Value to be assigned
130
+ def dry_run=(dry_run)
131
+ if dry_run.nil?
132
+ fail ArgumentError, 'dry_run cannot be nil'
133
+ end
134
+
135
+ @dry_run = dry_run
136
+ end
137
+
138
+ # Custom attribute writer method with validation
139
+ # @param [Object] can_publish Value to be assigned
140
+ def can_publish=(can_publish)
141
+ if can_publish.nil?
142
+ fail ArgumentError, 'can_publish cannot be nil'
143
+ end
144
+
145
+ @can_publish = can_publish
146
+ end
147
+
148
+ # Custom attribute writer method with validation
149
+ # @param [Object] tiktok Value to be assigned
150
+ def tiktok=(tiktok)
151
+ if tiktok.nil?
152
+ fail ArgumentError, 'tiktok cannot be nil'
153
+ end
154
+
155
+ @tiktok = tiktok
156
+ end
157
+
158
+ # Checks equality by comparing each attribute.
159
+ # @param [Object] Object to be compared
160
+ def ==(o)
161
+ return true if self.equal?(o)
162
+ self.class == o.class &&
163
+ dry_run == o.dry_run &&
164
+ can_publish == o.can_publish &&
165
+ tiktok == o.tiktok
166
+ end
167
+
168
+ # @see the `==` method
169
+ # @param [Object] Object to be compared
170
+ def eql?(o)
171
+ self == o
172
+ end
173
+
174
+ # Calculates hash code according to all attributes.
175
+ # @return [Integer] Hash code
176
+ def hash
177
+ [dry_run, can_publish, tiktok].hash
178
+ end
179
+
180
+ # Builds the object from hash
181
+ # @param [Hash] attributes Model attributes in the form of hash
182
+ # @return [Object] Returns the model itself
183
+ def self.build_from_hash(attributes)
184
+ return nil unless attributes.is_a?(Hash)
185
+ attributes = attributes.transform_keys(&:to_sym)
186
+ transformed_hash = {}
187
+ openapi_types.each_pair do |key, type|
188
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
189
+ transformed_hash["#{key}"] = nil
190
+ elsif type =~ /\AArray<(.*)>/i
191
+ # check to ensure the input is an array given that the attribute
192
+ # is documented as an array but the input is not
193
+ if attributes[attribute_map[key]].is_a?(Array)
194
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
195
+ end
196
+ elsif !attributes[attribute_map[key]].nil?
197
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
198
+ end
199
+ end
200
+ new(transformed_hash)
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ end
220
+
221
+ end
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Zernio
17
- class CreatePost200ResponseTiktokInner < ApiModelBase
17
+ class TikTokDryRunVerdictTiktokInner < ApiModelBase
18
18
  attr_accessor :account_id
19
19
 
20
20
  attr_accessor :can_publish
@@ -65,14 +65,14 @@ module Zernio
65
65
  # @param [Hash] attributes Model attributes in the form of hash
66
66
  def initialize(attributes = {})
67
67
  if (!attributes.is_a?(Hash))
68
- fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CreatePost200ResponseTiktokInner` initialize method"
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::TikTokDryRunVerdictTiktokInner` initialize method"
69
69
  end
70
70
 
71
71
  # check to see if the attribute exists and convert string to symbol for hash key
72
72
  acceptable_attribute_map = self.class.acceptable_attribute_map
73
73
  attributes = attributes.each_with_object({}) { |(k, v), h|
74
74
  if (!acceptable_attribute_map.key?(k.to_sym))
75
- fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::CreatePost200ResponseTiktokInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
75
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::TikTokDryRunVerdictTiktokInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
76
76
  end
77
77
  h[k.to_sym] = v
78
78
  }