From 8cdba867feb6274e6bf99e3f8c97aaf64cc6948a Mon Sep 17 00:00:00 2001 From: OneSignal Date: Wed, 19 Aug 2026 22:01:18 +0000 Subject: [PATCH] feat: add v5.12.0 package updates --- README.md | 6 +- docs/CreateJourneyRequest.md | 30 + docs/DefaultApi.md | 563 ++++++++++++++++++ docs/Journey.md | 48 ++ docs/JourneyAudience.md | 28 + docs/JourneyBranch.md | 24 + docs/JourneyBranchStats.md | 18 + docs/JourneyCondition.md | 34 ++ docs/JourneyEarlyExit.md | 20 + docs/JourneyEarlyExitRules.md | 24 + docs/JourneyEarlyExitRulesOnEvent.md | 18 + docs/JourneyEarlyExitRulesOnSegment.md | 18 + docs/JourneyEventAttribute.md | 22 + docs/JourneyListAudience.md | 18 + docs/JourneyListItem.md | 40 ++ docs/JourneyListResponse.md | 22 + docs/JourneyMessageStats.md | 18 + docs/JourneyNode.md | 50 ++ docs/JourneyNodeStats.md | 26 + docs/JourneyReentryRules.md | 18 + docs/JourneySchedule.md | 22 + docs/JourneyStats.md | 28 + docs/JourneyTimePoint.md | 20 + docs/JourneyTimeWindow.md | 22 + docs/JourneyWaitUntilExpiration.md | 20 + docs/UpdateJourneyNodeRequest.md | 48 ++ docs/UpdateJourneyRequest.md | 34 ++ lib/onesignal.rb | 25 + lib/onesignal/api/default_api.rb | 524 ++++++++++++++++ lib/onesignal/api_client.rb | 2 +- .../models/create_journey_request.rb | 287 +++++++++ lib/onesignal/models/journey.rb | 409 +++++++++++++ lib/onesignal/models/journey_audience.rb | 316 ++++++++++ lib/onesignal/models/journey_branch.rb | 250 ++++++++ lib/onesignal/models/journey_branch_stats.rb | 220 +++++++ lib/onesignal/models/journey_condition.rb | 360 +++++++++++ lib/onesignal/models/journey_early_exit.rb | 231 +++++++ .../models/journey_early_exit_rules.rb | 251 ++++++++ .../journey_early_exit_rules_on_event.rb | 224 +++++++ .../journey_early_exit_rules_on_segment.rb | 221 +++++++ .../models/journey_event_attribute.rb | 283 +++++++++ lib/onesignal/models/journey_list_audience.rb | 254 ++++++++ lib/onesignal/models/journey_list_item.rb | 366 ++++++++++++ lib/onesignal/models/journey_list_response.rb | 241 ++++++++ lib/onesignal/models/journey_message_stats.rb | 222 +++++++ lib/onesignal/models/journey_node.rb | 480 +++++++++++++++ lib/onesignal/models/journey_node_stats.rb | 293 +++++++++ lib/onesignal/models/journey_reentry_rules.rb | 236 ++++++++ lib/onesignal/models/journey_schedule.rb | 243 ++++++++ lib/onesignal/models/journey_stats.rb | 274 +++++++++ lib/onesignal/models/journey_time_point.rb | 277 +++++++++ lib/onesignal/models/journey_time_window.rb | 266 +++++++++ .../models/journey_wait_until_expiration.rb | 256 ++++++++ .../models/update_journey_node_request.rb | 454 ++++++++++++++ .../models/update_journey_request.rb | 337 +++++++++++ lib/onesignal/version.rb | 2 +- spec/api/default_api_spec.rb | 95 +++ spec/models/create_journey_request_spec.rb | 69 +++ spec/models/journey_audience_spec.rb | 67 +++ spec/models/journey_branch_spec.rb | 51 ++ spec/models/journey_branch_stats_spec.rb | 33 + spec/models/journey_condition_spec.rb | 89 +++ .../journey_early_exit_rules_on_event_spec.rb | 33 + ...ourney_early_exit_rules_on_segment_spec.rb | 33 + spec/models/journey_early_exit_rules_spec.rb | 51 ++ spec/models/journey_early_exit_spec.rb | 39 ++ spec/models/journey_event_attribute_spec.rb | 49 ++ spec/models/journey_list_audience_spec.rb | 37 ++ spec/models/journey_list_item_spec.rb | 103 ++++ spec/models/journey_list_response_spec.rb | 45 ++ spec/models/journey_message_stats_spec.rb | 33 + spec/models/journey_node_spec.rb | 137 +++++ spec/models/journey_node_stats_spec.rb | 61 ++ spec/models/journey_reentry_rules_spec.rb | 33 + spec/models/journey_schedule_spec.rb | 45 ++ spec/models/journey_spec.rb | 127 ++++ spec/models/journey_stats_spec.rb | 63 ++ spec/models/journey_time_point_spec.rb | 39 ++ spec/models/journey_time_window_spec.rb | 45 ++ .../journey_wait_until_expiration_spec.rb | 39 ++ .../update_journey_node_request_spec.rb | 127 ++++ spec/models/update_journey_request_spec.rb | 85 +++ 82 files changed, 10666 insertions(+), 5 deletions(-) create mode 100644 docs/CreateJourneyRequest.md create mode 100644 docs/Journey.md create mode 100644 docs/JourneyAudience.md create mode 100644 docs/JourneyBranch.md create mode 100644 docs/JourneyBranchStats.md create mode 100644 docs/JourneyCondition.md create mode 100644 docs/JourneyEarlyExit.md create mode 100644 docs/JourneyEarlyExitRules.md create mode 100644 docs/JourneyEarlyExitRulesOnEvent.md create mode 100644 docs/JourneyEarlyExitRulesOnSegment.md create mode 100644 docs/JourneyEventAttribute.md create mode 100644 docs/JourneyListAudience.md create mode 100644 docs/JourneyListItem.md create mode 100644 docs/JourneyListResponse.md create mode 100644 docs/JourneyMessageStats.md create mode 100644 docs/JourneyNode.md create mode 100644 docs/JourneyNodeStats.md create mode 100644 docs/JourneyReentryRules.md create mode 100644 docs/JourneySchedule.md create mode 100644 docs/JourneyStats.md create mode 100644 docs/JourneyTimePoint.md create mode 100644 docs/JourneyTimeWindow.md create mode 100644 docs/JourneyWaitUntilExpiration.md create mode 100644 docs/UpdateJourneyNodeRequest.md create mode 100644 docs/UpdateJourneyRequest.md create mode 100644 lib/onesignal/models/create_journey_request.rb create mode 100644 lib/onesignal/models/journey.rb create mode 100644 lib/onesignal/models/journey_audience.rb create mode 100644 lib/onesignal/models/journey_branch.rb create mode 100644 lib/onesignal/models/journey_branch_stats.rb create mode 100644 lib/onesignal/models/journey_condition.rb create mode 100644 lib/onesignal/models/journey_early_exit.rb create mode 100644 lib/onesignal/models/journey_early_exit_rules.rb create mode 100644 lib/onesignal/models/journey_early_exit_rules_on_event.rb create mode 100644 lib/onesignal/models/journey_early_exit_rules_on_segment.rb create mode 100644 lib/onesignal/models/journey_event_attribute.rb create mode 100644 lib/onesignal/models/journey_list_audience.rb create mode 100644 lib/onesignal/models/journey_list_item.rb create mode 100644 lib/onesignal/models/journey_list_response.rb create mode 100644 lib/onesignal/models/journey_message_stats.rb create mode 100644 lib/onesignal/models/journey_node.rb create mode 100644 lib/onesignal/models/journey_node_stats.rb create mode 100644 lib/onesignal/models/journey_reentry_rules.rb create mode 100644 lib/onesignal/models/journey_schedule.rb create mode 100644 lib/onesignal/models/journey_stats.rb create mode 100644 lib/onesignal/models/journey_time_point.rb create mode 100644 lib/onesignal/models/journey_time_window.rb create mode 100644 lib/onesignal/models/journey_wait_until_expiration.rb create mode 100644 lib/onesignal/models/update_journey_node_request.rb create mode 100644 lib/onesignal/models/update_journey_request.rb create mode 100644 spec/models/create_journey_request_spec.rb create mode 100644 spec/models/journey_audience_spec.rb create mode 100644 spec/models/journey_branch_spec.rb create mode 100644 spec/models/journey_branch_stats_spec.rb create mode 100644 spec/models/journey_condition_spec.rb create mode 100644 spec/models/journey_early_exit_rules_on_event_spec.rb create mode 100644 spec/models/journey_early_exit_rules_on_segment_spec.rb create mode 100644 spec/models/journey_early_exit_rules_spec.rb create mode 100644 spec/models/journey_early_exit_spec.rb create mode 100644 spec/models/journey_event_attribute_spec.rb create mode 100644 spec/models/journey_list_audience_spec.rb create mode 100644 spec/models/journey_list_item_spec.rb create mode 100644 spec/models/journey_list_response_spec.rb create mode 100644 spec/models/journey_message_stats_spec.rb create mode 100644 spec/models/journey_node_spec.rb create mode 100644 spec/models/journey_node_stats_spec.rb create mode 100644 spec/models/journey_reentry_rules_spec.rb create mode 100644 spec/models/journey_schedule_spec.rb create mode 100644 spec/models/journey_spec.rb create mode 100644 spec/models/journey_stats_spec.rb create mode 100644 spec/models/journey_time_point_spec.rb create mode 100644 spec/models/journey_time_window_spec.rb create mode 100644 spec/models/journey_wait_until_expiration_spec.rb create mode 100644 spec/models/update_journey_node_request_spec.rb create mode 100644 spec/models/update_journey_request_spec.rb diff --git a/README.md b/README.md index 12d86d8..393d4a3 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,15 @@ OneSignal - the Ruby gem for OneSignal A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com -- API version: 5.11.2 -- Package version: 5.11.2 +- API version: 5.12.0 +- Package version: 5.12.0 ## Installation Add to your `Gemfile`: ```ruby -gem 'onesignal', '~> 5.11.2' +gem 'onesignal', '~> 5.12.0' ``` Then run `bundle install`. diff --git a/docs/CreateJourneyRequest.md b/docs/CreateJourneyRequest.md new file mode 100644 index 0000000..adc3988 --- /dev/null +++ b/docs/CreateJourneyRequest.md @@ -0,0 +1,30 @@ +# OneSignal::CreateJourneyRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | Journey name, up to 300 characters. | | +| **description** | **String** | Optional journey description, up to 1024 characters. | [optional] | +| **audience** | [**JourneyAudience**](JourneyAudience.md) | | [optional] | +| **early_exit** | [**JourneyEarlyExit**](JourneyEarlyExit.md) | | [optional] | +| **reentry_rules** | [**JourneyReentryRules**](JourneyReentryRules.md) | | [optional] | +| **schedule** | [**JourneySchedule**](JourneySchedule.md) | | [optional] | +| **nodes** | [**Array<JourneyNode>**](JourneyNode.md) | Ordered list of journey nodes. Server-assigned id fields are rejected on create. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::CreateJourneyRequest.new( + name: nil, + description: nil, + audience: nil, + early_exit: nil, + reentry_rules: nil, + schedule: nil, + nodes: nil +) +``` + diff --git a/docs/DefaultApi.md b/docs/DefaultApi.md index 241bb71..f695da3 100644 --- a/docs/DefaultApi.md +++ b/docs/DefaultApi.md @@ -11,6 +11,7 @@ All URIs are relative to *https://api.onesignal.com* | [**create_api_key**](DefaultApi.md#create_api_key) | **POST** /apps/{app_id}/auth/tokens | Create API key | | [**create_app**](DefaultApi.md#create_app) | **POST** /apps | Create an app | | [**create_custom_events**](DefaultApi.md#create_custom_events) | **POST** /apps/{app_id}/custom_events | Create custom events | +| [**create_journey**](DefaultApi.md#create_journey) | **POST** /apps/{app_id}/journeys | Create journey | | [**create_notification**](DefaultApi.md#create_notification) | **POST** /notifications | Create notification | | [**create_segment**](DefaultApi.md#create_segment) | **POST** /apps/{app_id}/segments | Create Segment | | [**create_subscription**](DefaultApi.md#create_subscription) | **POST** /apps/{app_id}/users/by/{alias_label}/{alias_id}/subscriptions | | @@ -18,6 +19,7 @@ All URIs are relative to *https://api.onesignal.com* | [**create_user**](DefaultApi.md#create_user) | **POST** /apps/{app_id}/users | | | [**delete_alias**](DefaultApi.md#delete_alias) | **DELETE** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity/{alias_label_to_delete} | | | [**delete_api_key**](DefaultApi.md#delete_api_key) | **DELETE** /apps/{app_id}/auth/tokens/{token_id} | Delete API key | +| [**delete_journey**](DefaultApi.md#delete_journey) | **DELETE** /apps/{app_id}/journeys/{journey_id} | Delete journey | | [**delete_segment**](DefaultApi.md#delete_segment) | **DELETE** /apps/{app_id}/segments/{segment_id} | Delete Segment | | [**delete_subscription**](DefaultApi.md#delete_subscription) | **DELETE** /apps/{app_id}/subscriptions/{subscription_id} | | | [**delete_template**](DefaultApi.md#delete_template) | **DELETE** /templates/{template_id} | Delete template | @@ -42,6 +44,8 @@ All URIs are relative to *https://api.onesignal.com* | [**unsubscribe_email_with_token**](DefaultApi.md#unsubscribe_email_with_token) | **POST** /apps/{app_id}/notifications/{notification_id}/unsubscribe | Unsubscribe with token | | [**update_api_key**](DefaultApi.md#update_api_key) | **PATCH** /apps/{app_id}/auth/tokens/{token_id} | Update API key | | [**update_app**](DefaultApi.md#update_app) | **PUT** /apps/{app_id} | Update an app | +| [**update_journey**](DefaultApi.md#update_journey) | **PATCH** /apps/{app_id}/journeys/{journey_id} | Update journey | +| [**update_journey_node**](DefaultApi.md#update_journey_node) | **PATCH** /apps/{app_id}/journeys/{journey_id}/nodes/{node_id} | Update journey node | | [**update_live_activity**](DefaultApi.md#update_live_activity) | **POST** /apps/{app_id}/live_activities/{activity_id}/notifications | Update a Live Activity via Push | | [**update_segment**](DefaultApi.md#update_segment) | **PATCH** /apps/{app_id}/segments/{segment_id} | Update Segment | | [**update_subscription**](DefaultApi.md#update_subscription) | **PATCH** /apps/{app_id}/subscriptions/{subscription_id} | | @@ -49,6 +53,9 @@ All URIs are relative to *https://api.onesignal.com* | [**update_template**](DefaultApi.md#update_template) | **PATCH** /templates/{template_id} | Update template | | [**update_user**](DefaultApi.md#update_user) | **PATCH** /apps/{app_id}/users/by/{alias_label}/{alias_id} | | | [**view_api_keys**](DefaultApi.md#view_api_keys) | **GET** /apps/{app_id}/auth/tokens | View API keys | +| [**view_journey**](DefaultApi.md#view_journey) | **GET** /apps/{app_id}/journeys/{journey_id} | View journey | +| [**view_journey_stats**](DefaultApi.md#view_journey_stats) | **GET** /apps/{app_id}/journeys/{journey_id}/stats | View journey stats | +| [**view_journeys**](DefaultApi.md#view_journeys) | **GET** /apps/{app_id}/journeys | View journeys | | [**view_template**](DefaultApi.md#view_template) | **GET** /templates/{template_id} | View template | | [**view_templates**](DefaultApi.md#view_templates) | **GET** /templates | View templates | @@ -640,6 +647,84 @@ end - **Accept**: application/json +## create_journey + +> create_journey(app_id, create_journey_request) + +Create journey + +The Journeys API is in beta. Endpoints and response fields can still change. Create a new journey with an audience and a node graph. Journeys are always created in the draft state. The authenticated App API key must have permission to create journeys. + +### Examples + +```ruby +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: rest_api_key + config.rest_api_key = 'YOUR_REST_API_KEY' + +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'YOUR_APP_ID' # String | Your OneSignal App ID in UUID v4 format. +create_journey_request = OneSignal::CreateJourneyRequest.new({name: 'name_example'}) # CreateJourneyRequest | + +begin + # Create journey + result = api_instance.create_journey(app_id, create_journey_request) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->create_journey: #{e}" + puts "Status Code: #{e.code}" + # `e.error_messages` flattens any error-envelope shape to an Array; + # the raw body remains on `e.response_body`. + puts "Error Messages: #{e.error_messages}" + puts "Response Body: #{e.response_body}" +end +``` + +#### Using the create_journey_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_journey_with_http_info(app_id, create_journey_request) + +```ruby +begin + # Create journey + data, status_code, headers = api_instance.create_journey_with_http_info(app_id, create_journey_request) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->create_journey_with_http_info: #{e}" + puts "Status Code: #{e.code}" + puts "Response Body: #{e.response_body}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | Your OneSignal App ID in UUID v4 format. | | +| **create_journey_request** | [**CreateJourneyRequest**](CreateJourneyRequest.md) | | | + +### Return type + +[**Journey**](Journey.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-ruby-api#configuration) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + ## create_notification > create_notification(notification) @@ -1262,6 +1347,84 @@ end - **Accept**: application/json +## delete_journey + +> delete_journey(app_id, journey_id) + +Delete journey + +The Journeys API is in beta. Endpoints and response fields can still change. Permanently delete a journey by its UUID. Returns { \"success\": true } on success. The authenticated App API key must have permission to delete journeys. Deleting a journey stops any in-flight users and cannot be undone. Archive a running journey instead if you need to keep its data. + +### Examples + +```ruby +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: rest_api_key + config.rest_api_key = 'YOUR_REST_API_KEY' + +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'YOUR_APP_ID' # String | Your OneSignal App ID in UUID v4 format. +journey_id = 'YOUR_JOURNEY_ID' # String | UUID of the journey to delete. + +begin + # Delete journey + result = api_instance.delete_journey(app_id, journey_id) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->delete_journey: #{e}" + puts "Status Code: #{e.code}" + # `e.error_messages` flattens any error-envelope shape to an Array; + # the raw body remains on `e.response_body`. + puts "Error Messages: #{e.error_messages}" + puts "Response Body: #{e.response_body}" +end +``` + +#### Using the delete_journey_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> delete_journey_with_http_info(app_id, journey_id) + +```ruby +begin + # Delete journey + data, status_code, headers = api_instance.delete_journey_with_http_info(app_id, journey_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->delete_journey_with_http_info: #{e}" + puts "Status Code: #{e.code}" + puts "Response Body: #{e.response_body}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | Your OneSignal App ID in UUID v4 format. | | +| **journey_id** | **String** | UUID of the journey to delete. | | + +### Return type + +[**GenericSuccessBoolResponse**](GenericSuccessBoolResponse.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-ruby-api#configuration) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + ## delete_segment > delete_segment(app_id, segment_id) @@ -3189,6 +3352,168 @@ end - **Accept**: application/json +## update_journey + +> update_journey(app_id, journey_id, update_journey_request) + +Update journey + +The Journeys API is in beta. Endpoints and response fields can still change. Apply a partial update to a journey using JSON Merge Patch (RFC 7396). Send only the fields you want to change; omitted fields are left unchanged. A null value clears a nullable field, and arrays such as nodes are replaced wholesale. Set state to active to activate a draft journey. + +### Examples + +```ruby +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: rest_api_key + config.rest_api_key = 'YOUR_REST_API_KEY' + +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'YOUR_APP_ID' # String | Your OneSignal App ID in UUID v4 format. +journey_id = 'YOUR_JOURNEY_ID' # String | UUID of the journey to update. +update_journey_request = OneSignal::UpdateJourneyRequest.new # UpdateJourneyRequest | + +begin + # Update journey + result = api_instance.update_journey(app_id, journey_id, update_journey_request) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->update_journey: #{e}" + puts "Status Code: #{e.code}" + # `e.error_messages` flattens any error-envelope shape to an Array; + # the raw body remains on `e.response_body`. + puts "Error Messages: #{e.error_messages}" + puts "Response Body: #{e.response_body}" +end +``` + +#### Using the update_journey_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_journey_with_http_info(app_id, journey_id, update_journey_request) + +```ruby +begin + # Update journey + data, status_code, headers = api_instance.update_journey_with_http_info(app_id, journey_id, update_journey_request) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->update_journey_with_http_info: #{e}" + puts "Status Code: #{e.code}" + puts "Response Body: #{e.response_body}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | Your OneSignal App ID in UUID v4 format. | | +| **journey_id** | **String** | UUID of the journey to update. | | +| **update_journey_request** | [**UpdateJourneyRequest**](UpdateJourneyRequest.md) | | | + +### Return type + +[**Journey**](Journey.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-ruby-api#configuration) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## update_journey_node + +> update_journey_node(app_id, journey_id, node_id, update_journey_node_request) + +Update journey node + +The Journeys API is in beta. Endpoints and response fields can still change. Apply a partial update to a single node, located by its server-assigned id, using JSON Merge Patch (RFC 7396). Send only the node fields you want to change; the rest of the node and the rest of the journey graph are left untouched. Returns the full updated journey. + +### Examples + +```ruby +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: rest_api_key + config.rest_api_key = 'YOUR_REST_API_KEY' + +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'YOUR_APP_ID' # String | Your OneSignal App ID in UUID v4 format. +journey_id = 'YOUR_JOURNEY_ID' # String | UUID of the journey that owns the node. +node_id = 'YOUR_NODE_ID' # String | Server-assigned UUID of the node to update, from a prior View journey fetch. +update_journey_node_request = OneSignal::UpdateJourneyNodeRequest.new # UpdateJourneyNodeRequest | + +begin + # Update journey node + result = api_instance.update_journey_node(app_id, journey_id, node_id, update_journey_node_request) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->update_journey_node: #{e}" + puts "Status Code: #{e.code}" + # `e.error_messages` flattens any error-envelope shape to an Array; + # the raw body remains on `e.response_body`. + puts "Error Messages: #{e.error_messages}" + puts "Response Body: #{e.response_body}" +end +``` + +#### Using the update_journey_node_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_journey_node_with_http_info(app_id, journey_id, node_id, update_journey_node_request) + +```ruby +begin + # Update journey node + data, status_code, headers = api_instance.update_journey_node_with_http_info(app_id, journey_id, node_id, update_journey_node_request) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->update_journey_node_with_http_info: #{e}" + puts "Status Code: #{e.code}" + puts "Response Body: #{e.response_body}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | Your OneSignal App ID in UUID v4 format. | | +| **journey_id** | **String** | UUID of the journey that owns the node. | | +| **node_id** | **String** | Server-assigned UUID of the node to update, from a prior View journey fetch. | | +| **update_journey_node_request** | [**UpdateJourneyNodeRequest**](UpdateJourneyNodeRequest.md) | | | + +### Return type + +[**Journey**](Journey.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-ruby-api#configuration) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + ## update_live_activity > update_live_activity(app_id, activity_id, update_live_activity_request) @@ -3750,6 +4075,244 @@ end - **Accept**: application/json +## view_journey + +> view_journey(app_id, journey_id) + +View journey + +The Journeys API is in beta. Endpoints and response fields can still change. Retrieve the full configuration of a single journey by its UUID, including its audience and node graph. + +### Examples + +```ruby +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: rest_api_key + config.rest_api_key = 'YOUR_REST_API_KEY' + +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'YOUR_APP_ID' # String | Your OneSignal App ID in UUID v4 format. +journey_id = 'YOUR_JOURNEY_ID' # String | UUID of the journey to retrieve. + +begin + # View journey + result = api_instance.view_journey(app_id, journey_id) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->view_journey: #{e}" + puts "Status Code: #{e.code}" + # `e.error_messages` flattens any error-envelope shape to an Array; + # the raw body remains on `e.response_body`. + puts "Error Messages: #{e.error_messages}" + puts "Response Body: #{e.response_body}" +end +``` + +#### Using the view_journey_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> view_journey_with_http_info(app_id, journey_id) + +```ruby +begin + # View journey + data, status_code, headers = api_instance.view_journey_with_http_info(app_id, journey_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->view_journey_with_http_info: #{e}" + puts "Status Code: #{e.code}" + puts "Response Body: #{e.response_body}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | Your OneSignal App ID in UUID v4 format. | | +| **journey_id** | **String** | UUID of the journey to retrieve. | | + +### Return type + +[**Journey**](Journey.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-ruby-api#configuration) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## view_journey_stats + +> view_journey_stats(app_id, journey_id) + +View journey stats + +The Journeys API is in beta. Endpoints and response fields can still change. Retrieve performance stats for a single journey: journey-level entry and exit counts, per-node counts keyed by node id, per-branch counts keyed by branch id, and channel delivery stats for message-sending nodes. The response carries no definition detail, so join it by id against the journey from View journey. + +### Examples + +```ruby +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: rest_api_key + config.rest_api_key = 'YOUR_REST_API_KEY' + +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'YOUR_APP_ID' # String | Your OneSignal App ID in UUID v4 format. +journey_id = 'YOUR_JOURNEY_ID' # String | UUID of the journey to retrieve stats for. + +begin + # View journey stats + result = api_instance.view_journey_stats(app_id, journey_id) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->view_journey_stats: #{e}" + puts "Status Code: #{e.code}" + # `e.error_messages` flattens any error-envelope shape to an Array; + # the raw body remains on `e.response_body`. + puts "Error Messages: #{e.error_messages}" + puts "Response Body: #{e.response_body}" +end +``` + +#### Using the view_journey_stats_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> view_journey_stats_with_http_info(app_id, journey_id) + +```ruby +begin + # View journey stats + data, status_code, headers = api_instance.view_journey_stats_with_http_info(app_id, journey_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->view_journey_stats_with_http_info: #{e}" + puts "Status Code: #{e.code}" + puts "Response Body: #{e.response_body}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | Your OneSignal App ID in UUID v4 format. | | +| **journey_id** | **String** | UUID of the journey to retrieve stats for. | | + +### Return type + +[**JourneyStats**](JourneyStats.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-ruby-api#configuration) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## view_journeys + +> view_journeys(app_id, opts) + +View journeys + +The Journeys API is in beta. Endpoints and response fields can still change. Retrieve a paginated list of journeys for an app. Returns a summary representation of each journey; use View journey for the full configuration. Uses forward-only cursor-based pagination. + +### Examples + +```ruby +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: rest_api_key + config.rest_api_key = 'YOUR_REST_API_KEY' + +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'YOUR_APP_ID' # String | Your OneSignal App ID in UUID v4 format. +opts = { + cursor: 'cursor_example', # String | Opaque pagination token from a previous response's next_cursor. Omit for the first page. + limit: 50 # Integer | Maximum journeys to return per page. Minimum 1, maximum 50. +} + +begin + # View journeys + result = api_instance.view_journeys(app_id, opts) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->view_journeys: #{e}" + puts "Status Code: #{e.code}" + # `e.error_messages` flattens any error-envelope shape to an Array; + # the raw body remains on `e.response_body`. + puts "Error Messages: #{e.error_messages}" + puts "Response Body: #{e.response_body}" +end +``` + +#### Using the view_journeys_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> view_journeys_with_http_info(app_id, opts) + +```ruby +begin + # View journeys + data, status_code, headers = api_instance.view_journeys_with_http_info(app_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->view_journeys_with_http_info: #{e}" + puts "Status Code: #{e.code}" + puts "Response Body: #{e.response_body}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | Your OneSignal App ID in UUID v4 format. | | +| **cursor** | **String** | Opaque pagination token from a previous response's next_cursor. Omit for the first page. | [optional] | +| **limit** | **Integer** | Maximum journeys to return per page. Minimum 1, maximum 50. | [optional][default to 50] | + +### Return type + +[**JourneyListResponse**](JourneyListResponse.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-ruby-api#configuration) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + ## view_template > view_template(template_id, app_id) diff --git a/docs/Journey.md b/docs/Journey.md new file mode 100644 index 0000000..84a3ddf --- /dev/null +++ b/docs/Journey.md @@ -0,0 +1,48 @@ +# OneSignal::Journey + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Journey UUID. Read-only. | [optional] | +| **app_id** | **String** | UUID of the app the journey belongs to. Read-only. | [optional] | +| **name** | **String** | Journey name, up to 300 characters. | [optional] | +| **description** | **String** | Journey description, up to 1024 characters. Defaults to an empty string. | [optional] | +| **state** | **String** | Journey state. New journeys are created as draft. processing is transient while activation is in progress. archived is a journey that has been stopped. Change it through the state field on Update journey. | [optional] | +| **created_at** | **String** | ISO 8601 creation time. Read-only. | [optional] | +| **updated_at** | **String** | ISO 8601 last-update time. Read-only. | [optional] | +| **started_at** | **String** | ISO 8601 time the journey was activated, or null. Read-only. May stay null briefly after you set state to active: activation is enqueued, and started_at populates once the journey finishes processing. | [optional] | +| **archived_at** | **String** | ISO 8601 time the journey was archived, or null. Read-only. | [optional] | +| **created_source** | **String** | Origin of the journey, for example public_api or dashboard. Read-only. | [optional] | +| **audience** | [**JourneyAudience**](JourneyAudience.md) | | [optional] | +| **early_exit** | [**JourneyEarlyExit**](JourneyEarlyExit.md) | | [optional] | +| **reentry_rules** | [**JourneyReentryRules**](JourneyReentryRules.md) | | [optional] | +| **schedule** | [**JourneySchedule**](JourneySchedule.md) | | [optional] | +| **nodes** | [**Array<JourneyNode>**](JourneyNode.md) | Ordered list of journey nodes. | [optional] | +| **concurrency_key** | **String** | Opaque optimistic-concurrency token. Read-only. Pass it back on update to guard against overwriting a concurrent change (409). Send it back exactly as read; do not construct or parse it. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::Journey.new( + id: nil, + app_id: nil, + name: nil, + description: nil, + state: nil, + created_at: nil, + updated_at: nil, + started_at: nil, + archived_at: nil, + created_source: nil, + audience: nil, + early_exit: nil, + reentry_rules: nil, + schedule: nil, + nodes: nil, + concurrency_key: nil +) +``` + diff --git a/docs/JourneyAudience.md b/docs/JourneyAudience.md new file mode 100644 index 0000000..29e3573 --- /dev/null +++ b/docs/JourneyAudience.md @@ -0,0 +1,28 @@ +# OneSignal::JourneyAudience + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **kind** | **String** | Audience kind. Selects which other fields apply. | | +| **included_segment_ids** | **Array<String>** | segment audiences: Segment UUIDs whose users enter the journey. | [optional] | +| **excluded_segment_ids** | **Array<String>** | segment audiences: Segment UUIDs whose users are excluded. | [optional] | +| **future_additions_only** | **Boolean** | segment audiences: when true, only users who newly match the segment after activation enter the journey. Defaults to false. | [optional] | +| **name** | **String** | event_trigger audiences: event name that triggers entry, up to 255 characters. | [optional] | +| **attributes** | **Array<Array<JourneyEventAttribute>>** | Event attribute matchers, as a list of condition groups. Send a single group whose conditions are AND'd together. More than one group is rejected. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyAudience.new( + kind: nil, + included_segment_ids: nil, + excluded_segment_ids: nil, + future_additions_only: nil, + name: nil, + attributes: nil +) +``` + diff --git a/docs/JourneyBranch.md b/docs/JourneyBranch.md new file mode 100644 index 0000000..31ac594 --- /dev/null +++ b/docs/JourneyBranch.md @@ -0,0 +1,24 @@ +# OneSignal::JourneyBranch + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Server-assigned branch identifier. Read-only on create; echo it on update to keep the branch. | [optional] | +| **condition** | [**JourneyCondition**](JourneyCondition.md) | | [optional] | +| **weight** | **Float** | Branch weight for split_range nodes. Weights across a node's branches must sum to 100. | [optional] | +| **nodes** | [**Array<JourneyNode>**](JourneyNode.md) | Nodes run when this branch is taken, before flow converges to the next sibling node. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyBranch.new( + id: nil, + condition: nil, + weight: nil, + nodes: nil +) +``` + diff --git a/docs/JourneyBranchStats.md b/docs/JourneyBranchStats.md new file mode 100644 index 0000000..3e20566 --- /dev/null +++ b/docs/JourneyBranchStats.md @@ -0,0 +1,18 @@ +# OneSignal::JourneyBranchStats + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **completed** | **Integer** | Users who took this branch. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyBranchStats.new( + completed: nil +) +``` + diff --git a/docs/JourneyCondition.md b/docs/JourneyCondition.md new file mode 100644 index 0000000..8c8eb8c --- /dev/null +++ b/docs/JourneyCondition.md @@ -0,0 +1,34 @@ +# OneSignal::JourneyCondition + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **kind** | **String** | Condition kind. Selects which other fields apply. | | +| **included_segment_ids** | **Array<String>** | segment_membership conditions: Segment UUIDs the user must belong to. | [optional] | +| **excluded_segment_ids** | **Array<String>** | segment_membership conditions: Segment UUIDs the user must not belong to. | [optional] | +| **action** | **String** | on_notification_action conditions: the notification action to branch on. Which actions apply depends on the sending node's channel. | [optional] | +| **sending_node_id** | **String** | on_notification_action conditions: id of the sending node this action refers to. Returned on reads; accepted on write. | [optional] | +| **client_node_id** | **String** | on_notification_action conditions: write-only alternative to sending_node_id. References the sending node by its client_node_id. | [optional] | +| **name** | **String** | event_trigger conditions: event name, up to 255 characters. | [optional] | +| **attributes** | **Array<Array<JourneyEventAttribute>>** | Event attribute matchers, as a list of condition groups. Send a single group whose conditions are AND'd together. More than one group is rejected. | [optional] | +| **entry_event_match_attributes** | **Array<Object>** | event_trigger conditions: match incoming event properties against the journey's entry event. Only valid on event-triggered journeys. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyCondition.new( + kind: nil, + included_segment_ids: nil, + excluded_segment_ids: nil, + action: nil, + sending_node_id: nil, + client_node_id: nil, + name: nil, + attributes: nil, + entry_event_match_attributes: nil +) +``` + diff --git a/docs/JourneyEarlyExit.md b/docs/JourneyEarlyExit.md new file mode 100644 index 0000000..62f912e --- /dev/null +++ b/docs/JourneyEarlyExit.md @@ -0,0 +1,20 @@ +# OneSignal::JourneyEarlyExit + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **rules** | [**JourneyEarlyExitRules**](JourneyEarlyExitRules.md) | | [optional] | +| **tag_on_early_exit** | **Hash<String, String>** | Tag key-value pairs applied when a user exits early. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyEarlyExit.new( + rules: nil, + tag_on_early_exit: nil +) +``` + diff --git a/docs/JourneyEarlyExitRules.md b/docs/JourneyEarlyExitRules.md new file mode 100644 index 0000000..16fdd8b --- /dev/null +++ b/docs/JourneyEarlyExitRules.md @@ -0,0 +1,24 @@ +# OneSignal::JourneyEarlyExitRules + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **on_segment** | [**JourneyEarlyExitRulesOnSegment**](JourneyEarlyExitRulesOnSegment.md) | | [optional] | +| **when_not_in_audience** | **Boolean** | Exit when the user no longer matches the journey audience. Defaults to false. | [optional] | +| **on_session** | **Boolean** | Exit on a new session start. Defaults to false. | [optional] | +| **on_event** | [**JourneyEarlyExitRulesOnEvent**](JourneyEarlyExitRulesOnEvent.md) | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyEarlyExitRules.new( + on_segment: nil, + when_not_in_audience: nil, + on_session: nil, + on_event: nil +) +``` + diff --git a/docs/JourneyEarlyExitRulesOnEvent.md b/docs/JourneyEarlyExitRulesOnEvent.md new file mode 100644 index 0000000..8bdc721 --- /dev/null +++ b/docs/JourneyEarlyExitRulesOnEvent.md @@ -0,0 +1,18 @@ +# OneSignal::JourneyEarlyExitRulesOnEvent + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | Exit when this event occurs. Up to 255 characters. | | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyEarlyExitRulesOnEvent.new( + name: nil +) +``` + diff --git a/docs/JourneyEarlyExitRulesOnSegment.md b/docs/JourneyEarlyExitRulesOnSegment.md new file mode 100644 index 0000000..c4d7bb3 --- /dev/null +++ b/docs/JourneyEarlyExitRulesOnSegment.md @@ -0,0 +1,18 @@ +# OneSignal::JourneyEarlyExitRulesOnSegment + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **included_segment_ids** | **Array<String>** | Exit when the user enters any of these segments. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyEarlyExitRulesOnSegment.new( + included_segment_ids: nil +) +``` + diff --git a/docs/JourneyEventAttribute.md b/docs/JourneyEventAttribute.md new file mode 100644 index 0000000..372a526 --- /dev/null +++ b/docs/JourneyEventAttribute.md @@ -0,0 +1,22 @@ +# OneSignal::JourneyEventAttribute + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **key** | **String** | Event attribute key. | | +| **operator** | **String** | Comparison operator. | | +| **value** | **String** | Value to compare against. Not required for exists and not_exists. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyEventAttribute.new( + key: nil, + operator: nil, + value: nil +) +``` + diff --git a/docs/JourneyListAudience.md b/docs/JourneyListAudience.md new file mode 100644 index 0000000..42822d0 --- /dev/null +++ b/docs/JourneyListAudience.md @@ -0,0 +1,18 @@ +# OneSignal::JourneyListAudience + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **kind** | **String** | Audience kind. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyListAudience.new( + kind: nil +) +``` + diff --git a/docs/JourneyListItem.md b/docs/JourneyListItem.md new file mode 100644 index 0000000..07822cc --- /dev/null +++ b/docs/JourneyListItem.md @@ -0,0 +1,40 @@ +# OneSignal::JourneyListItem + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Journey UUID. Read-only. | [optional] | +| **app_id** | **String** | UUID of the app the journey belongs to. Read-only. | [optional] | +| **name** | **String** | Journey name, up to 300 characters. | [optional] | +| **state** | **String** | Journey state. New journeys are created as draft. processing is transient while activation is in progress. archived is a journey that has been stopped. Change it through the state field on Update journey. | [optional] | +| **created_at** | **String** | ISO 8601 creation time. Read-only. | [optional] | +| **updated_at** | **String** | ISO 8601 last-update time. Read-only. | [optional] | +| **started_at** | **String** | ISO 8601 time the journey was activated, or null. Read-only. | [optional] | +| **archived_at** | **String** | ISO 8601 time the journey was archived, or null. Read-only. | [optional] | +| **created_source** | **String** | Origin of the journey, for example public_api or dashboard. Read-only. | [optional] | +| **schedule** | [**JourneySchedule**](JourneySchedule.md) | | [optional] | +| **audience** | [**JourneyListAudience**](JourneyListAudience.md) | | [optional] | +| **reentry_rules** | [**JourneyReentryRules**](JourneyReentryRules.md) | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyListItem.new( + id: nil, + app_id: nil, + name: nil, + state: nil, + created_at: nil, + updated_at: nil, + started_at: nil, + archived_at: nil, + created_source: nil, + schedule: nil, + audience: nil, + reentry_rules: nil +) +``` + diff --git a/docs/JourneyListResponse.md b/docs/JourneyListResponse.md new file mode 100644 index 0000000..1fbbdf8 --- /dev/null +++ b/docs/JourneyListResponse.md @@ -0,0 +1,22 @@ +# OneSignal::JourneyListResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **journeys** | [**Array<JourneyListItem>**](JourneyListItem.md) | Journeys ordered by creation time, newest first. | [optional] | +| **has_more** | **Boolean** | true if more journeys exist beyond this page. | [optional] | +| **next_cursor** | **String** | Cursor for the next page. Present only when has_more is true. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyListResponse.new( + journeys: nil, + has_more: nil, + next_cursor: nil +) +``` + diff --git a/docs/JourneyMessageStats.md b/docs/JourneyMessageStats.md new file mode 100644 index 0000000..14b3968 --- /dev/null +++ b/docs/JourneyMessageStats.md @@ -0,0 +1,18 @@ +# OneSignal::JourneyMessageStats + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **totals** | **Hash<String, Float>** | All-time totals for this node, keyed by channel-specific stat name. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyMessageStats.new( + totals: nil +) +``` + diff --git a/docs/JourneyNode.md b/docs/JourneyNode.md new file mode 100644 index 0000000..f6f74a7 --- /dev/null +++ b/docs/JourneyNode.md @@ -0,0 +1,50 @@ +# OneSignal::JourneyNode + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Server-assigned node UUID. Returned on reads. Required on update to keep an existing node. Rejected on create with a 400 validation error. | [optional] | +| **kind** | **String** | Node kind. Selects which other fields apply. | | +| **client_node_id** | **String** | Optional client-assigned identifier, unique within the journey. Use it to reference this node from elsewhere in the same request. Persisted and returned on reads. | [optional] | +| **annotation** | **String** | Optional free-text label, up to 255 characters. Stored and returned as-is with no effect on journey behavior. | [optional] | +| **duration_seconds** | **Integer** | wait nodes: seconds to hold the user. Minimum 60, maximum 31556952 (1 year). | [optional] | +| **relative_to** | **String** | time_window nodes: schedule_in_timezone uses the configured windows; last_active_time holds relative to the user's last active time. | [optional] | +| **windows** | [**Array<JourneyTimeWindow>**](JourneyTimeWindow.md) | time_window nodes: one or more time windows. A window with no day_of_week applies to every day. Required when relative_to is schedule_in_timezone; omit when it is last_active_time. | [optional] | +| **time_zone** | **String** | time_window nodes: IANA timezone identifier used when the user's timezone is unavailable. | [optional] | +| **use_user_time_zone** | **Boolean** | time_window nodes: when true, uses the user's timezone if available. | [optional] | +| **template_id** | **String** | send_push, send_email, and send_sms nodes: UUID of the template to send. | [optional] | +| **iam_id** | **String** | send_iam nodes: UUID of the in-app message to send. | [optional] | +| **user_ttl_seconds** | **Integer** | send_iam nodes: optional time-to-live for the in-app message, in seconds. | [optional] | +| **webhook_id** | **String** | send_webhook nodes: UUID of the webhook to send. | [optional] | +| **assignments** | **Hash<String, String>** | tag nodes: tag key-value pairs to assign. An empty string value removes the tag. Keys are limited to 255 characters and values to 1024. | [optional] | +| **randomize_on_entry** | **Boolean** | split_range nodes: when true, assigns each user to a branch at random on entry. Defaults to false. | [optional] | +| **branches** | [**Array<JourneyBranch>**](JourneyBranch.md) | Branching nodes: nested branches. split_range requires 2-20 weighted branches that sum to 100. yes_no requires exactly 2 branches. wait_until requires 1-10 condition branches. | [optional] | +| **expiration** | [**JourneyWaitUntilExpiration**](JourneyWaitUntilExpiration.md) | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyNode.new( + id: nil, + kind: nil, + client_node_id: nil, + annotation: nil, + duration_seconds: nil, + relative_to: nil, + windows: nil, + time_zone: nil, + use_user_time_zone: nil, + template_id: nil, + iam_id: nil, + user_ttl_seconds: nil, + webhook_id: nil, + assignments: nil, + randomize_on_entry: nil, + branches: nil, + expiration: nil +) +``` + diff --git a/docs/JourneyNodeStats.md b/docs/JourneyNodeStats.md new file mode 100644 index 0000000..9bd3107 --- /dev/null +++ b/docs/JourneyNodeStats.md @@ -0,0 +1,26 @@ +# OneSignal::JourneyNodeStats + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **kind** | **String** | Node kind, repeated here so stats can be read without joining against the journey definition. | [optional] | +| **waiting** | **Integer** | Users currently held at this node. | [optional] | +| **completed** | **Integer** | Users who advanced past this node normally. | [optional] | +| **exited_early** | **Integer** | Users who left the journey from this node through an early exit rule. | [optional] | +| **message_stats** | [**JourneyMessageStats**](JourneyMessageStats.md) | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyNodeStats.new( + kind: nil, + waiting: nil, + completed: nil, + exited_early: nil, + message_stats: nil +) +``` + diff --git a/docs/JourneyReentryRules.md b/docs/JourneyReentryRules.md new file mode 100644 index 0000000..0a54b91 --- /dev/null +++ b/docs/JourneyReentryRules.md @@ -0,0 +1,18 @@ +# OneSignal::JourneyReentryRules + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **duration_seconds** | **Integer** | Minimum seconds before a user can re-enter. Must be at least 600 (10 minutes). | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyReentryRules.new( + duration_seconds: nil +) +``` + diff --git a/docs/JourneySchedule.md b/docs/JourneySchedule.md new file mode 100644 index 0000000..0afa318 --- /dev/null +++ b/docs/JourneySchedule.md @@ -0,0 +1,22 @@ +# OneSignal::JourneySchedule + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **start_at** | **String** | ISO 8601 start time. Use UTC (Z or +00:00). Must be at least 5 minutes in the future. | [optional] | +| **stop_at** | **String** | ISO 8601 stop time. Use UTC (Z or +00:00). Must be in the future and later than start_at. | [optional] | +| **error** | **String** | Read-only. Present when a scheduling error occurred. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneySchedule.new( + start_at: nil, + stop_at: nil, + error: nil +) +``` + diff --git a/docs/JourneyStats.md b/docs/JourneyStats.md new file mode 100644 index 0000000..142ce53 --- /dev/null +++ b/docs/JourneyStats.md @@ -0,0 +1,28 @@ +# OneSignal::JourneyStats + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | UUID of the journey these stats belong to. | [optional] | +| **started** | **Integer** | Users who entered the journey. | [optional] | +| **completed** | **Integer** | Users who reached the end of the journey normally. | [optional] | +| **exited_early** | **Integer** | Users who left the journey through an early exit rule. | [optional] | +| **nodes** | [**Hash<String, JourneyNodeStats>**](JourneyNodeStats.md) | Node stats keyed by node id. Includes every node in the graph, at any nesting depth. | [optional] | +| **branches** | [**Hash<String, JourneyBranchStats>**](JourneyBranchStats.md) | Branch stats keyed by branch id. Empty for a journey with no branching nodes. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyStats.new( + id: nil, + started: nil, + completed: nil, + exited_early: nil, + nodes: nil, + branches: nil +) +``` + diff --git a/docs/JourneyTimePoint.md b/docs/JourneyTimePoint.md new file mode 100644 index 0000000..92dfd34 --- /dev/null +++ b/docs/JourneyTimePoint.md @@ -0,0 +1,20 @@ +# OneSignal::JourneyTimePoint + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **hour** | **Integer** | Hour of day, 0-23. | [optional] | +| **minute** | **Integer** | Minute of hour, 0-59. Defaults to 0. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyTimePoint.new( + hour: nil, + minute: nil +) +``` + diff --git a/docs/JourneyTimeWindow.md b/docs/JourneyTimeWindow.md new file mode 100644 index 0000000..181db08 --- /dev/null +++ b/docs/JourneyTimeWindow.md @@ -0,0 +1,22 @@ +# OneSignal::JourneyTimeWindow + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **start** | [**JourneyTimePoint**](JourneyTimePoint.md) | When the window opens. | [optional] | +| **_end** | [**JourneyTimePoint**](JourneyTimePoint.md) | When the window closes. | [optional] | +| **day_of_week** | **Integer** | Day of week, 1 = Monday. Omit to apply the window to every day. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyTimeWindow.new( + start: nil, + _end: nil, + day_of_week: nil +) +``` + diff --git a/docs/JourneyWaitUntilExpiration.md b/docs/JourneyWaitUntilExpiration.md new file mode 100644 index 0000000..74025a6 --- /dev/null +++ b/docs/JourneyWaitUntilExpiration.md @@ -0,0 +1,20 @@ +# OneSignal::JourneyWaitUntilExpiration + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **duration_seconds** | **Integer** | Seconds to wait before the timer fires. Minimum 60, maximum 31556952 (1 year). | [optional] | +| **exits** | **Boolean** | When true, the user exits the journey when the timer fires; when false, the user continues to convergence. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::JourneyWaitUntilExpiration.new( + duration_seconds: nil, + exits: nil +) +``` + diff --git a/docs/UpdateJourneyNodeRequest.md b/docs/UpdateJourneyNodeRequest.md new file mode 100644 index 0000000..1b5fec5 --- /dev/null +++ b/docs/UpdateJourneyNodeRequest.md @@ -0,0 +1,48 @@ +# OneSignal::UpdateJourneyNodeRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **client_node_id** | **String** | Optional client-assigned identifier, unique within the journey. Use it to reference this node from elsewhere in the same request. Persisted and returned on reads. | [optional] | +| **annotation** | **String** | Optional free-text label, up to 255 characters. Stored and returned as-is with no effect on journey behavior. | [optional] | +| **duration_seconds** | **Integer** | wait nodes: seconds to hold the user. Minimum 60, maximum 31556952 (1 year). | [optional] | +| **relative_to** | **String** | time_window nodes: schedule_in_timezone uses the configured windows; last_active_time holds relative to the user's last active time. | [optional] | +| **windows** | [**Array<JourneyTimeWindow>**](JourneyTimeWindow.md) | time_window nodes: one or more time windows. A window with no day_of_week applies to every day. Required when relative_to is schedule_in_timezone; omit when it is last_active_time. | [optional] | +| **time_zone** | **String** | time_window nodes: IANA timezone identifier used when the user's timezone is unavailable. | [optional] | +| **use_user_time_zone** | **Boolean** | time_window nodes: when true, uses the user's timezone if available. | [optional] | +| **template_id** | **String** | send_push, send_email, and send_sms nodes: UUID of the template to send. | [optional] | +| **iam_id** | **String** | send_iam nodes: UUID of the in-app message to send. | [optional] | +| **user_ttl_seconds** | **Integer** | send_iam nodes: optional time-to-live for the in-app message, in seconds. | [optional] | +| **webhook_id** | **String** | send_webhook nodes: UUID of the webhook to send. | [optional] | +| **assignments** | **Hash<String, String>** | tag nodes: tag key-value pairs to assign. An empty string value removes the tag. Keys are limited to 255 characters and values to 1024. | [optional] | +| **randomize_on_entry** | **Boolean** | split_range nodes: when true, assigns each user to a branch at random on entry. Defaults to false. | [optional] | +| **branches** | [**Array<JourneyBranch>**](JourneyBranch.md) | Branching nodes: nested branches. split_range requires 2-20 weighted branches that sum to 100. yes_no requires exactly 2 branches. wait_until requires 1-10 condition branches. | [optional] | +| **expiration** | [**JourneyWaitUntilExpiration**](JourneyWaitUntilExpiration.md) | | [optional] | +| **concurrency_key** | **String** | Optional optimistic-concurrency token. Pass the concurrency_key from a prior fetch to reject the update with 409 if the journey changed. Omit to skip the check. It is not merged onto the node. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::UpdateJourneyNodeRequest.new( + client_node_id: nil, + annotation: nil, + duration_seconds: nil, + relative_to: nil, + windows: nil, + time_zone: nil, + use_user_time_zone: nil, + template_id: nil, + iam_id: nil, + user_ttl_seconds: nil, + webhook_id: nil, + assignments: nil, + randomize_on_entry: nil, + branches: nil, + expiration: nil, + concurrency_key: nil +) +``` + diff --git a/docs/UpdateJourneyRequest.md b/docs/UpdateJourneyRequest.md new file mode 100644 index 0000000..b19f5c6 --- /dev/null +++ b/docs/UpdateJourneyRequest.md @@ -0,0 +1,34 @@ +# OneSignal::UpdateJourneyRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | Journey name. | [optional] | +| **description** | **String** | Journey description. Send null to clear it. | [optional] | +| **audience** | [**JourneyAudience**](JourneyAudience.md) | | [optional] | +| **early_exit** | [**JourneyEarlyExit**](JourneyEarlyExit.md) | | [optional] | +| **reentry_rules** | [**JourneyReentryRules**](JourneyReentryRules.md) | | [optional] | +| **schedule** | [**JourneySchedule**](JourneySchedule.md) | | [optional] | +| **nodes** | [**Array<JourneyNode>**](JourneyNode.md) | Full ordered list of nodes, which replaces the existing graph wholesale. Preserve each node's server-assigned id from a prior fetch to keep in-flight users on that node; omit id to add a new node. | [optional] | +| **state** | **String** | Target state. Set active to activate a draft journey, or scheduled together with a future schedule.start_at to activate it later. Set archived to stop a running journey; archiving is permanent. Only scheduled and processing journeys can return to draft. | [optional] | +| **concurrency_key** | **String** | Optional optimistic-concurrency token. Pass the concurrency_key from a prior fetch to reject the update with 409 if the journey changed. Omit to skip the check. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::UpdateJourneyRequest.new( + name: nil, + description: nil, + audience: nil, + early_exit: nil, + reentry_rules: nil, + schedule: nil, + nodes: nil, + state: nil, + concurrency_key: nil +) +``` + diff --git a/lib/onesignal.rb b/lib/onesignal.rb index 92bf1d7..b015ef0 100644 --- a/lib/onesignal.rb +++ b/lib/onesignal.rb @@ -31,6 +31,7 @@ require 'onesignal/models/copy_template_request' require 'onesignal/models/create_api_key_request' require 'onesignal/models/create_api_key_response' +require 'onesignal/models/create_journey_request' require 'onesignal/models/create_notification_success_response' require 'onesignal/models/create_segment_conflict_response' require 'onesignal/models/create_segment_success_response' @@ -51,6 +52,28 @@ require 'onesignal/models/get_notification_history_request_body' require 'onesignal/models/get_segment_success_response' require 'onesignal/models/get_segments_success_response' +require 'onesignal/models/journey' +require 'onesignal/models/journey_audience' +require 'onesignal/models/journey_branch' +require 'onesignal/models/journey_branch_stats' +require 'onesignal/models/journey_condition' +require 'onesignal/models/journey_early_exit' +require 'onesignal/models/journey_early_exit_rules' +require 'onesignal/models/journey_early_exit_rules_on_event' +require 'onesignal/models/journey_early_exit_rules_on_segment' +require 'onesignal/models/journey_event_attribute' +require 'onesignal/models/journey_list_audience' +require 'onesignal/models/journey_list_item' +require 'onesignal/models/journey_list_response' +require 'onesignal/models/journey_message_stats' +require 'onesignal/models/journey_node' +require 'onesignal/models/journey_node_stats' +require 'onesignal/models/journey_reentry_rules' +require 'onesignal/models/journey_schedule' +require 'onesignal/models/journey_stats' +require 'onesignal/models/journey_time_point' +require 'onesignal/models/journey_time_window' +require 'onesignal/models/journey_wait_until_expiration' require 'onesignal/models/language_string_map' require 'onesignal/models/list_audit_logs_success_response' require 'onesignal/models/notification' @@ -84,6 +107,8 @@ require 'onesignal/models/templates_list_response' require 'onesignal/models/transfer_subscription_request_body' require 'onesignal/models/update_api_key_request' +require 'onesignal/models/update_journey_node_request' +require 'onesignal/models/update_journey_request' require 'onesignal/models/update_live_activity_request' require 'onesignal/models/update_live_activity_success_response' require 'onesignal/models/update_segment_request' diff --git a/lib/onesignal/api/default_api.rb b/lib/onesignal/api/default_api.rb index d368c9f..ce2aed7 100644 --- a/lib/onesignal/api/default_api.rb +++ b/lib/onesignal/api/default_api.rb @@ -547,6 +547,80 @@ def create_custom_events_with_http_info(app_id, custom_events_request, opts = {} return data, status_code, headers end + # Create journey + # The Journeys API is in beta. Endpoints and response fields can still change. Create a new journey with an audience and a node graph. Journeys are always created in the draft state. The authenticated App API key must have permission to create journeys. + # @param app_id [String] Your OneSignal App ID in UUID v4 format. + # @param create_journey_request [CreateJourneyRequest] + # @param [Hash] opts the optional parameters + # @return [Journey] + def create_journey(app_id, create_journey_request, opts = {}) + data, _status_code, _headers = create_journey_with_http_info(app_id, create_journey_request, opts) + data + end + + # Create journey + # The Journeys API is in beta. Endpoints and response fields can still change. Create a new journey with an audience and a node graph. Journeys are always created in the draft state. The authenticated App API key must have permission to create journeys. + # @param app_id [String] Your OneSignal App ID in UUID v4 format. + # @param create_journey_request [CreateJourneyRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(Journey, Integer, Hash)>] Journey data, response status code and response headers + def create_journey_with_http_info(app_id, create_journey_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.create_journey ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.create_journey" + end + # verify the required parameter 'create_journey_request' is set + if @api_client.config.client_side_validation && create_journey_request.nil? + fail ArgumentError, "Missing the required parameter 'create_journey_request' when calling DefaultApi.create_journey" + end + # resource path + local_var_path = '/apps/{app_id}/journeys'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_journey_request) + + # return_type + return_type = opts[:debug_return_type] || 'Journey' + + # auth_names + auth_names = opts[:debug_auth_names] || ['rest_api_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.create_journey", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#create_journey\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create notification # Sends notifications to your users. **Target by External ID (push example):** set `include_aliases` to `{ \"external_id\": [\"your-user-id\"] }` and set `target_channel` to `push` (or `email` / `sms` for those channels). Alias object keys must match API labels exactly (for example `external_id`, not camelCase). **Do not confuse** the notification-level `external_id` field with External ID targeting: top-level `external_id` / `idempotency_key` are for idempotent notification requests only, not for selecting recipients. **Targeting compatibility:** `include_aliases` must not be combined with other targeting modes (segments, filters, subscription IDs, legacy player IDs, etc.). Clients should send only one targeting strategy per request. # @param notification [Notification] @@ -1057,6 +1131,75 @@ def delete_api_key_with_http_info(app_id, token_id, opts = {}) return data, status_code, headers end + # Delete journey + # The Journeys API is in beta. Endpoints and response fields can still change. Permanently delete a journey by its UUID. Returns { \"success\": true } on success. The authenticated App API key must have permission to delete journeys. Deleting a journey stops any in-flight users and cannot be undone. Archive a running journey instead if you need to keep its data. + # @param app_id [String] Your OneSignal App ID in UUID v4 format. + # @param journey_id [String] UUID of the journey to delete. + # @param [Hash] opts the optional parameters + # @return [GenericSuccessBoolResponse] + def delete_journey(app_id, journey_id, opts = {}) + data, _status_code, _headers = delete_journey_with_http_info(app_id, journey_id, opts) + data + end + + # Delete journey + # The Journeys API is in beta. Endpoints and response fields can still change. Permanently delete a journey by its UUID. Returns { \"success\": true } on success. The authenticated App API key must have permission to delete journeys. Deleting a journey stops any in-flight users and cannot be undone. Archive a running journey instead if you need to keep its data. + # @param app_id [String] Your OneSignal App ID in UUID v4 format. + # @param journey_id [String] UUID of the journey to delete. + # @param [Hash] opts the optional parameters + # @return [Array<(GenericSuccessBoolResponse, Integer, Hash)>] GenericSuccessBoolResponse data, response status code and response headers + def delete_journey_with_http_info(app_id, journey_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.delete_journey ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.delete_journey" + end + # verify the required parameter 'journey_id' is set + if @api_client.config.client_side_validation && journey_id.nil? + fail ArgumentError, "Missing the required parameter 'journey_id' when calling DefaultApi.delete_journey" + end + # resource path + local_var_path = '/apps/{app_id}/journeys/{journey_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'journey_id' + '}', CGI.escape(journey_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GenericSuccessBoolResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['rest_api_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.delete_journey", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#delete_journey\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete Segment # Delete a segment (not user devices) - Required: OneSignal Paid Plan You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header that has admin access on the app. The segment_id can be found in the URL of the segment when viewing it in the dashboard. # @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs. @@ -2837,6 +2980,172 @@ def update_app_with_http_info(app_id, app, opts = {}) return data, status_code, headers end + # Update journey + # The Journeys API is in beta. Endpoints and response fields can still change. Apply a partial update to a journey using JSON Merge Patch (RFC 7396). Send only the fields you want to change; omitted fields are left unchanged. A null value clears a nullable field, and arrays such as nodes are replaced wholesale. Set state to active to activate a draft journey. + # @param app_id [String] Your OneSignal App ID in UUID v4 format. + # @param journey_id [String] UUID of the journey to update. + # @param update_journey_request [UpdateJourneyRequest] + # @param [Hash] opts the optional parameters + # @return [Journey] + def update_journey(app_id, journey_id, update_journey_request, opts = {}) + data, _status_code, _headers = update_journey_with_http_info(app_id, journey_id, update_journey_request, opts) + data + end + + # Update journey + # The Journeys API is in beta. Endpoints and response fields can still change. Apply a partial update to a journey using JSON Merge Patch (RFC 7396). Send only the fields you want to change; omitted fields are left unchanged. A null value clears a nullable field, and arrays such as nodes are replaced wholesale. Set state to active to activate a draft journey. + # @param app_id [String] Your OneSignal App ID in UUID v4 format. + # @param journey_id [String] UUID of the journey to update. + # @param update_journey_request [UpdateJourneyRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(Journey, Integer, Hash)>] Journey data, response status code and response headers + def update_journey_with_http_info(app_id, journey_id, update_journey_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.update_journey ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_journey" + end + # verify the required parameter 'journey_id' is set + if @api_client.config.client_side_validation && journey_id.nil? + fail ArgumentError, "Missing the required parameter 'journey_id' when calling DefaultApi.update_journey" + end + # verify the required parameter 'update_journey_request' is set + if @api_client.config.client_side_validation && update_journey_request.nil? + fail ArgumentError, "Missing the required parameter 'update_journey_request' when calling DefaultApi.update_journey" + end + # resource path + local_var_path = '/apps/{app_id}/journeys/{journey_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'journey_id' + '}', CGI.escape(journey_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(update_journey_request) + + # return_type + return_type = opts[:debug_return_type] || 'Journey' + + # auth_names + auth_names = opts[:debug_auth_names] || ['rest_api_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.update_journey", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#update_journey\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update journey node + # The Journeys API is in beta. Endpoints and response fields can still change. Apply a partial update to a single node, located by its server-assigned id, using JSON Merge Patch (RFC 7396). Send only the node fields you want to change; the rest of the node and the rest of the journey graph are left untouched. Returns the full updated journey. + # @param app_id [String] Your OneSignal App ID in UUID v4 format. + # @param journey_id [String] UUID of the journey that owns the node. + # @param node_id [String] Server-assigned UUID of the node to update, from a prior View journey fetch. + # @param update_journey_node_request [UpdateJourneyNodeRequest] + # @param [Hash] opts the optional parameters + # @return [Journey] + def update_journey_node(app_id, journey_id, node_id, update_journey_node_request, opts = {}) + data, _status_code, _headers = update_journey_node_with_http_info(app_id, journey_id, node_id, update_journey_node_request, opts) + data + end + + # Update journey node + # The Journeys API is in beta. Endpoints and response fields can still change. Apply a partial update to a single node, located by its server-assigned id, using JSON Merge Patch (RFC 7396). Send only the node fields you want to change; the rest of the node and the rest of the journey graph are left untouched. Returns the full updated journey. + # @param app_id [String] Your OneSignal App ID in UUID v4 format. + # @param journey_id [String] UUID of the journey that owns the node. + # @param node_id [String] Server-assigned UUID of the node to update, from a prior View journey fetch. + # @param update_journey_node_request [UpdateJourneyNodeRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(Journey, Integer, Hash)>] Journey data, response status code and response headers + def update_journey_node_with_http_info(app_id, journey_id, node_id, update_journey_node_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.update_journey_node ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_journey_node" + end + # verify the required parameter 'journey_id' is set + if @api_client.config.client_side_validation && journey_id.nil? + fail ArgumentError, "Missing the required parameter 'journey_id' when calling DefaultApi.update_journey_node" + end + # verify the required parameter 'node_id' is set + if @api_client.config.client_side_validation && node_id.nil? + fail ArgumentError, "Missing the required parameter 'node_id' when calling DefaultApi.update_journey_node" + end + # verify the required parameter 'update_journey_node_request' is set + if @api_client.config.client_side_validation && update_journey_node_request.nil? + fail ArgumentError, "Missing the required parameter 'update_journey_node_request' when calling DefaultApi.update_journey_node" + end + # resource path + local_var_path = '/apps/{app_id}/journeys/{journey_id}/nodes/{node_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'journey_id' + '}', CGI.escape(journey_id.to_s)).sub('{' + 'node_id' + '}', CGI.escape(node_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(update_journey_node_request) + + # return_type + return_type = opts[:debug_return_type] || 'Journey' + + # auth_names + auth_names = opts[:debug_auth_names] || ['rest_api_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.update_journey_node", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#update_journey_node\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update a Live Activity via Push # Updates a specified live activity. # @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs. @@ -3385,6 +3694,221 @@ def view_api_keys_with_http_info(app_id, opts = {}) return data, status_code, headers end + # View journey + # The Journeys API is in beta. Endpoints and response fields can still change. Retrieve the full configuration of a single journey by its UUID, including its audience and node graph. + # @param app_id [String] Your OneSignal App ID in UUID v4 format. + # @param journey_id [String] UUID of the journey to retrieve. + # @param [Hash] opts the optional parameters + # @return [Journey] + def view_journey(app_id, journey_id, opts = {}) + data, _status_code, _headers = view_journey_with_http_info(app_id, journey_id, opts) + data + end + + # View journey + # The Journeys API is in beta. Endpoints and response fields can still change. Retrieve the full configuration of a single journey by its UUID, including its audience and node graph. + # @param app_id [String] Your OneSignal App ID in UUID v4 format. + # @param journey_id [String] UUID of the journey to retrieve. + # @param [Hash] opts the optional parameters + # @return [Array<(Journey, Integer, Hash)>] Journey data, response status code and response headers + def view_journey_with_http_info(app_id, journey_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.view_journey ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.view_journey" + end + # verify the required parameter 'journey_id' is set + if @api_client.config.client_side_validation && journey_id.nil? + fail ArgumentError, "Missing the required parameter 'journey_id' when calling DefaultApi.view_journey" + end + # resource path + local_var_path = '/apps/{app_id}/journeys/{journey_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'journey_id' + '}', CGI.escape(journey_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Journey' + + # auth_names + auth_names = opts[:debug_auth_names] || ['rest_api_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.view_journey", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#view_journey\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # View journey stats + # The Journeys API is in beta. Endpoints and response fields can still change. Retrieve performance stats for a single journey: journey-level entry and exit counts, per-node counts keyed by node id, per-branch counts keyed by branch id, and channel delivery stats for message-sending nodes. The response carries no definition detail, so join it by id against the journey from View journey. + # @param app_id [String] Your OneSignal App ID in UUID v4 format. + # @param journey_id [String] UUID of the journey to retrieve stats for. + # @param [Hash] opts the optional parameters + # @return [JourneyStats] + def view_journey_stats(app_id, journey_id, opts = {}) + data, _status_code, _headers = view_journey_stats_with_http_info(app_id, journey_id, opts) + data + end + + # View journey stats + # The Journeys API is in beta. Endpoints and response fields can still change. Retrieve performance stats for a single journey: journey-level entry and exit counts, per-node counts keyed by node id, per-branch counts keyed by branch id, and channel delivery stats for message-sending nodes. The response carries no definition detail, so join it by id against the journey from View journey. + # @param app_id [String] Your OneSignal App ID in UUID v4 format. + # @param journey_id [String] UUID of the journey to retrieve stats for. + # @param [Hash] opts the optional parameters + # @return [Array<(JourneyStats, Integer, Hash)>] JourneyStats data, response status code and response headers + def view_journey_stats_with_http_info(app_id, journey_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.view_journey_stats ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.view_journey_stats" + end + # verify the required parameter 'journey_id' is set + if @api_client.config.client_side_validation && journey_id.nil? + fail ArgumentError, "Missing the required parameter 'journey_id' when calling DefaultApi.view_journey_stats" + end + # resource path + local_var_path = '/apps/{app_id}/journeys/{journey_id}/stats'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'journey_id' + '}', CGI.escape(journey_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'JourneyStats' + + # auth_names + auth_names = opts[:debug_auth_names] || ['rest_api_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.view_journey_stats", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#view_journey_stats\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # View journeys + # The Journeys API is in beta. Endpoints and response fields can still change. Retrieve a paginated list of journeys for an app. Returns a summary representation of each journey; use View journey for the full configuration. Uses forward-only cursor-based pagination. + # @param app_id [String] Your OneSignal App ID in UUID v4 format. + # @param [Hash] opts the optional parameters + # @option opts [String] :cursor Opaque pagination token from a previous response's next_cursor. Omit for the first page. + # @option opts [Integer] :limit Maximum journeys to return per page. Minimum 1, maximum 50. (default to 50) + # @return [JourneyListResponse] + def view_journeys(app_id, opts = {}) + data, _status_code, _headers = view_journeys_with_http_info(app_id, opts) + data + end + + # View journeys + # The Journeys API is in beta. Endpoints and response fields can still change. Retrieve a paginated list of journeys for an app. Returns a summary representation of each journey; use View journey for the full configuration. Uses forward-only cursor-based pagination. + # @param app_id [String] Your OneSignal App ID in UUID v4 format. + # @param [Hash] opts the optional parameters + # @option opts [String] :cursor Opaque pagination token from a previous response's next_cursor. Omit for the first page. + # @option opts [Integer] :limit Maximum journeys to return per page. Minimum 1, maximum 50. (default to 50) + # @return [Array<(JourneyListResponse, Integer, Hash)>] JourneyListResponse data, response status code and response headers + def view_journeys_with_http_info(app_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.view_journeys ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.view_journeys" + end + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DefaultApi.view_journeys, must be smaller than or equal to 50.' + end + + if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DefaultApi.view_journeys, must be greater than or equal to 1.' + end + + # resource path + local_var_path = '/apps/{app_id}/journeys'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'JourneyListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['rest_api_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.view_journeys", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#view_journeys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # View template # Fetch a single template by id. # @param template_id [String] diff --git a/lib/onesignal/api_client.rb b/lib/onesignal/api_client.rb index 2fedab7..7c4d222 100644 --- a/lib/onesignal/api_client.rb +++ b/lib/onesignal/api_client.rb @@ -89,7 +89,7 @@ def build_request(http_method, path, opts = {}) url = build_request_url(path, opts) http_method = http_method.to_sym.downcase - opts[:header_params]['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-ruby, version=5.11.2' + opts[:header_params]['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-ruby, version=5.12.0' header_params = @default_headers.merge(opts[:header_params] || {}) query_params = opts[:query_params] || {} form_params = opts[:form_params] || {} diff --git a/lib/onesignal/models/create_journey_request.rb b/lib/onesignal/models/create_journey_request.rb new file mode 100644 index 0000000..47d43df --- /dev/null +++ b/lib/onesignal/models/create_journey_request.rb @@ -0,0 +1,287 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Writable fields for Create journey. Journeys are always created in the draft state. Server-controlled fields such as state or id are rejected. + class CreateJourneyRequest + # Journey name, up to 300 characters. + attr_accessor :name + + # Optional journey description, up to 1024 characters. + attr_accessor :description + + attr_accessor :audience + + attr_accessor :early_exit + + attr_accessor :reentry_rules + + attr_accessor :schedule + + # Ordered list of journey nodes. Server-assigned id fields are rejected on create. + attr_accessor :nodes + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'description' => :'description', + :'audience' => :'audience', + :'early_exit' => :'early_exit', + :'reentry_rules' => :'reentry_rules', + :'schedule' => :'schedule', + :'nodes' => :'nodes' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'description' => :'String', + :'audience' => :'JourneyAudience', + :'early_exit' => :'JourneyEarlyExit', + :'reentry_rules' => :'JourneyReentryRules', + :'schedule' => :'JourneySchedule', + :'nodes' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'description', + :'early_exit', + :'reentry_rules', + :'schedule', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::CreateJourneyRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::CreateJourneyRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'audience') + self.audience = attributes[:'audience'] + end + + if attributes.key?(:'early_exit') + self.early_exit = attributes[:'early_exit'] + end + + if attributes.key?(:'reentry_rules') + self.reentry_rules = attributes[:'reentry_rules'] + end + + if attributes.key?(:'schedule') + self.schedule = attributes[:'schedule'] + end + + if attributes.key?(:'nodes') + if (value = attributes[:'nodes']).is_a?(Array) + self.nodes = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + description == o.description && + audience == o.audience && + early_exit == o.early_exit && + reentry_rules == o.reentry_rules && + schedule == o.schedule && + nodes == o.nodes + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, description, audience, early_exit, reentry_rules, schedule, nodes].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey.rb b/lib/onesignal/models/journey.rb new file mode 100644 index 0000000..24b8fb7 --- /dev/null +++ b/lib/onesignal/models/journey.rb @@ -0,0 +1,409 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Full journey representation returned by the detail, create, and update endpoints. + class Journey + # Journey UUID. Read-only. + attr_accessor :id + + # UUID of the app the journey belongs to. Read-only. + attr_accessor :app_id + + # Journey name, up to 300 characters. + attr_accessor :name + + # Journey description, up to 1024 characters. Defaults to an empty string. + attr_accessor :description + + # Journey state. New journeys are created as draft. processing is transient while activation is in progress. archived is a journey that has been stopped. Change it through the state field on Update journey. + attr_accessor :state + + # ISO 8601 creation time. Read-only. + attr_accessor :created_at + + # ISO 8601 last-update time. Read-only. + attr_accessor :updated_at + + # ISO 8601 time the journey was activated, or null. Read-only. May stay null briefly after you set state to active: activation is enqueued, and started_at populates once the journey finishes processing. + attr_accessor :started_at + + # ISO 8601 time the journey was archived, or null. Read-only. + attr_accessor :archived_at + + # Origin of the journey, for example public_api or dashboard. Read-only. + attr_accessor :created_source + + attr_accessor :audience + + attr_accessor :early_exit + + attr_accessor :reentry_rules + + attr_accessor :schedule + + # Ordered list of journey nodes. + attr_accessor :nodes + + # Opaque optimistic-concurrency token. Read-only. Pass it back on update to guard against overwriting a concurrent change (409). Send it back exactly as read; do not construct or parse it. + attr_accessor :concurrency_key + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'app_id' => :'app_id', + :'name' => :'name', + :'description' => :'description', + :'state' => :'state', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'started_at' => :'started_at', + :'archived_at' => :'archived_at', + :'created_source' => :'created_source', + :'audience' => :'audience', + :'early_exit' => :'early_exit', + :'reentry_rules' => :'reentry_rules', + :'schedule' => :'schedule', + :'nodes' => :'nodes', + :'concurrency_key' => :'concurrency_key' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'app_id' => :'String', + :'name' => :'String', + :'description' => :'String', + :'state' => :'String', + :'created_at' => :'String', + :'updated_at' => :'String', + :'started_at' => :'String', + :'archived_at' => :'String', + :'created_source' => :'String', + :'audience' => :'JourneyAudience', + :'early_exit' => :'JourneyEarlyExit', + :'reentry_rules' => :'JourneyReentryRules', + :'schedule' => :'JourneySchedule', + :'nodes' => :'Array', + :'concurrency_key' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'description', + :'started_at', + :'archived_at', + :'created_source', + :'early_exit', + :'reentry_rules', + :'schedule', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::Journey` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::Journey`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'app_id') + self.app_id = attributes[:'app_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'started_at') + self.started_at = attributes[:'started_at'] + end + + if attributes.key?(:'archived_at') + self.archived_at = attributes[:'archived_at'] + end + + if attributes.key?(:'created_source') + self.created_source = attributes[:'created_source'] + end + + if attributes.key?(:'audience') + self.audience = attributes[:'audience'] + end + + if attributes.key?(:'early_exit') + self.early_exit = attributes[:'early_exit'] + end + + if attributes.key?(:'reentry_rules') + self.reentry_rules = attributes[:'reentry_rules'] + end + + if attributes.key?(:'schedule') + self.schedule = attributes[:'schedule'] + end + + if attributes.key?(:'nodes') + if (value = attributes[:'nodes']).is_a?(Array) + self.nodes = value + end + end + + if attributes.key?(:'concurrency_key') + self.concurrency_key = attributes[:'concurrency_key'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + state_validator = EnumAttributeValidator.new('String', ["draft", "scheduled", "processing", "active", "archived"]) + return false unless state_validator.valid?(@state) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] state Object to be assigned + def state=(state) + validator = EnumAttributeValidator.new('String', ["draft", "scheduled", "processing", "active", "archived"]) + unless validator.valid?(state) + fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}." + end + @state = state + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + app_id == o.app_id && + name == o.name && + description == o.description && + state == o.state && + created_at == o.created_at && + updated_at == o.updated_at && + started_at == o.started_at && + archived_at == o.archived_at && + created_source == o.created_source && + audience == o.audience && + early_exit == o.early_exit && + reentry_rules == o.reentry_rules && + schedule == o.schedule && + nodes == o.nodes && + concurrency_key == o.concurrency_key + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, app_id, name, description, state, created_at, updated_at, started_at, archived_at, created_source, audience, early_exit, reentry_rules, schedule, nodes, concurrency_key].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_audience.rb b/lib/onesignal/models/journey_audience.rb new file mode 100644 index 0000000..cac7db6 --- /dev/null +++ b/lib/onesignal/models/journey_audience.rb @@ -0,0 +1,316 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # The journey entry audience. The kind field selects which other fields apply. + class JourneyAudience + # Audience kind. Selects which other fields apply. + attr_accessor :kind + + # segment audiences: Segment UUIDs whose users enter the journey. + attr_accessor :included_segment_ids + + # segment audiences: Segment UUIDs whose users are excluded. + attr_accessor :excluded_segment_ids + + # segment audiences: when true, only users who newly match the segment after activation enter the journey. Defaults to false. + attr_accessor :future_additions_only + + # event_trigger audiences: event name that triggers entry, up to 255 characters. + attr_accessor :name + + # Event attribute matchers, as a list of condition groups. Send a single group whose conditions are AND'd together. More than one group is rejected. + attr_accessor :attributes + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'kind' => :'kind', + :'included_segment_ids' => :'included_segment_ids', + :'excluded_segment_ids' => :'excluded_segment_ids', + :'future_additions_only' => :'future_additions_only', + :'name' => :'name', + :'attributes' => :'attributes' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'kind' => :'String', + :'included_segment_ids' => :'Array', + :'excluded_segment_ids' => :'Array', + :'future_additions_only' => :'Boolean', + :'name' => :'String', + :'attributes' => :'Array>' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'future_additions_only', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyAudience` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyAudience`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'kind') + self.kind = attributes[:'kind'] + end + + if attributes.key?(:'included_segment_ids') + if (value = attributes[:'included_segment_ids']).is_a?(Array) + self.included_segment_ids = value + end + end + + if attributes.key?(:'excluded_segment_ids') + if (value = attributes[:'excluded_segment_ids']).is_a?(Array) + self.excluded_segment_ids = value + end + end + + if attributes.key?(:'future_additions_only') + self.future_additions_only = attributes[:'future_additions_only'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'attributes') + if (value = attributes[:'attributes']).is_a?(Array) + self.attributes = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @kind.nil? + invalid_properties.push('invalid value for "kind", kind cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @kind.nil? + kind_validator = EnumAttributeValidator.new('String', ["segment", "event_trigger"]) + return false unless kind_validator.valid?(@kind) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] kind Object to be assigned + def kind=(kind) + validator = EnumAttributeValidator.new('String', ["segment", "event_trigger"]) + unless validator.valid?(kind) + fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}." + end + @kind = kind + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + kind == o.kind && + included_segment_ids == o.included_segment_ids && + excluded_segment_ids == o.excluded_segment_ids && + future_additions_only == o.future_additions_only && + name == o.name && + attributes == o.attributes + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [kind, included_segment_ids, excluded_segment_ids, future_additions_only, name, attributes].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_branch.rb b/lib/onesignal/models/journey_branch.rb new file mode 100644 index 0000000..3b956dc --- /dev/null +++ b/lib/onesignal/models/journey_branch.rb @@ -0,0 +1,250 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class JourneyBranch + # Server-assigned branch identifier. Read-only on create; echo it on update to keep the branch. + attr_accessor :id + + attr_accessor :condition + + # Branch weight for split_range nodes. Weights across a node's branches must sum to 100. + attr_accessor :weight + + # Nodes run when this branch is taken, before flow converges to the next sibling node. + attr_accessor :nodes + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'condition' => :'condition', + :'weight' => :'weight', + :'nodes' => :'nodes' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'condition' => :'JourneyCondition', + :'weight' => :'Float', + :'nodes' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyBranch` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyBranch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'condition') + self.condition = attributes[:'condition'] + end + + if attributes.key?(:'weight') + self.weight = attributes[:'weight'] + end + + if attributes.key?(:'nodes') + if (value = attributes[:'nodes']).is_a?(Array) + self.nodes = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + condition == o.condition && + weight == o.weight && + nodes == o.nodes + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, condition, weight, nodes].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_branch_stats.rb b/lib/onesignal/models/journey_branch_stats.rb new file mode 100644 index 0000000..7593c00 --- /dev/null +++ b/lib/onesignal/models/journey_branch_stats.rb @@ -0,0 +1,220 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Stats for a single branch of a branching node. Keyed in the response by the branch's server-assigned id. + class JourneyBranchStats + # Users who took this branch. + attr_accessor :completed + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'completed' => :'completed' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'completed' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyBranchStats` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyBranchStats`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'completed') + self.completed = attributes[:'completed'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + completed == o.completed + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [completed].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_condition.rb b/lib/onesignal/models/journey_condition.rb new file mode 100644 index 0000000..68d453d --- /dev/null +++ b/lib/onesignal/models/journey_condition.rb @@ -0,0 +1,360 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # A branch condition. The kind field selects which other fields apply. + class JourneyCondition + # Condition kind. Selects which other fields apply. + attr_accessor :kind + + # segment_membership conditions: Segment UUIDs the user must belong to. + attr_accessor :included_segment_ids + + # segment_membership conditions: Segment UUIDs the user must not belong to. + attr_accessor :excluded_segment_ids + + # on_notification_action conditions: the notification action to branch on. Which actions apply depends on the sending node's channel. + attr_accessor :action + + # on_notification_action conditions: id of the sending node this action refers to. Returned on reads; accepted on write. + attr_accessor :sending_node_id + + # on_notification_action conditions: write-only alternative to sending_node_id. References the sending node by its client_node_id. + attr_accessor :client_node_id + + # event_trigger conditions: event name, up to 255 characters. + attr_accessor :name + + # Event attribute matchers, as a list of condition groups. Send a single group whose conditions are AND'd together. More than one group is rejected. + attr_accessor :attributes + + # event_trigger conditions: match incoming event properties against the journey's entry event. Only valid on event-triggered journeys. + attr_accessor :entry_event_match_attributes + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'kind' => :'kind', + :'included_segment_ids' => :'included_segment_ids', + :'excluded_segment_ids' => :'excluded_segment_ids', + :'action' => :'action', + :'sending_node_id' => :'sending_node_id', + :'client_node_id' => :'client_node_id', + :'name' => :'name', + :'attributes' => :'attributes', + :'entry_event_match_attributes' => :'entry_event_match_attributes' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'kind' => :'String', + :'included_segment_ids' => :'Array', + :'excluded_segment_ids' => :'Array', + :'action' => :'String', + :'sending_node_id' => :'String', + :'client_node_id' => :'String', + :'name' => :'String', + :'attributes' => :'Array>', + :'entry_event_match_attributes' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'entry_event_match_attributes' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyCondition` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyCondition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'kind') + self.kind = attributes[:'kind'] + end + + if attributes.key?(:'included_segment_ids') + if (value = attributes[:'included_segment_ids']).is_a?(Array) + self.included_segment_ids = value + end + end + + if attributes.key?(:'excluded_segment_ids') + if (value = attributes[:'excluded_segment_ids']).is_a?(Array) + self.excluded_segment_ids = value + end + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + end + + if attributes.key?(:'sending_node_id') + self.sending_node_id = attributes[:'sending_node_id'] + end + + if attributes.key?(:'client_node_id') + self.client_node_id = attributes[:'client_node_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'attributes') + if (value = attributes[:'attributes']).is_a?(Array) + self.attributes = value + end + end + + if attributes.key?(:'entry_event_match_attributes') + if (value = attributes[:'entry_event_match_attributes']).is_a?(Array) + self.entry_event_match_attributes = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @kind.nil? + invalid_properties.push('invalid value for "kind", kind cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @kind.nil? + kind_validator = EnumAttributeValidator.new('String', ["segment_membership", "on_notification_action", "event_trigger"]) + return false unless kind_validator.valid?(@kind) + action_validator = EnumAttributeValidator.new('String', ["received", "clicked", "opened"]) + return false unless action_validator.valid?(@action) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] kind Object to be assigned + def kind=(kind) + validator = EnumAttributeValidator.new('String', ["segment_membership", "on_notification_action", "event_trigger"]) + unless validator.valid?(kind) + fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}." + end + @kind = kind + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] action Object to be assigned + def action=(action) + validator = EnumAttributeValidator.new('String', ["received", "clicked", "opened"]) + unless validator.valid?(action) + fail ArgumentError, "invalid value for \"action\", must be one of #{validator.allowable_values}." + end + @action = action + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + kind == o.kind && + included_segment_ids == o.included_segment_ids && + excluded_segment_ids == o.excluded_segment_ids && + action == o.action && + sending_node_id == o.sending_node_id && + client_node_id == o.client_node_id && + name == o.name && + attributes == o.attributes && + entry_event_match_attributes == o.entry_event_match_attributes + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [kind, included_segment_ids, excluded_segment_ids, action, sending_node_id, client_node_id, name, attributes, entry_event_match_attributes].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_early_exit.rb b/lib/onesignal/models/journey_early_exit.rb new file mode 100644 index 0000000..649fe39 --- /dev/null +++ b/lib/onesignal/models/journey_early_exit.rb @@ -0,0 +1,231 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Conditions that remove a user from the journey before it completes. At least one rule must be set under rules. Send null to remove early exit entirely. + class JourneyEarlyExit + attr_accessor :rules + + # Tag key-value pairs applied when a user exits early. + attr_accessor :tag_on_early_exit + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'rules' => :'rules', + :'tag_on_early_exit' => :'tag_on_early_exit' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'rules' => :'JourneyEarlyExitRules', + :'tag_on_early_exit' => :'Hash' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyEarlyExit` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyEarlyExit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'rules') + self.rules = attributes[:'rules'] + end + + if attributes.key?(:'tag_on_early_exit') + if (value = attributes[:'tag_on_early_exit']).is_a?(Hash) + self.tag_on_early_exit = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rules == o.rules && + tag_on_early_exit == o.tag_on_early_exit + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [rules, tag_on_early_exit].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_early_exit_rules.rb b/lib/onesignal/models/journey_early_exit_rules.rb new file mode 100644 index 0000000..1867f81 --- /dev/null +++ b/lib/onesignal/models/journey_early_exit_rules.rb @@ -0,0 +1,251 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class JourneyEarlyExitRules + attr_accessor :on_segment + + # Exit when the user no longer matches the journey audience. Defaults to false. + attr_accessor :when_not_in_audience + + # Exit on a new session start. Defaults to false. + attr_accessor :on_session + + attr_accessor :on_event + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'on_segment' => :'on_segment', + :'when_not_in_audience' => :'when_not_in_audience', + :'on_session' => :'on_session', + :'on_event' => :'on_event' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'on_segment' => :'JourneyEarlyExitRulesOnSegment', + :'when_not_in_audience' => :'Boolean', + :'on_session' => :'Boolean', + :'on_event' => :'JourneyEarlyExitRulesOnEvent' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'on_segment', + :'when_not_in_audience', + :'on_session', + :'on_event' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyEarlyExitRules` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyEarlyExitRules`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'on_segment') + self.on_segment = attributes[:'on_segment'] + end + + if attributes.key?(:'when_not_in_audience') + self.when_not_in_audience = attributes[:'when_not_in_audience'] + end + + if attributes.key?(:'on_session') + self.on_session = attributes[:'on_session'] + end + + if attributes.key?(:'on_event') + self.on_event = attributes[:'on_event'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + on_segment == o.on_segment && + when_not_in_audience == o.when_not_in_audience && + on_session == o.on_session && + on_event == o.on_event + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [on_segment, when_not_in_audience, on_session, on_event].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_early_exit_rules_on_event.rb b/lib/onesignal/models/journey_early_exit_rules_on_event.rb new file mode 100644 index 0000000..98c3b80 --- /dev/null +++ b/lib/onesignal/models/journey_early_exit_rules_on_event.rb @@ -0,0 +1,224 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class JourneyEarlyExitRulesOnEvent + # Exit when this event occurs. Up to 255 characters. + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyEarlyExitRulesOnEvent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyEarlyExitRulesOnEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @name.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_early_exit_rules_on_segment.rb b/lib/onesignal/models/journey_early_exit_rules_on_segment.rb new file mode 100644 index 0000000..299a099 --- /dev/null +++ b/lib/onesignal/models/journey_early_exit_rules_on_segment.rb @@ -0,0 +1,221 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class JourneyEarlyExitRulesOnSegment + # Exit when the user enters any of these segments. + attr_accessor :included_segment_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'included_segment_ids' => :'included_segment_ids' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'included_segment_ids' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyEarlyExitRulesOnSegment` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyEarlyExitRulesOnSegment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'included_segment_ids') + if (value = attributes[:'included_segment_ids']).is_a?(Array) + self.included_segment_ids = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + included_segment_ids == o.included_segment_ids + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [included_segment_ids].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_event_attribute.rb b/lib/onesignal/models/journey_event_attribute.rb new file mode 100644 index 0000000..3a0c5b2 --- /dev/null +++ b/lib/onesignal/models/journey_event_attribute.rb @@ -0,0 +1,283 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class JourneyEventAttribute + # Event attribute key. + attr_accessor :key + + # Comparison operator. + attr_accessor :operator + + # Value to compare against. Not required for exists and not_exists. + attr_accessor :value + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'key' => :'key', + :'operator' => :'operator', + :'value' => :'value' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'key' => :'String', + :'operator' => :'String', + :'value' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyEventAttribute` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyEventAttribute`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'operator') + self.operator = attributes[:'operator'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @key.nil? + invalid_properties.push('invalid value for "key", key cannot be nil.') + end + + if @operator.nil? + invalid_properties.push('invalid value for "operator", operator cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @key.nil? + return false if @operator.nil? + operator_validator = EnumAttributeValidator.new('String', ["equal", "not_equal", "less", "less_or_equal", "greater_or_equal", "greater", "is", "is_not", "exists", "not_exists", "before", "after"]) + return false unless operator_validator.valid?(@operator) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] operator Object to be assigned + def operator=(operator) + validator = EnumAttributeValidator.new('String', ["equal", "not_equal", "less", "less_or_equal", "greater_or_equal", "greater", "is", "is_not", "exists", "not_exists", "before", "after"]) + unless validator.valid?(operator) + fail ArgumentError, "invalid value for \"operator\", must be one of #{validator.allowable_values}." + end + @operator = operator + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + key == o.key && + operator == o.operator && + value == o.value + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [key, operator, value].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_list_audience.rb b/lib/onesignal/models/journey_list_audience.rb new file mode 100644 index 0000000..a490efb --- /dev/null +++ b/lib/onesignal/models/journey_list_audience.rb @@ -0,0 +1,254 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Entry audience reduced to its kind. Use View journey for the full audience configuration. + class JourneyListAudience + # Audience kind. + attr_accessor :kind + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'kind' => :'kind' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'kind' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyListAudience` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyListAudience`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'kind') + self.kind = attributes[:'kind'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + kind_validator = EnumAttributeValidator.new('String', ["segment", "event_trigger"]) + return false unless kind_validator.valid?(@kind) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] kind Object to be assigned + def kind=(kind) + validator = EnumAttributeValidator.new('String', ["segment", "event_trigger"]) + unless validator.valid?(kind) + fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}." + end + @kind = kind + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + kind == o.kind + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [kind].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_list_item.rb b/lib/onesignal/models/journey_list_item.rb new file mode 100644 index 0000000..1c8ff6d --- /dev/null +++ b/lib/onesignal/models/journey_list_item.rb @@ -0,0 +1,366 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Summary journey representation returned by the list endpoint. Excludes description, nodes, early-exit configuration, and concurrency_key. + class JourneyListItem + # Journey UUID. Read-only. + attr_accessor :id + + # UUID of the app the journey belongs to. Read-only. + attr_accessor :app_id + + # Journey name, up to 300 characters. + attr_accessor :name + + # Journey state. New journeys are created as draft. processing is transient while activation is in progress. archived is a journey that has been stopped. Change it through the state field on Update journey. + attr_accessor :state + + # ISO 8601 creation time. Read-only. + attr_accessor :created_at + + # ISO 8601 last-update time. Read-only. + attr_accessor :updated_at + + # ISO 8601 time the journey was activated, or null. Read-only. + attr_accessor :started_at + + # ISO 8601 time the journey was archived, or null. Read-only. + attr_accessor :archived_at + + # Origin of the journey, for example public_api or dashboard. Read-only. + attr_accessor :created_source + + attr_accessor :schedule + + attr_accessor :audience + + attr_accessor :reentry_rules + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'app_id' => :'app_id', + :'name' => :'name', + :'state' => :'state', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at', + :'started_at' => :'started_at', + :'archived_at' => :'archived_at', + :'created_source' => :'created_source', + :'schedule' => :'schedule', + :'audience' => :'audience', + :'reentry_rules' => :'reentry_rules' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'app_id' => :'String', + :'name' => :'String', + :'state' => :'String', + :'created_at' => :'String', + :'updated_at' => :'String', + :'started_at' => :'String', + :'archived_at' => :'String', + :'created_source' => :'String', + :'schedule' => :'JourneySchedule', + :'audience' => :'JourneyListAudience', + :'reentry_rules' => :'JourneyReentryRules' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'started_at', + :'archived_at', + :'created_source', + :'schedule', + :'reentry_rules' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyListItem` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyListItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'app_id') + self.app_id = attributes[:'app_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'started_at') + self.started_at = attributes[:'started_at'] + end + + if attributes.key?(:'archived_at') + self.archived_at = attributes[:'archived_at'] + end + + if attributes.key?(:'created_source') + self.created_source = attributes[:'created_source'] + end + + if attributes.key?(:'schedule') + self.schedule = attributes[:'schedule'] + end + + if attributes.key?(:'audience') + self.audience = attributes[:'audience'] + end + + if attributes.key?(:'reentry_rules') + self.reentry_rules = attributes[:'reentry_rules'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + state_validator = EnumAttributeValidator.new('String', ["draft", "scheduled", "processing", "active", "archived"]) + return false unless state_validator.valid?(@state) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] state Object to be assigned + def state=(state) + validator = EnumAttributeValidator.new('String', ["draft", "scheduled", "processing", "active", "archived"]) + unless validator.valid?(state) + fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}." + end + @state = state + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + app_id == o.app_id && + name == o.name && + state == o.state && + created_at == o.created_at && + updated_at == o.updated_at && + started_at == o.started_at && + archived_at == o.archived_at && + created_source == o.created_source && + schedule == o.schedule && + audience == o.audience && + reentry_rules == o.reentry_rules + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, app_id, name, state, created_at, updated_at, started_at, archived_at, created_source, schedule, audience, reentry_rules].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_list_response.rb b/lib/onesignal/models/journey_list_response.rb new file mode 100644 index 0000000..8d51233 --- /dev/null +++ b/lib/onesignal/models/journey_list_response.rb @@ -0,0 +1,241 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class JourneyListResponse + # Journeys ordered by creation time, newest first. + attr_accessor :journeys + + # true if more journeys exist beyond this page. + attr_accessor :has_more + + # Cursor for the next page. Present only when has_more is true. + attr_accessor :next_cursor + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'journeys' => :'journeys', + :'has_more' => :'has_more', + :'next_cursor' => :'next_cursor' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'journeys' => :'Array', + :'has_more' => :'Boolean', + :'next_cursor' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyListResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyListResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'journeys') + if (value = attributes[:'journeys']).is_a?(Array) + self.journeys = value + end + end + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + end + + if attributes.key?(:'next_cursor') + self.next_cursor = attributes[:'next_cursor'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + journeys == o.journeys && + has_more == o.has_more && + next_cursor == o.next_cursor + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [journeys, has_more, next_cursor].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_message_stats.rb b/lib/onesignal/models/journey_message_stats.rb new file mode 100644 index 0000000..619bca6 --- /dev/null +++ b/lib/onesignal/models/journey_message_stats.rb @@ -0,0 +1,222 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Delivery stats for a message-sending node. Present only on send_push, send_email, send_sms, send_iam, and send_webhook nodes. The keys inside totals depend on the node's channel. + class JourneyMessageStats + # All-time totals for this node, keyed by channel-specific stat name. + attr_accessor :totals + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'totals' => :'totals' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'totals' => :'Hash' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyMessageStats` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyMessageStats`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'totals') + if (value = attributes[:'totals']).is_a?(Hash) + self.totals = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + totals == o.totals + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [totals].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_node.rb b/lib/onesignal/models/journey_node.rb new file mode 100644 index 0000000..ddd4d69 --- /dev/null +++ b/lib/onesignal/models/journey_node.rb @@ -0,0 +1,480 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # A journey node. The kind field selects which other fields apply. Branching nodes (split_range, yes_no, wait_until) nest their sub-graphs inline via branches[].nodes. + class JourneyNode + # Server-assigned node UUID. Returned on reads. Required on update to keep an existing node. Rejected on create with a 400 validation error. + attr_accessor :id + + # Node kind. Selects which other fields apply. + attr_accessor :kind + + # Optional client-assigned identifier, unique within the journey. Use it to reference this node from elsewhere in the same request. Persisted and returned on reads. + attr_accessor :client_node_id + + # Optional free-text label, up to 255 characters. Stored and returned as-is with no effect on journey behavior. + attr_accessor :annotation + + # wait nodes: seconds to hold the user. Minimum 60, maximum 31556952 (1 year). + attr_accessor :duration_seconds + + # time_window nodes: schedule_in_timezone uses the configured windows; last_active_time holds relative to the user's last active time. + attr_accessor :relative_to + + # time_window nodes: one or more time windows. A window with no day_of_week applies to every day. Required when relative_to is schedule_in_timezone; omit when it is last_active_time. + attr_accessor :windows + + # time_window nodes: IANA timezone identifier used when the user's timezone is unavailable. + attr_accessor :time_zone + + # time_window nodes: when true, uses the user's timezone if available. + attr_accessor :use_user_time_zone + + # send_push, send_email, and send_sms nodes: UUID of the template to send. + attr_accessor :template_id + + # send_iam nodes: UUID of the in-app message to send. + attr_accessor :iam_id + + # send_iam nodes: optional time-to-live for the in-app message, in seconds. + attr_accessor :user_ttl_seconds + + # send_webhook nodes: UUID of the webhook to send. + attr_accessor :webhook_id + + # tag nodes: tag key-value pairs to assign. An empty string value removes the tag. Keys are limited to 255 characters and values to 1024. + attr_accessor :assignments + + # split_range nodes: when true, assigns each user to a branch at random on entry. Defaults to false. + attr_accessor :randomize_on_entry + + # Branching nodes: nested branches. split_range requires 2-20 weighted branches that sum to 100. yes_no requires exactly 2 branches. wait_until requires 1-10 condition branches. + attr_accessor :branches + + attr_accessor :expiration + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'kind' => :'kind', + :'client_node_id' => :'client_node_id', + :'annotation' => :'annotation', + :'duration_seconds' => :'duration_seconds', + :'relative_to' => :'relative_to', + :'windows' => :'windows', + :'time_zone' => :'time_zone', + :'use_user_time_zone' => :'use_user_time_zone', + :'template_id' => :'template_id', + :'iam_id' => :'iam_id', + :'user_ttl_seconds' => :'user_ttl_seconds', + :'webhook_id' => :'webhook_id', + :'assignments' => :'assignments', + :'randomize_on_entry' => :'randomize_on_entry', + :'branches' => :'branches', + :'expiration' => :'expiration' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'kind' => :'String', + :'client_node_id' => :'String', + :'annotation' => :'String', + :'duration_seconds' => :'Integer', + :'relative_to' => :'String', + :'windows' => :'Array', + :'time_zone' => :'String', + :'use_user_time_zone' => :'Boolean', + :'template_id' => :'String', + :'iam_id' => :'String', + :'user_ttl_seconds' => :'Integer', + :'webhook_id' => :'String', + :'assignments' => :'Hash', + :'randomize_on_entry' => :'Boolean', + :'branches' => :'Array', + :'expiration' => :'JourneyWaitUntilExpiration' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'duration_seconds', + :'use_user_time_zone', + :'user_ttl_seconds', + :'randomize_on_entry', + :'expiration' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyNode` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyNode`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'kind') + self.kind = attributes[:'kind'] + end + + if attributes.key?(:'client_node_id') + self.client_node_id = attributes[:'client_node_id'] + end + + if attributes.key?(:'annotation') + self.annotation = attributes[:'annotation'] + end + + if attributes.key?(:'duration_seconds') + self.duration_seconds = attributes[:'duration_seconds'] + end + + if attributes.key?(:'relative_to') + self.relative_to = attributes[:'relative_to'] + end + + if attributes.key?(:'windows') + if (value = attributes[:'windows']).is_a?(Array) + self.windows = value + end + end + + if attributes.key?(:'time_zone') + self.time_zone = attributes[:'time_zone'] + end + + if attributes.key?(:'use_user_time_zone') + self.use_user_time_zone = attributes[:'use_user_time_zone'] + end + + if attributes.key?(:'template_id') + self.template_id = attributes[:'template_id'] + end + + if attributes.key?(:'iam_id') + self.iam_id = attributes[:'iam_id'] + end + + if attributes.key?(:'user_ttl_seconds') + self.user_ttl_seconds = attributes[:'user_ttl_seconds'] + end + + if attributes.key?(:'webhook_id') + self.webhook_id = attributes[:'webhook_id'] + end + + if attributes.key?(:'assignments') + if (value = attributes[:'assignments']).is_a?(Hash) + self.assignments = value + end + end + + if attributes.key?(:'randomize_on_entry') + self.randomize_on_entry = attributes[:'randomize_on_entry'] + end + + if attributes.key?(:'branches') + if (value = attributes[:'branches']).is_a?(Array) + self.branches = value + end + end + + if attributes.key?(:'expiration') + self.expiration = attributes[:'expiration'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @kind.nil? + invalid_properties.push('invalid value for "kind", kind cannot be nil.') + end + + if !@duration_seconds.nil? && @duration_seconds > 31556952 + invalid_properties.push('invalid value for "duration_seconds", must be smaller than or equal to 31556952.') + end + + if !@duration_seconds.nil? && @duration_seconds < 60 + invalid_properties.push('invalid value for "duration_seconds", must be greater than or equal to 60.') + end + + if !@user_ttl_seconds.nil? && @user_ttl_seconds < 1 + invalid_properties.push('invalid value for "user_ttl_seconds", must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @kind.nil? + kind_validator = EnumAttributeValidator.new('String', ["wait", "time_window", "send_push", "send_email", "send_sms", "send_iam", "send_webhook", "tag", "split_range", "yes_no", "wait_until"]) + return false unless kind_validator.valid?(@kind) + return false if !@duration_seconds.nil? && @duration_seconds > 31556952 + return false if !@duration_seconds.nil? && @duration_seconds < 60 + relative_to_validator = EnumAttributeValidator.new('String', ["schedule_in_timezone", "last_active_time"]) + return false unless relative_to_validator.valid?(@relative_to) + return false if !@user_ttl_seconds.nil? && @user_ttl_seconds < 1 + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] kind Object to be assigned + def kind=(kind) + validator = EnumAttributeValidator.new('String', ["wait", "time_window", "send_push", "send_email", "send_sms", "send_iam", "send_webhook", "tag", "split_range", "yes_no", "wait_until"]) + unless validator.valid?(kind) + fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}." + end + @kind = kind + end + + # Custom attribute writer method with validation + # @param [Object] duration_seconds Value to be assigned + def duration_seconds=(duration_seconds) + if !duration_seconds.nil? && duration_seconds > 31556952 + fail ArgumentError, 'invalid value for "duration_seconds", must be smaller than or equal to 31556952.' + end + + if !duration_seconds.nil? && duration_seconds < 60 + fail ArgumentError, 'invalid value for "duration_seconds", must be greater than or equal to 60.' + end + + @duration_seconds = duration_seconds + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] relative_to Object to be assigned + def relative_to=(relative_to) + validator = EnumAttributeValidator.new('String', ["schedule_in_timezone", "last_active_time"]) + unless validator.valid?(relative_to) + fail ArgumentError, "invalid value for \"relative_to\", must be one of #{validator.allowable_values}." + end + @relative_to = relative_to + end + + # Custom attribute writer method with validation + # @param [Object] user_ttl_seconds Value to be assigned + def user_ttl_seconds=(user_ttl_seconds) + if !user_ttl_seconds.nil? && user_ttl_seconds < 1 + fail ArgumentError, 'invalid value for "user_ttl_seconds", must be greater than or equal to 1.' + end + + @user_ttl_seconds = user_ttl_seconds + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + kind == o.kind && + client_node_id == o.client_node_id && + annotation == o.annotation && + duration_seconds == o.duration_seconds && + relative_to == o.relative_to && + windows == o.windows && + time_zone == o.time_zone && + use_user_time_zone == o.use_user_time_zone && + template_id == o.template_id && + iam_id == o.iam_id && + user_ttl_seconds == o.user_ttl_seconds && + webhook_id == o.webhook_id && + assignments == o.assignments && + randomize_on_entry == o.randomize_on_entry && + branches == o.branches && + expiration == o.expiration + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, kind, client_node_id, annotation, duration_seconds, relative_to, windows, time_zone, use_user_time_zone, template_id, iam_id, user_ttl_seconds, webhook_id, assignments, randomize_on_entry, branches, expiration].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_node_stats.rb b/lib/onesignal/models/journey_node_stats.rb new file mode 100644 index 0000000..896c1b4 --- /dev/null +++ b/lib/onesignal/models/journey_node_stats.rb @@ -0,0 +1,293 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Stats for a single node. Keyed in the response by the node's server-assigned id. + class JourneyNodeStats + # Node kind, repeated here so stats can be read without joining against the journey definition. + attr_accessor :kind + + # Users currently held at this node. + attr_accessor :waiting + + # Users who advanced past this node normally. + attr_accessor :completed + + # Users who left the journey from this node through an early exit rule. + attr_accessor :exited_early + + attr_accessor :message_stats + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'kind' => :'kind', + :'waiting' => :'waiting', + :'completed' => :'completed', + :'exited_early' => :'exited_early', + :'message_stats' => :'message_stats' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'kind' => :'String', + :'waiting' => :'Integer', + :'completed' => :'Integer', + :'exited_early' => :'Integer', + :'message_stats' => :'JourneyMessageStats' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyNodeStats` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyNodeStats`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'kind') + self.kind = attributes[:'kind'] + end + + if attributes.key?(:'waiting') + self.waiting = attributes[:'waiting'] + end + + if attributes.key?(:'completed') + self.completed = attributes[:'completed'] + end + + if attributes.key?(:'exited_early') + self.exited_early = attributes[:'exited_early'] + end + + if attributes.key?(:'message_stats') + self.message_stats = attributes[:'message_stats'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + kind_validator = EnumAttributeValidator.new('String', ["wait", "time_window", "send_push", "send_email", "send_sms", "send_iam", "send_webhook", "tag", "split_range", "yes_no", "wait_until"]) + return false unless kind_validator.valid?(@kind) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] kind Object to be assigned + def kind=(kind) + validator = EnumAttributeValidator.new('String', ["wait", "time_window", "send_push", "send_email", "send_sms", "send_iam", "send_webhook", "tag", "split_range", "yes_no", "wait_until"]) + unless validator.valid?(kind) + fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}." + end + @kind = kind + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + kind == o.kind && + waiting == o.waiting && + completed == o.completed && + exited_early == o.exited_early && + message_stats == o.message_stats + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [kind, waiting, completed, exited_early, message_stats].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_reentry_rules.rb b/lib/onesignal/models/journey_reentry_rules.rb new file mode 100644 index 0000000..f3c5ba4 --- /dev/null +++ b/lib/onesignal/models/journey_reentry_rules.rb @@ -0,0 +1,236 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Controls whether and how soon a user can re-enter the journey. null means re-entry is not allowed. + class JourneyReentryRules + # Minimum seconds before a user can re-enter. Must be at least 600 (10 minutes). + attr_accessor :duration_seconds + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'duration_seconds' => :'duration_seconds' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'duration_seconds' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'duration_seconds' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyReentryRules` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyReentryRules`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'duration_seconds') + self.duration_seconds = attributes[:'duration_seconds'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@duration_seconds.nil? && @duration_seconds < 600 + invalid_properties.push('invalid value for "duration_seconds", must be greater than or equal to 600.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@duration_seconds.nil? && @duration_seconds < 600 + true + end + + # Custom attribute writer method with validation + # @param [Object] duration_seconds Value to be assigned + def duration_seconds=(duration_seconds) + if !duration_seconds.nil? && duration_seconds < 600 + fail ArgumentError, 'invalid value for "duration_seconds", must be greater than or equal to 600.' + end + + @duration_seconds = duration_seconds + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + duration_seconds == o.duration_seconds + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [duration_seconds].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_schedule.rb b/lib/onesignal/models/journey_schedule.rb new file mode 100644 index 0000000..6ac8d43 --- /dev/null +++ b/lib/onesignal/models/journey_schedule.rb @@ -0,0 +1,243 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Optional future start and/or stop time. null means no scheduled activation. + class JourneySchedule + # ISO 8601 start time. Use UTC (Z or +00:00). Must be at least 5 minutes in the future. + attr_accessor :start_at + + # ISO 8601 stop time. Use UTC (Z or +00:00). Must be in the future and later than start_at. + attr_accessor :stop_at + + # Read-only. Present when a scheduling error occurred. + attr_accessor :error + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'start_at' => :'start_at', + :'stop_at' => :'stop_at', + :'error' => :'error' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'start_at' => :'String', + :'stop_at' => :'String', + :'error' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'start_at', + :'stop_at', + :'error' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneySchedule` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneySchedule`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'start_at') + self.start_at = attributes[:'start_at'] + end + + if attributes.key?(:'stop_at') + self.stop_at = attributes[:'stop_at'] + end + + if attributes.key?(:'error') + self.error = attributes[:'error'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + start_at == o.start_at && + stop_at == o.stop_at && + error == o.error + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [start_at, stop_at, error].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_stats.rb b/lib/onesignal/models/journey_stats.rb new file mode 100644 index 0000000..1ad8d8e --- /dev/null +++ b/lib/onesignal/models/journey_stats.rb @@ -0,0 +1,274 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Journey-level counts plus flat, id-keyed maps of node and branch stats. Contains no definition detail; join it by id against the journey from View journey. + class JourneyStats + # UUID of the journey these stats belong to. + attr_accessor :id + + # Users who entered the journey. + attr_accessor :started + + # Users who reached the end of the journey normally. + attr_accessor :completed + + # Users who left the journey through an early exit rule. + attr_accessor :exited_early + + # Node stats keyed by node id. Includes every node in the graph, at any nesting depth. + attr_accessor :nodes + + # Branch stats keyed by branch id. Empty for a journey with no branching nodes. + attr_accessor :branches + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'started' => :'started', + :'completed' => :'completed', + :'exited_early' => :'exited_early', + :'nodes' => :'nodes', + :'branches' => :'branches' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'started' => :'Integer', + :'completed' => :'Integer', + :'exited_early' => :'Integer', + :'nodes' => :'Hash', + :'branches' => :'Hash' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyStats` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyStats`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'started') + self.started = attributes[:'started'] + end + + if attributes.key?(:'completed') + self.completed = attributes[:'completed'] + end + + if attributes.key?(:'exited_early') + self.exited_early = attributes[:'exited_early'] + end + + if attributes.key?(:'nodes') + if (value = attributes[:'nodes']).is_a?(Hash) + self.nodes = value + end + end + + if attributes.key?(:'branches') + if (value = attributes[:'branches']).is_a?(Hash) + self.branches = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + started == o.started && + completed == o.completed && + exited_early == o.exited_early && + nodes == o.nodes && + branches == o.branches + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, started, completed, exited_early, nodes, branches].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_time_point.rb b/lib/onesignal/models/journey_time_point.rb new file mode 100644 index 0000000..5716b7c --- /dev/null +++ b/lib/onesignal/models/journey_time_point.rb @@ -0,0 +1,277 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class JourneyTimePoint + # Hour of day, 0-23. + attr_accessor :hour + + # Minute of hour, 0-59. Defaults to 0. + attr_accessor :minute + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'hour' => :'hour', + :'minute' => :'minute' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'hour' => :'Integer', + :'minute' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyTimePoint` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyTimePoint`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'hour') + self.hour = attributes[:'hour'] + end + + if attributes.key?(:'minute') + self.minute = attributes[:'minute'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@hour.nil? && @hour > 23 + invalid_properties.push('invalid value for "hour", must be smaller than or equal to 23.') + end + + if !@hour.nil? && @hour < 0 + invalid_properties.push('invalid value for "hour", must be greater than or equal to 0.') + end + + if !@minute.nil? && @minute > 59 + invalid_properties.push('invalid value for "minute", must be smaller than or equal to 59.') + end + + if !@minute.nil? && @minute < 0 + invalid_properties.push('invalid value for "minute", must be greater than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@hour.nil? && @hour > 23 + return false if !@hour.nil? && @hour < 0 + return false if !@minute.nil? && @minute > 59 + return false if !@minute.nil? && @minute < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] hour Value to be assigned + def hour=(hour) + if !hour.nil? && hour > 23 + fail ArgumentError, 'invalid value for "hour", must be smaller than or equal to 23.' + end + + if !hour.nil? && hour < 0 + fail ArgumentError, 'invalid value for "hour", must be greater than or equal to 0.' + end + + @hour = hour + end + + # Custom attribute writer method with validation + # @param [Object] minute Value to be assigned + def minute=(minute) + if !minute.nil? && minute > 59 + fail ArgumentError, 'invalid value for "minute", must be smaller than or equal to 59.' + end + + if !minute.nil? && minute < 0 + fail ArgumentError, 'invalid value for "minute", must be greater than or equal to 0.' + end + + @minute = minute + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + hour == o.hour && + minute == o.minute + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [hour, minute].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_time_window.rb b/lib/onesignal/models/journey_time_window.rb new file mode 100644 index 0000000..7201298 --- /dev/null +++ b/lib/onesignal/models/journey_time_window.rb @@ -0,0 +1,266 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # A wall-clock window. Each window must span at least 15 minutes. + class JourneyTimeWindow + # When the window opens. + attr_accessor :start + + # When the window closes. + attr_accessor :_end + + # Day of week, 1 = Monday. Omit to apply the window to every day. + attr_accessor :day_of_week + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'start' => :'start', + :'_end' => :'end', + :'day_of_week' => :'day_of_week' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'start' => :'JourneyTimePoint', + :'_end' => :'JourneyTimePoint', + :'day_of_week' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'start', + :'_end', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyTimeWindow` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyTimeWindow`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'start') + self.start = attributes[:'start'] + end + + if attributes.key?(:'_end') + self._end = attributes[:'_end'] + end + + if attributes.key?(:'day_of_week') + self.day_of_week = attributes[:'day_of_week'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@day_of_week.nil? && @day_of_week > 7 + invalid_properties.push('invalid value for "day_of_week", must be smaller than or equal to 7.') + end + + if !@day_of_week.nil? && @day_of_week < 1 + invalid_properties.push('invalid value for "day_of_week", must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@day_of_week.nil? && @day_of_week > 7 + return false if !@day_of_week.nil? && @day_of_week < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] day_of_week Value to be assigned + def day_of_week=(day_of_week) + if !day_of_week.nil? && day_of_week > 7 + fail ArgumentError, 'invalid value for "day_of_week", must be smaller than or equal to 7.' + end + + if !day_of_week.nil? && day_of_week < 1 + fail ArgumentError, 'invalid value for "day_of_week", must be greater than or equal to 1.' + end + + @day_of_week = day_of_week + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + start == o.start && + _end == o._end && + day_of_week == o.day_of_week + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [start, _end, day_of_week].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/journey_wait_until_expiration.rb b/lib/onesignal/models/journey_wait_until_expiration.rb new file mode 100644 index 0000000..1af7838 --- /dev/null +++ b/lib/onesignal/models/journey_wait_until_expiration.rb @@ -0,0 +1,256 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Optional expiration timer. null waits indefinitely. + class JourneyWaitUntilExpiration + # Seconds to wait before the timer fires. Minimum 60, maximum 31556952 (1 year). + attr_accessor :duration_seconds + + # When true, the user exits the journey when the timer fires; when false, the user continues to convergence. + attr_accessor :exits + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'duration_seconds' => :'duration_seconds', + :'exits' => :'exits' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'duration_seconds' => :'Integer', + :'exits' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'duration_seconds', + :'exits' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::JourneyWaitUntilExpiration` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::JourneyWaitUntilExpiration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'duration_seconds') + self.duration_seconds = attributes[:'duration_seconds'] + end + + if attributes.key?(:'exits') + self.exits = attributes[:'exits'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@duration_seconds.nil? && @duration_seconds > 31556952 + invalid_properties.push('invalid value for "duration_seconds", must be smaller than or equal to 31556952.') + end + + if !@duration_seconds.nil? && @duration_seconds < 60 + invalid_properties.push('invalid value for "duration_seconds", must be greater than or equal to 60.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@duration_seconds.nil? && @duration_seconds > 31556952 + return false if !@duration_seconds.nil? && @duration_seconds < 60 + true + end + + # Custom attribute writer method with validation + # @param [Object] duration_seconds Value to be assigned + def duration_seconds=(duration_seconds) + if !duration_seconds.nil? && duration_seconds > 31556952 + fail ArgumentError, 'invalid value for "duration_seconds", must be smaller than or equal to 31556952.' + end + + if !duration_seconds.nil? && duration_seconds < 60 + fail ArgumentError, 'invalid value for "duration_seconds", must be greater than or equal to 60.' + end + + @duration_seconds = duration_seconds + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + duration_seconds == o.duration_seconds && + exits == o.exits + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [duration_seconds, exits].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/update_journey_node_request.rb b/lib/onesignal/models/update_journey_node_request.rb new file mode 100644 index 0000000..59ba4da --- /dev/null +++ b/lib/onesignal/models/update_journey_node_request.rb @@ -0,0 +1,454 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Node fields to change, merged onto the current node. Send only the fields you want to change. The node's kind and id cannot be changed. Send null to clear a nullable field. Which other fields apply depends on the node's kind, matching JourneyNode. + class UpdateJourneyNodeRequest + # Optional client-assigned identifier, unique within the journey. Use it to reference this node from elsewhere in the same request. Persisted and returned on reads. + attr_accessor :client_node_id + + # Optional free-text label, up to 255 characters. Stored and returned as-is with no effect on journey behavior. + attr_accessor :annotation + + # wait nodes: seconds to hold the user. Minimum 60, maximum 31556952 (1 year). + attr_accessor :duration_seconds + + # time_window nodes: schedule_in_timezone uses the configured windows; last_active_time holds relative to the user's last active time. + attr_accessor :relative_to + + # time_window nodes: one or more time windows. A window with no day_of_week applies to every day. Required when relative_to is schedule_in_timezone; omit when it is last_active_time. + attr_accessor :windows + + # time_window nodes: IANA timezone identifier used when the user's timezone is unavailable. + attr_accessor :time_zone + + # time_window nodes: when true, uses the user's timezone if available. + attr_accessor :use_user_time_zone + + # send_push, send_email, and send_sms nodes: UUID of the template to send. + attr_accessor :template_id + + # send_iam nodes: UUID of the in-app message to send. + attr_accessor :iam_id + + # send_iam nodes: optional time-to-live for the in-app message, in seconds. + attr_accessor :user_ttl_seconds + + # send_webhook nodes: UUID of the webhook to send. + attr_accessor :webhook_id + + # tag nodes: tag key-value pairs to assign. An empty string value removes the tag. Keys are limited to 255 characters and values to 1024. + attr_accessor :assignments + + # split_range nodes: when true, assigns each user to a branch at random on entry. Defaults to false. + attr_accessor :randomize_on_entry + + # Branching nodes: nested branches. split_range requires 2-20 weighted branches that sum to 100. yes_no requires exactly 2 branches. wait_until requires 1-10 condition branches. + attr_accessor :branches + + attr_accessor :expiration + + # Optional optimistic-concurrency token. Pass the concurrency_key from a prior fetch to reject the update with 409 if the journey changed. Omit to skip the check. It is not merged onto the node. + attr_accessor :concurrency_key + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'client_node_id' => :'client_node_id', + :'annotation' => :'annotation', + :'duration_seconds' => :'duration_seconds', + :'relative_to' => :'relative_to', + :'windows' => :'windows', + :'time_zone' => :'time_zone', + :'use_user_time_zone' => :'use_user_time_zone', + :'template_id' => :'template_id', + :'iam_id' => :'iam_id', + :'user_ttl_seconds' => :'user_ttl_seconds', + :'webhook_id' => :'webhook_id', + :'assignments' => :'assignments', + :'randomize_on_entry' => :'randomize_on_entry', + :'branches' => :'branches', + :'expiration' => :'expiration', + :'concurrency_key' => :'concurrency_key' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'client_node_id' => :'String', + :'annotation' => :'String', + :'duration_seconds' => :'Integer', + :'relative_to' => :'String', + :'windows' => :'Array', + :'time_zone' => :'String', + :'use_user_time_zone' => :'Boolean', + :'template_id' => :'String', + :'iam_id' => :'String', + :'user_ttl_seconds' => :'Integer', + :'webhook_id' => :'String', + :'assignments' => :'Hash', + :'randomize_on_entry' => :'Boolean', + :'branches' => :'Array', + :'expiration' => :'JourneyWaitUntilExpiration', + :'concurrency_key' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'duration_seconds', + :'use_user_time_zone', + :'user_ttl_seconds', + :'randomize_on_entry', + :'expiration', + :'concurrency_key' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::UpdateJourneyNodeRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::UpdateJourneyNodeRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'client_node_id') + self.client_node_id = attributes[:'client_node_id'] + end + + if attributes.key?(:'annotation') + self.annotation = attributes[:'annotation'] + end + + if attributes.key?(:'duration_seconds') + self.duration_seconds = attributes[:'duration_seconds'] + end + + if attributes.key?(:'relative_to') + self.relative_to = attributes[:'relative_to'] + end + + if attributes.key?(:'windows') + if (value = attributes[:'windows']).is_a?(Array) + self.windows = value + end + end + + if attributes.key?(:'time_zone') + self.time_zone = attributes[:'time_zone'] + end + + if attributes.key?(:'use_user_time_zone') + self.use_user_time_zone = attributes[:'use_user_time_zone'] + end + + if attributes.key?(:'template_id') + self.template_id = attributes[:'template_id'] + end + + if attributes.key?(:'iam_id') + self.iam_id = attributes[:'iam_id'] + end + + if attributes.key?(:'user_ttl_seconds') + self.user_ttl_seconds = attributes[:'user_ttl_seconds'] + end + + if attributes.key?(:'webhook_id') + self.webhook_id = attributes[:'webhook_id'] + end + + if attributes.key?(:'assignments') + if (value = attributes[:'assignments']).is_a?(Hash) + self.assignments = value + end + end + + if attributes.key?(:'randomize_on_entry') + self.randomize_on_entry = attributes[:'randomize_on_entry'] + end + + if attributes.key?(:'branches') + if (value = attributes[:'branches']).is_a?(Array) + self.branches = value + end + end + + if attributes.key?(:'expiration') + self.expiration = attributes[:'expiration'] + end + + if attributes.key?(:'concurrency_key') + self.concurrency_key = attributes[:'concurrency_key'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@duration_seconds.nil? && @duration_seconds > 31556952 + invalid_properties.push('invalid value for "duration_seconds", must be smaller than or equal to 31556952.') + end + + if !@duration_seconds.nil? && @duration_seconds < 60 + invalid_properties.push('invalid value for "duration_seconds", must be greater than or equal to 60.') + end + + if !@user_ttl_seconds.nil? && @user_ttl_seconds < 1 + invalid_properties.push('invalid value for "user_ttl_seconds", must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@duration_seconds.nil? && @duration_seconds > 31556952 + return false if !@duration_seconds.nil? && @duration_seconds < 60 + relative_to_validator = EnumAttributeValidator.new('String', ["schedule_in_timezone", "last_active_time"]) + return false unless relative_to_validator.valid?(@relative_to) + return false if !@user_ttl_seconds.nil? && @user_ttl_seconds < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] duration_seconds Value to be assigned + def duration_seconds=(duration_seconds) + if !duration_seconds.nil? && duration_seconds > 31556952 + fail ArgumentError, 'invalid value for "duration_seconds", must be smaller than or equal to 31556952.' + end + + if !duration_seconds.nil? && duration_seconds < 60 + fail ArgumentError, 'invalid value for "duration_seconds", must be greater than or equal to 60.' + end + + @duration_seconds = duration_seconds + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] relative_to Object to be assigned + def relative_to=(relative_to) + validator = EnumAttributeValidator.new('String', ["schedule_in_timezone", "last_active_time"]) + unless validator.valid?(relative_to) + fail ArgumentError, "invalid value for \"relative_to\", must be one of #{validator.allowable_values}." + end + @relative_to = relative_to + end + + # Custom attribute writer method with validation + # @param [Object] user_ttl_seconds Value to be assigned + def user_ttl_seconds=(user_ttl_seconds) + if !user_ttl_seconds.nil? && user_ttl_seconds < 1 + fail ArgumentError, 'invalid value for "user_ttl_seconds", must be greater than or equal to 1.' + end + + @user_ttl_seconds = user_ttl_seconds + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + client_node_id == o.client_node_id && + annotation == o.annotation && + duration_seconds == o.duration_seconds && + relative_to == o.relative_to && + windows == o.windows && + time_zone == o.time_zone && + use_user_time_zone == o.use_user_time_zone && + template_id == o.template_id && + iam_id == o.iam_id && + user_ttl_seconds == o.user_ttl_seconds && + webhook_id == o.webhook_id && + assignments == o.assignments && + randomize_on_entry == o.randomize_on_entry && + branches == o.branches && + expiration == o.expiration && + concurrency_key == o.concurrency_key + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [client_node_id, annotation, duration_seconds, relative_to, windows, time_zone, use_user_time_zone, template_id, iam_id, user_ttl_seconds, webhook_id, assignments, randomize_on_entry, branches, expiration, concurrency_key].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/update_journey_request.rb b/lib/onesignal/models/update_journey_request.rb new file mode 100644 index 0000000..ef7e3ad --- /dev/null +++ b/lib/onesignal/models/update_journey_request.rb @@ -0,0 +1,337 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Partial update applied with JSON Merge Patch (RFC 7396). Send only the fields you want to change. A null value clears a nullable field. Arrays such as nodes are replaced wholesale. + class UpdateJourneyRequest + # Journey name. + attr_accessor :name + + # Journey description. Send null to clear it. + attr_accessor :description + + attr_accessor :audience + + attr_accessor :early_exit + + attr_accessor :reentry_rules + + attr_accessor :schedule + + # Full ordered list of nodes, which replaces the existing graph wholesale. Preserve each node's server-assigned id from a prior fetch to keep in-flight users on that node; omit id to add a new node. + attr_accessor :nodes + + # Target state. Set active to activate a draft journey, or scheduled together with a future schedule.start_at to activate it later. Set archived to stop a running journey; archiving is permanent. Only scheduled and processing journeys can return to draft. + attr_accessor :state + + # Optional optimistic-concurrency token. Pass the concurrency_key from a prior fetch to reject the update with 409 if the journey changed. Omit to skip the check. + attr_accessor :concurrency_key + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'description' => :'description', + :'audience' => :'audience', + :'early_exit' => :'early_exit', + :'reentry_rules' => :'reentry_rules', + :'schedule' => :'schedule', + :'nodes' => :'nodes', + :'state' => :'state', + :'concurrency_key' => :'concurrency_key' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'description' => :'String', + :'audience' => :'JourneyAudience', + :'early_exit' => :'JourneyEarlyExit', + :'reentry_rules' => :'JourneyReentryRules', + :'schedule' => :'JourneySchedule', + :'nodes' => :'Array', + :'state' => :'String', + :'concurrency_key' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'description', + :'early_exit', + :'reentry_rules', + :'schedule', + :'concurrency_key' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::UpdateJourneyRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::UpdateJourneyRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'audience') + self.audience = attributes[:'audience'] + end + + if attributes.key?(:'early_exit') + self.early_exit = attributes[:'early_exit'] + end + + if attributes.key?(:'reentry_rules') + self.reentry_rules = attributes[:'reentry_rules'] + end + + if attributes.key?(:'schedule') + self.schedule = attributes[:'schedule'] + end + + if attributes.key?(:'nodes') + if (value = attributes[:'nodes']).is_a?(Array) + self.nodes = value + end + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'concurrency_key') + self.concurrency_key = attributes[:'concurrency_key'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + state_validator = EnumAttributeValidator.new('String', ["draft", "scheduled", "active", "archived"]) + return false unless state_validator.valid?(@state) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] state Object to be assigned + def state=(state) + validator = EnumAttributeValidator.new('String', ["draft", "scheduled", "active", "archived"]) + unless validator.valid?(state) + fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}." + end + @state = state + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + description == o.description && + audience == o.audience && + early_exit == o.early_exit && + reentry_rules == o.reentry_rules && + schedule == o.schedule && + nodes == o.nodes && + state == o.state && + concurrency_key == o.concurrency_key + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, description, audience, early_exit, reentry_rules, schedule, nodes, state, concurrency_key].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/version.rb b/lib/onesignal/version.rb index d833686..a9db917 100644 --- a/lib/onesignal/version.rb +++ b/lib/onesignal/version.rb @@ -10,5 +10,5 @@ =end module OneSignal - VERSION = '5.11.2' + VERSION = '5.12.0' end diff --git a/spec/api/default_api_spec.rb b/spec/api/default_api_spec.rb index 5cab27b..9364fe3 100644 --- a/spec/api/default_api_spec.rb +++ b/spec/api/default_api_spec.rb @@ -123,6 +123,19 @@ end end + # unit tests for create_journey + # Create journey + # The Journeys API is in beta. Endpoints and response fields can still change. Create a new journey with an audience and a node graph. Journeys are always created in the draft state. The authenticated App API key must have permission to create journeys. + # @param app_id Your OneSignal App ID in UUID v4 format. + # @param create_journey_request + # @param [Hash] opts the optional parameters + # @return [Journey] + describe 'create_journey test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + # unit tests for create_notification # Create notification # Sends notifications to your users. **Target by External ID (push example):** set `include_aliases` to `{ \"external_id\": [\"your-user-id\"] }` and set `target_channel` to `push` (or `email` / `sms` for those channels). Alias object keys must match API labels exactly (for example `external_id`, not camelCase). **Do not confuse** the notification-level `external_id` field with External ID targeting: top-level `external_id` / `idempotency_key` are for idempotent notification requests only, not for selecting recipients. **Targeting compatibility:** `include_aliases` must not be combined with other targeting modes (segments, filters, subscription IDs, legacy player IDs, etc.). Clients should send only one targeting strategy per request. @@ -213,6 +226,19 @@ end end + # unit tests for delete_journey + # Delete journey + # The Journeys API is in beta. Endpoints and response fields can still change. Permanently delete a journey by its UUID. Returns { \"success\": true } on success. The authenticated App API key must have permission to delete journeys. Deleting a journey stops any in-flight users and cannot be undone. Archive a running journey instead if you need to keep its data. + # @param app_id Your OneSignal App ID in UUID v4 format. + # @param journey_id UUID of the journey to delete. + # @param [Hash] opts the optional parameters + # @return [GenericSuccessBoolResponse] + describe 'delete_journey test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + # unit tests for delete_segment # Delete Segment # Delete a segment (not user devices) - Required: OneSignal Paid Plan You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header that has admin access on the app. The segment_id can be found in the URL of the segment when viewing it in the dashboard. @@ -542,6 +568,35 @@ end end + # unit tests for update_journey + # Update journey + # The Journeys API is in beta. Endpoints and response fields can still change. Apply a partial update to a journey using JSON Merge Patch (RFC 7396). Send only the fields you want to change; omitted fields are left unchanged. A null value clears a nullable field, and arrays such as nodes are replaced wholesale. Set state to active to activate a draft journey. + # @param app_id Your OneSignal App ID in UUID v4 format. + # @param journey_id UUID of the journey to update. + # @param update_journey_request + # @param [Hash] opts the optional parameters + # @return [Journey] + describe 'update_journey test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for update_journey_node + # Update journey node + # The Journeys API is in beta. Endpoints and response fields can still change. Apply a partial update to a single node, located by its server-assigned id, using JSON Merge Patch (RFC 7396). Send only the node fields you want to change; the rest of the node and the rest of the journey graph are left untouched. Returns the full updated journey. + # @param app_id Your OneSignal App ID in UUID v4 format. + # @param journey_id UUID of the journey that owns the node. + # @param node_id Server-assigned UUID of the node to update, from a prior View journey fetch. + # @param update_journey_node_request + # @param [Hash] opts the optional parameters + # @return [Journey] + describe 'update_journey_node test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + # unit tests for update_live_activity # Update a Live Activity via Push # Updates a specified live activity. @@ -638,6 +693,46 @@ end end + # unit tests for view_journey + # View journey + # The Journeys API is in beta. Endpoints and response fields can still change. Retrieve the full configuration of a single journey by its UUID, including its audience and node graph. + # @param app_id Your OneSignal App ID in UUID v4 format. + # @param journey_id UUID of the journey to retrieve. + # @param [Hash] opts the optional parameters + # @return [Journey] + describe 'view_journey test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for view_journey_stats + # View journey stats + # The Journeys API is in beta. Endpoints and response fields can still change. Retrieve performance stats for a single journey: journey-level entry and exit counts, per-node counts keyed by node id, per-branch counts keyed by branch id, and channel delivery stats for message-sending nodes. The response carries no definition detail, so join it by id against the journey from View journey. + # @param app_id Your OneSignal App ID in UUID v4 format. + # @param journey_id UUID of the journey to retrieve stats for. + # @param [Hash] opts the optional parameters + # @return [JourneyStats] + describe 'view_journey_stats test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + # unit tests for view_journeys + # View journeys + # The Journeys API is in beta. Endpoints and response fields can still change. Retrieve a paginated list of journeys for an app. Returns a summary representation of each journey; use View journey for the full configuration. Uses forward-only cursor-based pagination. + # @param app_id Your OneSignal App ID in UUID v4 format. + # @param [Hash] opts the optional parameters + # @option opts [String] :cursor Opaque pagination token from a previous response's next_cursor. Omit for the first page. + # @option opts [Integer] :limit Maximum journeys to return per page. Minimum 1, maximum 50. + # @return [JourneyListResponse] + describe 'view_journeys test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + # unit tests for view_template # View template # Fetch a single template by id. diff --git a/spec/models/create_journey_request_spec.rb b/spec/models/create_journey_request_spec.rb new file mode 100644 index 0000000..18218d3 --- /dev/null +++ b/spec/models/create_journey_request_spec.rb @@ -0,0 +1,69 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::CreateJourneyRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::CreateJourneyRequest do + let(:instance) { OneSignal::CreateJourneyRequest.new } + + describe 'test an instance of CreateJourneyRequest' do + it 'should create an instance of CreateJourneyRequest' do + expect(instance).to be_instance_of(OneSignal::CreateJourneyRequest) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "audience"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "early_exit"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "reentry_rules"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "schedule"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "nodes"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_audience_spec.rb b/spec/models/journey_audience_spec.rb new file mode 100644 index 0000000..36ad6ca --- /dev/null +++ b/spec/models/journey_audience_spec.rb @@ -0,0 +1,67 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyAudience +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyAudience do + let(:instance) { OneSignal::JourneyAudience.new } + + describe 'test an instance of JourneyAudience' do + it 'should create an instance of JourneyAudience' do + expect(instance).to be_instance_of(OneSignal::JourneyAudience) + end + end + describe 'test attribute "kind"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["segment", "event_trigger"]) + # validator.allowable_values.each do |value| + # expect { instance.kind = value }.not_to raise_error + # end + end + end + + describe 'test attribute "included_segment_ids"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "excluded_segment_ids"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "future_additions_only"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "attributes"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_branch_spec.rb b/spec/models/journey_branch_spec.rb new file mode 100644 index 0000000..9be4ca0 --- /dev/null +++ b/spec/models/journey_branch_spec.rb @@ -0,0 +1,51 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyBranch +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyBranch do + let(:instance) { OneSignal::JourneyBranch.new } + + describe 'test an instance of JourneyBranch' do + it 'should create an instance of JourneyBranch' do + expect(instance).to be_instance_of(OneSignal::JourneyBranch) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "condition"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "weight"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "nodes"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_branch_stats_spec.rb b/spec/models/journey_branch_stats_spec.rb new file mode 100644 index 0000000..94ad68c --- /dev/null +++ b/spec/models/journey_branch_stats_spec.rb @@ -0,0 +1,33 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyBranchStats +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyBranchStats do + let(:instance) { OneSignal::JourneyBranchStats.new } + + describe 'test an instance of JourneyBranchStats' do + it 'should create an instance of JourneyBranchStats' do + expect(instance).to be_instance_of(OneSignal::JourneyBranchStats) + end + end + describe 'test attribute "completed"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_condition_spec.rb b/spec/models/journey_condition_spec.rb new file mode 100644 index 0000000..9d47b8a --- /dev/null +++ b/spec/models/journey_condition_spec.rb @@ -0,0 +1,89 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyCondition +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyCondition do + let(:instance) { OneSignal::JourneyCondition.new } + + describe 'test an instance of JourneyCondition' do + it 'should create an instance of JourneyCondition' do + expect(instance).to be_instance_of(OneSignal::JourneyCondition) + end + end + describe 'test attribute "kind"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["segment_membership", "on_notification_action", "event_trigger"]) + # validator.allowable_values.each do |value| + # expect { instance.kind = value }.not_to raise_error + # end + end + end + + describe 'test attribute "included_segment_ids"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "excluded_segment_ids"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "action"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["received", "clicked", "opened"]) + # validator.allowable_values.each do |value| + # expect { instance.action = value }.not_to raise_error + # end + end + end + + describe 'test attribute "sending_node_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "client_node_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "attributes"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "entry_event_match_attributes"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_early_exit_rules_on_event_spec.rb b/spec/models/journey_early_exit_rules_on_event_spec.rb new file mode 100644 index 0000000..6270488 --- /dev/null +++ b/spec/models/journey_early_exit_rules_on_event_spec.rb @@ -0,0 +1,33 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyEarlyExitRulesOnEvent +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyEarlyExitRulesOnEvent do + let(:instance) { OneSignal::JourneyEarlyExitRulesOnEvent.new } + + describe 'test an instance of JourneyEarlyExitRulesOnEvent' do + it 'should create an instance of JourneyEarlyExitRulesOnEvent' do + expect(instance).to be_instance_of(OneSignal::JourneyEarlyExitRulesOnEvent) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_early_exit_rules_on_segment_spec.rb b/spec/models/journey_early_exit_rules_on_segment_spec.rb new file mode 100644 index 0000000..48dfdf9 --- /dev/null +++ b/spec/models/journey_early_exit_rules_on_segment_spec.rb @@ -0,0 +1,33 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyEarlyExitRulesOnSegment +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyEarlyExitRulesOnSegment do + let(:instance) { OneSignal::JourneyEarlyExitRulesOnSegment.new } + + describe 'test an instance of JourneyEarlyExitRulesOnSegment' do + it 'should create an instance of JourneyEarlyExitRulesOnSegment' do + expect(instance).to be_instance_of(OneSignal::JourneyEarlyExitRulesOnSegment) + end + end + describe 'test attribute "included_segment_ids"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_early_exit_rules_spec.rb b/spec/models/journey_early_exit_rules_spec.rb new file mode 100644 index 0000000..daaf424 --- /dev/null +++ b/spec/models/journey_early_exit_rules_spec.rb @@ -0,0 +1,51 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyEarlyExitRules +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyEarlyExitRules do + let(:instance) { OneSignal::JourneyEarlyExitRules.new } + + describe 'test an instance of JourneyEarlyExitRules' do + it 'should create an instance of JourneyEarlyExitRules' do + expect(instance).to be_instance_of(OneSignal::JourneyEarlyExitRules) + end + end + describe 'test attribute "on_segment"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "when_not_in_audience"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "on_session"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "on_event"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_early_exit_spec.rb b/spec/models/journey_early_exit_spec.rb new file mode 100644 index 0000000..71b939e --- /dev/null +++ b/spec/models/journey_early_exit_spec.rb @@ -0,0 +1,39 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyEarlyExit +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyEarlyExit do + let(:instance) { OneSignal::JourneyEarlyExit.new } + + describe 'test an instance of JourneyEarlyExit' do + it 'should create an instance of JourneyEarlyExit' do + expect(instance).to be_instance_of(OneSignal::JourneyEarlyExit) + end + end + describe 'test attribute "rules"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "tag_on_early_exit"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_event_attribute_spec.rb b/spec/models/journey_event_attribute_spec.rb new file mode 100644 index 0000000..ae566c6 --- /dev/null +++ b/spec/models/journey_event_attribute_spec.rb @@ -0,0 +1,49 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyEventAttribute +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyEventAttribute do + let(:instance) { OneSignal::JourneyEventAttribute.new } + + describe 'test an instance of JourneyEventAttribute' do + it 'should create an instance of JourneyEventAttribute' do + expect(instance).to be_instance_of(OneSignal::JourneyEventAttribute) + end + end + describe 'test attribute "key"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "operator"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["equal", "not_equal", "less", "less_or_equal", "greater_or_equal", "greater", "is", "is_not", "exists", "not_exists", "before", "after"]) + # validator.allowable_values.each do |value| + # expect { instance.operator = value }.not_to raise_error + # end + end + end + + describe 'test attribute "value"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_list_audience_spec.rb b/spec/models/journey_list_audience_spec.rb new file mode 100644 index 0000000..c1105b1 --- /dev/null +++ b/spec/models/journey_list_audience_spec.rb @@ -0,0 +1,37 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyListAudience +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyListAudience do + let(:instance) { OneSignal::JourneyListAudience.new } + + describe 'test an instance of JourneyListAudience' do + it 'should create an instance of JourneyListAudience' do + expect(instance).to be_instance_of(OneSignal::JourneyListAudience) + end + end + describe 'test attribute "kind"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["segment", "event_trigger"]) + # validator.allowable_values.each do |value| + # expect { instance.kind = value }.not_to raise_error + # end + end + end + +end diff --git a/spec/models/journey_list_item_spec.rb b/spec/models/journey_list_item_spec.rb new file mode 100644 index 0000000..1cfd44b --- /dev/null +++ b/spec/models/journey_list_item_spec.rb @@ -0,0 +1,103 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyListItem +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyListItem do + let(:instance) { OneSignal::JourneyListItem.new } + + describe 'test an instance of JourneyListItem' do + it 'should create an instance of JourneyListItem' do + expect(instance).to be_instance_of(OneSignal::JourneyListItem) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "app_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "state"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["draft", "scheduled", "processing", "active", "archived"]) + # validator.allowable_values.each do |value| + # expect { instance.state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "started_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "archived_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_source"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "schedule"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "audience"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "reentry_rules"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_list_response_spec.rb b/spec/models/journey_list_response_spec.rb new file mode 100644 index 0000000..9a3c439 --- /dev/null +++ b/spec/models/journey_list_response_spec.rb @@ -0,0 +1,45 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyListResponse +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyListResponse do + let(:instance) { OneSignal::JourneyListResponse.new } + + describe 'test an instance of JourneyListResponse' do + it 'should create an instance of JourneyListResponse' do + expect(instance).to be_instance_of(OneSignal::JourneyListResponse) + end + end + describe 'test attribute "journeys"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "has_more"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "next_cursor"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_message_stats_spec.rb b/spec/models/journey_message_stats_spec.rb new file mode 100644 index 0000000..462ebec --- /dev/null +++ b/spec/models/journey_message_stats_spec.rb @@ -0,0 +1,33 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyMessageStats +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyMessageStats do + let(:instance) { OneSignal::JourneyMessageStats.new } + + describe 'test an instance of JourneyMessageStats' do + it 'should create an instance of JourneyMessageStats' do + expect(instance).to be_instance_of(OneSignal::JourneyMessageStats) + end + end + describe 'test attribute "totals"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_node_spec.rb b/spec/models/journey_node_spec.rb new file mode 100644 index 0000000..6e4f96f --- /dev/null +++ b/spec/models/journey_node_spec.rb @@ -0,0 +1,137 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyNode +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyNode do + let(:instance) { OneSignal::JourneyNode.new } + + describe 'test an instance of JourneyNode' do + it 'should create an instance of JourneyNode' do + expect(instance).to be_instance_of(OneSignal::JourneyNode) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "kind"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["wait", "time_window", "send_push", "send_email", "send_sms", "send_iam", "send_webhook", "tag", "split_range", "yes_no", "wait_until"]) + # validator.allowable_values.each do |value| + # expect { instance.kind = value }.not_to raise_error + # end + end + end + + describe 'test attribute "client_node_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "annotation"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "duration_seconds"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "relative_to"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["schedule_in_timezone", "last_active_time"]) + # validator.allowable_values.each do |value| + # expect { instance.relative_to = value }.not_to raise_error + # end + end + end + + describe 'test attribute "windows"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "time_zone"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "use_user_time_zone"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "template_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "iam_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "user_ttl_seconds"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "webhook_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "assignments"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "randomize_on_entry"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "branches"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "expiration"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_node_stats_spec.rb b/spec/models/journey_node_stats_spec.rb new file mode 100644 index 0000000..93447e4 --- /dev/null +++ b/spec/models/journey_node_stats_spec.rb @@ -0,0 +1,61 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyNodeStats +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyNodeStats do + let(:instance) { OneSignal::JourneyNodeStats.new } + + describe 'test an instance of JourneyNodeStats' do + it 'should create an instance of JourneyNodeStats' do + expect(instance).to be_instance_of(OneSignal::JourneyNodeStats) + end + end + describe 'test attribute "kind"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["wait", "time_window", "send_push", "send_email", "send_sms", "send_iam", "send_webhook", "tag", "split_range", "yes_no", "wait_until"]) + # validator.allowable_values.each do |value| + # expect { instance.kind = value }.not_to raise_error + # end + end + end + + describe 'test attribute "waiting"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "completed"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "exited_early"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "message_stats"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_reentry_rules_spec.rb b/spec/models/journey_reentry_rules_spec.rb new file mode 100644 index 0000000..f5526ca --- /dev/null +++ b/spec/models/journey_reentry_rules_spec.rb @@ -0,0 +1,33 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyReentryRules +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyReentryRules do + let(:instance) { OneSignal::JourneyReentryRules.new } + + describe 'test an instance of JourneyReentryRules' do + it 'should create an instance of JourneyReentryRules' do + expect(instance).to be_instance_of(OneSignal::JourneyReentryRules) + end + end + describe 'test attribute "duration_seconds"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_schedule_spec.rb b/spec/models/journey_schedule_spec.rb new file mode 100644 index 0000000..b21259c --- /dev/null +++ b/spec/models/journey_schedule_spec.rb @@ -0,0 +1,45 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneySchedule +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneySchedule do + let(:instance) { OneSignal::JourneySchedule.new } + + describe 'test an instance of JourneySchedule' do + it 'should create an instance of JourneySchedule' do + expect(instance).to be_instance_of(OneSignal::JourneySchedule) + end + end + describe 'test attribute "start_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "stop_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "error"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_spec.rb b/spec/models/journey_spec.rb new file mode 100644 index 0000000..12847fa --- /dev/null +++ b/spec/models/journey_spec.rb @@ -0,0 +1,127 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::Journey +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::Journey do + let(:instance) { OneSignal::Journey.new } + + describe 'test an instance of Journey' do + it 'should create an instance of Journey' do + expect(instance).to be_instance_of(OneSignal::Journey) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "app_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "state"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["draft", "scheduled", "processing", "active", "archived"]) + # validator.allowable_values.each do |value| + # expect { instance.state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "updated_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "started_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "archived_at"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "created_source"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "audience"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "early_exit"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "reentry_rules"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "schedule"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "nodes"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "concurrency_key"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_stats_spec.rb b/spec/models/journey_stats_spec.rb new file mode 100644 index 0000000..0b31502 --- /dev/null +++ b/spec/models/journey_stats_spec.rb @@ -0,0 +1,63 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyStats +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyStats do + let(:instance) { OneSignal::JourneyStats.new } + + describe 'test an instance of JourneyStats' do + it 'should create an instance of JourneyStats' do + expect(instance).to be_instance_of(OneSignal::JourneyStats) + end + end + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "started"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "completed"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "exited_early"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "nodes"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "branches"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_time_point_spec.rb b/spec/models/journey_time_point_spec.rb new file mode 100644 index 0000000..6b85622 --- /dev/null +++ b/spec/models/journey_time_point_spec.rb @@ -0,0 +1,39 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyTimePoint +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyTimePoint do + let(:instance) { OneSignal::JourneyTimePoint.new } + + describe 'test an instance of JourneyTimePoint' do + it 'should create an instance of JourneyTimePoint' do + expect(instance).to be_instance_of(OneSignal::JourneyTimePoint) + end + end + describe 'test attribute "hour"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "minute"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_time_window_spec.rb b/spec/models/journey_time_window_spec.rb new file mode 100644 index 0000000..0d6a0b7 --- /dev/null +++ b/spec/models/journey_time_window_spec.rb @@ -0,0 +1,45 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyTimeWindow +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyTimeWindow do + let(:instance) { OneSignal::JourneyTimeWindow.new } + + describe 'test an instance of JourneyTimeWindow' do + it 'should create an instance of JourneyTimeWindow' do + expect(instance).to be_instance_of(OneSignal::JourneyTimeWindow) + end + end + describe 'test attribute "start"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "_end"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "day_of_week"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/journey_wait_until_expiration_spec.rb b/spec/models/journey_wait_until_expiration_spec.rb new file mode 100644 index 0000000..137c3b2 --- /dev/null +++ b/spec/models/journey_wait_until_expiration_spec.rb @@ -0,0 +1,39 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::JourneyWaitUntilExpiration +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::JourneyWaitUntilExpiration do + let(:instance) { OneSignal::JourneyWaitUntilExpiration.new } + + describe 'test an instance of JourneyWaitUntilExpiration' do + it 'should create an instance of JourneyWaitUntilExpiration' do + expect(instance).to be_instance_of(OneSignal::JourneyWaitUntilExpiration) + end + end + describe 'test attribute "duration_seconds"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "exits"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/update_journey_node_request_spec.rb b/spec/models/update_journey_node_request_spec.rb new file mode 100644 index 0000000..20769b6 --- /dev/null +++ b/spec/models/update_journey_node_request_spec.rb @@ -0,0 +1,127 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::UpdateJourneyNodeRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::UpdateJourneyNodeRequest do + let(:instance) { OneSignal::UpdateJourneyNodeRequest.new } + + describe 'test an instance of UpdateJourneyNodeRequest' do + it 'should create an instance of UpdateJourneyNodeRequest' do + expect(instance).to be_instance_of(OneSignal::UpdateJourneyNodeRequest) + end + end + describe 'test attribute "client_node_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "annotation"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "duration_seconds"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "relative_to"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["schedule_in_timezone", "last_active_time"]) + # validator.allowable_values.each do |value| + # expect { instance.relative_to = value }.not_to raise_error + # end + end + end + + describe 'test attribute "windows"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "time_zone"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "use_user_time_zone"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "template_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "iam_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "user_ttl_seconds"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "webhook_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "assignments"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "randomize_on_entry"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "branches"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "expiration"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "concurrency_key"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/update_journey_request_spec.rb b/spec/models/update_journey_request_spec.rb new file mode 100644 index 0000000..0e73425 --- /dev/null +++ b/spec/models/update_journey_request_spec.rb @@ -0,0 +1,85 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::UpdateJourneyRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::UpdateJourneyRequest do + let(:instance) { OneSignal::UpdateJourneyRequest.new } + + describe 'test an instance of UpdateJourneyRequest' do + it 'should create an instance of UpdateJourneyRequest' do + expect(instance).to be_instance_of(OneSignal::UpdateJourneyRequest) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "audience"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "early_exit"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "reentry_rules"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "schedule"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "nodes"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "state"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["draft", "scheduled", "active", "archived"]) + # validator.allowable_values.each do |value| + # expect { instance.state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "concurrency_key"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end