Module: CatchNotes::Base::FinderMethods::ClassMethods

Defined in:
lib/catch_notes/base.rb

Instance Method Summary collapse

Instance Method Details

#allObject



48
49
50
51
52
53
54
55
# File 'lib/catch_notes/base.rb', line 48

def all
  res = get "/notes"
  if send(:ok?, res)
    res.parsed_response['notes'].map do |note|
      send :build_from_hash, note
    end
  end
end

#find(id) ⇒ Object



57
58
59
60
61
62
# File 'lib/catch_notes/base.rb', line 57

def find(id)
  res = get "/notes/#{id}"
  if send(:ok?, res)
    send :build_from_hash, res.parsed_response['notes'].first
  end
end

#firstObject



64
65
66
# File 'lib/catch_notes/base.rb', line 64

def first
  all.first
end

#lastObject



68
69
70
# File 'lib/catch_notes/base.rb', line 68

def last
  all.last
end