Sha256: 5b93916aef2be1cae7e321101b29bf3694c0e842b2d203dc893e7760d886f91a

Contents?: true

Size: 613 Bytes

Versions: 1

Compression:

Stored size: 613 Bytes

Contents

require "hall/version"
require "httparty"

module Hall

  class Client
    include HTTParty
    base_uri 'https://hall.com/api/1/'

    def initialize(room_token, integration_name)
      @room_token = room_token
      @integration_name = integration_name
    end

    def post_message(text)
      body ={
        "title" => @integration_name,
        "message" => text
      }

      options = {body: body, options: { headers: { 'ContentType' => 'application/json' } } }

      self.class.post(room_path, options)
    end

    private

    def room_path
      '/services/generic/' + @room_token
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hall-0.0.2 lib/hall.rb