Sha256: 5fa6a8c601e4689a6f60d42b71463ea008cdc4b434121b3516a61cf88c77309c

Contents?: true

Size: 471 Bytes

Versions: 2

Compression:

Stored size: 471 Bytes

Contents

module ZaloAPI
  module Middleware
    module Request
      class UrlBasedAccessToken < Faraday::Middleware
        def initialize(app, token)
          super(app)
          @token = token
        end

        def call(env)
          if env[:url].query
            env[:url].query += '&'
          else
            env[:url].query = ''
          end

          env[:url].query += "access_token=#{@token}"

          @app.call(env)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zalo-api-0.1.1 lib/zalo_api/middleware/request/url_based_access_token.rb
zalo-api-0.1.0 lib/zalo_api/middleware/request/url_based_access_token.rb