Module: Tumblife::Client::Blog

Included in:
Tumblife::Client
Defined in:
lib/tumblife/client/blog.rb

Instance Method Summary collapse

Instance Method Details

#avatar(blog, size = 64) ⇒ Hashie::Mash

Retrieve a Blog Avatar

Parameters:

  • blog (String)

    The standard or custom blog hostname

  • size (Integer) (defaults to: 64)

    The size of the avatar (square, one value for both length and width). Must be one of the values: 16, 24, 30, 40, 48, 64, 96, 128, 512

Returns:

  • (Hashie::Mash)

See Also:

Requires Authentication?:

  • None


23
24
25
# File 'lib/tumblife/client/blog.rb', line 23

def avatar(blog, size = 64)
  get("/v2/blog/#{blog}/avatar", :size => size)
end

#blog_info(blog) ⇒ Hashie::Mash

Retrieve Blog Info

Parameters:

  • blog (String)

    The standard or custom blog hostname

Returns:

  • (Hashie::Mash)

See Also:

Requires Authentication?:

  • API Key


12
13
14
# File 'lib/tumblife/client/blog.rb', line 12

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

#draft(blog) ⇒ Hashie::Mash

Retrieve Draft Posts

Parameters:

  • blog (String)

    The standard or custom blog hostname

Returns:

  • (Hashie::Mash)

See Also:

Requires Authentication?:

  • OAuth


76
77
78
# File 'lib/tumblife/client/blog.rb', line 76

def draft(blog)
  get("/v2/blog/#{blog}/posts/draft")
end

#followers(blog, options = {}) ⇒ Hashie::Mash

Retrieve a Blog's Followers

Parameters:

  • blog (String)

    The standard or custom blog hostname

  • options (Hash) (defaults to: {})

    An optional options hash

Options Hash (options):

  • :limit (Integer) — default: 20

    The number of results to return: 1–20, inclusive

  • :offset (Integer) — default: 0

    Result to start at

Returns:

  • (Hashie::Mash)

See Also:

Requires Authentication?:

  • OAuth


36
37
38
# File 'lib/tumblife/client/blog.rb', line 36

def followers(blog, options = {})
  get("/v2/blog/#{blog}/followers", options)
end

#posts(blog, options = {}) ⇒ Hashie::Mash

Retrieve Published Posts

Parameters:

  • blog (String)

    The standard or custom blog hostname

  • options (Hash) (defaults to: {})

    An optional options hash

Options Hash (options):

  • :type (String) — default: nil

    The type of post to return. Specify one of the following: text, quote, link, answer, video, audio, photo, chat

  • :id (Integer) — default: nil

    A specific post ID. Returns the single post specified or (if not found) a 404 error.

  • :tag (String) — default: nil

    Limits the response to posts with the specified tag

  • :limit (Integer) — default: 20

    The number of posts to return: 1–20, inclusive

  • :offset (Integer) — default: 0

    Post number to start at

  • :reblog_info (Boolean) — default: false

    Indicates whether to return reblog information (specify true or false). Returns the various reblogged_ fields.

  • :notes_info (Boolean) — default: false

    Indicates whether to return notes information (specify true or false). Returns note count and note metadata.

  • :filter (String) — default: nil

    Specifies the post format to return, other than HTML: text – (Plain text, no HTML), raw – (As entered by the user (no post-processing); if the user writes in Markdown, the Markdown will be returned rather than HTML)

Returns:

  • (Hashie::Mash)

See Also:

Requires Authentication?:

  • API Key


55
56
57
58
# File 'lib/tumblife/client/blog.rb', line 55

def posts(blog, options = {})
  options[:api_key] = consumer_key
  get("/v2/blog/#{blog}/posts", options)
end

#queue(blog) ⇒ Hashie::Mash

Retrieve Queued Posts

Parameters:

  • blog (String)

    The standard or custom blog hostname

Returns:

  • (Hashie::Mash)

See Also:

Requires Authentication?:

  • OAuth


66
67
68
# File 'lib/tumblife/client/blog.rb', line 66

def queue(blog)
  get("/v2/blog/#{blog}/posts/queue")
end

#submission(blog) ⇒ Hashie::Mash

Retrieve Submission Posts

Parameters:

  • blog (String)

    The standard or custom blog hostname

Returns:

  • (Hashie::Mash)

See Also:

Requires Authentication?:

  • OAuth


86
87
88
# File 'lib/tumblife/client/blog.rb', line 86

def submission(blog)
  get("/v2/blog/#{blog}/posts/submission")
end