onesignal_sdk 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +31 -0
- data/Gemfile +9 -0
- data/LICENSE +24 -0
- data/README.md +210 -0
- data/RELEASE_INSTRUCTIONS.md +11 -0
- data/Rakefile +10 -0
- data/docs/App.md +84 -0
- data/docs/BasicNotification.md +228 -0
- data/docs/BasicNotificationAllOf.md +200 -0
- data/docs/BasicNotificationAllOfAndroidBackgroundLayout.md +22 -0
- data/docs/BeginLiveActivityRequest.md +20 -0
- data/docs/Button.md +22 -0
- data/docs/CancelNotificationSuccessResponse.md +18 -0
- data/docs/CreateNotificationSuccessResponse.md +24 -0
- data/docs/CreatePlayerSuccessResponse.md +20 -0
- data/docs/CreateSegmentConflictResponse.md +20 -0
- data/docs/CreateSegmentSuccessResponse.md +20 -0
- data/docs/CreateSubscriptionRequestBody.md +20 -0
- data/docs/CreateUserConflictResponse.md +18 -0
- data/docs/CreateUserConflictResponseErrorsInner.md +22 -0
- data/docs/CreateUserConflictResponseErrorsItemsMeta.md +18 -0
- data/docs/DefaultApi.md +2713 -0
- data/docs/DeletePlayerNotFoundResponse.md +18 -0
- data/docs/DeletePlayerSuccessResponse.md +18 -0
- data/docs/DeleteSegmentNotFoundResponse.md +18 -0
- data/docs/DeleteSegmentSuccessResponse.md +18 -0
- data/docs/DeliveryData.md +26 -0
- data/docs/ExportEventsSuccessResponse.md +18 -0
- data/docs/ExportPlayersRequestBody.md +22 -0
- data/docs/ExportPlayersSuccessResponse.md +18 -0
- data/docs/Filter.md +24 -0
- data/docs/FilterExpressions.md +26 -0
- data/docs/GenericError.md +18 -0
- data/docs/GenericErrorErrorsInner.md +20 -0
- data/docs/GetNotificationRequestBody.md +22 -0
- data/docs/InlineResponse200.md +18 -0
- data/docs/InlineResponse2003.md +18 -0
- data/docs/InlineResponse201.md +18 -0
- data/docs/InlineResponse202.md +18 -0
- data/docs/InvalidIdentifierError.md +20 -0
- data/docs/Notification.md +230 -0
- data/docs/Notification200Errors.md +49 -0
- data/docs/NotificationAllOf.md +18 -0
- data/docs/NotificationHistorySuccessResponse.md +20 -0
- data/docs/NotificationSlice.md +24 -0
- data/docs/NotificationTarget.md +44 -0
- data/docs/NotificationWithMeta.md +250 -0
- data/docs/NotificationWithMetaAllOf.md +38 -0
- data/docs/Operator.md +18 -0
- data/docs/OutcomeData.md +22 -0
- data/docs/OutcomesData.md +18 -0
- data/docs/PlatformDeliveryData.md +32 -0
- data/docs/PlatformDeliveryDataEmailAllOf.md +30 -0
- data/docs/PlatformDeliveryDataSmsAllOf.md +22 -0
- data/docs/Player.md +70 -0
- data/docs/PlayerNotificationTarget.md +40 -0
- data/docs/PlayerNotificationTargetIncludeAliases.md +18 -0
- data/docs/PlayerSlice.md +24 -0
- data/docs/PropertiesDeltas.md +22 -0
- data/docs/PropertiesObject.md +38 -0
- data/docs/Purchase.md +24 -0
- data/docs/RateLimiterError.md +18 -0
- data/docs/Segment.md +22 -0
- data/docs/SegmentNotificationTarget.md +20 -0
- data/docs/StringMap.md +102 -0
- data/docs/SubscriptionObject.md +50 -0
- data/docs/TransferSubscriptionRequestBody.md +18 -0
- data/docs/UpdateLiveActivityRequest.md +24 -0
- data/docs/UpdateLiveActivitySuccessResponse.md +20 -0
- data/docs/UpdatePlayerSuccessResponse.md +18 -0
- data/docs/UpdatePlayerTagsRequestBody.md +18 -0
- data/docs/UpdatePlayerTagsSuccessResponse.md +18 -0
- data/docs/UpdateSubscriptionRequestBody.md +18 -0
- data/docs/UpdateUserRequest.md +22 -0
- data/docs/User.md +24 -0
- data/docs/UserIdentityRequestBody.md +18 -0
- data/docs/UserIdentityResponse.md +18 -0
- data/docs/UserSubscriptionOptions.md +18 -0
- data/lib/onesignal/api/default_api.rb +2727 -0
- data/lib/onesignal/api_client.rb +393 -0
- data/lib/onesignal/api_error.rb +57 -0
- data/lib/onesignal/configuration.rb +245 -0
- data/lib/onesignal/models/app.rb +586 -0
- data/lib/onesignal/models/basic_notification.rb +1431 -0
- data/lib/onesignal/models/basic_notification_all_of.rb +1241 -0
- data/lib/onesignal/models/basic_notification_all_of_android_background_layout.rb +241 -0
- data/lib/onesignal/models/begin_live_activity_request.rb +238 -0
- data/lib/onesignal/models/button.rb +242 -0
- data/lib/onesignal/models/cancel_notification_success_response.rb +219 -0
- data/lib/onesignal/models/create_notification_success_response.rb +248 -0
- data/lib/onesignal/models/create_player_success_response.rb +228 -0
- data/lib/onesignal/models/create_segment_conflict_response.rb +230 -0
- data/lib/onesignal/models/create_segment_success_response.rb +229 -0
- data/lib/onesignal/models/create_subscription_request_body.rb +228 -0
- data/lib/onesignal/models/create_user_conflict_response.rb +221 -0
- data/lib/onesignal/models/create_user_conflict_response_errors_inner.rb +237 -0
- data/lib/onesignal/models/create_user_conflict_response_errors_items_meta.rb +219 -0
- data/lib/onesignal/models/delete_player_not_found_response.rb +219 -0
- data/lib/onesignal/models/delete_player_success_response.rb +219 -0
- data/lib/onesignal/models/delete_segment_not_found_response.rb +219 -0
- data/lib/onesignal/models/delete_segment_success_response.rb +219 -0
- data/lib/onesignal/models/delivery_data.rb +265 -0
- data/lib/onesignal/models/export_events_success_response.rb +219 -0
- data/lib/onesignal/models/export_players_request_body.rb +242 -0
- data/lib/onesignal/models/export_players_success_response.rb +219 -0
- data/lib/onesignal/models/filter.rb +294 -0
- data/lib/onesignal/models/filter_expressions.rb +336 -0
- data/lib/onesignal/models/generic_error.rb +221 -0
- data/lib/onesignal/models/generic_error_errors_inner.rb +228 -0
- data/lib/onesignal/models/get_notification_request_body.rb +273 -0
- data/lib/onesignal/models/inline_response200.rb +221 -0
- data/lib/onesignal/models/inline_response2003.rb +221 -0
- data/lib/onesignal/models/inline_response201.rb +219 -0
- data/lib/onesignal/models/inline_response202.rb +219 -0
- data/lib/onesignal/models/invalid_identifier_error.rb +234 -0
- data/lib/onesignal/models/notification.rb +1442 -0
- data/lib/onesignal/models/notification200_errors.rb +105 -0
- data/lib/onesignal/models/notification_all_of.rb +221 -0
- data/lib/onesignal/models/notification_history_success_response.rb +228 -0
- data/lib/onesignal/models/notification_slice.rb +248 -0
- data/lib/onesignal/models/notification_target.rb +429 -0
- data/lib/onesignal/models/notification_with_meta.rb +1546 -0
- data/lib/onesignal/models/notification_with_meta_all_of.rb +323 -0
- data/lib/onesignal/models/operator.rb +254 -0
- data/lib/onesignal/models/outcome_data.rb +286 -0
- data/lib/onesignal/models/outcomes_data.rb +221 -0
- data/lib/onesignal/models/platform_delivery_data.rb +285 -0
- data/lib/onesignal/models/platform_delivery_data_email_all_of.rb +287 -0
- data/lib/onesignal/models/platform_delivery_data_sms_all_of.rb +243 -0
- data/lib/onesignal/models/player.rb +494 -0
- data/lib/onesignal/models/player_notification_target.rb +385 -0
- data/lib/onesignal/models/player_notification_target_include_aliases.rb +221 -0
- data/lib/onesignal/models/player_slice.rb +248 -0
- data/lib/onesignal/models/properties_deltas.rb +239 -0
- data/lib/onesignal/models/properties_object.rb +313 -0
- data/lib/onesignal/models/purchase.rb +264 -0
- data/lib/onesignal/models/rate_limiter_error.rb +221 -0
- data/lib/onesignal/models/segment.rb +252 -0
- data/lib/onesignal/models/segment_notification_target.rb +234 -0
- data/lib/onesignal/models/string_map.rb +640 -0
- data/lib/onesignal/models/subscription_object.rb +397 -0
- data/lib/onesignal/models/transfer_subscription_request_body.rb +221 -0
- data/lib/onesignal/models/update_live_activity_request.rb +309 -0
- data/lib/onesignal/models/update_live_activity_success_response.rb +228 -0
- data/lib/onesignal/models/update_player_success_response.rb +219 -0
- data/lib/onesignal/models/update_player_tags_request_body.rb +220 -0
- data/lib/onesignal/models/update_player_tags_success_response.rb +219 -0
- data/lib/onesignal/models/update_subscription_request_body.rb +219 -0
- data/lib/onesignal/models/update_user_request.rb +239 -0
- data/lib/onesignal/models/user.rb +250 -0
- data/lib/onesignal/models/user_identity_request_body.rb +221 -0
- data/lib/onesignal/models/user_identity_response.rb +221 -0
- data/lib/onesignal/models/user_subscription_options.rb +219 -0
- data/lib/onesignal/version.rb +15 -0
- data/lib/onesignal.rb +111 -0
- data/onesignal.gemspec +38 -0
- data/spec/api/default_api_spec.rb +522 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/app_spec.rb +236 -0
- data/spec/models/basic_notification_all_of_android_background_layout_spec.rb +46 -0
- data/spec/models/basic_notification_all_of_spec.rb +584 -0
- data/spec/models/basic_notification_spec.rb +672 -0
- data/spec/models/begin_live_activity_request_spec.rb +40 -0
- data/spec/models/button_spec.rb +46 -0
- data/spec/models/cancel_notification_success_response_spec.rb +34 -0
- data/spec/models/create_notification_success_response_spec.rb +52 -0
- data/spec/models/create_player_success_response_spec.rb +40 -0
- data/spec/models/create_segment_conflict_response_spec.rb +40 -0
- data/spec/models/create_segment_success_response_spec.rb +40 -0
- data/spec/models/create_subscription_request_body_spec.rb +40 -0
- data/spec/models/create_user_conflict_response_errors_inner_spec.rb +46 -0
- data/spec/models/create_user_conflict_response_errors_items_meta_spec.rb +34 -0
- data/spec/models/create_user_conflict_response_spec.rb +34 -0
- data/spec/models/delete_player_not_found_response_spec.rb +34 -0
- data/spec/models/delete_player_success_response_spec.rb +34 -0
- data/spec/models/delete_segment_not_found_response_spec.rb +34 -0
- data/spec/models/delete_segment_success_response_spec.rb +34 -0
- data/spec/models/delivery_data_spec.rb +58 -0
- data/spec/models/export_events_success_response_spec.rb +34 -0
- data/spec/models/export_players_request_body_spec.rb +46 -0
- data/spec/models/export_players_success_response_spec.rb +34 -0
- data/spec/models/filter_expressions_spec.rb +66 -0
- data/spec/models/filter_spec.rb +56 -0
- data/spec/models/generic_error_errors_inner_spec.rb +40 -0
- data/spec/models/generic_error_spec.rb +34 -0
- data/spec/models/get_notification_request_body_spec.rb +50 -0
- data/spec/models/inline_response2003_spec.rb +34 -0
- data/spec/models/inline_response200_spec.rb +34 -0
- data/spec/models/inline_response201_spec.rb +34 -0
- data/spec/models/inline_response202_spec.rb +34 -0
- data/spec/models/invalid_identifier_error_spec.rb +40 -0
- data/spec/models/notification200_errors_spec.rb +31 -0
- data/spec/models/notification_all_of_spec.rb +34 -0
- data/spec/models/notification_history_success_response_spec.rb +40 -0
- data/spec/models/notification_slice_spec.rb +52 -0
- data/spec/models/notification_spec.rb +678 -0
- data/spec/models/notification_target_spec.rb +116 -0
- data/spec/models/notification_with_meta_all_of_spec.rb +94 -0
- data/spec/models/notification_with_meta_spec.rb +738 -0
- data/spec/models/operator_spec.rb +38 -0
- data/spec/models/outcome_data_spec.rb +50 -0
- data/spec/models/outcomes_data_spec.rb +34 -0
- data/spec/models/platform_delivery_data_email_all_of_spec.rb +70 -0
- data/spec/models/platform_delivery_data_sms_all_of_spec.rb +46 -0
- data/spec/models/platform_delivery_data_spec.rb +76 -0
- data/spec/models/player_notification_target_include_aliases_spec.rb +34 -0
- data/spec/models/player_notification_target_spec.rb +104 -0
- data/spec/models/player_slice_spec.rb +52 -0
- data/spec/models/player_spec.rb +190 -0
- data/spec/models/properties_deltas_spec.rb +46 -0
- data/spec/models/properties_object_spec.rb +94 -0
- data/spec/models/purchase_spec.rb +52 -0
- data/spec/models/rate_limiter_error_spec.rb +34 -0
- data/spec/models/segment_notification_target_spec.rb +40 -0
- data/spec/models/segment_spec.rb +46 -0
- data/spec/models/string_map_spec.rb +286 -0
- data/spec/models/subscription_object_spec.rb +134 -0
- data/spec/models/transfer_subscription_request_body_spec.rb +34 -0
- data/spec/models/update_live_activity_request_spec.rb +60 -0
- data/spec/models/update_live_activity_success_response_spec.rb +40 -0
- data/spec/models/update_player_success_response_spec.rb +34 -0
- data/spec/models/update_player_tags_request_body_spec.rb +34 -0
- data/spec/models/update_player_tags_success_response_spec.rb +34 -0
- data/spec/models/update_subscription_request_body_spec.rb +34 -0
- data/spec/models/update_user_request_spec.rb +46 -0
- data/spec/models/user_identity_request_body_spec.rb +34 -0
- data/spec/models/user_identity_response_spec.rb +34 -0
- data/spec/models/user_spec.rb +52 -0
- data/spec/models/user_subscription_options_spec.rb +34 -0
- data/spec/spec_helper.rb +111 -0
- metadata +389 -0
@@ -0,0 +1,313 @@
|
|
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: 1.2.2
|
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
|
+
class PropertiesObject
|
18
|
+
attr_accessor :tags
|
19
|
+
|
20
|
+
attr_accessor :language
|
21
|
+
|
22
|
+
attr_accessor :timezone_id
|
23
|
+
|
24
|
+
attr_accessor :lat
|
25
|
+
|
26
|
+
attr_accessor :long
|
27
|
+
|
28
|
+
attr_accessor :country
|
29
|
+
|
30
|
+
attr_accessor :first_active
|
31
|
+
|
32
|
+
attr_accessor :last_active
|
33
|
+
|
34
|
+
attr_accessor :amount_spent
|
35
|
+
|
36
|
+
attr_accessor :purchases
|
37
|
+
|
38
|
+
attr_accessor :ip
|
39
|
+
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
41
|
+
def self.attribute_map
|
42
|
+
{
|
43
|
+
:'tags' => :'tags',
|
44
|
+
:'language' => :'language',
|
45
|
+
:'timezone_id' => :'timezone_id',
|
46
|
+
:'lat' => :'lat',
|
47
|
+
:'long' => :'long',
|
48
|
+
:'country' => :'country',
|
49
|
+
:'first_active' => :'first_active',
|
50
|
+
:'last_active' => :'last_active',
|
51
|
+
:'amount_spent' => :'amount_spent',
|
52
|
+
:'purchases' => :'purchases',
|
53
|
+
:'ip' => :'ip'
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# Returns all the JSON keys this model knows about
|
58
|
+
def self.acceptable_attributes
|
59
|
+
attribute_map.values
|
60
|
+
end
|
61
|
+
|
62
|
+
# Attribute type mapping.
|
63
|
+
def self.openapi_types
|
64
|
+
{
|
65
|
+
:'tags' => :'Hash<String, Object>',
|
66
|
+
:'language' => :'String',
|
67
|
+
:'timezone_id' => :'String',
|
68
|
+
:'lat' => :'Float',
|
69
|
+
:'long' => :'Float',
|
70
|
+
:'country' => :'String',
|
71
|
+
:'first_active' => :'Float',
|
72
|
+
:'last_active' => :'Float',
|
73
|
+
:'amount_spent' => :'Float',
|
74
|
+
:'purchases' => :'Array<Purchase>',
|
75
|
+
:'ip' => :'String'
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
# List of attributes with nullable: true
|
80
|
+
def self.openapi_nullable
|
81
|
+
Set.new([
|
82
|
+
])
|
83
|
+
end
|
84
|
+
|
85
|
+
# Initializes the object
|
86
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
87
|
+
def initialize(attributes = {})
|
88
|
+
if (!attributes.is_a?(Hash))
|
89
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::PropertiesObject` initialize method"
|
90
|
+
end
|
91
|
+
|
92
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
93
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
94
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
95
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::PropertiesObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
96
|
+
end
|
97
|
+
h[k.to_sym] = v
|
98
|
+
}
|
99
|
+
|
100
|
+
if attributes.key?(:'tags')
|
101
|
+
if (value = attributes[:'tags']).is_a?(Hash)
|
102
|
+
self.tags = value
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.key?(:'language')
|
107
|
+
self.language = attributes[:'language']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.key?(:'timezone_id')
|
111
|
+
self.timezone_id = attributes[:'timezone_id']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.key?(:'lat')
|
115
|
+
self.lat = attributes[:'lat']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.key?(:'long')
|
119
|
+
self.long = attributes[:'long']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.key?(:'country')
|
123
|
+
self.country = attributes[:'country']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.key?(:'first_active')
|
127
|
+
self.first_active = attributes[:'first_active']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:'last_active')
|
131
|
+
self.last_active = attributes[:'last_active']
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes.key?(:'amount_spent')
|
135
|
+
self.amount_spent = attributes[:'amount_spent']
|
136
|
+
end
|
137
|
+
|
138
|
+
if attributes.key?(:'purchases')
|
139
|
+
if (value = attributes[:'purchases']).is_a?(Array)
|
140
|
+
self.purchases = value
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.key?(:'ip')
|
145
|
+
self.ip = attributes[:'ip']
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
150
|
+
# @return Array for valid properties with the reasons
|
151
|
+
def list_invalid_properties
|
152
|
+
invalid_properties = Array.new
|
153
|
+
invalid_properties
|
154
|
+
end
|
155
|
+
|
156
|
+
# Check to see if the all the properties in the model are valid
|
157
|
+
# @return true if the model is valid
|
158
|
+
def valid?
|
159
|
+
true
|
160
|
+
end
|
161
|
+
|
162
|
+
# Checks equality by comparing each attribute.
|
163
|
+
# @param [Object] Object to be compared
|
164
|
+
def ==(o)
|
165
|
+
return true if self.equal?(o)
|
166
|
+
self.class == o.class &&
|
167
|
+
tags == o.tags &&
|
168
|
+
language == o.language &&
|
169
|
+
timezone_id == o.timezone_id &&
|
170
|
+
lat == o.lat &&
|
171
|
+
long == o.long &&
|
172
|
+
country == o.country &&
|
173
|
+
first_active == o.first_active &&
|
174
|
+
last_active == o.last_active &&
|
175
|
+
amount_spent == o.amount_spent &&
|
176
|
+
purchases == o.purchases &&
|
177
|
+
ip == o.ip
|
178
|
+
end
|
179
|
+
|
180
|
+
# @see the `==` method
|
181
|
+
# @param [Object] Object to be compared
|
182
|
+
def eql?(o)
|
183
|
+
self == o
|
184
|
+
end
|
185
|
+
|
186
|
+
# Calculates hash code according to all attributes.
|
187
|
+
# @return [Integer] Hash code
|
188
|
+
def hash
|
189
|
+
[tags, language, timezone_id, lat, long, country, first_active, last_active, amount_spent, purchases, ip].hash
|
190
|
+
end
|
191
|
+
|
192
|
+
# Builds the object from hash
|
193
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
194
|
+
# @return [Object] Returns the model itself
|
195
|
+
def self.build_from_hash(attributes)
|
196
|
+
new.build_from_hash(attributes)
|
197
|
+
end
|
198
|
+
|
199
|
+
# Builds the object from hash
|
200
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
201
|
+
# @return [Object] Returns the model itself
|
202
|
+
def build_from_hash(attributes)
|
203
|
+
return nil unless attributes.is_a?(Hash)
|
204
|
+
attributes = attributes.transform_keys(&:to_sym)
|
205
|
+
self.class.openapi_types.each_pair do |key, type|
|
206
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
207
|
+
self.send("#{key}=", nil)
|
208
|
+
elsif type =~ /\AArray<(.*)>/i
|
209
|
+
# check to ensure the input is an array given that the attribute
|
210
|
+
# is documented as an array but the input is not
|
211
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
212
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
213
|
+
end
|
214
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
215
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
self
|
220
|
+
end
|
221
|
+
|
222
|
+
# Deserializes the data based on type
|
223
|
+
# @param string type Data type
|
224
|
+
# @param string value Value to be deserialized
|
225
|
+
# @return [Object] Deserialized data
|
226
|
+
def _deserialize(type, value)
|
227
|
+
case type.to_sym
|
228
|
+
when :Time
|
229
|
+
Time.parse(value)
|
230
|
+
when :Date
|
231
|
+
Date.parse(value)
|
232
|
+
when :String
|
233
|
+
value.to_s
|
234
|
+
when :Integer
|
235
|
+
value.to_i
|
236
|
+
when :Float
|
237
|
+
value.to_f
|
238
|
+
when :Boolean
|
239
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
240
|
+
true
|
241
|
+
else
|
242
|
+
false
|
243
|
+
end
|
244
|
+
when :Object
|
245
|
+
# generic object (usually a Hash), return directly
|
246
|
+
value
|
247
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
248
|
+
inner_type = Regexp.last_match[:inner_type]
|
249
|
+
value.map { |v| _deserialize(inner_type, v) }
|
250
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
251
|
+
k_type = Regexp.last_match[:k_type]
|
252
|
+
v_type = Regexp.last_match[:v_type]
|
253
|
+
{}.tap do |hash|
|
254
|
+
value.each do |k, v|
|
255
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
256
|
+
end
|
257
|
+
end
|
258
|
+
else # model
|
259
|
+
# models (e.g. Pet) or oneOf
|
260
|
+
klass = OneSignal.const_get(type)
|
261
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
# Returns the string representation of the object
|
266
|
+
# @return [String] String presentation of the object
|
267
|
+
def to_s
|
268
|
+
to_hash.to_s
|
269
|
+
end
|
270
|
+
|
271
|
+
# to_body is an alias to to_hash (backward compatibility)
|
272
|
+
# @return [Hash] Returns the object in the form of hash
|
273
|
+
def to_body
|
274
|
+
to_hash
|
275
|
+
end
|
276
|
+
|
277
|
+
# Returns the object in the form of hash
|
278
|
+
# @return [Hash] Returns the object in the form of hash
|
279
|
+
def to_hash
|
280
|
+
hash = {}
|
281
|
+
self.class.attribute_map.each_pair do |attr, param|
|
282
|
+
value = self.send(attr)
|
283
|
+
if value.nil?
|
284
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
285
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
286
|
+
end
|
287
|
+
|
288
|
+
hash[param] = _to_hash(value)
|
289
|
+
end
|
290
|
+
hash
|
291
|
+
end
|
292
|
+
|
293
|
+
# Outputs non-array value in the form of hash
|
294
|
+
# For object, use to_hash. Otherwise, just return the value
|
295
|
+
# @param [Object] value Any valid value
|
296
|
+
# @return [Hash] Returns the value in the form of hash
|
297
|
+
def _to_hash(value)
|
298
|
+
if value.is_a?(Array)
|
299
|
+
value.compact.map { |v| _to_hash(v) }
|
300
|
+
elsif value.is_a?(Hash)
|
301
|
+
{}.tap do |hash|
|
302
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
303
|
+
end
|
304
|
+
elsif value.respond_to? :to_hash
|
305
|
+
value.to_hash
|
306
|
+
else
|
307
|
+
value
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
end
|
312
|
+
|
313
|
+
end
|
@@ -0,0 +1,264 @@
|
|
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: 1.2.2
|
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
|
+
class Purchase
|
18
|
+
# The unique identifier of the purchased item.
|
19
|
+
attr_accessor :sku
|
20
|
+
|
21
|
+
# The amount, in USD, spent purchasing the item.
|
22
|
+
attr_accessor :amount
|
23
|
+
|
24
|
+
# The 3-letter ISO 4217 currency code. Required for correct storage and conversion of amount.
|
25
|
+
attr_accessor :iso
|
26
|
+
|
27
|
+
attr_accessor :count
|
28
|
+
|
29
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
30
|
+
def self.attribute_map
|
31
|
+
{
|
32
|
+
:'sku' => :'sku',
|
33
|
+
:'amount' => :'amount',
|
34
|
+
:'iso' => :'iso',
|
35
|
+
:'count' => :'count'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Returns all the JSON keys this model knows about
|
40
|
+
def self.acceptable_attributes
|
41
|
+
attribute_map.values
|
42
|
+
end
|
43
|
+
|
44
|
+
# Attribute type mapping.
|
45
|
+
def self.openapi_types
|
46
|
+
{
|
47
|
+
:'sku' => :'String',
|
48
|
+
:'amount' => :'String',
|
49
|
+
:'iso' => :'String',
|
50
|
+
:'count' => :'Float'
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
# List of attributes with nullable: true
|
55
|
+
def self.openapi_nullable
|
56
|
+
Set.new([
|
57
|
+
])
|
58
|
+
end
|
59
|
+
|
60
|
+
# Initializes the object
|
61
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
62
|
+
def initialize(attributes = {})
|
63
|
+
if (!attributes.is_a?(Hash))
|
64
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::Purchase` initialize method"
|
65
|
+
end
|
66
|
+
|
67
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
68
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
69
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
70
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::Purchase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
71
|
+
end
|
72
|
+
h[k.to_sym] = v
|
73
|
+
}
|
74
|
+
|
75
|
+
if attributes.key?(:'sku')
|
76
|
+
self.sku = attributes[:'sku']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:'amount')
|
80
|
+
self.amount = attributes[:'amount']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:'iso')
|
84
|
+
self.iso = attributes[:'iso']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:'count')
|
88
|
+
self.count = attributes[:'count']
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
93
|
+
# @return Array for valid properties with the reasons
|
94
|
+
def list_invalid_properties
|
95
|
+
invalid_properties = Array.new
|
96
|
+
if @sku.nil?
|
97
|
+
invalid_properties.push('invalid value for "sku", sku cannot be nil.')
|
98
|
+
end
|
99
|
+
|
100
|
+
if @amount.nil?
|
101
|
+
invalid_properties.push('invalid value for "amount", amount cannot be nil.')
|
102
|
+
end
|
103
|
+
|
104
|
+
if @iso.nil?
|
105
|
+
invalid_properties.push('invalid value for "iso", iso cannot be nil.')
|
106
|
+
end
|
107
|
+
|
108
|
+
invalid_properties
|
109
|
+
end
|
110
|
+
|
111
|
+
# Check to see if the all the properties in the model are valid
|
112
|
+
# @return true if the model is valid
|
113
|
+
def valid?
|
114
|
+
return false if @sku.nil?
|
115
|
+
return false if @amount.nil?
|
116
|
+
return false if @iso.nil?
|
117
|
+
true
|
118
|
+
end
|
119
|
+
|
120
|
+
# Checks equality by comparing each attribute.
|
121
|
+
# @param [Object] Object to be compared
|
122
|
+
def ==(o)
|
123
|
+
return true if self.equal?(o)
|
124
|
+
self.class == o.class &&
|
125
|
+
sku == o.sku &&
|
126
|
+
amount == o.amount &&
|
127
|
+
iso == o.iso &&
|
128
|
+
count == o.count
|
129
|
+
end
|
130
|
+
|
131
|
+
# @see the `==` method
|
132
|
+
# @param [Object] Object to be compared
|
133
|
+
def eql?(o)
|
134
|
+
self == o
|
135
|
+
end
|
136
|
+
|
137
|
+
# Calculates hash code according to all attributes.
|
138
|
+
# @return [Integer] Hash code
|
139
|
+
def hash
|
140
|
+
[sku, amount, iso, count].hash
|
141
|
+
end
|
142
|
+
|
143
|
+
# Builds the object from hash
|
144
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
145
|
+
# @return [Object] Returns the model itself
|
146
|
+
def self.build_from_hash(attributes)
|
147
|
+
new.build_from_hash(attributes)
|
148
|
+
end
|
149
|
+
|
150
|
+
# Builds the object from hash
|
151
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
152
|
+
# @return [Object] Returns the model itself
|
153
|
+
def build_from_hash(attributes)
|
154
|
+
return nil unless attributes.is_a?(Hash)
|
155
|
+
attributes = attributes.transform_keys(&:to_sym)
|
156
|
+
self.class.openapi_types.each_pair do |key, type|
|
157
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
158
|
+
self.send("#{key}=", nil)
|
159
|
+
elsif type =~ /\AArray<(.*)>/i
|
160
|
+
# check to ensure the input is an array given that the attribute
|
161
|
+
# is documented as an array but the input is not
|
162
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
163
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
164
|
+
end
|
165
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
166
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
self
|
171
|
+
end
|
172
|
+
|
173
|
+
# Deserializes the data based on type
|
174
|
+
# @param string type Data type
|
175
|
+
# @param string value Value to be deserialized
|
176
|
+
# @return [Object] Deserialized data
|
177
|
+
def _deserialize(type, value)
|
178
|
+
case type.to_sym
|
179
|
+
when :Time
|
180
|
+
Time.parse(value)
|
181
|
+
when :Date
|
182
|
+
Date.parse(value)
|
183
|
+
when :String
|
184
|
+
value.to_s
|
185
|
+
when :Integer
|
186
|
+
value.to_i
|
187
|
+
when :Float
|
188
|
+
value.to_f
|
189
|
+
when :Boolean
|
190
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
191
|
+
true
|
192
|
+
else
|
193
|
+
false
|
194
|
+
end
|
195
|
+
when :Object
|
196
|
+
# generic object (usually a Hash), return directly
|
197
|
+
value
|
198
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
199
|
+
inner_type = Regexp.last_match[:inner_type]
|
200
|
+
value.map { |v| _deserialize(inner_type, v) }
|
201
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
202
|
+
k_type = Regexp.last_match[:k_type]
|
203
|
+
v_type = Regexp.last_match[:v_type]
|
204
|
+
{}.tap do |hash|
|
205
|
+
value.each do |k, v|
|
206
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
else # model
|
210
|
+
# models (e.g. Pet) or oneOf
|
211
|
+
klass = OneSignal.const_get(type)
|
212
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
# Returns the string representation of the object
|
217
|
+
# @return [String] String presentation of the object
|
218
|
+
def to_s
|
219
|
+
to_hash.to_s
|
220
|
+
end
|
221
|
+
|
222
|
+
# to_body is an alias to to_hash (backward compatibility)
|
223
|
+
# @return [Hash] Returns the object in the form of hash
|
224
|
+
def to_body
|
225
|
+
to_hash
|
226
|
+
end
|
227
|
+
|
228
|
+
# Returns the object in the form of hash
|
229
|
+
# @return [Hash] Returns the object in the form of hash
|
230
|
+
def to_hash
|
231
|
+
hash = {}
|
232
|
+
self.class.attribute_map.each_pair do |attr, param|
|
233
|
+
value = self.send(attr)
|
234
|
+
if value.nil?
|
235
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
236
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
237
|
+
end
|
238
|
+
|
239
|
+
hash[param] = _to_hash(value)
|
240
|
+
end
|
241
|
+
hash
|
242
|
+
end
|
243
|
+
|
244
|
+
# Outputs non-array value in the form of hash
|
245
|
+
# For object, use to_hash. Otherwise, just return the value
|
246
|
+
# @param [Object] value Any valid value
|
247
|
+
# @return [Hash] Returns the value in the form of hash
|
248
|
+
def _to_hash(value)
|
249
|
+
if value.is_a?(Array)
|
250
|
+
value.compact.map { |v| _to_hash(v) }
|
251
|
+
elsif value.is_a?(Hash)
|
252
|
+
{}.tap do |hash|
|
253
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
254
|
+
end
|
255
|
+
elsif value.respond_to? :to_hash
|
256
|
+
value.to_hash
|
257
|
+
else
|
258
|
+
value
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
end
|
263
|
+
|
264
|
+
end
|