late-sdk 0.0.930 → 0.0.932

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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -2
  3. data/docs/AdCampaignsApi.md +6 -10
  4. data/docs/AdCreative.md +0 -4
  5. data/docs/AdCreativesApi.md +1 -1
  6. data/docs/BoostPostRequest.md +1 -1
  7. data/docs/ConnectApi.md +140 -0
  8. data/docs/CreateAdCreative201Response.md +1 -5
  9. data/docs/CreateAdCreativeRequest.md +2 -2
  10. data/docs/CreateStandaloneAdRequest.md +2 -2
  11. data/docs/CreateStandaloneAdRequestCreativesInner.md +0 -2
  12. data/docs/GetPageWebhookSubscription200Response.md +26 -0
  13. data/docs/ResyncPageWebhookSubscription200Response.md +28 -0
  14. data/docs/UpdateAdRequestCreative.md +2 -2
  15. data/lib/zernio-sdk/api/ad_campaigns_api.rb +4 -7
  16. data/lib/zernio-sdk/api/ad_creatives_api.rb +2 -2
  17. data/lib/zernio-sdk/api/connect_api.rb +126 -0
  18. data/lib/zernio-sdk/models/ad_creative.rb +1 -42
  19. data/lib/zernio-sdk/models/boost_post_request.rb +1 -1
  20. data/lib/zernio-sdk/models/create_ad_creative201_response.rb +4 -44
  21. data/lib/zernio-sdk/models/create_ad_creative_request.rb +3 -2
  22. data/lib/zernio-sdk/models/create_standalone_ad_request.rb +3 -2
  23. data/lib/zernio-sdk/models/create_standalone_ad_request_creatives_inner.rb +1 -11
  24. data/lib/zernio-sdk/models/get_page_webhook_subscription200_response.rb +189 -0
  25. data/lib/zernio-sdk/models/resync_page_webhook_subscription200_response.rb +195 -0
  26. data/lib/zernio-sdk/models/update_ad_request_creative.rb +4 -3
  27. data/lib/zernio-sdk/version.rb +1 -1
  28. data/lib/zernio-sdk.rb +2 -2
  29. data/openapi.yaml +94 -71
  30. data/spec/api/ad_campaigns_api_spec.rb +2 -3
  31. data/spec/api/ad_creatives_api_spec.rb +1 -1
  32. data/spec/api/connect_api_spec.rb +24 -0
  33. data/spec/models/ad_creative_spec.rb +0 -12
  34. data/spec/models/create_ad_creative201_response_spec.rb +0 -12
  35. data/spec/models/create_standalone_ad_request_creatives_inner_spec.rb +0 -6
  36. data/spec/models/{meta_promotion_spec.rb → get_page_webhook_subscription200_response_spec.rb} +11 -15
  37. data/spec/models/resync_page_webhook_subscription200_response_spec.rb +66 -0
  38. data/zernio-sdk-0.0.932.gem +0 -0
  39. metadata +10 -10
  40. data/docs/MetaPromotion.md +0 -26
  41. data/docs/MetaPromotionStatus.md +0 -15
  42. data/lib/zernio-sdk/models/meta_promotion.rb +0 -275
  43. data/lib/zernio-sdk/models/meta_promotion_status.rb +0 -41
  44. data/spec/models/meta_promotion_status_spec.rb +0 -30
  45. data/zernio-sdk-0.0.930.gem +0 -0
@@ -276,6 +276,18 @@ describe 'ConnectApi' do
276
276
  end
277
277
  end
278
278
 
279
+ # unit tests for get_page_webhook_subscription
280
+ # Read a Facebook Page's webhook subscription
281
+ # Returns the webhook fields Zernio's app is subscribed to on the connected Page, read live from Meta. Use it to confirm `leadgen` is present: a Page missing it keeps delivering every other event while lead ads stop arriving, with nothing to indicate it.
282
+ # @param account_id
283
+ # @param [Hash] opts the optional parameters
284
+ # @return [GetPageWebhookSubscription200Response]
285
+ describe 'get_page_webhook_subscription test' do
286
+ it 'should work' do
287
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
288
+ end
289
+ end
290
+
279
291
  # unit tests for get_pending_o_auth_data
280
292
  # Get pending OAuth data
