late-sdk 0.0.705 → 0.0.706

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -0
  3. data/docs/AdAccountsApi.md +214 -0
  4. data/docs/CreateAdCreativeRequest.md +3 -1
  5. data/docs/CreateCustomConversionRequest.md +26 -0
  6. data/docs/CreateHighDemandPeriod201Response.md +20 -0
  7. data/docs/CreateHighDemandPeriodRequest.md +34 -0
  8. data/docs/CreateStandaloneAdRequest.md +2 -0
  9. data/docs/CustomConversion.md +28 -0
  10. data/docs/CustomConversionResult.md +24 -0
  11. data/docs/ListCustomConversions200Response.md +20 -0
  12. data/lib/zernio-sdk/api/ad_accounts_api.rb +212 -0
  13. data/lib/zernio-sdk/models/create_ad_creative_request.rb +26 -4
  14. data/lib/zernio-sdk/models/create_custom_conversion_request.rb +282 -0
  15. data/lib/zernio-sdk/models/create_high_demand_period201_response.rb +158 -0
  16. data/lib/zernio-sdk/models/create_high_demand_period_request.rb +347 -0
  17. data/lib/zernio-sdk/models/create_standalone_ad_request.rb +23 -1
  18. data/lib/zernio-sdk/models/custom_conversion.rb +198 -0
  19. data/lib/zernio-sdk/models/custom_conversion_result.rb +176 -0
  20. data/lib/zernio-sdk/models/list_custom_conversions200_response.rb +158 -0
  21. data/lib/zernio-sdk/version.rb +1 -1
  22. data/lib/zernio-sdk.rb +6 -0
  23. data/openapi.yaml +151 -0
  24. data/spec/api/ad_accounts_api_spec.rb +38 -0
  25. data/spec/models/create_ad_creative_request_spec.rb +10 -0
  26. data/spec/models/create_custom_conversion_request_spec.rb +60 -0
  27. data/spec/models/create_high_demand_period201_response_spec.rb +42 -0
  28. data/spec/models/create_high_demand_period_request_spec.rb +92 -0
  29. data/spec/models/create_standalone_ad_request_spec.rb +10 -0
  30. data/spec/models/custom_conversion_result_spec.rb +54 -0
  31. data/spec/models/custom_conversion_spec.rb +66 -0
  32. data/spec/models/list_custom_conversions200_response_spec.rb +42 -0
  33. data/zernio-sdk-0.0.706.gem +0 -0
  34. metadata +26 -2
  35. data/zernio-sdk-0.0.705.gem +0 -0
