Sha256: a39a8da3e9ef44988025b2c4cb81dd9206ada093ebae90880cf26937759967e0

Contents?: true

Size: 1.58 KB

Versions: 10

Compression:

Stored size: 1.58 KB

Contents

module Tumblr
  module Blog

    # Gets the info about the blog
    def blog_info(blog_name)
      get(blog_path(blog_name, 'info'), :api_key => @consumer_key)
    end

    # Gets the avatar URL of specified size
    def avatar(blog_name, size = nil)
      url = blog_path(blog_name, 'avatar')
      url = "#{url}/#{size}" if size
      get_redirect_url(url)
    end

    # Gets the list of followers for the blog
    def followers(blog_name, options = {})
      validate_options([:limit, :offset], options)
      get(blog_path(blog_name, 'followers'), options)
    end

    # Gets the list of likes for the blog
    def blog_likes(blog_name, options = {})
      validate_options([:limit, :offset], options)
      url = blog_path(blog_name, 'likes')

      params = { :api_key => @consumer_key }
      params.merge! options
      get(url, params)
    end

    def posts(blog_name, options = {})
      url = blog_path(blog_name, 'posts')
      if options.has_key?(:type)
        url = "#{url}/#{options[:type]}"
      end

      params = { :api_key => @consumer_key }
      params.merge! options
      get(url, params)
    end

    def queue(blog_name, options = {})
      validate_options([:limit, :offset], options)
      get(blog_path(blog_name, 'posts/queue'), options)
    end

    def draft(blog_name, options = {})
      validate_options([:limit, :offset], options)
      get(blog_path(blog_name, 'posts/draft'), options)
    end

    def submissions(blog_name, options = {})
      validate_options([:limit, :offset], options)
      get(blog_path(blog_name, 'posts/submission'), options)
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tumblr_client-0.8.5 lib/tumblr/blog.rb
tumblr_client-0.8.4 lib/tumblr/blog.rb
tumblr_client-0.8.3 lib/tumblr/blog.rb
tumblr_client-0.8.2 lib/tumblr/blog.rb
tumblr_client-0.8.1 lib/tumblr/blog.rb
tumblr_client-0.7.5 lib/tumblr/blog.rb
tumblr_client-0.7.4 lib/tumblr/blog.rb
tumblr_client-0.7.3 lib/tumblr/blog.rb
tumblr_client-0.7.2 lib/tumblr/blog.rb
tumblr_client-0.7.1 lib/tumblr/blog.rb