281
293
  # Fetch pending OAuth data for headless mode using the pendingDataToken from the redirect URL. **Scope**: This endpoint is used for LinkedIn organizations, Google Business Profile locations, Slack channels, Snapchat profiles, and Pinterest boards, where the selection list is too large to fit in URL params. The redirect carries a `pendingDataToken` instead of the full payload; the response includes the corresponding selection array (e.g. `boards` for Pinterest). WhatsApp, Facebook and other platforms pass selection state directly via URL query params on the redirect (`profileId`, `tempToken`, `step`), no pending record is created, so this endpoint will return 404 for those flows. Use the platform-specific selection endpoint instead (e.g. `/v1/connect/whatsapp/select-phone-number`). Reading the token does not consume it, so this fetch is repeatable until the token expires 1 hour after issuance. Completing the platform selection deletes the pending record, so the token stops working from then on. No authentication required.
@@ -542,6 +554,18 @@ describe 'ConnectApi' do
542
554
  end
543
555
  end
544
556
 
557
+ # unit tests for resync_page_webhook_subscription
558
+ # Re-subscribe a Facebook Page to Zernio's webhooks
559
+ # Re-sends the full field set to Meta and returns the subscription read back afterwards. Meta only honours the field set sent at subscribe time, so a Page connected before a field existed stays without it until this runs. The response reflects what Meta actually granted, not what was requested.
560
+ # @param account_id
561
+ # @param [Hash] opts the optional parameters
562
+ # @return [ResyncPageWebhookSubscription200Response]
563
+ describe 'resync_page_webhook_subscription test' do
564
+ it 'should work' do
565
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
566
+ end
567
+ end
568
+
545
569
  # unit tests for select_facebook_page
546
570
  # Select Facebook page
547
571
  # Complete a classic Facebook Page connection with profileId, pageId, tempToken and userProfile. Use X-Connect-Token for headless connections. The dashboard business-login picker instead sends only selectionToken and pageId to complete a Meta Ads connection. The server verifies the initiating user, profile access, current grants and connection eligibility. The profile, platform token, ad-account scope and return URL come only from the encrypted grant. Business selection requires a session or bearer authentication for the initiating user; X-Connect-Token is not accepted. It returns redirect_url with connected=metaads on success or an eligibility error redirect.
@@ -81,18 +81,6 @@ describe Zernio::AdCreative do
81
81
  end
82
82
  end
83
83
 
84
- describe 'test attribute "promotion"' do
85
- it 'should work' do
86
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
87
- end
88
- end
89
-
90
- describe 'test attribute "promotion_status"' do
91
- it 'should work' do
92
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
93
- end
94
- end
95
-
96
84
  describe 'test attribute "creative_id"' do
97
85
  it 'should work' do
98
86
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -39,16 +39,4 @@ describe Zernio::CreateAdCreative201Response do
39
39
  end
40
40
  end
41
41
 
42
- describe 'test attribute "promotion"' do
43
- it 'should work' do
44
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
45
- end
46
- end
47
-
48
- describe 'test attribute "promotion_status"' do
49
- it 'should work' do
50
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
51
- end
52
- end
53
-
54
42
  end
@@ -27,12 +27,6 @@ describe Zernio::CreateStandaloneAdRequestCreativesInner do
27
27
  end
28
28
  end
29
29
 
30
- describe 'test attribute "promotion"' do
31
- it 'should work' do
32
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
- end
34
- end
35
-
36
30
  describe 'test attribute "creative_features"' do
37
31
  it 'should work' do
38
32
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
@@ -14,48 +14,44 @@ require 'spec_helper'
14
14
  require 'json'
15
15
  require 'date'
16
16
 
17
- # Unit tests for Zernio::MetaPromotion
17
+ # Unit tests for Zernio::GetPageWebhookSubscription200Response
18
18
  # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
19
  # Please update as you see appropriate
20
- describe Zernio::MetaPromotion do
21
- #let(:instance) { Zernio::MetaPromotion.new }
20
+ describe Zernio::GetPageWebhookSubscription200Response do
21
+ #let(:instance) { Zernio::GetPageWebhookSubscription200Response.new }
22
22
 
23
- describe 'test an instance of MetaPromotion' do
24
- it 'should create an instance of MetaPromotion' do
23
+ describe 'test an instance of GetPageWebhookSubscription200Response' do
24
+ it 'should create an instance of GetPageWebhookSubscription200Response' do
25
25
  # uncomment below to test the instance creation
