onesignal 5.10.0 → 5.11.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/docs/AuditLogActor.md +26 -0
- data/docs/AuditLogContext.md +24 -0
- data/docs/AuditLogEvent.md +36 -0
- data/docs/AuditLogTarget.md +24 -0
- data/docs/DefaultApi.md +267 -0
- data/docs/GetSegmentSuccessResponse.md +20 -0
- data/docs/ListAuditLogsSuccessResponse.md +22 -0
- data/docs/SegmentDetails.md +28 -0
- data/docs/UpdateSegmentRequest.md +22 -0
- data/docs/UpdateSegmentSuccessResponse.md +20 -0
- data/lib/onesignal/api/default_api.rb +273 -1
- data/lib/onesignal/api_client.rb +2 -2
- data/lib/onesignal/api_error.rb +1 -1
- data/lib/onesignal/configuration.rb +1 -1
- data/lib/onesignal/models/api_key_token.rb +1 -1
- data/lib/onesignal/models/api_key_tokens_list_response.rb +1 -1
- data/lib/onesignal/models/app.rb +1 -1
- data/lib/onesignal/models/audit_log_actor.rb +261 -0
- data/lib/onesignal/models/audit_log_context.rb +251 -0
- data/lib/onesignal/models/audit_log_event.rb +310 -0
- data/lib/onesignal/models/audit_log_target.rb +251 -0
- data/lib/onesignal/models/basic_notification.rb +1 -1
- data/lib/onesignal/models/basic_notification_all_of.rb +1 -1
- data/lib/onesignal/models/basic_notification_all_of_android_background_layout.rb +1 -1
- data/lib/onesignal/models/button.rb +1 -1
- data/lib/onesignal/models/copy_template_request.rb +1 -1
- data/lib/onesignal/models/create_api_key_request.rb +1 -1
- data/lib/onesignal/models/create_api_key_response.rb +1 -1
- data/lib/onesignal/models/create_notification_success_response.rb +1 -1
- data/lib/onesignal/models/create_segment_conflict_response.rb +1 -1
- data/lib/onesignal/models/create_segment_success_response.rb +1 -1
- data/lib/onesignal/models/create_template_request.rb +1 -1
- data/lib/onesignal/models/create_user_conflict_response.rb +1 -1
- data/lib/onesignal/models/create_user_conflict_response_errors_inner.rb +1 -1
- data/lib/onesignal/models/create_user_conflict_response_errors_items_meta.rb +1 -1
- data/lib/onesignal/models/custom_event.rb +1 -1
- data/lib/onesignal/models/custom_events_request.rb +1 -1
- data/lib/onesignal/models/delivery_data.rb +1 -1
- data/lib/onesignal/models/export_events_success_response.rb +1 -1
- data/lib/onesignal/models/export_subscriptions_request_body.rb +1 -1
- data/lib/onesignal/models/export_subscriptions_success_response.rb +1 -1
- data/lib/onesignal/models/filter.rb +1 -1
- data/lib/onesignal/models/filter_expression.rb +1 -1
- data/lib/onesignal/models/generic_error.rb +1 -1
- data/lib/onesignal/models/generic_success_bool_response.rb +1 -1
- data/lib/onesignal/models/get_notification_history_request_body.rb +1 -1
- data/lib/onesignal/models/get_segment_success_response.rb +229 -0
- data/lib/onesignal/models/get_segments_success_response.rb +1 -1
- data/lib/onesignal/models/language_string_map.rb +1 -1
- data/lib/onesignal/models/list_audit_logs_success_response.rb +242 -0
- data/lib/onesignal/models/notification.rb +1 -1
- data/lib/onesignal/models/notification_all_of.rb +1 -1
- data/lib/onesignal/models/notification_history_success_response.rb +1 -1
- data/lib/onesignal/models/notification_slice.rb +1 -1
- data/lib/onesignal/models/notification_target.rb +1 -1
- data/lib/onesignal/models/notification_with_meta.rb +1 -1
- data/lib/onesignal/models/notification_with_meta_all_of.rb +1 -1
- data/lib/onesignal/models/operator.rb +1 -1
- data/lib/onesignal/models/outcome_data.rb +1 -1
- data/lib/onesignal/models/outcomes_data.rb +1 -1
- data/lib/onesignal/models/platform_delivery_data.rb +1 -1
- data/lib/onesignal/models/platform_delivery_data_email_all_of.rb +1 -1
- data/lib/onesignal/models/platform_delivery_data_sms_all_of.rb +1 -1
- data/lib/onesignal/models/properties_body.rb +1 -1
- data/lib/onesignal/models/properties_deltas.rb +1 -1
- data/lib/onesignal/models/properties_object.rb +1 -1
- data/lib/onesignal/models/purchase.rb +1 -1
- data/lib/onesignal/models/rate_limit_error.rb +1 -1
- data/lib/onesignal/models/segment.rb +1 -1
- data/lib/onesignal/models/segment_data.rb +1 -1
- data/lib/onesignal/models/segment_details.rb +308 -0
- data/lib/onesignal/models/segment_notification_target.rb +1 -1
- data/lib/onesignal/models/start_live_activity_request.rb +1 -1
- data/lib/onesignal/models/start_live_activity_success_response.rb +1 -1
- data/lib/onesignal/models/subscription.rb +1 -1
- data/lib/onesignal/models/subscription_body.rb +1 -1
- data/lib/onesignal/models/subscription_notification_target.rb +1 -1
- data/lib/onesignal/models/template_resource.rb +1 -1
- data/lib/onesignal/models/templates_list_response.rb +1 -1
- data/lib/onesignal/models/transfer_subscription_request_body.rb +1 -1
- data/lib/onesignal/models/update_api_key_request.rb +1 -1
- data/lib/onesignal/models/update_live_activity_request.rb +1 -1
- data/lib/onesignal/models/update_live_activity_success_response.rb +1 -1
- data/lib/onesignal/models/update_segment_request.rb +281 -0
- data/lib/onesignal/models/update_segment_success_response.rb +230 -0
- data/lib/onesignal/models/update_template_request.rb +1 -1
- data/lib/onesignal/models/update_user_request.rb +1 -1
- data/lib/onesignal/models/user.rb +1 -1
- data/lib/onesignal/models/user_identity_body.rb +1 -1
- data/lib/onesignal/models/web_button.rb +1 -1
- data/lib/onesignal/version.rb +2 -2
- data/lib/onesignal.rb +10 -1
- data/onesignal.gemspec +1 -1
- data/spec/api/default_api_spec.rb +52 -1
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/api_key_token_spec.rb +1 -1
- data/spec/models/api_key_tokens_list_response_spec.rb +1 -1
- data/spec/models/app_spec.rb +1 -1
- data/spec/models/audit_log_actor_spec.rb +58 -0
- data/spec/models/audit_log_context_spec.rb +52 -0
- data/spec/models/audit_log_event_spec.rb +88 -0
- data/spec/models/audit_log_target_spec.rb +52 -0
- data/spec/models/basic_notification_all_of_android_background_layout_spec.rb +1 -1
- data/spec/models/basic_notification_all_of_spec.rb +1 -1
- data/spec/models/basic_notification_spec.rb +1 -1
- data/spec/models/button_spec.rb +1 -1
- data/spec/models/copy_template_request_spec.rb +1 -1
- data/spec/models/create_api_key_request_spec.rb +1 -1
- data/spec/models/create_api_key_response_spec.rb +1 -1
- data/spec/models/create_notification_success_response_spec.rb +1 -1
- data/spec/models/create_segment_conflict_response_spec.rb +1 -1
- data/spec/models/create_segment_success_response_spec.rb +1 -1
- data/spec/models/create_template_request_spec.rb +1 -1
- data/spec/models/create_user_conflict_response_errors_inner_spec.rb +1 -1
- data/spec/models/create_user_conflict_response_errors_items_meta_spec.rb +1 -1
- data/spec/models/create_user_conflict_response_spec.rb +1 -1
- data/spec/models/custom_event_spec.rb +1 -1
- data/spec/models/custom_events_request_spec.rb +1 -1
- data/spec/models/delivery_data_spec.rb +1 -1
- data/spec/models/export_events_success_response_spec.rb +1 -1
- data/spec/models/export_subscriptions_request_body_spec.rb +1 -1
- data/spec/models/export_subscriptions_success_response_spec.rb +1 -1
- data/spec/models/filter_expression_spec.rb +1 -1
- data/spec/models/filter_spec.rb +1 -1
- data/spec/models/generic_error_spec.rb +1 -1
- data/spec/models/generic_success_bool_response_spec.rb +1 -1
- data/spec/models/get_notification_history_request_body_spec.rb +1 -1
- data/spec/models/get_segment_success_response_spec.rb +40 -0
- data/spec/models/get_segments_success_response_spec.rb +1 -1
- data/spec/models/language_string_map_spec.rb +1 -1
- data/spec/models/list_audit_logs_success_response_spec.rb +46 -0
- data/spec/models/notification_all_of_spec.rb +1 -1
- data/spec/models/notification_history_success_response_spec.rb +1 -1
- data/spec/models/notification_slice_spec.rb +1 -1
- data/spec/models/notification_spec.rb +1 -1
- data/spec/models/notification_target_spec.rb +1 -1
- data/spec/models/notification_with_meta_all_of_spec.rb +1 -1
- data/spec/models/notification_with_meta_spec.rb +1 -1
- data/spec/models/operator_spec.rb +1 -1
- data/spec/models/outcome_data_spec.rb +1 -1
- data/spec/models/outcomes_data_spec.rb +1 -1
- data/spec/models/platform_delivery_data_email_all_of_spec.rb +1 -1
- data/spec/models/platform_delivery_data_sms_all_of_spec.rb +1 -1
- data/spec/models/platform_delivery_data_spec.rb +1 -1
- data/spec/models/properties_body_spec.rb +1 -1
- data/spec/models/properties_deltas_spec.rb +1 -1
- data/spec/models/properties_object_spec.rb +1 -1
- data/spec/models/purchase_spec.rb +1 -1
- data/spec/models/rate_limit_error_spec.rb +1 -1
- data/spec/models/segment_data_spec.rb +1 -1
- data/spec/models/segment_details_spec.rb +68 -0
- data/spec/models/segment_notification_target_spec.rb +1 -1
- data/spec/models/segment_spec.rb +1 -1
- data/spec/models/start_live_activity_request_spec.rb +1 -1
- data/spec/models/start_live_activity_success_response_spec.rb +1 -1
- data/spec/models/subscription_body_spec.rb +1 -1
- data/spec/models/subscription_notification_target_spec.rb +1 -1
- data/spec/models/subscription_spec.rb +1 -1
- data/spec/models/template_resource_spec.rb +1 -1
- data/spec/models/templates_list_response_spec.rb +1 -1
- data/spec/models/transfer_subscription_request_body_spec.rb +1 -1
- data/spec/models/update_api_key_request_spec.rb +1 -1
- data/spec/models/update_live_activity_request_spec.rb +1 -1
- data/spec/models/update_live_activity_success_response_spec.rb +1 -1
- data/spec/models/update_segment_request_spec.rb +46 -0
- data/spec/models/update_segment_success_response_spec.rb +40 -0
- data/spec/models/update_template_request_spec.rb +1 -1
- data/spec/models/update_user_request_spec.rb +1 -1
- data/spec/models/user_identity_body_spec.rb +1 -1
- data/spec/models/user_spec.rb +1 -1
- data/spec/models/web_button_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-13.0.0/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.5.1/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.8.2/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.8.2/mkmf.log +3 -3
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.4.0/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.1/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/gem_make.out +5 -5
- metadata +94 -58
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 5.
|
|
6
|
+
The version of the OpenAPI document: 5.11.0
|
|
7
7
|
Contact: devrel@onesignal.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
|
@@ -2043,6 +2043,78 @@ module OneSignal
|
|
|
2043
2043
|
return data, status_code, headers
|
|
2044
2044
|
end
|
|
2045
2045
|
|
|
2046
|
+
# View Segment
|
|
2047
|
+
# Retrieve details for a single segment by its ID, including subscriber count and optionally segment metadata and filters.
|
|
2048
|
+
# @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs.
|
|
2049
|
+
# @param segment_id [String] The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard.
|
|
2050
|
+
# @param [Hash] opts the optional parameters
|
|
2051
|
+
# @option opts [Boolean] :include_segment_detail Set to true to include segment metadata and filters in the response.
|
|
2052
|
+
# @return [GetSegmentSuccessResponse]
|
|
2053
|
+
def get_segment(app_id, segment_id, opts = {})
|
|
2054
|
+
data, _status_code, _headers = get_segment_with_http_info(app_id, segment_id, opts)
|
|
2055
|
+
data
|
|
2056
|
+
end
|
|
2057
|
+
|
|
2058
|
+
# View Segment
|
|
2059
|
+
# Retrieve details for a single segment by its ID, including subscriber count and optionally segment metadata and filters.
|
|
2060
|
+
# @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs.
|
|
2061
|
+
# @param segment_id [String] The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard.
|
|
2062
|
+
# @param [Hash] opts the optional parameters
|
|
2063
|
+
# @option opts [Boolean] :include_segment_detail Set to true to include segment metadata and filters in the response.
|
|
2064
|
+
# @return [Array<(GetSegmentSuccessResponse, Integer, Hash)>] GetSegmentSuccessResponse data, response status code and response headers
|
|
2065
|
+
def get_segment_with_http_info(app_id, segment_id, opts = {})
|
|
2066
|
+
if @api_client.config.debugging
|
|
2067
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.get_segment ...'
|
|
2068
|
+
end
|
|
2069
|
+
# verify the required parameter 'app_id' is set
|
|
2070
|
+
if @api_client.config.client_side_validation && app_id.nil?
|
|
2071
|
+
fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_segment"
|
|
2072
|
+
end
|
|
2073
|
+
# verify the required parameter 'segment_id' is set
|
|
2074
|
+
if @api_client.config.client_side_validation && segment_id.nil?
|
|
2075
|
+
fail ArgumentError, "Missing the required parameter 'segment_id' when calling DefaultApi.get_segment"
|
|
2076
|
+
end
|
|
2077
|
+
# resource path
|
|
2078
|
+
local_var_path = '/apps/{app_id}/segments/{segment_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'segment_id' + '}', CGI.escape(segment_id.to_s))
|
|
2079
|
+
|
|
2080
|
+
# query parameters
|
|
2081
|
+
query_params = opts[:query_params] || {}
|
|
2082
|
+
query_params[:'include-segment-detail'] = opts[:'include_segment_detail'] if !opts[:'include_segment_detail'].nil?
|
|
2083
|
+
|
|
2084
|
+
# header parameters
|
|
2085
|
+
header_params = opts[:header_params] || {}
|
|
2086
|
+
# HTTP header 'Accept' (if needed)
|
|
2087
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
2088
|
+
|
|
2089
|
+
# form parameters
|
|
2090
|
+
form_params = opts[:form_params] || {}
|
|
2091
|
+
|
|
2092
|
+
# http body (model)
|
|
2093
|
+
post_body = opts[:debug_body]
|
|
2094
|
+
|
|
2095
|
+
# return_type
|
|
2096
|
+
return_type = opts[:debug_return_type] || 'GetSegmentSuccessResponse'
|
|
2097
|
+
|
|
2098
|
+
# auth_names
|
|
2099
|
+
auth_names = opts[:debug_auth_names] || ['rest_api_key']
|
|
2100
|
+
|
|
2101
|
+
new_options = opts.merge(
|
|
2102
|
+
:operation => :"DefaultApi.get_segment",
|
|
2103
|
+
:header_params => header_params,
|
|
2104
|
+
:query_params => query_params,
|
|
2105
|
+
:form_params => form_params,
|
|
2106
|
+
:body => post_body,
|
|
2107
|
+
:auth_names => auth_names,
|
|
2108
|
+
:return_type => return_type
|
|
2109
|
+
)
|
|
2110
|
+
|
|
2111
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
2112
|
+
if @api_client.config.debugging
|
|
2113
|
+
@api_client.config.logger.debug "API called: DefaultApi#get_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
2114
|
+
end
|
|
2115
|
+
return data, status_code, headers
|
|
2116
|
+
end
|
|
2117
|
+
|
|
2046
2118
|
# Get Segments
|
|
2047
2119
|
# Returns an array of segments from an app.
|
|
2048
2120
|
# @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs.
|
|
@@ -2185,6 +2257,130 @@ module OneSignal
|
|
|
2185
2257
|
return data, status_code, headers
|
|
2186
2258
|
end
|
|
2187
2259
|
|
|
2260
|
+
# List audit logs
|
|
2261
|
+
# Retrieve a paginated, time-scoped list of audit log events for an organization. Requires an Enterprise plan with the audit logs entitlement enabled.
|
|
2262
|
+
# @param organization_id [String] The UUID of the organization to retrieve audit logs for. Must match the authenticated Organization API Key.
|
|
2263
|
+
# @param [Hash] opts the optional parameters
|
|
2264
|
+
# @option opts [String] :start_time Start of the time range in ISO 8601 format (e.g. 2026-02-01T00:00:00Z). Required unless cursor is provided. Must be within the last 90 days.
|
|
2265
|
+
# @option opts [String] :end_time End of the time range in ISO 8601 format. Defaults to the current time. Must be after start_time.
|
|
2266
|
+
# @option opts [String] :cursor Pagination cursor returned in a previous response as next_cursor. When provided, start_time and end_time are ignored.
|
|
2267
|
+
# @option opts [Integer] :limit Maximum number of events to return per page. Minimum 1, maximum 100. Values outside this range are clamped automatically by the server.
|
|
2268
|
+
# @option opts [Array<String>] :app_ids Filter events by app UUID. Accepts up to 10 values. Org-level events are always included.
|
|
2269
|
+
# @option opts [Array<String>] :actions Filter by action type (e.g. notification.sent, segment.created). Accepts up to 20 values.
|
|
2270
|
+
# @option opts [Array<String>] :actor_ids Filter by actor UUID (the user or service that performed the action). Accepts up to 10 values.
|
|
2271
|
+
# @option opts [Array<String>] :actor_emails Filter by actor email address. Accepts up to 10 values.
|
|
2272
|
+
# @option opts [Array<String>] :target_types Filter by the type of resource the action was performed on (e.g. notification, segment, journey). Accepts up to 10 values.
|
|
2273
|
+
# @option opts [Array<String>] :target_ids Filter by the UUID of the resource the action was performed on. Accepts up to 10 values.
|
|
2274
|
+
# @option opts [Array<String>] :ip_addresses Filter by the IP address the action originated from. Accepts up to 10 values.
|
|
2275
|
+
# @return [ListAuditLogsSuccessResponse]
|
|
2276
|
+
def list_audit_logs(organization_id, opts = {})
|
|
2277
|
+
data, _status_code, _headers = list_audit_logs_with_http_info(organization_id, opts)
|
|
2278
|
+
data
|
|
2279
|
+
end
|
|
2280
|
+
|
|
2281
|
+
# List audit logs
|
|
2282
|
+
# Retrieve a paginated, time-scoped list of audit log events for an organization. Requires an Enterprise plan with the audit logs entitlement enabled.
|
|
2283
|
+
# @param organization_id [String] The UUID of the organization to retrieve audit logs for. Must match the authenticated Organization API Key.
|
|
2284
|
+
# @param [Hash] opts the optional parameters
|
|
2285
|
+
# @option opts [String] :start_time Start of the time range in ISO 8601 format (e.g. 2026-02-01T00:00:00Z). Required unless cursor is provided. Must be within the last 90 days.
|
|
2286
|
+
# @option opts [String] :end_time End of the time range in ISO 8601 format. Defaults to the current time. Must be after start_time.
|
|
2287
|
+
# @option opts [String] :cursor Pagination cursor returned in a previous response as next_cursor. When provided, start_time and end_time are ignored.
|
|
2288
|
+
# @option opts [Integer] :limit Maximum number of events to return per page. Minimum 1, maximum 100. Values outside this range are clamped automatically by the server.
|
|
2289
|
+
# @option opts [Array<String>] :app_ids Filter events by app UUID. Accepts up to 10 values. Org-level events are always included.
|
|
2290
|
+
# @option opts [Array<String>] :actions Filter by action type (e.g. notification.sent, segment.created). Accepts up to 20 values.
|
|
2291
|
+
# @option opts [Array<String>] :actor_ids Filter by actor UUID (the user or service that performed the action). Accepts up to 10 values.
|
|
2292
|
+
# @option opts [Array<String>] :actor_emails Filter by actor email address. Accepts up to 10 values.
|
|
2293
|
+
# @option opts [Array<String>] :target_types Filter by the type of resource the action was performed on (e.g. notification, segment, journey). Accepts up to 10 values.
|
|
2294
|
+
# @option opts [Array<String>] :target_ids Filter by the UUID of the resource the action was performed on. Accepts up to 10 values.
|
|
2295
|
+
# @option opts [Array<String>] :ip_addresses Filter by the IP address the action originated from. Accepts up to 10 values.
|
|
2296
|
+
# @return [Array<(ListAuditLogsSuccessResponse, Integer, Hash)>] ListAuditLogsSuccessResponse data, response status code and response headers
|
|
2297
|
+
def list_audit_logs_with_http_info(organization_id, opts = {})
|
|
2298
|
+
if @api_client.config.debugging
|
|
2299
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.list_audit_logs ...'
|
|
2300
|
+
end
|
|
2301
|
+
# verify the required parameter 'organization_id' is set
|
|
2302
|
+
if @api_client.config.client_side_validation && organization_id.nil?
|
|
2303
|
+
fail ArgumentError, "Missing the required parameter 'organization_id' when calling DefaultApi.list_audit_logs"
|
|
2304
|
+
end
|
|
2305
|
+
if @api_client.config.client_side_validation && !opts[:'app_ids'].nil? && opts[:'app_ids'].length > 10
|
|
2306
|
+
fail ArgumentError, 'invalid value for "opts[:"app_ids"]" when calling DefaultApi.list_audit_logs, number of items must be less than or equal to 10.'
|
|
2307
|
+
end
|
|
2308
|
+
|
|
2309
|
+
if @api_client.config.client_side_validation && !opts[:'actions'].nil? && opts[:'actions'].length > 20
|
|
2310
|
+
fail ArgumentError, 'invalid value for "opts[:"actions"]" when calling DefaultApi.list_audit_logs, number of items must be less than or equal to 20.'
|
|
2311
|
+
end
|
|
2312
|
+
|
|
2313
|
+
if @api_client.config.client_side_validation && !opts[:'actor_ids'].nil? && opts[:'actor_ids'].length > 10
|
|
2314
|
+
fail ArgumentError, 'invalid value for "opts[:"actor_ids"]" when calling DefaultApi.list_audit_logs, number of items must be less than or equal to 10.'
|
|
2315
|
+
end
|
|
2316
|
+
|
|
2317
|
+
if @api_client.config.client_side_validation && !opts[:'actor_emails'].nil? && opts[:'actor_emails'].length > 10
|
|
2318
|
+
fail ArgumentError, 'invalid value for "opts[:"actor_emails"]" when calling DefaultApi.list_audit_logs, number of items must be less than or equal to 10.'
|
|
2319
|
+
end
|
|
2320
|
+
|
|
2321
|
+
if @api_client.config.client_side_validation && !opts[:'target_types'].nil? && opts[:'target_types'].length > 10
|
|
2322
|
+
fail ArgumentError, 'invalid value for "opts[:"target_types"]" when calling DefaultApi.list_audit_logs, number of items must be less than or equal to 10.'
|
|
2323
|
+
end
|
|
2324
|
+
|
|
2325
|
+
if @api_client.config.client_side_validation && !opts[:'target_ids'].nil? && opts[:'target_ids'].length > 10
|
|
2326
|
+
fail ArgumentError, 'invalid value for "opts[:"target_ids"]" when calling DefaultApi.list_audit_logs, number of items must be less than or equal to 10.'
|
|
2327
|
+
end
|
|
2328
|
+
|
|
2329
|
+
if @api_client.config.client_side_validation && !opts[:'ip_addresses'].nil? && opts[:'ip_addresses'].length > 10
|
|
2330
|
+
fail ArgumentError, 'invalid value for "opts[:"ip_addresses"]" when calling DefaultApi.list_audit_logs, number of items must be less than or equal to 10.'
|
|
2331
|
+
end
|
|
2332
|
+
|
|
2333
|
+
# resource path
|
|
2334
|
+
local_var_path = '/organizations/{organization_id}/audit_logs'.sub('{' + 'organization_id' + '}', CGI.escape(organization_id.to_s))
|
|
2335
|
+
|
|
2336
|
+
# query parameters
|
|
2337
|
+
query_params = opts[:query_params] || {}
|
|
2338
|
+
query_params[:'start_time'] = opts[:'start_time'] if !opts[:'start_time'].nil?
|
|
2339
|
+
query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?
|
|
2340
|
+
query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
|
|
2341
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
|
2342
|
+
query_params[:'app_ids'] = @api_client.build_collection_param(opts[:'app_ids'], :multi) if !opts[:'app_ids'].nil?
|
|
2343
|
+
query_params[:'actions'] = @api_client.build_collection_param(opts[:'actions'], :multi) if !opts[:'actions'].nil?
|
|
2344
|
+
query_params[:'actor_ids'] = @api_client.build_collection_param(opts[:'actor_ids'], :multi) if !opts[:'actor_ids'].nil?
|
|
2345
|
+
query_params[:'actor_emails'] = @api_client.build_collection_param(opts[:'actor_emails'], :multi) if !opts[:'actor_emails'].nil?
|
|
2346
|
+
query_params[:'target_types'] = @api_client.build_collection_param(opts[:'target_types'], :multi) if !opts[:'target_types'].nil?
|
|
2347
|
+
query_params[:'target_ids'] = @api_client.build_collection_param(opts[:'target_ids'], :multi) if !opts[:'target_ids'].nil?
|
|
2348
|
+
query_params[:'ip_addresses'] = @api_client.build_collection_param(opts[:'ip_addresses'], :multi) if !opts[:'ip_addresses'].nil?
|
|
2349
|
+
|
|
2350
|
+
# header parameters
|
|
2351
|
+
header_params = opts[:header_params] || {}
|
|
2352
|
+
# HTTP header 'Accept' (if needed)
|
|
2353
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
2354
|
+
|
|
2355
|
+
# form parameters
|
|
2356
|
+
form_params = opts[:form_params] || {}
|
|
2357
|
+
|
|
2358
|
+
# http body (model)
|
|
2359
|
+
post_body = opts[:debug_body]
|
|
2360
|
+
|
|
2361
|
+
# return_type
|
|
2362
|
+
return_type = opts[:debug_return_type] || 'ListAuditLogsSuccessResponse'
|
|
2363
|
+
|
|
2364
|
+
# auth_names
|
|
2365
|
+
auth_names = opts[:debug_auth_names] || ['organization_api_key']
|
|
2366
|
+
|
|
2367
|
+
new_options = opts.merge(
|
|
2368
|
+
:operation => :"DefaultApi.list_audit_logs",
|
|
2369
|
+
:header_params => header_params,
|
|
2370
|
+
:query_params => query_params,
|
|
2371
|
+
:form_params => form_params,
|
|
2372
|
+
:body => post_body,
|
|
2373
|
+
:auth_names => auth_names,
|
|
2374
|
+
:return_type => return_type
|
|
2375
|
+
)
|
|
2376
|
+
|
|
2377
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
2378
|
+
if @api_client.config.debugging
|
|
2379
|
+
@api_client.config.logger.debug "API called: DefaultApi#list_audit_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
2380
|
+
end
|
|
2381
|
+
return data, status_code, headers
|
|
2382
|
+
end
|
|
2383
|
+
|
|
2188
2384
|
# Rotate API key
|
|
2189
2385
|
# Rotate a Rich Authentication Token (App API Key) for a OneSignal app. Rotating a key revokes the current token and generates a new one under the same configuration—ideal when a token is lost or compromised but you don’t want to recreate and reconfigure it from scratch.
|
|
2190
2386
|
# @param app_id [String]
|
|
@@ -2722,6 +2918,82 @@ module OneSignal
|
|
|
2722
2918
|
return data, status_code, headers
|
|
2723
2919
|
end
|
|
2724
2920
|
|
|
2921
|
+
# Update Segment
|
|
2922
|
+
# 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.
|
|
2923
|
+
# @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs.
|
|
2924
|
+
# @param segment_id [String] The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard.
|
|
2925
|
+
# @param [Hash] opts the optional parameters
|
|
2926
|
+
# @option opts [UpdateSegmentRequest] :update_segment_request
|
|
2927
|
+
# @return [UpdateSegmentSuccessResponse]
|
|
2928
|
+
def update_segment(app_id, segment_id, opts = {})
|
|
2929
|
+
data, _status_code, _headers = update_segment_with_http_info(app_id, segment_id, opts)
|
|
2930
|
+
data
|
|
2931
|
+
end
|
|
2932
|
+
|
|
2933
|
+
# Update Segment
|
|
2934
|
+
# 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.
|
|
2935
|
+
# @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs.
|
|
2936
|
+
# @param segment_id [String] The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard.
|
|
2937
|
+
# @param [Hash] opts the optional parameters
|
|
2938
|
+
# @option opts [UpdateSegmentRequest] :update_segment_request
|
|
2939
|
+
# @return [Array<(UpdateSegmentSuccessResponse, Integer, Hash)>] UpdateSegmentSuccessResponse data, response status code and response headers
|
|
2940
|
+
def update_segment_with_http_info(app_id, segment_id, opts = {})
|
|
2941
|
+
if @api_client.config.debugging
|
|
2942
|
+
@api_client.config.logger.debug 'Calling API: DefaultApi.update_segment ...'
|
|
2943
|
+
end
|
|
2944
|
+
# verify the required parameter 'app_id' is set
|
|
2945
|
+
if @api_client.config.client_side_validation && app_id.nil?
|
|
2946
|
+
fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_segment"
|
|
2947
|
+
end
|
|
2948
|
+
# verify the required parameter 'segment_id' is set
|
|
2949
|
+
if @api_client.config.client_side_validation && segment_id.nil?
|
|
2950
|
+
fail ArgumentError, "Missing the required parameter 'segment_id' when calling DefaultApi.update_segment"
|
|
2951
|
+
end
|
|
2952
|
+
# resource path
|
|
2953
|
+
local_var_path = '/apps/{app_id}/segments/{segment_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'segment_id' + '}', CGI.escape(segment_id.to_s))
|
|
2954
|
+
|
|
2955
|
+
# query parameters
|
|
2956
|
+
query_params = opts[:query_params] || {}
|
|
2957
|
+
|
|
2958
|
+
# header parameters
|
|
2959
|
+
header_params = opts[:header_params] || {}
|
|
2960
|
+
# HTTP header 'Accept' (if needed)
|
|
2961
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
2962
|
+
# HTTP header 'Content-Type'
|
|
2963
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
2964
|
+
if !content_type.nil?
|
|
2965
|
+
header_params['Content-Type'] = content_type
|
|
2966
|
+
end
|
|
2967
|
+
|
|
2968
|
+
# form parameters
|
|
2969
|
+
form_params = opts[:form_params] || {}
|
|
2970
|
+
|
|
2971
|
+
# http body (model)
|
|
2972
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_segment_request'])
|
|
2973
|
+
|
|
2974
|
+
# return_type
|
|
2975
|
+
return_type = opts[:debug_return_type] || 'UpdateSegmentSuccessResponse'
|
|
2976
|
+
|
|
2977
|
+
# auth_names
|
|
2978
|
+
auth_names = opts[:debug_auth_names] || ['rest_api_key']
|
|
2979
|
+
|
|
2980
|
+
new_options = opts.merge(
|
|
2981
|
+
:operation => :"DefaultApi.update_segment",
|
|
2982
|
+
:header_params => header_params,
|
|
2983
|
+
:query_params => query_params,
|
|
2984
|
+
:form_params => form_params,
|
|
2985
|
+
:body => post_body,
|
|
2986
|
+
:auth_names => auth_names,
|
|
2987
|
+
:return_type => return_type
|
|
2988
|
+
)
|
|
2989
|
+
|
|
2990
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
|
2991
|
+
if @api_client.config.debugging
|
|
2992
|
+
@api_client.config.logger.debug "API called: DefaultApi#update_segment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
2993
|
+
end
|
|
2994
|
+
return data, status_code, headers
|
|
2995
|
+
end
|
|
2996
|
+
|
|
2725
2997
|
# Updates an existing Subscription’s properties.
|
|
2726
2998
|
# @param app_id [String]
|
|
2727
2999
|
# @param subscription_id [String]
|
data/lib/onesignal/api_client.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 5.
|
|
6
|
+
The version of the OpenAPI document: 5.11.0
|
|
7
7
|
Contact: devrel@onesignal.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
|
@@ -90,7 +90,7 @@ module OneSignal
|
|
|
90
90
|
url = build_request_url(path, opts)
|
|
91
91
|
http_method = http_method.to_sym.downcase
|
|
92
92
|
|
|
93
|
-
opts[:header_params]['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-ruby, version=5.
|
|
93
|
+
opts[:header_params]['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-ruby, version=5.11.0'
|
|
94
94
|
header_params = @default_headers.merge(opts[:header_params] || {})
|
|
95
95
|
query_params = opts[:query_params] || {}
|
|
96
96
|
form_params = opts[:form_params] || {}
|
data/lib/onesignal/api_error.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 5.
|
|
6
|
+
The version of the OpenAPI document: 5.11.0
|
|
7
7
|
Contact: devrel@onesignal.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 5.
|
|
6
|
+
The version of the OpenAPI document: 5.11.0
|
|
7
7
|
Contact: devrel@onesignal.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 5.
|
|
6
|
+
The version of the OpenAPI document: 5.11.0
|
|
7
7
|
Contact: devrel@onesignal.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 5.
|
|
6
|
+
The version of the OpenAPI document: 5.11.0
|
|
7
7
|
Contact: devrel@onesignal.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
data/lib/onesignal/models/app.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 5.
|
|
6
|
+
The version of the OpenAPI document: 5.11.0
|
|
7
7
|
Contact: devrel@onesignal.com
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
|
@@ -0,0 +1,261 @@
|
|
|
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
|
+
The version of the OpenAPI document: 5.11.0
|
|
7
|
+
Contact: devrel@onesignal.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
OpenAPI Generator version: 6.0.0-SNAPSHOT
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module OneSignal
|
|
17
|
+
# The user or service that performed the action. Absent if the actor is unknown.
|
|
18
|
+
class AuditLogActor
|
|
19
|
+
# Email address of the actor. Absent if unavailable.
|
|
20
|
+
attr_accessor :email
|
|
21
|
+
|
|
22
|
+
# UUID of the actor.
|
|
23
|
+
attr_accessor :id
|
|
24
|
+
|
|
25
|
+
# Additional actor-specific data.
|
|
26
|
+
attr_accessor :metadata
|
|
27
|
+
|
|
28
|
+
# Display name of the actor. Absent if unavailable.
|
|
29
|
+
attr_accessor :name
|
|
30
|
+
|
|
31
|
+
# Actor type (e.g. member, api_key, system).
|
|
32
|
+
attr_accessor :type
|
|
33
|
+
|
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
35
|
+
def self.attribute_map
|
|
36
|
+
{
|
|
37
|
+
:'email' => :'email',
|
|
38
|
+
:'id' => :'id',
|
|
39
|
+
:'metadata' => :'metadata',
|
|
40
|
+
:'name' => :'name',
|
|
41
|
+
:'type' => :'type'
|
|
42
|
+
}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Returns all the JSON keys this model knows about
|
|
46
|
+
def self.acceptable_attributes
|
|
47
|
+
attribute_map.values
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Attribute type mapping.
|
|
51
|
+
def self.openapi_types
|
|
52
|
+
{
|
|
53
|
+
:'email' => :'String',
|
|
54
|
+
:'id' => :'String',
|
|
55
|
+
:'metadata' => :'Object',
|
|
56
|
+
:'name' => :'String',
|
|
57
|
+
:'type' => :'String'
|
|
58
|
+
}
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# List of attributes with nullable: true
|
|
62
|
+
def self.openapi_nullable
|
|
63
|
+
Set.new([
|
|
64
|
+
])
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Initializes the object
|
|
68
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
69
|
+
def initialize(attributes = {})
|
|
70
|
+
if (!attributes.is_a?(Hash))
|
|
71
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::AuditLogActor` initialize method"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
75
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
76
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
77
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::AuditLogActor`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
78
|
+
end
|
|
79
|
+
h[k.to_sym] = v
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if attributes.key?(:'email')
|
|
83
|
+
self.email = attributes[:'email']
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
if attributes.key?(:'id')
|
|
87
|
+
self.id = attributes[:'id']
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
if attributes.key?(:'metadata')
|
|
91
|
+
self.metadata = attributes[:'metadata']
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if attributes.key?(:'name')
|
|
95
|
+
self.name = attributes[:'name']
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
if attributes.key?(:'type')
|
|
99
|
+
self.type = attributes[:'type']
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
104
|
+
# @return Array for valid properties with the reasons
|
|
105
|
+
def list_invalid_properties
|
|
106
|
+
invalid_properties = Array.new
|
|
107
|
+
invalid_properties
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Check to see if the all the properties in the model are valid
|
|
111
|
+
# @return true if the model is valid
|
|
112
|
+
def valid?
|
|
113
|
+
true
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Checks equality by comparing each attribute.
|
|
117
|
+
# @param [Object] Object to be compared
|
|
118
|
+
def ==(o)
|
|
119
|
+
return true if self.equal?(o)
|
|
120
|
+
self.class == o.class &&
|
|
121
|
+
email == o.email &&
|
|
122
|
+
id == o.id &&
|
|
123
|
+
metadata == o.metadata &&
|
|
124
|
+
name == o.name &&
|
|
125
|
+
type == o.type
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# @see the `==` method
|
|
129
|
+
# @param [Object] Object to be compared
|
|
130
|
+
def eql?(o)
|
|
131
|
+
self == o
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Calculates hash code according to all attributes.
|
|
135
|
+
# @return [Integer] Hash code
|
|
136
|
+
def hash
|
|
137
|
+
[email, id, metadata, name, type].hash
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Builds the object from hash
|
|
141
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
142
|
+
# @return [Object] Returns the model itself
|
|
143
|
+
def self.build_from_hash(attributes)
|
|
144
|
+
new.build_from_hash(attributes)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Builds the object from hash
|
|
148
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
149
|
+
# @return [Object] Returns the model itself
|
|
150
|
+
def build_from_hash(attributes)
|
|
151
|
+
return nil unless attributes.is_a?(Hash)
|
|
152
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
153
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
154
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
155
|
+
self.send("#{key}=", nil)
|
|
156
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
157
|
+
# check to ensure the input is an array given that the attribute
|
|
158
|
+
# is documented as an array but the input is not
|
|
159
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
160
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
161
|
+
end
|
|
162
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
163
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
self
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Deserializes the data based on type
|
|
171
|
+
# @param string type Data type
|
|
172
|
+
# @param string value Value to be deserialized
|
|
173
|
+
# @return [Object] Deserialized data
|
|
174
|
+
def _deserialize(type, value)
|
|
175
|
+
case type.to_sym
|
|
176
|
+
when :Time
|
|
177
|
+
Time.parse(value)
|
|
178
|
+
when :Date
|
|
179
|
+
Date.parse(value)
|
|
180
|
+
when :String
|
|
181
|
+
value.to_s
|
|
182
|
+
when :Integer
|
|
183
|
+
value.to_i
|
|
184
|
+
when :Float
|
|
185
|
+
value.to_f
|
|
186
|
+
when :Boolean
|
|
187
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
188
|
+
true
|
|
189
|
+
else
|
|
190
|
+
false
|
|
191
|
+
end
|
|
192
|
+
when :Object
|
|
193
|
+
# generic object (usually a Hash), return directly
|
|
194
|
+
value
|
|
195
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
196
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
197
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
198
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
199
|
+
k_type = Regexp.last_match[:k_type]
|
|
200
|
+
v_type = Regexp.last_match[:v_type]
|
|
201
|
+
{}.tap do |hash|
|
|
202
|
+
value.each do |k, v|
|
|
203
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
else # model
|
|
207
|
+
# models (e.g. Pet) or oneOf
|
|
208
|
+
klass = OneSignal.const_get(type)
|
|
209
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Returns the string representation of the object
|
|
214
|
+
# @return [String] String presentation of the object
|
|
215
|
+
def to_s
|
|
216
|
+
to_hash.to_s
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
220
|
+
# @return [Hash] Returns the object in the form of hash
|
|
221
|
+
def to_body
|
|
222
|
+
to_hash
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# Returns the object in the form of hash
|
|
226
|
+
# @return [Hash] Returns the object in the form of hash
|
|
227
|
+
def to_hash
|
|
228
|
+
hash = {}
|
|
229
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
230
|
+
value = self.send(attr)
|
|
231
|
+
if value.nil?
|
|
232
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
233
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
hash[param] = _to_hash(value)
|
|
237
|
+
end
|
|
238
|
+
hash
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Outputs non-array value in the form of hash
|
|
242
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
243
|
+
# @param [Object] value Any valid value
|
|
244
|
+
# @return [Hash] Returns the value in the form of hash
|
|
245
|
+
def _to_hash(value)
|
|
246
|
+
if value.is_a?(Array)
|
|
247
|
+
value.compact.map { |v| _to_hash(v) }
|
|
248
|
+
elsif value.is_a?(Hash)
|
|
249
|
+
{}.tap do |hash|
|
|
250
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
251
|
+
end
|
|
252
|
+
elsif value.respond_to? :to_hash
|
|
253
|
+
value.to_hash
|
|
254
|
+
else
|
|
255
|
+
value
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
end
|