Class: Hcloud::ActionResource
Instance Attribute Summary
#client, #parent
Instance Method Summary
collapse
#each, #initialize, #limit, #mj, #order, #page, #per_page
Instance Method Details
#[](arg) ⇒ Object
18
19
20
21
|
# File 'lib/hcloud/action_resource.rb', line 18
def [](arg)
find(arg)
rescue Error::NotFound
end
|
#all ⇒ Object
4
5
6
7
8
|
# File 'lib/hcloud/action_resource.rb', line 4
def all
mj(base_path("actions")) do |j|
j.flat_map{|x| x["actions"].map{ |x| Action.new(x, self, client) } }
end
end
|
#find(id) ⇒ Object
10
11
12
13
14
15
16
|
# File 'lib/hcloud/action_resource.rb', line 10
def find(id)
Action.new(
Oj.load(request(base_path("actions/#{id.to_i}")).run.body)["action"],
self,
client
)
end
|
#where(status: nil) ⇒ Object
23
24
25
26
27
|
# File 'lib/hcloud/action_resource.rb', line 23
def where(status: nil)
mj(base_path("actions"), q: {status: status}) do |j|
j.flat_map{|x| x["actions"].map{ |x| Action.new(x, self, client) }}
end
end
|