class Thumbtack::NoteSummary

Represents a note summary as returned from Notes#list.

@api public @see Notes#list

Constants

ATTRIBUTES

The attributes for a NoteSummary

@api private

Attributes

digest[R]

20 character hexadecimal SHA1 hash of the note text

@example

note.digest  # => '0c9c30f60cadabd31415'

@return [String]

@api public

id[R]

The identifier for the note

@example

note.id  # => '8e5d6964bb810e0050b0'

@return [String]

@api public

length[R]

The length of the note text

@example

note.length  # => 153

@return [Integer]

@api public

title[R]

The title of the note

@example

note.title  # => 'StarCraft beta coming this week!'

@return [String]

@api public

Public Class Methods

from_hash(hash) click to toggle source

Creates a new NoteSummary from a Hash

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

NoteSummary attributes

@return [NoteSummary]

@api private @see Client#get

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

Initialize a NoteSummary

@param [Hash] attrs

NoteSummary attributes

@api private

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

Public Instance Methods

created_at() click to toggle source

The time at which the note was created

@example

note.created_at  # => 2014-08-13 19:53:16 +0000

@return [Time]

@api public

# File lib/thumbtack/note_summary.rb, line 49
def created_at
  Types::Time.deserialize_from_note(@created_at)
end
updated_at() click to toggle source

The time at which the note was last updated

@example

note.updated_at  # => 2014-08-13 19:53:16 +0000

@return [Time]

@api public

# File lib/thumbtack/note_summary.rb, line 61
def updated_at
  Types::Time.deserialize_from_note(@updated_at)
end