Sha256: 689fe96932edfd3bed0a82d17bf185bcfa8f7d1619e6cdcd028729b8289e42d8

Contents?: true

Size: 644 Bytes

Versions: 8

Compression:

Stored size: 644 Bytes

Contents

module Clicksign
  module API
    module Requests
      def post(request_path, body, token)
        conn.post do |req|
          req.url request_path, { access_token: Clicksign::API.credentials[token] }
          req.headers['Content-Type'] = 'application/json'
          req.body = body.to_json
        end
      end

      def get(request_path, token)
        conn.get do |req|
          req.url request_path, { access_token: Clicksign::API.credentials[token] }
          req.headers['Content-Type'] = 'application/json'
        end
      end

      def conn
        @conn ||= Faraday.new(url: Clicksign::API.url)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
clicksign-api-1.1.1 lib/clicksign/api/requests.rb
clicksign-api-1.1.0 lib/clicksign/api/requests.rb
clicksign-api-1.1.0.alpha6 lib/clicksign/api/requests.rb
clicksign-api-1.1.0.alpha5 lib/clicksign/api/requests.rb
clicksign-api-1.1.0.alpha4 lib/clicksign/api/requests.rb
clicksign-api-1.1.0.alpha3 lib/clicksign/api/requests.rb
clicksign-api-1.1.0.alpha2 lib/clicksign/api/requests.rb
clicksign-api-1.1.0.alpha lib/clicksign/api/requests.rb