@@ -19,6 +19,148 @@ module Zernio
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Create or reuse a custom conversion
23
+ # Provision the Meta custom conversion an ads flow optimises toward, and hand back the `customConversionId` for `promotedObject.customConversionId` on POST /v1/ads/create. Removes the manual \"create it in Ads Manager first\" step. **Reuse is ours, not Meta's.** Meta's create is not idempotent, so a retried request would otherwise mint a duplicate carrying none of the original's optimisation history. A non-archived conversion with the same `name` on the same `pixelId` is returned instead of created, with `reused: true` and a 200 rather than a 201. `rule` is forwarded verbatim in Meta's own grammar (e.g. `{\"url\": {\"i_contains\": \"thank-you\"}}`); Meta validates it and rejects a malformed one with \"A conversion rule is required at creation time\".
24
+ # @param account_id [String] Meta ads SocialAccount id.
25
+ # @param create_custom_conversion_request [CreateCustomConversionRequest]
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [CustomConversionResult]
28
+ def create_custom_conversion(account_id, create_custom_conversion_request, opts = {})
29
+ data, _status_code, _headers = create_custom_conversion_with_http_info(account_id, create_custom_conversion_request, opts)
30
+ data
31
+ end
32
+
33
+ # Create or reuse a custom conversion
34
+ # Provision the Meta custom conversion an ads flow optimises toward, and hand back the `customConversionId` for `promotedObject.customConversionId` on POST /v1/ads/create. Removes the manual \"create it in Ads Manager first\" step. **Reuse is ours, not Meta's.** Meta's create is not idempotent, so a retried request would otherwise mint a duplicate carrying none of the original's optimisation history. A non-archived conversion with the same `name` on the same `pixelId` is returned instead of created, with `reused: true` and a 200 rather than a 201. `rule` is forwarded verbatim in Meta's own grammar (e.g. `{\"url\": {\"i_contains\": \"thank-you\"}}`); Meta validates it and rejects a malformed one with \"A conversion rule is required at creation time\".
35
+ # @param account_id [String] Meta ads SocialAccount id.
36
+ # @param create_custom_conversion_request [CreateCustomConversionRequest]
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(CustomConversionResult, Integer, Hash)>] CustomConversionResult data, response status code and response headers
39
+ def create_custom_conversion_with_http_info(account_id, create_custom_conversion_request, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.create_custom_conversion ...'
42
+ end
43
+ # verify the required parameter 'account_id' is set
44
+ if @api_client.config.client_side_validation && account_id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdAccountsApi.create_custom_conversion"
46
+ end
47
+ # verify the required parameter 'create_custom_conversion_request' is set
48
+ if @api_client.config.client_side_validation && create_custom_conversion_request.nil?
49
+ fail ArgumentError, "Missing the required parameter 'create_custom_conversion_request' when calling AdAccountsApi.create_custom_conversion"
50
+ end
51
+ # resource path
52
+ local_var_path = '/v1/accounts/{accountId}/custom-conversions'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+
57
+ # header parameters
58
+ header_params = opts[:header_params] || {}
59
+ # HTTP header 'Accept' (if needed)
60
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
61
+ # HTTP header 'Content-Type'
62
+ content_type = @api_client.select_header_content_type(['application/json'])
63
+ if !content_type.nil?
64
+ header_params['Content-Type'] = content_type
65
+ end
66
+
67
+ # form parameters
68
+ form_params = opts[:form_params] || {}
69
+
70
+ # http body (model)
71
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_custom_conversion_request)
72
+
73
+ # return_type
74
+ return_type = opts[:debug_return_type] || 'CustomConversionResult'
75
+
76
+ # auth_names
77
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
78
+
79
+ new_options = opts.merge(
80
+ :operation => :"AdAccountsApi.create_custom_conversion",
81
+ :header_params => header_params,
82
+ :query_params => query_params,
83
+ :form_params => form_params,
84
+ :body => post_body,
85
+ :auth_names => auth_names,
86
+ :return_type => return_type
87
+ )
88
+
89
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
90
+ if @api_client.config.debugging
91
+ @api_client.config.logger.debug "API called: AdAccountsApi#create_custom_conversion\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
92
+ end
93
+ return data, status_code, headers
94
+ end
95
+
96
+ # Schedule a budget increase
97
+ # Pre-schedule a temporary budget increase (Black Friday, a launch, a sale) instead of editing the budget by hand on the day. Same target rule as the GET: exactly one of `campaignId` / `adSetId`. Two Meta constraints worth knowing before you call it. `timeStart` / `timeEnd` must fall on a 15-minute boundary, and a campaign cannot mix `ABSOLUTE` and `MULTIPLIER` across its schedules — the second type is rejected with \"Can't mix your budget scaling selection\". Window rules (must sit inside the campaign's run dates, minimum lead time, no overlap) are Meta's and its message is forwarded verbatim.
98
+ # @param create_high_demand_period_request [CreateHighDemandPeriodRequest]
99
+ # @param [Hash] opts the optional parameters
100
+ # @return [CreateHighDemandPeriod201Response]
101
+ def create_high_demand_period(create_high_demand_period_request, opts = {})
102
+ data, _status_code, _headers = create_high_demand_period_with_http_info(create_high_demand_period_request, opts)
103
+ data
104
+ end
105
+
106
+ # Schedule a budget increase
107
+ # Pre-schedule a temporary budget increase (Black Friday, a launch, a sale) instead of editing the budget by hand on the day. Same target rule as the GET: exactly one of &#x60;campaignId&#x60; / &#x60;adSetId&#x60;. Two Meta constraints worth knowing before you call it. &#x60;timeStart&#x60; / &#x60;timeEnd&#x60; must fall on a 15-minute boundary, and a campaign cannot mix &#x60;ABSOLUTE&#x60; and &#x60;MULTIPLIER&#x60; across its schedules — the second type is rejected with \&quot;Can&#39;t mix your budget scaling selection\&quot;. Window rules (must sit inside the campaign&#39;s run dates, minimum lead time, no overlap) are Meta&#39;s and its message is forwarded verbatim.
108
+ # @param create_high_demand_period_request [CreateHighDemandPeriodRequest]
109
+ # @param [Hash] opts the optional parameters
110
+ # @return [Array<(CreateHighDemandPeriod201Response, Integer, Hash)>] CreateHighDemandPeriod201Response data, response status code and response headers
111
+ def create_high_demand_period_with_http_info(create_high_demand_period_request, opts = {})
112
+ if @api_client.config.debugging
113
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.create_high_demand_period ...'
114
+ end
115
+ # verify the required parameter 'create_high_demand_period_request' is set
116
+ if @api_client.config.client_side_validation && create_high_demand_period_request.nil?
117
+ fail ArgumentError, "Missing the required parameter 'create_high_demand_period_request' when calling AdAccountsApi.create_high_demand_period"
118
+ end
119
+ # resource path
120
+ local_var_path = '/v1/ads/high-demand-periods'
121
+
122
+ # query parameters
123
+ query_params = opts[:query_params] || {}
124
+
125
+ # header parameters
126
+ header_params = opts[:header_params] || {}
127
+ # HTTP header 'Accept' (if needed)
128
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
129
+ # HTTP header 'Content-Type'
130
+ content_type = @api_client.select_header_content_type(['application/json'])
131
+ if !content_type.nil?
132
+ header_params['Content-Type'] = content_type
133
+ end
134
+
135
+ # form parameters
136
+ form_params = opts[:form_params] || {}
137
+
138
+ # http body (model)
139
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_high_demand_period_request)
140
+
141
+ # return_type
142
+ return_type = opts[:debug_return_type] || 'CreateHighDemandPeriod201Response'
143
+
144
+ # auth_names
145
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
146
+
147
+ new_options = opts.merge(
148
+ :operation => :"AdAccountsApi.create_high_demand_period",
149
+ :header_params => header_params,
150
+ :query_params => query_params,
151
+ :form_params => form_params,
152
+ :body => post_body,
153
+ :auth_names => auth_names,
154
+ :return_type => return_type
155
+ )
156
+
157
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
158
+ if @api_client.config.debugging
159
+ @api_client.config.logger.debug "API called: AdAccountsApi#create_high_demand_period\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
160
+ end
161
+ return data, status_code, headers
162
+ end
163
+
22
164
  # Create a value rule set
