Sha256: 6e6f139452bed23569b4abe3392273ba15586c39a4375a354f9be7fe11b339b7

Contents?: true

Size: 734 Bytes

Versions: 6

Compression:

Stored size: 734 Bytes

Contents

require 'faraday'
require 'faraday_middleware'
require 'tumblr/request/oauth'

module Tumblr
  module Connection
    def connection(options={})
      default_options = {
        :headers => {
          :accept => "application/json",
          :user_agent => "Tumblr v1.0"
        },
        :url => "http://api.tumblr.com/"
      }
      Faraday.new("http://api.tumblr.com/", default_options.merge(options)) do |builder|
        builder.use Tumblr::Request::TumblrOAuth, Tumblr::credentials if not Tumblr::credentials.empty?
        builder.use Faraday::Request::UrlEncoded
        builder.use FaradayMiddleware::ParseJson, :content_type => "application/json"
        builder.use Faraday::Adapter::NetHttp
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
tumblr_client-0.6.9 lib/tumblr/connection.rb
tumblr_client-0.6.8 lib/tumblr/connection.rb
tumblr_client_faraday_0_8-0.6.7.1 lib/tumblr/connection.rb
tumblr_client-0.6.7 lib/tumblr/connection.rb
tumblr_client-0.6.6 lib/tumblr/connection.rb
tumblr_client-0.6.5 lib/tumblr/connection.rb