Sha256: f62912ec1c45d5fb1c03b1b6f70ecdb9b29be2e67a3391ade3f853e670bddda5
Contents?: true
Size: 832 Bytes
Versions: 1
Compression:
Stored size: 832 Bytes
Contents
require 'faraday' require 'faraday_middleware' module Tumblr module Connection def connection(options={}) options = options.clone default_options = { :headers => { :accept => 'application/json', :user_agent => "tumblr_client (ruby) - #{Tumblr::VERSION}" }, :url => "http://#{api_host}/" } client = options.delete(:client) || Faraday.default_adapter Faraday.new("http://#{api_host}/", default_options.merge(options)) do |conn| data = { :api_host => api_host }.merge(credentials) unless credentials.empty? conn.request :oauth, data end conn.request :multipart conn.request :url_encoded conn.response :json, :content_type => /\bjson$/ conn.adapter client end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tumblr_client-0.8.3 | lib/tumblr/connection.rb |