class Thumbtack::Post

Represents a bookmark

@api public

Constants

ATTRIBUTES

The attributes for a Post

@api private

Attributes

description[R]

The title of the post

@example

post.description  # => 'Pinboard'

@return [String]

@api public

digest[R]

32 character hexadecimal MD5 hash of the post URL

@example

post.digest  # => '92959a96fd69146c5fe7cbde6e5720f2'

@return [String]

@api public

extended[R]

The description of the post

@example

post.extended  # => 'antisocial bookmarking'

@return [String]

@api public

href[R]

The url of the post

@example

post.href  # => 'http://pinboard.in'

@return [String]

@api public

meta[R]

32 character hexadecimal MD5 hash change signature for the post

@example

post.meta  # => '92959a96fd69146c5fe7cbde6e5720f2'

@return [String]

@api public

Public Class Methods

from_hash(hash) click to toggle source

Creates a new Post from a Hash

@param [Hash{#to_sym => Object}] hash

Post attributes

@return [Post]

@api private @see Client#get

# File lib/thumbtack/post.rb, line 130
def self.from_hash(hash)
  new(SymbolizeKeys.symbolize(HashToDigest.rename(hash)))
end
new(attrs = EMPTY_HASH) click to toggle source

Initialize a Post

@param [Hash] attrs

Post attributes

@api private

# File lib/thumbtack/post.rb, line 140
def initialize(attrs = EMPTY_HASH)
  ATTRIBUTES.each do |attribute|
    instance_variable_set "@#{attribute}", attrs.fetch(attribute)
  end
end

Public Instance Methods

shared() click to toggle source

If true, this post is public

@example

post.shared  # => true

@return [Boolean]

@api public

# File lib/thumbtack/post.rb, line 93
def shared
  Types::Boolean.deserialize(@shared)
end
tags() click to toggle source

The tags for this post, space-seperated

@example

post.tags  # => ['bookmarks', 'tools']

@return [Array<String>]

@api public

# File lib/thumbtack/post.rb, line 117
def tags
  Types::Tags.deserialize(@tags)
end
time() click to toggle source

The time at which the post was created

@example

post.time  # => 2014-08-13 19:53:16 +0000

@return [Time]

@api public

# File lib/thumbtack/post.rb, line 81
def time
  Types::Time.deserialize(@time)
end
toread() click to toggle source

If true, this post is marked unread

@example

post.toread  # => false

@return [Boolean]

@api public

# File lib/thumbtack/post.rb, line 105
def toread
  Types::Boolean.deserialize(@toread)
end