onesignal 5.15.0 → 5.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/Gemfile.lock +2 -2
  4. data/README.md +3 -3
  5. data/docs/DefaultApi.md +166 -6
  6. data/docs/DuplicateJourneyOverrides.md +30 -0
  7. data/docs/DuplicateJourneyRequest.md +18 -0
  8. data/docs/EmailReputationResponse.md +22 -0
  9. data/docs/EmailReputationWindow.md +20 -0
  10. data/docs/JourneyNode.md +2 -2
  11. data/docs/UpdateJourneyNodeRequest.md +2 -2
  12. data/lib/onesignal/api/default_api.rb +145 -6
  13. data/lib/onesignal/api_client.rb +1 -1
  14. data/lib/onesignal/models/duplicate_journey_overrides.rb +282 -0
  15. data/lib/onesignal/models/duplicate_journey_request.rb +219 -0
  16. data/lib/onesignal/models/email_reputation_response.rb +237 -0
  17. data/lib/onesignal/models/email_reputation_window.rb +230 -0
  18. data/lib/onesignal/models/journey.rb +1 -1
  19. data/lib/onesignal/models/journey_node.rb +2 -2
  20. data/lib/onesignal/models/update_journey_node_request.rb +2 -2
  21. data/lib/onesignal/version.rb +1 -1
  22. data/lib/onesignal.rb +4 -0
  23. data/spec/api/default_api_spec.rb +29 -3
  24. data/spec/models/duplicate_journey_overrides_spec.rb +69 -0
  25. data/spec/models/duplicate_journey_request_spec.rb +33 -0
  26. data/spec/models/email_reputation_response_spec.rb +45 -0
  27. data/spec/models/email_reputation_window_spec.rb +39 -0
  28. data/vendor/bundle/ruby/3.2.0/cache/io-console-0.9.4.gem +0 -0
  29. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-13.0.0/gem_make.out +5 -5
  30. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.5.1/gem_make.out +5 -5
  31. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{io-console-0.9.2 → io-console-0.9.4}/gem_make.out +12 -10
  32. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.9.4/io/console.so +0 -0
  33. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{io-console-0.9.2 → io-console-0.9.4}/mkmf.log +33 -6
  34. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
  35. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.5.0/gem_make.out +5 -5
  36. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.1/gem_make.out +5 -5
  37. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/gem_make.out +5 -5
  38. data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.4}/ext/io/console/Makefile +3 -3
  39. data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.4}/ext/io/console/console.c +101 -13
  40. data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.4}/ext/io/console/extconf.rb +27 -2
  41. data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.4}/lib/io/console/size.rb +4 -2
  42. data/vendor/bundle/ruby/3.2.0/gems/io-console-0.9.4/lib/io/console.so +0 -0
  43. data/vendor/bundle/ruby/3.2.0/specifications/{io-console-0.9.2.gemspec → io-console-0.9.4.gemspec} +3 -3
  44. metadata +125 -109
  45. data/vendor/bundle/ruby/3.2.0/cache/io-console-0.9.2.gem +0 -0
  46. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.9.2/io/console.so +0 -0
  47. data/vendor/bundle/ruby/3.2.0/gems/io-console-0.9.2/lib/io/console.so +0 -0
  48. /data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{io-console-0.9.2 → io-console-0.9.4}/gem.build_complete +0 -0
  49. /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.4}/.document +0 -0
  50. /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.4}/BSDL +0 -0
  51. /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.4}/COPYING +0 -0
  52. /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.4}/README.md +0 -0
  53. /data/vendor/bundle/ruby/3.2.0/gems/{io-console-0.9.2 → io-console-0.9.4}/ext/io/console/win32_vk.inc +0 -0
@@ -1203,7 +1203,7 @@ module OneSignal
1203
1203
  # Delete Segment
1204
1204
  # 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.
1205
1205
  # @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs.
1206
- # @param segment_id [String] The segment_id can be found in the URL of the segment when viewing it in the dashboard.
1206
+ # @param segment_id [String] The segment's unique identifier. In the dashboard, go to Audience > Segments, open the segment's options menu, and select Copy segment ID. You can also get it from the View Segments API or the segment's URL in the dashboard.
1207
1207
  # @param [Hash] opts the optional parameters
1208
1208
  # @return [GenericSuccessBoolResponse]
1209
1209
  def delete_segment(app_id, segment_id, opts = {})
@@ -1214,7 +1214,7 @@ module OneSignal
1214
1214
  # Delete Segment