26
- #expect(instance).to be_instance_of(Zernio::MetaPromotion)
26
+ #expect(instance).to be_instance_of(Zernio::GetPageWebhookSubscription200Response)
27
27
  end
28
28
  end
29
29
 
30
- describe 'test attribute "type"' do
30
+ describe 'test attribute "page_id"' do
31
31
  it 'should work' do
32
32
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
- # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["AMOUNT_OFF", "FREE_RETURN", "FREE_SHIPPING", "PERCENTAGE_OFF", "PROMO_CODE"])
34
- # validator.allowable_values.each do |value|
35
- # expect { instance.type = value }.not_to raise_error
36
- # end
37
33
  end
38
34
  end
39
35
 
40
- describe 'test attribute "value"' do
36
+ describe 'test attribute "app_subscribed"' do
41
37
  it 'should work' do
42
38
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
43
39
  end
44
40
  end
45
41
 
46
- describe 'test attribute "code"' do
42
+ describe 'test attribute "leadgen"' do
47
43
  it 'should work' do
48
44
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
49
45
  end
50
46
  end
51
47
 
52
- describe 'test attribute "start_date"' do
48
+ describe 'test attribute "subscribed_fields"' do
53
49
  it 'should work' do
54
50
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
55
51
  end
56
52
  end
57
53
 
58
- describe 'test attribute "end_date"' do
54
+ describe 'test attribute "warning"' do
59
55
  it 'should work' do
60
56
  # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
61
57
  end
@@ -0,0 +1,66 @@
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 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for Zernio::ResyncPageWebhookSubscription200Response
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe Zernio::ResyncPageWebhookSubscription200Response do
21
+ #let(:instance) { Zernio::ResyncPageWebhookSubscription200Response.new }
22
+
23
+ describe 'test an instance of ResyncPageWebhookSubscription200Response' do
24
+ it 'should create an instance of ResyncPageWebhookSubscription200Response' do
25
+ # uncomment below to test the instance creation
26
+ #expect(instance).to be_instance_of(Zernio::ResyncPageWebhookSubscription200Response)
27
+ end
28
+ end
29
+
30
+ describe 'test attribute "resubscribed"' do
31
+ it 'should work' do
32
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
33
+ end
34
+ end
35
+
36
+ describe 'test attribute "page_id"' do
37
+ it 'should work' do
38
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
39
+ end
40
+ end
41
+
42
+ describe 'test attribute "app_subscribed"' do
43
+ it 'should work' do
44
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
45
+ end
46
+ end
47
+
48
+ describe 'test attribute "leadgen"' do
49
+ it 'should work' do
50
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
51
+ end
52
+ end
53
+
54
+ describe 'test attribute "subscribed_fields"' do
55
+ it 'should work' do
56
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
57
+ end
58
+ end
59
+
60
+ describe 'test attribute "warning"' do
61
+ it 'should work' do
62
+ # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
63
+ end
64
+ end
65
+
66
+ end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: late-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.930
4
+ version: 0.0.932
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenAPI-Generator
@@ -869,6 +869,7 @@ files:
869
869
  - docs/GetMediaPresignedUrlRequest.md
870
870
  - docs/GetMessageAttachment200Response.md
871
871
  - docs/GetMessengerMenu200Response.md
872
+ - docs/GetPageWebhookSubscription200Response.md
872
873
  - docs/GetPendingOAuthData200Response.md
873
874
  - docs/GetPendingOAuthData200ResponseOrganizationsInner.md
874
875
  - docs/GetPhoneNumber200Response.md
@@ -1348,8 +1349,6 @@ files:
1348
1349
  - docs/MetaInstagramIdentityRef.md
1349
1350
  - docs/MetaLeadFormPlatformData.md
1350
1351
  - docs/MetaLeadFormPlatformDataContextCard.md
1351
- - docs/MetaPromotion.md
1352
- - docs/MetaPromotionStatus.md
1353
1352
  - docs/Money.md
1354
1353
  - docs/MoneyAmount.md
1355
1354
  - docs/MoveAccountToProfile200Response.md
@@ -1497,6 +1496,7 @@ files:
1497
1496
  - docs/RespondToSmsRegistrationReviewRequest.md
1498
1497
  - docs/RestoreWorkflowVersion200Response.md
1499
1498
  - docs/RestoreWorkflowVersion200ResponseWorkflow.md