23
165
  # Creates a value rule set on the ad account (Meta's `POST /act_X/value_rule_set`). Attach the returned id to an ad set with `valueRuleSetId` on `POST /v1/ads/create` or `PUT /v1/ads/ad-sets/{adSetId}`. **Rule order is semantic**: rules are evaluated in array order and only the first matching rule adjusts the bid for an overlapping audience. `adjustValue` is an unsigned magnitude in percent; the direction lives in `adjustSign`. `INCREASE` accepts 1-1000, `DECREASE` accepts 1-90. There is no signed field and 0 is out of range. `criteriaValueTypes` is positionally paired with `criteriaValues` (same length, same order). Every type is the literal `\"NONE\"` except on `LOCATION`, which uses `LOCATION_COUNTRY` / `LOCATION_REGION` / `LOCATION_CITY` / `LOCATION_COMSCORE_MARKET` and may mix them within one criterion. Location values are Targeting-Search keys: a two-letter country code for `LOCATION_COUNTRY`, a numeric key for the rest. `LOCATION_DMA` was replaced by `LOCATION_COMSCORE_MARKET` on 2026-06-22 and rules using DMAs are no longer active, so this API rejects it. `AUDIENCE_LABEL` values (e.g. `HIGH_VALUE`) are applied to a Custom Audience in Ads Manager. There is no API to provision them, so label strings are passed through unvalidated and a typo produces a rule that never fires. Ads Manager turns a rule set read-only (this API stays editable) when a rule uses more than 2 criteria, a custom age range, or the placements `FB_MARKETPLACE`, `FB_SEARCH`, `FB_VIDEO` or `IG_EXPLORE`. Limits: 6 rule sets per ad account, 10 rules per set, 4 criteria per rule. The per-account cap is enforced by Meta, not here.