1215
1215
  # 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.
1216
1216
  # @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs.
1217
- # @param segment_id [String] The segment_id can be found in the URL of the segment when viewing it in the dashboard.
1217
+ # @param segment_id [String] The segment's unique identifier. In the dashboard, go to Audience > Segments, open the segment's options menu, and select Copy segment ID. You can also get it from the View Segments API or the segment's URL in the dashboard.
1218
1218
  # @param [Hash] opts the optional parameters
1219
1219
  # @return [Array<(GenericSuccessBoolResponse, Integer, Hash)>] GenericSuccessBoolResponse data, response status code and response headers
1220
1220
  def delete_segment_with_http_info(app_id, segment_id, opts = {})
@@ -1479,6 +1479,82 @@ module OneSignal
1479
1479
  return data, status_code, headers
1480
1480
  end
1481
1481
 
1482
+ # Duplicate journey
1483
+ # The Journeys API is in beta. Endpoints and response fields can still change. Copy an existing journey into a new draft. The source does not change. The copy is always a draft, and started_at and archived_at are null. If you omit the body, or omit overrides, the copy keeps the source description, audience, nodes, early_exit, and reentry_rules. The copy takes the source name plus \" (Copy)\". The copy does not keep schedule. Send schedule under overrides to set it. Server-controlled fields are rejected with 400. The authenticated App API key must have permission to create journeys.
1484
+ # @param app_id [String] Your OneSignal App ID in UUID v4 format.
1485
+ # @param journey_id [String] UUID of the journey to copy.
1486
+ # @param [Hash] opts the optional parameters
1487
+ # @option opts [DuplicateJourneyRequest] :duplicate_journey_request
1488
+ # @return [Journey]
1489
+ def duplicate_journey(app_id, journey_id, opts = {})
1490
+ data, _status_code, _headers = duplicate_journey_with_http_info(app_id, journey_id, opts)
1491
+ data
1492
+ end
1493
+
1494
+ # Duplicate journey
1495
+ # The Journeys API is in beta. Endpoints and response fields can still change. Copy an existing journey into a new draft. The source does not change. The copy is always a draft, and started_at and archived_at are null. If you omit the body, or omit overrides, the copy keeps the source description, audience, nodes, early_exit, and reentry_rules. The copy takes the source name plus \&quot; (Copy)\&quot;. The copy does not keep schedule. Send schedule under overrides to set it. Server-controlled fields are rejected with 400. The authenticated App API key must have permission to create journeys.
1496
+ # @param app_id [String] Your OneSignal App ID in UUID v4 format.
1497
+ # @param journey_id [String] UUID of the journey to copy.
1498
+ # @param [Hash] opts the optional parameters
1499
+ # @option opts [DuplicateJourneyRequest] :duplicate_journey_request
1500
+ # @return [Array<(Journey, Integer, Hash)>] Journey data, response status code and response headers
1501
+ def duplicate_journey_with_http_info(app_id, journey_id, opts = {})
1502
+ if @api_client.config.debugging
1503
+ @api_client.config.logger.debug 'Calling API: DefaultApi.duplicate_journey ...'
1504
+ end
1505
+ # verify the required parameter 'app_id' is set
1506
+ if @api_client.config.client_side_validation && app_id.nil?
1507
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.duplicate_journey"
1508
+ end
1509
+ # verify the required parameter 'journey_id' is set
1510
+ if @api_client.config.client_side_validation && journey_id.nil?
1511
+ fail ArgumentError, "Missing the required parameter 'journey_id' when calling DefaultApi.duplicate_journey"
1512
+ end
1513
+ # resource path
1514
+ local_var_path = '/apps/{app_id}/journeys/{journey_id}/duplicate'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'journey_id' + '}', CGI.escape(journey_id.to_s))
1515
+
1516
+ # query parameters
1517
+ query_params = opts[:query_params] || {}
1518
+
1519
+ # header parameters
1520
+ header_params = opts[:header_params] || {}
1521
+ # HTTP header 'Accept' (if needed)
1522
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1523
+ # HTTP header 'Content-Type'
1524
+ content_type = @api_client.select_header_content_type(['application/json'])
1525
+ if !content_type.nil?
1526
+ header_params['Content-Type'] = content_type
1527
+ end
1528
+
1529
+ # form parameters
1530
+ form_params = opts[:form_params] || {}
1531
+
1532
+ # http body (model)
1533
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'duplicate_journey_request'])
1534
+
1535
+ # return_type
1536
+ return_type = opts[:debug_return_type] || 'Journey'
1537
+
1538
+ # auth_names
1539
+ auth_names = opts[:debug_auth_names] || ['rest_api_key']
1540
+
1541
+ new_options = opts.merge(
1542
+ :operation => :"DefaultApi.duplicate_journey",
1543
+ :header_params => header_params,
1544
+ :query_params => query_params,
1545
+ :form_params => form_params,
1546
+ :body => post_body,
1547
+ :auth_names => auth_names,
1548
+ :return_type => return_type
1549
+ )
1550
+
1551
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1552
+ if @api_client.config.debugging
1553
+ @api_client.config.logger.debug "API called: DefaultApi#duplicate_journey\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1554
+ end
1555
+ return data, status_code, headers
1556
+ end
1557
+
1482
1558
  # Estimate notification recipients