1499
+ - docs/ResyncPageWebhookSubscription200Response.md
1500
1500
  - docs/RetryPost207Response.md
1501
1501
  - docs/RetweetPost200Response.md
1502
1502
  - docs/RetweetPostRequest.md
@@ -3010,6 +3010,7 @@ files:
3010
3010
  - lib/zernio-sdk/models/get_media_presigned_url_request.rb
3011
3011
  - lib/zernio-sdk/models/get_message_attachment200_response.rb
3012
3012
  - lib/zernio-sdk/models/get_messenger_menu200_response.rb
3013
+ - lib/zernio-sdk/models/get_page_webhook_subscription200_response.rb
3013
3014
  - lib/zernio-sdk/models/get_pending_o_auth_data200_response.rb
3014
3015
  - lib/zernio-sdk/models/get_pending_o_auth_data200_response_organizations_inner.rb
3015
3016
  - lib/zernio-sdk/models/get_phone_number200_response.rb
@@ -3479,8 +3480,6 @@ files:
3479
3480
  - lib/zernio-sdk/models/meta_instagram_identity_ref.rb
3480
3481
  - lib/zernio-sdk/models/meta_lead_form_platform_data.rb
3481
3482
  - lib/zernio-sdk/models/meta_lead_form_platform_data_context_card.rb
3482
- - lib/zernio-sdk/models/meta_promotion.rb
3483
- - lib/zernio-sdk/models/meta_promotion_status.rb
3484
3483
  - lib/zernio-sdk/models/money.rb
3485
3484
  - lib/zernio-sdk/models/money_amount.rb
3486
3485
  - lib/zernio-sdk/models/move_account_to_profile200_response.rb
@@ -3622,6 +3621,7 @@ files:
3622
3621
  - lib/zernio-sdk/models/respond_to_sms_registration_review_request.rb
3623
3622
  - lib/zernio-sdk/models/restore_workflow_version200_response.rb
3624
3623
  - lib/zernio-sdk/models/restore_workflow_version200_response_workflow.rb
3624
+ - lib/zernio-sdk/models/resync_page_webhook_subscription200_response.rb
3625
3625
  - lib/zernio-sdk/models/retry_post207_response.rb
3626
3626
  - lib/zernio-sdk/models/retweet_post200_response.rb
3627
3627
  - lib/zernio-sdk/models/retweet_post_request.rb
@@ -5108,6 +5108,7 @@ files:
5108
5108
  - spec/models/get_media_presigned_url_request_spec.rb
5109
5109
  - spec/models/get_message_attachment200_response_spec.rb
5110
5110
  - spec/models/get_messenger_menu200_response_spec.rb
5111
+ - spec/models/get_page_webhook_subscription200_response_spec.rb
5111
5112
  - spec/models/get_pending_o_auth_data200_response_organizations_inner_spec.rb
5112
5113
  - spec/models/get_pending_o_auth_data200_response_spec.rb
5113
5114
  - spec/models/get_phone_number200_response_phone_number_spec.rb
@@ -5577,8 +5578,6 @@ files:
5577
5578
  - spec/models/meta_instagram_identity_ref_spec.rb
5578
5579
  - spec/models/meta_lead_form_platform_data_context_card_spec.rb
5579
5580
  - spec/models/meta_lead_form_platform_data_spec.rb
5580
- - spec/models/meta_promotion_spec.rb
5581
- - spec/models/meta_promotion_status_spec.rb
5582
5581
  - spec/models/money_amount_spec.rb
5583
5582
  - spec/models/money_spec.rb
5584
5583
  - spec/models/move_account_to_profile200_response_spec.rb
@@ -5720,6 +5719,7 @@ files:
5720
5719
  - spec/models/respond_to_sms_registration_review_request_spec.rb
5721
5720
  - spec/models/restore_workflow_version200_response_spec.rb
5722
5721
  - spec/models/restore_workflow_version200_response_workflow_spec.rb
5722
+ - spec/models/resync_page_webhook_subscription200_response_spec.rb
5723
5723
  - spec/models/retry_post207_response_spec.rb
5724
5724
  - spec/models/retweet_post200_response_spec.rb
5725
5725
  - spec/models/retweet_post_request_spec.rb
@@ -6367,7 +6367,7 @@ files:
6367
6367
  - spec/models/you_tube_video_retention_response_retention_curve_inner_spec.rb