24
166
  # @param create_value_rule_set_request [CreateValueRuleSetRequest]
@@ -933,6 +1075,76 @@ module Zernio
933
1075
  return data, status_code, headers
934
1076
  end
935
1077
 
1078
+ # List custom conversions
1079
+ # The ad account's Meta custom conversions, including archived ones (`isArchived`).
1080
+ # @param account_id [String] Meta ads SocialAccount id.
1081
+ # @param ad_account_id [String] Meta ad account id (act_&lt;n&gt;).
1082
+ # @param [Hash] opts the optional parameters
1083
+ # @return [ListCustomConversions200Response]
1084
+ def list_custom_conversions(account_id, ad_account_id, opts = {})
1085
+ data, _status_code, _headers = list_custom_conversions_with_http_info(account_id, ad_account_id, opts)
1086
+ data
1087
+ end
1088
+
1089
+ # List custom conversions
1090
+ # The ad account&#39;s Meta custom conversions, including archived ones (&#x60;isArchived&#x60;).
1091
+ # @param account_id [String] Meta ads SocialAccount id.
1092
+ # @param ad_account_id [String] Meta ad account id (act_&lt;n&gt;).
1093
+ # @param [Hash] opts the optional parameters
1094
+ # @return [Array<(ListCustomConversions200Response, Integer, Hash)>] ListCustomConversions200Response data, response status code and response headers
1095
+ def list_custom_conversions_with_http_info(account_id, ad_account_id, opts = {})
1096
+ if @api_client.config.debugging
1097
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.list_custom_conversions ...'
1098
+ end
1099
+ # verify the required parameter 'account_id' is set
1100
+ if @api_client.config.client_side_validation && account_id.nil?
1101
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdAccountsApi.list_custom_conversions"
1102
+ end
1103
+ # verify the required parameter 'ad_account_id' is set
1104
+ if @api_client.config.client_side_validation && ad_account_id.nil?
1105
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.list_custom_conversions"
1106
+ end
1107
+ # resource path
1108
+ local_var_path = '/v1/accounts/{accountId}/custom-conversions'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
1109
+
1110
+ # query parameters
1111
+ query_params = opts[:query_params] || {}
1112
+ query_params[:'adAccountId'] = ad_account_id
1113
+
1114
+ # header parameters
1115
+ header_params = opts[:header_params] || {}
1116
+ # HTTP header 'Accept' (if needed)
1117
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1118
+
1119
+ # form parameters
1120
+ form_params = opts[:form_params] || {}
1121
+
1122
+ # http body (model)
1123
+ post_body = opts[:debug_body]
1124
+
1125
+ # return_type
1126
+ return_type = opts[:debug_return_type] || 'ListCustomConversions200Response'
1127
+
1128
+ # auth_names
1129
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1130
+
1131
+ new_options = opts.merge(
1132
+ :operation => :"AdAccountsApi.list_custom_conversions",
1133
+ :header_params => header_params,
1134
+ :query_params => query_params,
1135
+ :form_params => form_params,
1136
+ :body => post_body,
1137
+ :auth_names => auth_names,
1138
+ :return_type => return_type
1139
+ )
1140
+
1141
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1142
+ if @api_client.config.debugging
1143
+ @api_client.config.logger.debug "API called: AdAccountsApi#list_custom_conversions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1144
+ end
1145
+ return data, status_code, headers
1146
+ end
1147
+
936
1148
  # High demand periods / budget schedules
937
1149
  # Scheduled budget increases (Meta's budget-scheduling API). The Graph edge lives on the campaign and ad-set nodes only, so exactly one of `campaignId` / `adSetId` (platform ids) is required. Rows returned verbatim (budget_value, budget_value_type, time window, recurrence).
