Sha256: 25c2a2aa630489fc2ed4b9c02f675b2fe244a6fd60e7ea945465d4c6aa9894d3
Contents?: true
Size: 846 Bytes
Versions: 1
Compression:
Stored size: 846 Bytes
Contents
require 'faraday' require 'faraday_middleware' module MediumSdk::Connection class IntegrationToken attr_accessor :http attr_accessor :token def initialize(opts = {}) @endpoint = 'https://api.medium.com/v1/' @token = opts[:integration_token] if opts.key? :integration_token set_client end def set_client() headers = { 'Host' => 'api.medium.com', 'Authorization' => 'Bearer ' + @token, 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Accept-Charset' => 'utf-8' } @http = Faraday.new(url: @endpoint, headers: headers) do |conn| conn.request :multipart conn.request :json conn.response :json, content_type: 'application/json' conn.adapter Faraday.default_adapter end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
medium_sdk-0.0.3 | lib/medium_sdk/connection/integration_token.rb |