6368
6368
  - spec/models/you_tube_video_retention_response_spec.rb
6369
6369
  - spec/spec_helper.rb
6370
- - zernio-sdk-0.0.930.gem
6370
+ - zernio-sdk-0.0.932.gem
6371
6371
  - zernio-sdk.gemspec
6372
6372
  homepage: https://openapi-generator.tech
6373
6373
  licenses:
@@ -6505,6 +6505,7 @@ test_files:
6505
6505
  - spec/models/search_reddit200_response_spec.rb
6506
6506
  - spec/models/list_phone_number_countries200_response_spec.rb
6507
6507
  - spec/models/bulk_update_ad_campaign_status_request_campaigns_inner_spec.rb
6508
+ - spec/models/resync_page_webhook_subscription200_response_spec.rb
6508
6509
  - spec/models/linked_in_ads_platform_data_event_spec.rb
6509
6510
  - spec/models/business_agent_ui_skill_input_spec.rb
6510
6511
  - spec/models/update_conversion_destination_request_value_spec.rb
@@ -7328,7 +7329,6 @@ test_files:
7328
7329
  - spec/models/get_ad_comments200_response_meta_spec.rb
7329
7330
  - spec/models/get_discord_guild_member200_response_spec.rb
7330
7331
  - spec/models/on_verification_failed_request_spec.rb
7331
- - spec/models/meta_promotion_status_spec.rb
7332
7332
  - spec/models/money_amount_spec.rb
7333
7333
  - spec/models/list_ad_campaigns200_response_spec.rb
7334
7334
  - spec/models/search_tweets200_response_tweets_inner_author_spec.rb
@@ -7731,6 +7731,7 @@ test_files:
7731
7731
  - spec/models/webhook_payload_ad_status_changed_status_spec.rb
7732
7732
  - spec/models/create_blog_article_request_seo_spec.rb
7733
7733
  - spec/models/google_business_platform_data_event_schedule_spec.rb
7734
+ - spec/models/get_page_webhook_subscription200_response_spec.rb
7734
7735
  - spec/models/update_facebook_page_request_spec.rb
7735
7736
  - spec/models/create_phone_number_kyc_link_request_branding_spec.rb
7736
7737
  - spec/models/update_ad_campaign_request_budget_spec.rb
@@ -8166,7 +8167,6 @@ test_files:
8166
8167
  - spec/models/get_linked_in_bid_pricing200_response_spec.rb
8167
8168
  - spec/models/purchase_phone_number202_response_spec.rb
8168
8169
  - spec/models/boost_post_request_targeting_cities_inner_spec.rb
8169
- - spec/models/meta_promotion_spec.rb
8170
8170
  - spec/models/update_broadcast_request_template_variable_mapping_value_spec.rb
8171
8171
  - spec/models/comment_automation_template_element_spec.rb
8172
8172
  - spec/models/webhook_payload_call_ended_spec.rb
