Sha256: 753f2819e91e8747b4d0810f0e9df056aabad42caf5e09d8691307ee882303d5
Contents?: true
Size: 815 Bytes
Versions: 2
Compression:
Stored size: 815 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 :json conn.response :json, content_type: 'application/json' conn.adapter Faraday.default_adapter end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
medium_sdk-0.0.2 | lib/medium_sdk/connection/integration_token.rb |
medium_sdk-0.0.1 | lib/medium_sdk/connection/integration_token.rb |