lib/lita/adapters/ringcentral/connector.rb in lita-ringcentral-0.0.1 vs lib/lita/adapters/ringcentral/connector.rb in lita-ringcentral-0.0.2

- old
+ new

@@ -20,25 +20,28 @@ def connect client_connect end def client_connect - Lita.logger.debug('Authenticating with RingCentral.') + Lita.logger.info('Authenticating with RingCentral.') if @token.nil? @client.authorize_password @username, @extension, @password else @client.set_token @token end - observer = Lita::Adapters::RingCentral::Callback.new @robot @subscription = @client.create_subscription @subscription.subscribe([ '/restapi/v1.0/account/~/extension/~/message-store/instant?type=SMS' ]) + + observer = Lita::Adapters::RingCentral::Callback.new @robot @subscription.add_observer observer end def message(to_number, strings) + Lita.logger.info("Sending message to #{to_number}") + Lita.logger.info MultiJson.encode(strings) strings.each do |s| @client.messages.sms.create( from: @sms_number, to: to_number, text: s \ No newline at end of file