@@ -1,26 +0,0 @@
1
- # Zernio::MetaPromotion
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **type** | **String** | Promotion type accepted by Meta. PERCENTAGE_OFF values cannot exceed 100. | |
8
- | **value** | **Float** | Nonnegative promotion value passed to Meta unchanged. AMOUNT_OFF units are not confirmed, including major versus minor currency units. For PERCENTAGE_OFF this is the percentage discount, at most 100. | |
9
- | **code** | **String** | Optional promotion code. | [optional] |
10
- | **start_date** | **Time** | Optional ISO 8601 start timestamp with a timezone offset or Z. | [optional] |
11
- | **end_date** | **Time** | Optional ISO 8601 end timestamp with a timezone offset or Z. Must be after startDate when both are set. | [optional] |
12
-
13
- ## Example
14
-
15
- ```ruby
16
- require 'zernio-sdk'
17
-
18
- instance = Zernio::MetaPromotion.new(
19
- type: null,
20
- value: null,
21
- code: null,
22
- start_date: null,
23
- end_date: null
24
- )
25
- ```
26
-
@@ -1,15 +0,0 @@
1
- # Zernio::MetaPromotionStatus
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
-
8
- ## Example
9
-
10
- ```ruby
11
- require 'zernio-sdk'
12
-
13
- instance = Zernio::MetaPromotionStatus.new()
14
- ```
15
-
@@ -1,275 +0,0 @@
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
- # Meta explicit Promotion offer. Maps to creative_sourcing_spec.promotion_metadata_spec with promotion_source ADVERTISER_INPUT. Dates become Unix seconds. Send null to omit an explicit offer on a new creative or remove it when rebuilding. Creation success alone does not confirm application: inspect promotionStatus in the response.
18
- class MetaPromotion < ApiModelBase
19
- # Promotion type accepted by Meta. PERCENTAGE_OFF values cannot exceed 100.
20
- attr_accessor :type
21
-
22
- # Nonnegative promotion value passed to Meta unchanged. AMOUNT_OFF units are not confirmed, including major versus minor currency units. For PERCENTAGE_OFF this is the percentage discount, at most 100.
23
- attr_accessor :value
24
-
25
- # Optional promotion code.
26
- attr_accessor :code
27
-
28
- # Optional ISO 8601 start timestamp with a timezone offset or Z.
29
- attr_accessor :start_date
30
-
31
- # Optional ISO 8601 end timestamp with a timezone offset or Z. Must be after startDate when both are set.
32
- attr_accessor :end_date
33
-
34
- class EnumAttributeValidator
35
- attr_reader :datatype
36
- attr_reader :allowable_values
37
-
38
- def initialize(datatype, allowable_values)
39
- @allowable_values = allowable_values.map do |value|
40
- case datatype.to_s
41
- when /Integer/i
42
- value.to_i
43
- when /Float/i
44
- value.to_f
45
- else
46
- value
47
- end
48
- end
49
- end
50
-
51
- def valid?(value)
52
- !value || allowable_values.include?(value)
53
- end
54
- end
55
-
56
- # Attribute mapping from ruby-style variable name to JSON key.
57
- def self.attribute_map
58
- {
59
- :'type' => :'type',
60
- :'value' => :'value',
61
- :'code' => :'code',
62
- :'start_date' => :'startDate',
63
- :'end_date' => :'endDate'
64
- }
65
- end
66
-
67
- # Returns attribute mapping this model knows about
68
- def self.acceptable_attribute_map
69
- attribute_map
70
- end
71
-
72
- # Returns all the JSON keys this model knows about
73
- def self.acceptable_attributes
74
- acceptable_attribute_map.values
75
- end
76
-
77
- # Attribute type mapping.
78
- def self.openapi_types
79
- {
80
- :'type' => :'String',
81
- :'value' => :'Float',
82
- :'code' => :'String',
83
- :'start_date' => :'Time',
84
- :'end_date' => :'Time'
85
- }
86
- end
87
-
88
- # List of attributes with nullable: true
89
- def self.openapi_nullable
90
- Set.new([
91
- ])
92
- end
93
-
94
- # Initializes the object
95
- # @param [Hash] attributes Model attributes in the form of hash
96
- def initialize(attributes = {})
97
- if (!attributes.is_a?(Hash))
98
- fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::MetaPromotion` initialize method"
99
- end
100
-
101
- # check to see if the attribute exists and convert string to symbol for hash key
102
- acceptable_attribute_map = self.class.acceptable_attribute_map
103
- attributes = attributes.each_with_object({}) { |(k, v), h|
104
- if (!acceptable_attribute_map.key?(k.to_sym))
105
- fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::MetaPromotion`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
106
- end
107
- h[k.to_sym] = v
108
- }
109
-
110
- if attributes.key?(:'type')
111
- self.type = attributes[:'type']
112
- else
113
- self.type = nil
114
- end
115
-
116
- if attributes.key?(:'value')
117
- self.value = attributes[:'value']
118
- else
119
- self.value = nil
120
- end
121
-
122
- if attributes.key?(:'code')
123
- self.code = attributes[:'code']
124
- end
125
-
126
- if attributes.key?(:'start_date')
127
- self.start_date = attributes[:'start_date']
128
- end
129
-
130
- if attributes.key?(:'end_date')
131
- self.end_date = attributes[:'end_date']
132
- end
133
- end
134
-
135
- # Show invalid properties with the reasons. Usually used together with valid?
136
- # @return Array for valid properties with the reasons
137
- def list_invalid_properties
138
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
139
- invalid_properties = Array.new
140
- if @type.nil?
141
- invalid_properties.push('invalid value for "type", type cannot be nil.')
142
- end
143
-
144
- if @value.nil?
145
- invalid_properties.push('invalid value for "value", value cannot be nil.')
146
- end
147
-
148
- if @value < 0
149
- invalid_properties.push('invalid value for "value", must be greater than or equal to 0.')
150
- end
151
-
152
- if !@code.nil? && @code.to_s.length < 1
153
- invalid_properties.push('invalid value for "code", the character length must be greater than or equal to 1.')
154
- end
155
-
156
- invalid_properties
157
- end
158
-
159
- # Check to see if the all the properties in the model are valid
160
- # @return true if the model is valid
161
- def valid?
162
- warn '[DEPRECATED] the `valid?` method is obsolete'
163
- return false if @type.nil?
164
- type_validator = EnumAttributeValidator.new('String', ["AMOUNT_OFF", "FREE_RETURN", "FREE_SHIPPING", "PERCENTAGE_OFF", "PROMO_CODE"])
165
- return false unless type_validator.valid?(@type)
166
- return false if @value.nil?
167
- return false if @value < 0
168
- return false if !@code.nil? && @code.to_s.length < 1
169
- true
170
- end
171
-
172
- # Custom attribute writer method checking allowed values (enum).
173
- # @param [Object] type Object to be assigned
174
- def type=(type)
175
- validator = EnumAttributeValidator.new('String', ["AMOUNT_OFF", "FREE_RETURN", "FREE_SHIPPING", "PERCENTAGE_OFF", "PROMO_CODE"])
176
- unless validator.valid?(type)
177
- fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
178
- end
179
- @type = type
180
- end
181
-
182
- # Custom attribute writer method with validation
183
- # @param [Object] value Value to be assigned
184
- def value=(value)
185
- if value.nil?
186
- fail ArgumentError, 'value cannot be nil'
187
- end
188
-
189
- if value < 0
190
- fail ArgumentError, 'invalid value for "value", must be greater than or equal to 0.'
191
- end
192
-
193
- @value = value
194
- end
195
-
196
- # Custom attribute writer method with validation
197
- # @param [Object] code Value to be assigned
198
- def code=(code)
199
- if code.nil?
200
- fail ArgumentError, 'code cannot be nil'
201
- end
202
-
203
- if code.to_s.length < 1
204
- fail ArgumentError, 'invalid value for "code", the character length must be greater than or equal to 1.'
205
- end
206
-
207
- @code = code
208
- end
209
-
210
- # Checks equality by comparing each attribute.
211
- # @param [Object] Object to be compared
212
- def ==(o)
213
- return true if self.equal?(o)
214
- self.class == o.class &&
215
- type == o.type &&
216
- value == o.value &&
217
- code == o.code &&
218
- start_date == o.start_date &&
219
- end_date == o.end_date
220
- end
221
-
222
- # @see the `==` method
223
- # @param [Object] Object to be compared
224
- def eql?(o)
225
- self == o
226
- end
227
-
228
- # Calculates hash code according to all attributes.
229
- # @return [Integer] Hash code
230
- def hash
231
- [type, value, code, start_date, end_date].hash
232
- end
233
-
234
- # Builds the object from hash
235
- # @param [Hash] attributes Model attributes in the form of hash
236
- # @return [Object] Returns the model itself
237
- def self.build_from_hash(attributes)
238
- return nil unless attributes.is_a?(Hash)
239
- attributes = attributes.transform_keys(&:to_sym)
240
- transformed_hash = {}
241
- openapi_types.each_pair do |key, type|
242
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
243
- transformed_hash["#{key}"] = nil
244
- elsif type =~ /\AArray<(.*)>/i
245
- # check to ensure the input is an array given that the attribute
246
- # is documented as an array but the input is not
247
- if attributes[attribute_map[key]].is_a?(Array)
248
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
249
- end
250
- elsif !attributes[attribute_map[key]].nil?
251
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
252
- end
253
- end
254
- new(transformed_hash)
255
- end
256
-
257
- # Returns the object in the form of hash
258
- # @return [Hash] Returns the object in the form of hash
259
- def to_hash
260
- hash = {}
261
- self.class.attribute_map.each_pair do |attr, param|
262
- value = self.send(attr)
263
- if value.nil?
264
- is_nullable = self.class.openapi_nullable.include?(attr)
265
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
266
- end
267
-
268
- hash[param] = _to_hash(value)
269
- end
270
- hash
271
- end
272
-
273
- end
274
-
275
- end