Sha256: 019f4feb0edcb9d3dad622cf1eec7a555b19d401a6a66e5435977f65f6314de3
Contents?: true
Size: 1.21 KB
Versions: 4
Compression:
Stored size: 1.21 KB
Contents
class J7W1ApplicationDevice < ActiveRecord::Base set_table_name 'j7w1_application_devices' belongs_to :owner, polymorphic: true <%- if options['async_engine'] -%> after_create :create_device_endpoint_async after_destroy :destroy_device_endpoint_async <%- else -%> after_create :create_device_endpoint after_destroy :destroy_device_endpoint <%- end -%> def push!(options = {}) J7W1::PushClient.push device_endpoint_arn, platform, *options end def create_device_endpoint device_endpoint_arn = J7W1::PushClient.create_device_endpoint device_identifier, platform_id, custom_user_data: "#{owner.class} ##{owner.id}" update_attributes! device_endpoint_arn: device_endpoint_arn end def destroy_device_endpoint J7W1::PushClient.destroy_endpoint device_arn end <%- if options['async_engine'] == 'delayed_job' -%> private def create_device_endpoint_async delay.create_device_endpoint end def destroy_device_endpoint_async delay.destroy_device_endpoint end <%- elsif options['async_engine'] == 'sidekiq' -%> private def create_device_endpoint_async J7W1Worker.perform_async id end def destroy_device_endpoint_async J7W1Worker.perform_async id end <%- end -%> end
Version data entries
4 entries across 4 versions & 1 rubygems