Sha256: c738dfc06b2a41c16168414a01db7dbd3ca38b7543b636c7e54c66f1dfcd695b
Contents?: true
Size: 891 Bytes
Versions: 71
Compression:
Stored size: 891 Bytes
Contents
class Terraspace::Terraform::Api class Runs < Base extend Memoist attr_reader :workspace_id def initialize(workspace_id) @workspace_id = workspace_id end def list data, next_page = [], :start while next_page == :start || next_page url = "workspaces/#{@workspace_id}/runs" if next_page qs = URI.encode_www_form('page[number]': next_page) if next_page url += "?#{qs}" end payload = http.get(url) return unless payload data += payload['data'] next_page = payload['meta']['pagination']['next-page'] end data end def discard(id) action("discard", id) end def cancel(id) action("cancel", id) end def action(action, id) payload = http.post("runs/#{id}/actions/#{action}") payload['data'] if payload end end end
Version data entries
71 entries across 71 versions & 1 rubygems