Module: Droppper::Actions

Extended by:
Actions
Included in:
Actions
Defined in:
lib/droppper/actions.rb

Instance Method Summary collapse

Instance Method Details

#action(action_id) ⇒ Object



26
27
28
# File 'lib/droppper/actions.rb', line 26

def action(action_id)
  Droppper.client.actions.find id: action_id
end

#actions(args) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/droppper/actions.rb', line 15

def actions(args)
  pr = Droppper.client.actions.all(page:1, per_page: 25)
  pr.each
  data = pr.collection
  if args.size > 0
    re = Regexp.new(Array(args).join(".*"))
    data = data.select{|i| i.id.to_s=~re or i.status=~re or i.type=~re or i.resource_type=~re}
  end
  data
end

#list(*args) ⇒ Object



5
6
7
8
# File 'lib/droppper/actions.rb', line 5

def list(*args)
  data = actions(args)
  tp data, :id, :status, :type, :started_at, :completed_at, :resource_id, :resource_type, :region_slug
end

#status(action_id) ⇒ Object



10
11
12
13
# File 'lib/droppper/actions.rb', line 10

def status(action_id)
  act = action(action_id)
  puts act.inspect
end