1483
1559
  # Returns the estimated number of recipients for a notification's targeting, without creating or sending anything. The returned `count` reflects the same audience-size estimate you would see under \"Choose your target audience\" when composing a message. It is based on the user targeting method you've set and the specific platforms the message is targeted to send to. This endpoint only supports a subset of targeting parameters: `included_segments` is required (its `\"All\"` shorthand targets every subscriber), and `excluded_segments`, `filters`, `include_aliases`, and `target_channel` narrow that audience further. Use `target_channel` to select platforms. `include_subscription_ids` and the other raw subscription id/token fields, and the individual `isIos` / `isAndroid` / etc. platform flags, are not supported. All other notification fields (content, delivery options, and so on) are accepted, but ignored.
1484
1560
  # @param estimate_notification_recipients_request [EstimateNotificationRecipientsRequest]
@@ -1947,6 +2023,69 @@ module OneSignal
1947
2023
  return data, status_code, headers
1948
2024
  end
1949
2025
 
2026
+ # Get email reputation statistics
2027
+ # The email bounce and spam complaint rates received for the app over the last 24 hours, 7 days, and 30 days. Rates are expressed as fractions of successfully delivered emails (for example, `0.02` means 2%). A window reports `0` for both rates when the app has not successfully delivered any email in that period.
2028
+ # @param app_id [String] Your OneSignal App ID in UUID v4 format.
2029
+ # @param [Hash] opts the optional parameters
2030
+ # @return [EmailReputationResponse]
2031
+ def get_email_reputation(app_id, opts = {})
2032
+ data, _status_code, _headers = get_email_reputation_with_http_info(app_id, opts)
2033
+ data
2034
+ end
2035
+
2036
+ # Get email reputation statistics
2037
+ # The email bounce and spam complaint rates received for the app over the last 24 hours, 7 days, and 30 days. Rates are expressed as fractions of successfully delivered emails (for example, &#x60;0.02&#x60; means 2%). A window reports &#x60;0&#x60; for both rates when the app has not successfully delivered any email in that period.
2038
+ # @param app_id [String] Your OneSignal App ID in UUID v4 format.
2039
+ # @param [Hash] opts the optional parameters
2040
+ # @return [Array<(EmailReputationResponse, Integer, Hash)>] EmailReputationResponse data, response status code and response headers
2041
+ def get_email_reputation_with_http_info(app_id, opts = {})
2042
+ if @api_client.config.debugging
2043
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_email_reputation ...'
2044
+ end
2045
+ # verify the required parameter 'app_id' is set
2046
+ if @api_client.config.client_side_validation && app_id.nil?
2047
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_email_reputation"
2048
+ end
2049
+ # resource path
2050
+ local_var_path = '/apps/{app_id}/email_analytics/delivery_metrics'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
2051
+
2052
+ # query parameters
2053
+ query_params = opts[:query_params] || {}
2054
+
2055
+ # header parameters
2056
+ header_params = opts[:header_params] || {}
2057
+ # HTTP header 'Accept' (if needed)
2058
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2059
+
2060
+ # form parameters
2061
+ form_params = opts[:form_params] || {}
2062
+
2063
+ # http body (model)
2064
+ post_body = opts[:debug_body]
2065
+
2066
+ # return_type
2067
+ return_type = opts[:debug_return_type] || 'EmailReputationResponse'
2068
+
2069
+ # auth_names
2070
+ auth_names = opts[:debug_auth_names] || ['rest_api_key']
2071
+
2072
+ new_options = opts.merge(
2073
+ :operation => :"DefaultApi.get_email_reputation",
2074
+ :header_params => header_params,
2075
+ :query_params => query_params,
2076
+ :form_params => form_params,
2077
+ :body => post_body,
2078
+ :auth_names => auth_names,
2079
+ :return_type => return_type
2080
+ )
2081
+
2082
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
2083
+ if @api_client.config.debugging
2084
+ @api_client.config.logger.debug "API called: DefaultApi#get_email_reputation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2085
+ end
2086
+ return data, status_code, headers
2087
+ end
2088
+
1950
2089
  # View notification
