Class: MotionPusherClient

Inherits:
Object
  • Object
show all
Defined in:
lib/motion-pusher/motion-pusher-client.rb

Instance Method Summary collapse

Constructor Details

#initialize(delegate) ⇒ MotionPusherClient

Returns a new instance of MotionPusherClient.



2
3
4
5
6
7
8
# File 'lib/motion-pusher/motion-pusher-client.rb', line 2

def initialize(delegate)
  self.client = PTPusher.pusherWithKey(
    self.config['key'],
    delegate: delegate,
    encrypted: true
  )
end

Instance Method Details

#configObject



22
23
24
# File 'lib/motion-pusher/motion-pusher-client.rb', line 22

def config
  @config ||= NSBundle.mainBundle.objectForInfoDictionaryKey('MotionPusher')
end

#connectObject



10
11
12
# File 'lib/motion-pusher/motion-pusher-client.rb', line 10

def connect
  client.connect
end

#subscribe_to(channel) ⇒ Object



14
15
16
# File 'lib/motion-pusher/motion-pusher-client.rb', line 14

def subscribe_to(channel)
  client.subscribeToChannelNamed(channel)
end

#subscribe_to_private(channel) ⇒ Object



18
19
20
# File 'lib/motion-pusher/motion-pusher-client.rb', line 18

def subscribe_to_private(channel)
  client.subscribeToPrivateChannelNamed(channel)
end