938
1150
  # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
@@ -48,6 +48,9 @@ module Zernio
48
48
  # Advantage+ creative enhancements: partial map of Meta creative feature keys (snake_case) to enroll status, forwarded as degrees_of_freedom_spec.creative_features_spec. Unspecified features default to OPT_OUT.
49
49
  attr_accessor :creative_features
50
50
 
51
+ # Meta only. Multi-advertiser ads: whether Meta may show this ad alongside other advertisers' in one unit. Meta auto-enrols since Aug 2024, so send OPT_OUT to leave. It is a top-level creative field, NOT a `creativeFeatures` key — Meta rejects it there.
52
+ attr_accessor :multi_advertiser
53
+
51
54
  class EnumAttributeValidator
52
55
  attr_reader :datatype
53
56
  attr_reader :allowable_values
@@ -84,7 +87,8 @@ module Zernio
84
87
  :'image_hash' => :'imageHash',
85
88
  :'carousel_cards' => :'carouselCards',
86
89
  :'url_tags' => :'urlTags',
87
- :'creative_features' => :'creativeFeatures'
90
+ :'creative_features' => :'creativeFeatures',
91
+ :'multi_advertiser' => :'multiAdvertiser'
88
92
  }
89
93
  end
90
94
 
@@ -112,7 +116,8 @@ module Zernio
112
116
  :'image_hash' => :'String',
113
117
  :'carousel_cards' => :'Array<CreateAdCreativeRequestCarouselCardsInner>',
114
118
  :'url_tags' => :'String',
115
- :'creative_features' => :'Hash<String, String>'
119
+ :'creative_features' => :'Hash<String, String>',
120
+ :'multi_advertiser' => :'String'
116
121
  }
117
122
  end
118
123
 
@@ -201,6 +206,10 @@ module Zernio
201
206
  self.creative_features = value
202
207
  end
203
208
  end
209
+
210
+ if attributes.key?(:'multi_advertiser')
211
+ self.multi_advertiser = attributes[:'multi_advertiser']
212
+ end
204
213
  end
205
214
 
206
215
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -260,6 +269,8 @@ module Zernio
260
269
  return false if @link_url.nil?
261
270
  return false if !@carousel_cards.nil? && @carousel_cards.length > 10
262
271
  return false if !@carousel_cards.nil? && @carousel_cards.length < 2
272
+ multi_advertiser_validator = EnumAttributeValidator.new('String', ["OPT_IN", "OPT_OUT"])
273
+ return false unless multi_advertiser_validator.valid?(@multi_advertiser)
263
274
  true
264
275
  end
265
276
 
@@ -349,6 +360,16 @@ module Zernio
349
360
  @carousel_cards = carousel_cards
350
361
  end
351
362
 
363
+ # Custom attribute writer method checking allowed values (enum).
364
+ # @param [Object] multi_advertiser Object to be assigned
365
+ def multi_advertiser=(multi_advertiser)
366
+ validator = EnumAttributeValidator.new('String', ["OPT_IN", "OPT_OUT"])
367
+ unless validator.valid?(multi_advertiser)
368
+ fail ArgumentError, "invalid value for \"multi_advertiser\", must be one of #{validator.allowable_values}."
369
+ end
370
+ @multi_advertiser = multi_advertiser
371
+ end
372
+
352
373
  # Checks equality by comparing each attribute.
353
374
  # @param [Object] Object to be compared
354
375
  def ==(o)
@@ -365,7 +386,8 @@ module Zernio
365
386
  image_hash == o.image_hash &&
366
387
  carousel_cards == o.carousel_cards &&
367
388
  url_tags == o.url_tags &&
368
- creative_features == o.creative_features
389
+ creative_features == o.creative_features &&
390
+ multi_advertiser == o.multi_advertiser
369
391
  end
370
392
 
371
393
  # @see the `==` method
@@ -377,7 +399,7 @@ module Zernio
377
399
  # Calculates hash code according to all attributes.
378
400
  # @return [Integer] Hash code
379
401
  def hash
