Class: Parse::PushStatus
- Defined in:
- lib/parse/model/classes/push_status.rb
Overview
_PushStatus is hardcoded master-key-only at Parse Server's
REST layer (SharedRest.js). CLP changes via
Object.set_clp have no effect — all reads and writes
require a master-key client.
This class represents the data and columns contained in the standard Parse
_PushStatus collection. Push status records track the delivery status
and metrics of push notifications sent through Parse Server.
Push status records are created automatically when a push is sent and are updated as the push progresses through the delivery pipeline.
Status lifecycle: pending → scheduled → running → succeeded/failed
The default schema for the PushStatus class is as follows: class Parse::PushStatus < Parse::Object # See Parse::Object for inherited properties...
property :push_hash # Unique hash identifying the push
property :query, :object # The query used to target installations
property :payload, :object # The push payload that was sent
property :source # "rest" or "webUI"
property :status # "pending", "scheduled", "running", "succeeded", "failed"
property :num_sent, :integer
property :num_failed, :integer
property :sent_per_type, :object
property :failed_per_type, :object
property :sent_per_utc_offset, :object
property :failed_per_utc_offset, :object
property :count, :integer # Total installations targeted
property :push_time, :date # When the push was/will be sent
property :expiry, :date # When the push expires
end
Constant Summary
Constants inherited from Object
Object::BUILTIN_PARSE_CLASS_NAMES, Object::IDENTIFICATION_FIELDS, Object::VALID_ACL_POLICIES
Constants included from Core::Schema
Core::Schema::DEFAULT_PUBLIC_CLP, Core::Schema::SCHEMA_READONLY_CLASSES
Constants included from Core::Describe
Core::Describe::ALL_SECTIONS, Core::Describe::CORE_FIELD_KEYS, Core::Describe::LOCAL_SECTIONS, Core::Describe::NETWORK_SECTIONS
Constants included from Core::Indexing
Core::Indexing::MAX_INDEXES_PER_COLLECTION, Core::Indexing::PARSE_MANAGED_ARRAY_FIELDS, Core::Indexing::SENSITIVE_FIELDS
Constants included from Core::SearchIndexing
Core::SearchIndexing::ALLOWED_INDEX_TYPES, Core::SearchIndexing::INDEX_NAME_PATTERN
Constants included from Core::Fetching
Core::Fetching::NON_SERIALIZABLE_IVARS
Constants included from Core::EmbedManaged
Core::EmbedManaged::WRITER_KEY
Constants included from Core::ParseReference
Core::ParseReference::OBJECT_ID_LENGTH, Core::ParseReference::SEPARATOR
Constants included from Core::FieldGuards
Core::FieldGuards::GUARD_MODES
Constants included from Properties
Parse::Properties::BASE, Parse::Properties::BASE_FIELD_MAP, Parse::Properties::BASE_KEYS, Parse::Properties::CORE_FIELDS, Parse::Properties::DELETE_OP, Parse::Properties::PROTECTED_INITIALIZE_KEYS, Parse::Properties::PROTECTED_MASS_ASSIGNMENT_KEYS, Parse::Properties::TYPES
Constants inherited from Pointer
Parse::Pointer::ATTRIBUTES, Parse::Pointer::OBJECT_ID_FORMAT
Constants inherited from Model
Model::CLASS_AUDIENCE, Model::CLASS_INSTALLATION, Model::CLASS_JOB_SCHEDULE, Model::CLASS_JOB_STATUS, Model::CLASS_PRODUCT, Model::CLASS_PUSH_STATUS, Model::CLASS_ROLE, Model::CLASS_SCHEMA, Model::CLASS_SESSION, Model::CLASS_USER, Model::ID, Model::KEY_CLASS_NAME, Model::KEY_CREATED_AT, Model::KEY_OBJECT_ID, Model::KEY_UPDATED_AT, Model::OBJECT_ID, Model::TYPE_ACL, Model::TYPE_BYTES, Model::TYPE_DATE, Model::TYPE_FIELD, Model::TYPE_FILE, Model::TYPE_GEOPOINT, Model::TYPE_NUMBER, Model::TYPE_OBJECT, Model::TYPE_POINTER, Model::TYPE_POLYGON, Model::TYPE_RELATION
Instance Attribute Summary collapse
-
#count ⇒ Integer
Total number of installations targeted by this push.
-
#error_message ⇒ String?
Error message if the push failed.
-
#expiry ⇒ Parse::Date
When the push expires and will no longer be delivered.
-
#failed_per_type ⇒ Hash
Breakdown of failed sends by device type.
-
#failed_per_utc_offset ⇒ Hash
Breakdown of failed sends by UTC timezone offset.
-
#num_failed ⇒ Integer
The number of notifications that failed to send.
-
#num_sent ⇒ Integer
The number of notifications successfully sent.
-
#payload ⇒ Hash
The push payload that was sent.
-
#push_hash ⇒ String
A unique hash identifying this push notification.
-
#push_time ⇒ Parse::Date
When the push was/will be sent.
-
#query ⇒ Hash
The query constraints used to target installations.
-
#sent_per_type ⇒ Hash
Breakdown of successful sends by device type (ios, android, etc.).
-
#sent_per_utc_offset ⇒ Hash
Breakdown of successful sends by UTC timezone offset.
-
#source ⇒ String
The source of the push ("rest" for API, "webUI" for dashboard).
-
#status ⇒ String
The current status of the push.
Attributes inherited from Object
#acl, #created_at, #id, #updated_at
Attributes inherited from Pointer
Class Method Summary collapse
-
.failed ⇒ Parse::Query
Query for failed pushes.
-
.pending ⇒ Parse::Query
Query for pending pushes (not yet started).
-
.recent ⇒ Parse::Query
Query for recent pushes, ordered by creation time descending.
-
.running ⇒ Parse::Query
Query for running pushes (currently being sent).
-
.scheduled ⇒ Parse::Query
Query for scheduled pushes (waiting for push_time).
-
.succeeded ⇒ Parse::Query
Query for succeeded pushes.
Instance Method Summary collapse
-
#complete? ⇒ Boolean
Check if the push is complete (either succeeded or failed).
-
#failed? ⇒ Boolean
Check if the push failed.
-
#failure_rate ⇒ Float
Get the failure rate as a percentage.
-
#in_progress? ⇒ Boolean
Check if the push is still in progress.
-
#pending? ⇒ Boolean
Check if the push is pending (not yet started).
-
#running? ⇒ Boolean
Check if the push is currently running.
-
#scheduled? ⇒ Boolean
Check if the push is scheduled (waiting for push_time).
-
#succeeded? ⇒ Boolean
Check if the push succeeded.
-
#success_rate ⇒ Float
Get the success rate as a percentage.
-
#summary ⇒ Hash
Get a summary of the push metrics.
-
#total_attempted ⇒ Integer
Get the total number of notifications attempted (sent + failed).
Methods inherited from Object
#[], #[]=, #__type, #_resolve_acl_owner_id, #_resolve_default_acl, #acl_changed?, acl_owner_field, acl_policy, acl_policy_setting, #acl_was, #acl_will_change!, #after_create, #after_destroy, #after_save, #after_update, #after_validation, #apply_defaults!, #around_create, #around_destroy, #around_save, #around_update, #around_validation, #as_json, #autofetch_disabled?, #before_create, #before_destroy, #before_save, #before_update, #before_validation, build, #changed, #changed?, class_permissions, #clear_attribute_change!, #clear_changes!, #clear_partial_fetch_state!, default_acls, describe_access, #disable_autofetch!, #enable_autofetch!, #existed?, fetch_clp, #fetched?, #fetched_keys, #fetched_keys=, #field_was_fetched?, #filter_for_user, filter_results_for_user, #fully_fetched?, #has?, #has_selective_keys?, #initialize, #keys, master_only_class!, #nested_fetched_keys, #nested_fetched_keys=, #nested_keys_for, #new?, #parse_class, #partially_fetched?, #persisted?, pointer, #pretty, private_acl!, protect_fields, #reload!, roles_for_user, #rollback!, #run_after_create_callbacks, #run_after_delete_callbacks, #run_after_save_callbacks, #schema, #search_highlights, #search_score, set_class_access, set_clp, set_default_acl, set_default_clp, set_read_user_fields, set_write_user_fields, #twin, unlistable_class!, update_clp!, #updates, #valid?, #validate!, #vector_score, wait_for, watch, webhook, webhook_function
Methods included from Core::Querying
#all, #all_as, #count_distinct, #cursor, #distinct, #each, #find, #find_cached, #first, #first_as, #last_updated, #latest, #literal_where, #newest, #oldest, #scope, #subscribe
Methods included from Core::Schema
#_default_class_level_permissions_for_upgrade, #auto_upgrade!, #create_schema, #fetch_schema, #reset_clp!, #schema, #update_schema
Methods included from Core::Describe
Methods included from Core::Indexing
#apply_indexes!, #indexes_plan, #mongo_geo_index, #mongo_index, #mongo_index_declarations, #mongo_relation_index
Methods included from Core::SearchIndexing
#apply_search_indexes!, #mongo_search_index, #mongo_search_index_declarations, #search_indexes_plan
Methods included from Core::VectorSearchable
Methods included from Agent::MetadataDSL
#agent_description, #agent_methods, #property_descriptions, #property_enum_descriptions
Methods included from Core::Actions
#_deleted?, #change_requests, #changes_applied!, #changes_payload, #create, #destroy, #destroy_request, #op_add!, #op_add_relation!, #op_add_unique!, #op_destroy!, #op_increment!, #op_remove!, #op_remove_relation!, #operate_field!, #prepare_save!, #relation_change_operations, #save, #save!, #set_attributes!, #update, #update!, #update_relations, #uri_path
Methods included from Core::Fetching
#autofetch!, #fetch, #fetch!, #fetch_cache!, #fetch_json, #fetch_object, #prepare_for_dirty_tracking!
Methods included from Associations::HasMany
has_many, #relation_changes?, #relation_updates, #relations
Methods included from Associations::BelongsTo
Methods included from Associations::HasOne
Methods included from Core::ParseReference
format, generate_object_id, parse
Methods included from Core::FieldGuards
Methods included from Properties
#apply_attributes!, #attribute_changes?, #attribute_updates, #attributes, #attributes=, #field_map, #fields, #format_operation, #format_value
Methods inherited from Pointer
#==, #[], #[]=, #__type, #attributes, #className, #fetch, #fetch_cache!, #fetch_json, #fetch_object, #fetched?, #hash, #initialize, #json_hash, #method_missing, #pointer, #pointer?, #present?, #respond_to_missing?, #search_highlights, #search_score, #sig, #vector_score
Methods inherited from Model
#dirty?, find_class, same_parse_class?
Methods included from Client::Connectable
Constructor Details
This class inherits a constructor from Parse::Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Parse::Pointer
Instance Attribute Details
#count ⇒ Integer
Total number of installations targeted by this push.
118 |
# File 'lib/parse/model/classes/push_status.rb', line 118 property :count, :integer |
#error_message ⇒ String?
Error message if the push failed.
133 |
# File 'lib/parse/model/classes/push_status.rb', line 133 property :error_message |
#expiry ⇒ Parse::Date
When the push expires and will no longer be delivered.
128 |
# File 'lib/parse/model/classes/push_status.rb', line 128 property :expiry, :date |
#failed_per_type ⇒ Hash
Breakdown of failed sends by device type.
101 |
# File 'lib/parse/model/classes/push_status.rb', line 101 property :failed_per_type, :object |
#failed_per_utc_offset ⇒ Hash
Breakdown of failed sends by UTC timezone offset.
113 |
# File 'lib/parse/model/classes/push_status.rb', line 113 property :failed_per_utc_offset, :object |
#num_failed ⇒ Integer
The number of notifications that failed to send.
89 |
# File 'lib/parse/model/classes/push_status.rb', line 89 property :num_failed, :integer |
#num_sent ⇒ Integer
The number of notifications successfully sent.
84 |
# File 'lib/parse/model/classes/push_status.rb', line 84 property :num_sent, :integer |
#payload ⇒ Hash
The push payload that was sent.
68 |
# File 'lib/parse/model/classes/push_status.rb', line 68 property :payload, :object |
#push_hash ⇒ String
A unique hash identifying this push notification.
58 |
# File 'lib/parse/model/classes/push_status.rb', line 58 property :push_hash |
#push_time ⇒ Parse::Date
When the push was/will be sent. For scheduled pushes, this is the future time.
123 |
# File 'lib/parse/model/classes/push_status.rb', line 123 property :push_time, :date |
#query ⇒ Hash
The query constraints used to target installations.
63 |
# File 'lib/parse/model/classes/push_status.rb', line 63 property :query, :object |
#sent_per_type ⇒ Hash
Breakdown of successful sends by device type (ios, android, etc.).
96 |
# File 'lib/parse/model/classes/push_status.rb', line 96 property :sent_per_type, :object |
#sent_per_utc_offset ⇒ Hash
Breakdown of successful sends by UTC timezone offset.
108 |
# File 'lib/parse/model/classes/push_status.rb', line 108 property :sent_per_utc_offset, :object |
#source ⇒ String
The source of the push ("rest" for API, "webUI" for dashboard).
73 |
# File 'lib/parse/model/classes/push_status.rb', line 73 property :source |
#status ⇒ String
The current status of the push. One of: "pending", "scheduled", "running", "succeeded", "failed"
79 |
# File 'lib/parse/model/classes/push_status.rb', line 79 property :status |
Class Method Details
.failed ⇒ Parse::Query
Query for failed pushes.
166 167 168 |
# File 'lib/parse/model/classes/push_status.rb', line 166 def failed query(status: "failed") end |
.pending ⇒ Parse::Query
Query for pending pushes (not yet started).
142 143 144 |
# File 'lib/parse/model/classes/push_status.rb', line 142 def pending query(status: "pending") end |
.recent ⇒ Parse::Query
Query for recent pushes, ordered by creation time descending.
172 173 174 |
# File 'lib/parse/model/classes/push_status.rb', line 172 def recent query.order(:created_at.desc) end |
.running ⇒ Parse::Query
Query for running pushes (currently being sent).
154 155 156 |
# File 'lib/parse/model/classes/push_status.rb', line 154 def running query(status: "running") end |
.scheduled ⇒ Parse::Query
Query for scheduled pushes (waiting for push_time).
148 149 150 |
# File 'lib/parse/model/classes/push_status.rb', line 148 def scheduled query(status: "scheduled") end |
.succeeded ⇒ Parse::Query
Query for succeeded pushes.
160 161 162 |
# File 'lib/parse/model/classes/push_status.rb', line 160 def succeeded query(status: "succeeded") end |
Instance Method Details
#complete? ⇒ Boolean
Check if the push is complete (either succeeded or failed).
213 214 215 |
# File 'lib/parse/model/classes/push_status.rb', line 213 def complete? succeeded? || failed? end |
#failed? ⇒ Boolean
Check if the push failed.
207 208 209 |
# File 'lib/parse/model/classes/push_status.rb', line 207 def failed? status == "failed" end |
#failure_rate ⇒ Float
Get the failure rate as a percentage.
245 246 247 |
# File 'lib/parse/model/classes/push_status.rb', line 245 def failure_rate 100.0 - success_rate end |
#in_progress? ⇒ Boolean
Check if the push is still in progress.
219 220 221 |
# File 'lib/parse/model/classes/push_status.rb', line 219 def in_progress? !complete? end |
#pending? ⇒ Boolean
Check if the push is pending (not yet started).
183 184 185 |
# File 'lib/parse/model/classes/push_status.rb', line 183 def pending? status == "pending" end |
#running? ⇒ Boolean
Check if the push is currently running.
195 196 197 |
# File 'lib/parse/model/classes/push_status.rb', line 195 def running? status == "running" end |
#scheduled? ⇒ Boolean
Check if the push is scheduled (waiting for push_time).
189 190 191 |
# File 'lib/parse/model/classes/push_status.rb', line 189 def scheduled? status == "scheduled" end |
#succeeded? ⇒ Boolean
Check if the push succeeded.
201 202 203 |
# File 'lib/parse/model/classes/push_status.rb', line 201 def succeeded? status == "succeeded" end |
#success_rate ⇒ Float
Get the success rate as a percentage.
237 238 239 240 241 |
# File 'lib/parse/model/classes/push_status.rb', line 237 def success_rate total = total_attempted return 0.0 if total == 0 ((num_sent || 0).to_f / total * 100).round(2) end |
#summary ⇒ Hash
Get a summary of the push metrics.
254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/parse/model/classes/push_status.rb', line 254 def summary { status: status, sent: num_sent || 0, failed: num_failed || 0, total_targeted: count || 0, success_rate: success_rate, sent_per_type: sent_per_type || {}, failed_per_type: failed_per_type || {}, } end |
#total_attempted ⇒ Integer
Get the total number of notifications attempted (sent + failed).
229 230 231 |
# File 'lib/parse/model/classes/push_status.rb', line 229 def total_attempted (num_sent || 0) + (num_failed || 0) end |