Sha256: 74842c00cf995ec3e3c96ae8716bbae6bedbc33eead71583cf33ab0515c048fd

Contents?: true

Size: 1.57 KB

Versions: 1

Compression:

Stored size: 1.57 KB

Contents

module Tumblr
  module Blog

    # Gets the info about the blog
    def blog_info(blog_name)
      get("v2/blog/#{blog_name}/info", :api_key => @consumer_key)
    end

    # Gets the avatar URL of specified size
    def avatar(blog_name, size = nil)
      url = "v2/blog/#{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("v2/blog/#{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 = "v2/blog/#{blog_name}/likes"

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

    def posts(blog_name, options = {})
      url = "v2/blog/#{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("v2/blog/#{blog_name}/posts/queue", options)
    end

    def draft(blog_name, options = {})
      validate_options([:limit, :offset], options)
      get("v2/blog/#{blog_name}/posts/draft", options)
    end

    def submissions(blog_name, options = {})
      validate_options([:limit, :offset], options)
      get("v2/blog/#{blog_name}/posts/submission", options)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tumblr_client-0.7.0 lib/tumblr/blog.rb