380
- [account_id, ad_account_id, headline, body, description, call_to_action, link_url, image_url, image_hash, carousel_cards, url_tags, creative_features].hash
402
+ [account_id, ad_account_id, headline, body, description, call_to_action, link_url, image_url, image_hash, carousel_cards, url_tags, creative_features, multi_advertiser].hash
381
403
  end
382
404
 
383
405
  # Builds the object from hash
@@ -0,0 +1,282 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
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 CreateCustomConversionRequest < ApiModelBase
18
+ # Meta ad account id (act_<n>).
19
+ attr_accessor :ad_account_id
20
+
21
+ # Also the reuse key, together with pixelId.
22
+ attr_accessor :name
23
+
24
+ # Meta pixel id (event_source_id). From GET /v1/accounts/{accountId}/tracking-tags.
25
+ attr_accessor :pixel_id
26
+
27
+ # Meta custom_event_type, e.g. LEAD, PURCHASE, OTHER.
28
+ attr_accessor :custom_event_type
29
+
30
+ # Meta conversion rule, forwarded verbatim.
31
+ attr_accessor :rule
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'ad_account_id' => :'adAccountId',
37
+ :'name' => :'name',
38
+ :'pixel_id' => :'pixelId',
39
+ :'custom_event_type' => :'customEventType',
40
+ :'rule' => :'rule'
41
+ }
42
+ end
43
+
44
+ # Returns attribute mapping this model knows about
45
+ def self.acceptable_attribute_map
46
+ attribute_map
47
+ end
48
+
49
+ # Returns all the JSON keys this model knows about
50
+ def self.acceptable_attributes
51
+ acceptable_attribute_map.values
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'ad_account_id' => :'String',
58
+ :'name' => :'String',
59
+ :'pixel_id' => :'String',
60
+ :'custom_event_type' => :'String',
61
+ :'rule' => :'Object'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::CreateCustomConversionRequest` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ acceptable_attribute_map = self.class.acceptable_attribute_map
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!acceptable_attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::CreateCustomConversionRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'ad_account_id')
88
+ self.ad_account_id = attributes[:'ad_account_id']
89
+ else
90
+ self.ad_account_id = nil
91
+ end
92
+
93
+ if attributes.key?(:'name')
94
+ self.name = attributes[:'name']
95
+ else
96
+ self.name = nil
97
+ end
98
+
99
+ if attributes.key?(:'pixel_id')
100
+ self.pixel_id = attributes[:'pixel_id']
101
+ else
102
+ self.pixel_id = nil
103
+ end
104
+
105
+ if attributes.key?(:'custom_event_type')
106
+ self.custom_event_type = attributes[:'custom_event_type']
107
+ else
108
+ self.custom_event_type = nil
109
+ end
110
+
111
+ if attributes.key?(:'rule')
112
+ self.rule = attributes[:'rule']
113
+ else
114
+ self.rule = nil
115
+ end
116
+ end
117
+
118
+ # Show invalid properties with the reasons. Usually used together with valid?
119
+ # @return Array for valid properties with the reasons
120
+ def list_invalid_properties
121
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
122
+ invalid_properties = Array.new
123
+ if @ad_account_id.nil?
124
+ invalid_properties.push('invalid value for "ad_account_id", ad_account_id cannot be nil.')
125
+ end
126
+
127
+ if @name.nil?
128
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
129
+ end
130
+
131
+ if @name.to_s.length > 255
132
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 255.')
133
+ end
134
+
135
+ if @pixel_id.nil?
136
+ invalid_properties.push('invalid value for "pixel_id", pixel_id cannot be nil.')
137
+ end
138
+
139
+ if @custom_event_type.nil?
140
+ invalid_properties.push('invalid value for "custom_event_type", custom_event_type cannot be nil.')
141
+ end
142
+
143
+ if @rule.nil?
144
+ invalid_properties.push('invalid value for "rule", rule cannot be nil.')
145
+ end
146
+
147
+ invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ warn '[DEPRECATED] the `valid?` method is obsolete'
154
+ return false if @ad_account_id.nil?
155
+ return false if @name.nil?
156
+ return false if @name.to_s.length > 255
157
+ return false if @pixel_id.nil?
158
+ return false if @custom_event_type.nil?
159
+ return false if @rule.nil?
160
+ true
161
+ end
162
+
163
+ # Custom attribute writer method with validation
164
+ # @param [Object] ad_account_id Value to be assigned
165
+ def ad_account_id=(ad_account_id)
166
+ if ad_account_id.nil?
167
+ fail ArgumentError, 'ad_account_id cannot be nil'
168
+ end
169
+
170
+ @ad_account_id = ad_account_id
171
+ end
172
+
173
+ # Custom attribute writer method with validation
174
+ # @param [Object] name Value to be assigned
175
+ def name=(name)
176
+ if name.nil?
177
+ fail ArgumentError, 'name cannot be nil'
178
+ end
179
+
180
+ if name.to_s.length > 255
181
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 255.'
182
+ end
183
+
184
+ @name = name
185
+ end
186
+
187
+ # Custom attribute writer method with validation
188
+ # @param [Object] pixel_id Value to be assigned
189
+ def pixel_id=(pixel_id)
190
+ if pixel_id.nil?
191
+ fail ArgumentError, 'pixel_id cannot be nil'
192
+ end
193
+
194
+ @pixel_id = pixel_id
195
+ end
196
+
197
+ # Custom attribute writer method with validation
198
+ # @param [Object] custom_event_type Value to be assigned
199
+ def custom_event_type=(custom_event_type)
200
+ if custom_event_type.nil?
201
+ fail ArgumentError, 'custom_event_type cannot be nil'
202
+ end
203
+
204
+ @custom_event_type = custom_event_type
205
+ end
206
+
207
+ # Custom attribute writer method with validation
208
+ # @param [Object] rule Value to be assigned
209
+ def rule=(rule)
210
+ if rule.nil?
211
+ fail ArgumentError, 'rule cannot be nil'
212
+ end
213
+
214
+ @rule = rule
215
+ end
216
+
217
+ # Checks equality by comparing each attribute.
218
+ # @param [Object] Object to be compared
219
+ def ==(o)
220
+ return true if self.equal?(o)
221
+ self.class == o.class &&
222
+ ad_account_id == o.ad_account_id &&
223
+ name == o.name &&
224
+ pixel_id == o.pixel_id &&
225
+ custom_event_type == o.custom_event_type &&
226
+ rule == o.rule
227
+ end
228
+
229
+ # @see the `==` method
230
+ # @param [Object] Object to be compared
231
+ def eql?(o)
232
+ self == o
233
+ end
234
+
235
+ # Calculates hash code according to all attributes.
236
+ # @return [Integer] Hash code
237
+ def hash
238
+ [ad_account_id, name, pixel_id, custom_event_type, rule].hash
239
+ end
240
+
241
+ # Builds the object from hash
242
+ # @param [Hash] attributes Model attributes in the form of hash
243
+ # @return [Object] Returns the model itself
244
+ def self.build_from_hash(attributes)
245
+ return nil unless attributes.is_a?(Hash)
246
+ attributes = attributes.transform_keys(&:to_sym)
247
+ transformed_hash = {}
248
+ openapi_types.each_pair do |key, type|
249
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
250
+ transformed_hash["#{key}"] = nil
251
+ elsif type =~ /\AArray<(.*)>/i
252
+ # check to ensure the input is an array given that the attribute
253
+ # is documented as an array but the input is not
254
+ if attributes[attribute_map[key]].is_a?(Array)
255
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
256
+ end
257
+ elsif !attributes[attribute_map[key]].nil?
258
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
259
+ end
260
+ end
261
+ new(transformed_hash)
262
+ end
263
+
264
+ # Returns the object in the form of hash
265
+ # @return [Hash] Returns the object in the form of hash
266
+ def to_hash
267
+ hash = {}
268
+ self.class.attribute_map.each_pair do |attr, param|
269
+ value = self.send(attr)
270
+ if value.nil?
271
+ is_nullable = self.class.openapi_nullable.include?(attr)
272
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
273
+ end
274
+
275
+ hash[param] = _to_hash(value)
276
+ end
277
+ hash
278
+ end
279
+
280
+ end
281
+
282
+ end