1951
2090
  # View the details of a single notification and outcomes associated with it
1952
2091
  # @param app_id [String]
@@ -2256,7 +2395,7 @@ module OneSignal
2256
2395
  # View Segment
2257
2396
  # Retrieve details for a single segment by its ID, including subscriber count and optionally segment metadata and filters.
2258
2397
  # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
2259
- # @param segment_id [String] The segment&#39;s unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard.
2398
+ # @param segment_id [String] The segment&#39;s unique identifier. In the dashboard, go to Audience &gt; Segments, open the segment&#39;s options menu, and select Copy segment ID. You can also get it from the View Segments API or the segment&#39;s URL in the dashboard.
2260
2399
  # @param [Hash] opts the optional parameters
2261
2400
  # @option opts [Boolean] :include_segment_detail Set to true to include segment metadata and filters in the response.
2262
2401
  # @return [GetSegmentSuccessResponse]
@@ -2268,7 +2407,7 @@ module OneSignal
2268
2407
  # View Segment
2269
2408
  # Retrieve details for a single segment by its ID, including subscriber count and optionally segment metadata and filters.
2270
2409
  # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
2271
- # @param segment_id [String] The segment&#39;s unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard.
2410
+ # @param segment_id [String] The segment&#39;s unique identifier. In the dashboard, go to Audience &gt; Segments, open the segment&#39;s options menu, and select Copy segment ID. You can also get it from the View Segments API or the segment&#39;s URL in the dashboard.
2272
2411
  # @param [Hash] opts the optional parameters
2273
2412
  # @option opts [Boolean] :include_segment_detail Set to true to include segment metadata and filters in the response.
2274
2413
  # @return [Array<(GetSegmentSuccessResponse, Integer, Hash)>] GetSegmentSuccessResponse data, response status code and response headers
@@ -3297,7 +3436,7 @@ module OneSignal
3297
3436
  # Update Segment
3298
3437
  # Update an existing segment's name and/or filters. The name parameter is always required. When filters are provided, all existing filters are replaced with the new ones.
3299
3438
  # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
3300
- # @param segment_id [String] The segment&#39;s unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard.
3439
+ # @param segment_id [String] The segment&#39;s unique identifier. In the dashboard, go to Audience &gt; Segments, open the segment&#39;s options menu, and select Copy segment ID. You can also get it from the View Segments API or the segment&#39;s URL in the dashboard.
3301
3440
  # @param [Hash] opts the optional parameters
3302
3441
  # @option opts [UpdateSegmentRequest] :update_segment_request
3303
3442
  # @return [UpdateSegmentSuccessResponse]
@@ -3309,7 +3448,7 @@ module OneSignal
3309
3448
  # Update Segment
3310
3449
  # Update an existing segment&#39;s name and/or filters. The name parameter is always required. When filters are provided, all existing filters are replaced with the new ones.
3311
3450
  # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
3312
- # @param segment_id [String] The segment&#39;s unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard.
3451
+ # @param segment_id [String] The segment&#39;s unique identifier. In the dashboard, go to Audience &gt; Segments, open the segment&#39;s options menu, and select Copy segment ID. You can also get it from the View Segments API or the segment&#39;s URL in the dashboard.
3313
3452
  # @param [Hash] opts the optional parameters
3314
3453
  # @option opts [UpdateSegmentRequest] :update_segment_request
3315
3454
  # @return [Array<(UpdateSegmentSuccessResponse, Integer, Hash)>] UpdateSegmentSuccessResponse data, response status code and response headers
@@ -89,7 +89,7 @@ module OneSignal
89
89
  url = build_request_url(path, opts)
90
90
  http_method = http_method.to_sym.downcase
91
91
 
