Sha256: 17d19deef4e2b629f31e7c1ae4bbff6257cbf896ffef96dbb163f77c775c680e

Contents?: true

Size: 614 Bytes

Versions: 6

Compression:

Stored size: 614 Bytes

Contents

module Lita
  module Adapters
    class Glip < Adapter
      class RoomCreator
        class << self
          def find_or_create_room(room_id, glip_sdk)
            Lita::Room.find_by_id(room_id) || create_room(room_id, glip_sdk)
          end

          def create_room(room_id, glip_sdk)
            res = glip_sdk.groups.get groupId: room_id
            if res.status == 200
              glip_room = res.body
              return Lita::Room.create_or_update room_id, name: glip_room['name']
            end
            Lita::Room.create_or_update room_id
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lita-glip-0.2.0 lib/lita/adapters/glip/room_creator.rb
lita-glip-0.1.0 lib/lita/adapters/glip/room_creator.rb
lita-glip-0.0.4 lib/lita/adapters/glip/room_creator.rb
lita-glip-0.0.3 lib/lita/adapters/glip/room_creator.rb
lita-glip-0.0.2 lib/lita/adapters/glip/room_creator.rb
lita-glip-0.0.1 lib/lita/adapters/glip/room_creator.rb