Class: Pgai::Resources::Remote::Snapshot
Class Method Summary
collapse
Methods inherited from BaseRecord
client, #client, client=, #refresh_attributes, with_client
Methods included from Attributes
#assign_attribute, #assign_attributes, #has_attribute?, included, #initialize
Class Method Details
.all ⇒ Object
16
17
18
|
# File 'lib/pgai/resources/remote/snapshot.rb', line 16
def all
client.get(path).map { new(_1) }
end
|
.find(id) ⇒ Object
28
29
30
31
32
|
# File 'lib/pgai/resources/remote/snapshot.rb', line 28
def find(id)
record = all.find { |snapshot| snapshot.id.to_s == id.to_s }
raise Pgai::ResourceNotFound unless record
record
end
|
.latest ⇒ Object
20
21
22
|
# File 'lib/pgai/resources/remote/snapshot.rb', line 20
def latest
all.max_by(&:created_at)
end
|
.path ⇒ Object
24
25
26
|
# File 'lib/pgai/resources/remote/snapshot.rb', line 24
def path
"snapshots"
end
|