jam-cloud/ruby/lib/jam_ruby/lib/subscription_message.rb

44 lines
2.1 KiB
Ruby

module JamRuby
class SubscriptionMessage
# sent whenever we change the desired direction of the source
def self.mount_source_direction(mount)
Notification.send_subscription_message('mount', mount.id, {type: 'source_direction_change', source_direction: true}.to_json)
end
# sent whenever we receive an update about a sourcing attempt by a client
# source_change_json is created by a rabl, so currently only possible to use via web
def self.mount_source_change(mount, source_change_json)
Notification.send_subscription_message('mount', mount.id, source_change_json)
end
def self.mount_source_up_requested(mount)
Notification.send_subscription_message('mount', mount.id, {change_type: IcecastSourceChange::CHANGE_TYPE_MOUNT_UP_REQUEST}.to_json)
end
def self.mount_source_down_requested(mount)
Notification.send_subscription_message('mount', mount.id, {change_type: IcecastSourceChange::CHANGE_TYPE_MOUNT_DOWN_REQUEST}.to_json)
end
def self.jam_track_signing_job_change(jam_track_right)
Notification.send_subscription_message('jam_track_right', jam_track_right.id.to_s,
{signing_state: jam_track_right.signing_state,
current_packaging_step: jam_track_right.current_packaging_step,
packaging_steps: jam_track_right.packaging_steps}.to_json)
end
def self.mixdown_signing_job_change(jam_track_mixdown_package)
Notification.send_subscription_message('mixdown', jam_track_mixdown_package.id.to_s,
{signing_state: jam_track_mixdown_package.signing_state,
current_packaging_step: jam_track_mixdown_package.current_packaging_step,
packaging_steps: jam_track_mixdown_package.packaging_steps}.to_json)
end
def self.test
Notification.send_subscription_message('some_key', '1', {field1: 'field1', field2: 'field2'}.to_json)
end
end
end