Sha256: ecdd386c7b60d3c9b0c272bffd02cc4af8bb80bba18cb6caafa528afd02f4b4f

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

require 'tumblr/blog'
require 'tumblr/user'
require 'tumblr/request'
require 'tumblr/connection'
require 'tumblr/post'
require 'tumblr/tagged'
require 'tumblr/helpers'

module Tumblr
  class Client

    class << self
      def default_api_host
        ENV['TUMBLR_API_HOST'] || 'api.tumblr.com'
      end
    end

    include Tumblr::Request
    include Tumblr::Blog
    include Tumblr::User
    include Tumblr::Post
    include Tumblr::Tagged
    include Tumblr::Helper
    include Tumblr::Connection

    def initialize(attrs= {})
      attrs = Tumblr.options.merge(attrs)
      Config::VALID_OPTIONS_KEYS.each do |key|
        instance_variable_set("@#{key}".to_sym, attrs[key])
      end
    end

    def api_host
      self.class.default_api_host
    end

    def api_scheme
      @api_scheme || 'https'
    end

    def credentials
      {
        :consumer_key => @consumer_key,
        :consumer_secret => @consumer_secret,
        :token => @oauth_token,
        :token_secret => @oauth_token_secret
      }
    end

  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
doomy_client-0.8.5 lib/tumblr/client.rb
tumblr_client-0.8.5 lib/tumblr/client.rb