class MotionPusherClient

Attributes

client[RW]

Public Class Methods

new(delegate) click to toggle source
# File lib/motion-pusher/motion-pusher-client.rb, line 2
def initialize(delegate)
  self.client = PTPusher.pusherWithKey(
    self.config['key'],
    delegate: delegate,
    encrypted: true
  )
  if self.config['authorization_url']
    self.client.authorizationURL = NSURL.URLWithString(self.config['authorization_url'])
  end
end

Public Instance Methods

config() click to toggle source
# File lib/motion-pusher/motion-pusher-client.rb, line 34
def config
  @config ||= NSBundle.mainBundle.objectForInfoDictionaryKey('MotionPusher')
end
connect() click to toggle source
# File lib/motion-pusher/motion-pusher-client.rb, line 13
def connect
  client.connect
end
subscribe_to(channel) click to toggle source
# File lib/motion-pusher/motion-pusher-client.rb, line 17
def subscribe_to(channel)
  client.subscribeToChannelNamed(channel)
end
subscribe_to_presence(channel) click to toggle source
# File lib/motion-pusher/motion-pusher-client.rb, line 25
def subscribe_to_presence(channel)
  client.subscribeToPresenceChannelNamed(channel)
end
subscribe_to_private(channel) click to toggle source
# File lib/motion-pusher/motion-pusher-client.rb, line 21
def subscribe_to_private(channel)
  client.subscribeToPrivateChannelNamed(channel)
end
unsubscribe_from(channel) click to toggle source
# File lib/motion-pusher/motion-pusher-client.rb, line 29
def unsubscribe_from(channel)
  channel = self.client.channelNamed(channel) if channel.is_a? String
  channel.unsubscribe if channel
end