class Thumbtack::Notes

Wraps API calls related to notes

Public Class Methods

new(client) click to toggle source

Initialize a Notes

@param [Client] client

client to communicate with the Pinboard API

@api private

# File lib/thumbtack/notes.rb, line 12
def initialize(client)
  @client = client
end

Public Instance Methods

get(id) click to toggle source

Fetch a note

@example

note = notes.get(id)

@param [#to_s] id

the id of the note to fetch

@return [Note]

@api public

@see pinboard.in/api/#notes_id

# File lib/thumbtack/notes.rb, line 46
def get(id)
  Note.from_hash @client.get("/notes/#{id}")
end
list() click to toggle source

List of summaries of the user's notes

@example

summaries = notes.list

@return [Array<NoteSummary>]

@api public

@see pinboard.in/api/#notes_list

# File lib/thumbtack/notes.rb, line 26
def list
  response = @client.get('/notes/list')
  response.fetch('notes', EMPTY_ARRAY).map do |note_hash|
    NoteSummary.from_hash(note_hash)
  end
end