92
- opts[:header_params]['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-ruby, version=5.15.0'
92
+ opts[:header_params]['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-ruby, version=5.17.0'
93
93
  header_params = @default_headers.merge(opts[:header_params] || {})
94
94
  query_params = opts[:query_params] || {}
95
95
  form_params = opts[:form_params] || {}
@@ -0,0 +1,282 @@
1
+ =begin
2
+ #OneSignal
3
+
4
+ #A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
5
+
6
+ Contact: devrel@onesignal.com
7
+ Generated by: https://openapi-generator.tech
8
+ OpenAPI Generator version: 6.0.0-SNAPSHOT
9
+
10
+ =end
11
+
12
+ require 'date'
13
+ require 'time'
14
+
15
+ module OneSignal
16
+ # Journey fields to apply over the copy as a JSON Merge Patch (RFC 7396). Accepts the same writable fields as Create journey, and none of them are required. The patch merges into the copy, not the source. The copy starts without a schedule, so an omitted schedule leaves the copy unscheduled. An object merges key by key. A null value clears a nullable field. An array such as nodes replaces the copied array. Server-controlled fields such as id or state are rejected.
17
+ class DuplicateJourneyOverrides
18
+ # Name for the copy, up to 300 characters. If you omit it, the copy takes the name of the source plus \" (Copy)\".
19
+ attr_accessor :name
20
+
21
+ # Optional journey description, up to 1024 characters. If you omit it, the copy takes the description of the source. Send null to clear it.
22
+ attr_accessor :description
23
+
24
+ attr_accessor :audience
25
+
26
+ attr_accessor :early_exit
27
+
28
+ attr_accessor :reentry_rules
29
+
30
+ attr_accessor :schedule
31
+
32
+ # Full ordered list of nodes. Replaces the copied graph. Server-assigned id fields are rejected.
33
+ attr_accessor :nodes
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'name' => :'name',
39
+ :'description' => :'description',
40
+ :'audience' => :'audience',
41
+ :'early_exit' => :'early_exit',
42
+ :'reentry_rules' => :'reentry_rules',
43
+ :'schedule' => :'schedule',
44
+ :'nodes' => :'nodes'
45
+ }
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'name' => :'String',
57
+ :'description' => :'String',
58
+ :'audience' => :'JourneyAudience',
59
+ :'early_exit' => :'JourneyEarlyExit',
60
+ :'reentry_rules' => :'JourneyReentryRules',
61
+ :'schedule' => :'JourneySchedule',
62
+ :'nodes' => :'Array<JourneyNode>'
63
+ }
64
+ end
65
+
66
+ # List of attributes with nullable: true
67
+ def self.openapi_nullable
68
+ Set.new([
69
+ :'description',
70
+ :'early_exit',
71
+ :'reentry_rules',
72
+ :'schedule',
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::DuplicateJourneyOverrides` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ attributes = attributes.each_with_object({}) { |(k, v), h|
85
+ if (!self.class.attribute_map.key?(k.to_sym))
86
+ fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::DuplicateJourneyOverrides`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
+ end
88
+ h[k.to_sym] = v
89
+ }
90
+
91
+ if attributes.key?(:'name')
92
+ self.name = attributes[:'name']
93
+ end
94
+
95
+ if attributes.key?(:'description')
96
+ self.description = attributes[:'description']
97
+ end
98
+
99
+ if attributes.key?(:'audience')
100
+ self.audience = attributes[:'audience']
101
+ end
102
+
103
+ if attributes.key?(:'early_exit')
104
+ self.early_exit = attributes[:'early_exit']
105
+ end
106
+
107
+ if attributes.key?(:'reentry_rules')
108
+ self.reentry_rules = attributes[:'reentry_rules']
109
+ end
110
+
111
+ if attributes.key?(:'schedule')
112
+ self.schedule = attributes[:'schedule']
113
+ end
114
+
115
+ if attributes.key?(:'nodes')
116
+ if (value = attributes[:'nodes']).is_a?(Array)
117
+ self.nodes = value
118
+ end
119
+ end
120
+ end
121
+
122
+ # Show invalid properties with the reasons. Usually used together with valid?
123
+ # @return Array for valid properties with the reasons
124
+ def list_invalid_properties
125
+ invalid_properties = Array.new
126
+ invalid_properties
127
+ end
128
+
129
+ # Check to see if the all the properties in the model are valid
130
+ # @return true if the model is valid
131
+ def valid?
132
+ true
133
+ end
134
+
135
+ # Checks equality by comparing each attribute.
136
+ # @param [Object] Object to be compared
137
+ def ==(o)
138
+ return true if self.equal?(o)
139
+ self.class == o.class &&
140
+ name == o.name &&
141
+ description == o.description &&
142
+ audience == o.audience &&
143
+ early_exit == o.early_exit &&
144
+ reentry_rules == o.reentry_rules &&
145
+ schedule == o.schedule &&
146
+ nodes == o.nodes
147
+ end
148
+
149
+ # @see the `==` method
150
+ # @param [Object] Object to be compared
151
+ def eql?(o)
152
+ self == o
153
+ end
154
+
155
+ # Calculates hash code according to all attributes.
156
+ # @return [Integer] Hash code
157
+ def hash
158
+ [name, description, audience, early_exit, reentry_rules, schedule, nodes].hash
159
+ end
160
+
161
+ # Builds the object from hash
162
+ # @param [Hash] attributes Model attributes in the form of hash
163
+ # @return [Object] Returns the model itself
164
+ def self.build_from_hash(attributes)
165
+ new.build_from_hash(attributes)
166
+ end
167
+
168
+ # Builds the object from hash
169
+ # @param [Hash] attributes Model attributes in the form of hash
170
+ # @return [Object] Returns the model itself
171
+ def build_from_hash(attributes)
172
+ return nil unless attributes.is_a?(Hash)
173
+ attributes = attributes.transform_keys(&:to_sym)
174
+ self.class.openapi_types.each_pair do |key, type|
175
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
176
+ self.send("#{key}=", nil)
177
+ elsif type =~ /\AArray<(.*)>/i
178
+ # check to ensure the input is an array given that the attribute
179
+ # is documented as an array but the input is not
180
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
181
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
182
+ end
183
+ elsif !attributes[self.class.attribute_map[key]].nil?
184
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
185
+ end
186
+ end
187
+
188
+ self
189
+ end
190
+
191
+ # Deserializes the data based on type
192
+ # @param string type Data type
193
+ # @param string value Value to be deserialized
194
+ # @return [Object] Deserialized data
195
+ def _deserialize(type, value)
196
+ case type.to_sym
197
+ when :Time
198
+ Time.parse(value)
199
+ when :Date
200
+ Date.parse(value)
201
+ when :String
202
+ value.to_s
203
+ when :Integer
204
+ value.to_i
205
+ when :Float
206
+ value.to_f
207
+ when :Boolean
208
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
209
+ true
210
+ else
211
+ false
212
+ end
213
+ when :Object
214
+ # generic object (usually a Hash), return directly
215
+ value
216
+ when /\AArray<(?<inner_type>.+)>\z/
217
+ inner_type = Regexp.last_match[:inner_type]
218
+ value.map { |v| _deserialize(inner_type, v) }
219
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
220
+ k_type = Regexp.last_match[:k_type]
221
+ v_type = Regexp.last_match[:v_type]
222
+ {}.tap do |hash|
223
+ value.each do |k, v|
224
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
225
+ end
226
+ end
227
+ else # model
228
+ # models (e.g. Pet) or oneOf
229
+ klass = OneSignal.const_get(type)
230
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
231
+ end
232
+ end
233
+
234
+ # Returns the string representation of the object
235
+ # @return [String] String presentation of the object
236
+ def to_s
237
+ to_hash.to_s
238
+ end
239
+
240
+ # to_body is an alias to to_hash (backward compatibility)
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_body
243
+ to_hash
244
+ end
245
+
246
+ # Returns the object in the form of hash
247
+ # @return [Hash] Returns the object in the form of hash
248
+ def to_hash
249
+ hash = {}
250
+ self.class.attribute_map.each_pair do |attr, param|
251
+ value = self.send(attr)
252
+ if value.nil?
253
+ is_nullable = self.class.openapi_nullable.include?(attr)
254
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
255
+ end
256
+
257
+ hash[param] = _to_hash(value)
258
+ end
259
+ hash
260
+ end
261
+
262
+ # Outputs non-array value in the form of hash
263
+ # For object, use to_hash. Otherwise, just return the value
264
+ # @param [Object] value Any valid value
265
+ # @return [Hash] Returns the value in the form of hash
266
+ def _to_hash(value)
267
+ if value.is_a?(Array)
268
+ value.compact.map { |v| _to_hash(v) }
269
+ elsif value.is_a?(Hash)
270
+ {}.tap do |hash|
271
+ value.each { |k, v| hash[k] = _to_hash(v) }
272
+ end
273
+ elsif value.respond_to? :to_hash
274
+ value.to_hash
275
+ else
276
+ value
277
+ end
278
+ end
279
+
280
+ end
281
+
282
+ end