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.42 lib/webhook.rb
expressive-0.0.41 lib/webhook.rb
expressive-0.0.40 lib/webhook.rb
expressive-0.0.39 lib/webhook.rb
expressive-0.0.38 lib/webhook.rb
expressive-0.0.37 lib/webhook.rb
expressive-0.0.36 lib/webhook.rb
expressive-0.0.35 lib/webhook.rb
expressive-0.0.34 lib/webhook.rb
expressive-0.0.33 lib/webhook.rb
expressive-0.0.32 lib/webhook.rb
expressive-0.0.31 lib/webhook.rb
expressive-0.0.30 lib/webhook.rb
expressive-0.0.29 lib/webhook.rb
expressive-0.0.28 lib/webhook.rb
expressive-0.0.27 lib/webhook.rb
expressive-0.0.26 lib/webhook.rb
expressive-0.0.25 lib/webhook.rb
expressive-0.0.24 lib/webhook.rb
expressive-0.0.23 lib/webhook.rb