Sha256: 9b7b9f504f6dd385516ecd06dd208ad4ffd05f1b7a8169419e02dedf39832673

Contents?: true

Size: 616 Bytes

Versions: 33

Compression:

Stored size: 616 Bytes

Contents

module Expressive
  class Webhook

    def initialize(verb, url, params, headers)
      @verb, @url, @params, @headers = verb, url, params, headers
    end

    def execute
      self.send(@verb)
    end

    private
    def post
      headers = {:content_type => :json, :accept => :json}
      headers = headers.merge(@headers) if @headers
      RestClient.post(@url, @params.to_json, headers)
    end

    def get
      headers = {:params => @params}
      headers = headers.merge(@headers) if @headers
      RestClient.get(@url, headers)
    end

    def put
      RestClient.put(@url, @params)
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
expressive-0.0.22 lib/webhook.rb
expressive-0.0.21 lib/webhook.rb
expressive-0.0.20 lib/webhook.rb
expressive-0.0.18 lib/webhook.rb
expressive-0.0.17 lib/webhook.rb
expressive-0.0.16 lib/webhook.rb
expressive-0.0.15 lib/webhook.rb
expressive-0.0.14 lib/webhook.rb
expressive-0.0.13 lib/webhook.rb
expressive-0.0.12 lib/webhook.rb
expressive-0.0.11 lib/webhook.rb
expressive-0.0.10 lib/webhook.rb
expressive-0.0.9 lib/webhook.rb