Sha256: a3150aeb4515e6a7ca58240f94c3298826891e6216fb7040c30d8b22ed7d990f
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
require 'faraday' require 'faraday_middleware' module Mattermost module Request def get(path, options = {}, &block) puts "get #{path}, #{options}" connection.send(:get) do |request| request.url api(path), options end end def post(path, options = {}, &block) connection.send(:post) do |request| request.path = api(path) request.body = options[:body] if options.key? :body end end def put(path, options = {}, &block) connection.send(:put) do |request| request.path = api(path) request.body = options[:body] if options.key? :body end end def delete(path, options = {}, &block) connection.send(:delete) do |request| request.path = api(path) request.body = options[:body] if options.key? :body end end private def connection Faraday::Connection.new({ :headers => self.headers, :url => server }) do |connection| connection.response :json connection.adapter :httpclient end end def api(path) "#{subdir}/api/v4#{path}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mattermost-api4-ruby-0.0.10 | lib/mattermost/request.rb |
mattermost-api4-ruby-0.0.9 | lib/mattermost/request.rb |