Sha256: c8db0befb163f0ea90bd52e0b136d3bd75f524462051003520fe4c67d7a83e82
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
module FaaStRuby class Workspace < BaseObject ##### Class methods def self.create(name:, email: nil) api = API.new workspace = Workspace.new(name: name, email: email, errors: []) response = api.create_workspace(workspace_name: name, email: email) if response.errors.any? workspace.errors += response.errors return workspace end case response.code when 422 workspace.errors += ['(422) Unprocessable Entity', response.body] when 200 workspace.credentials = response.body['credentials'] else workspace.errors << "(#{response.code}) Error" end return workspace end ################### ##### Instance methods attr_accessor :name, :errors, :functions, :email, :object, :credentials def destroy response = @api.destroy_workspace(@name) @errors += response.errors if response.errors.any? end def deploy(package_file_name) response = @api.deploy(workspace_name: @name, package: package_file_name) @errors += response.errors if response.errors.any? self end def fetch response = @api.get_workspace_info(@name) if response.errors.any? @errors += response.errors else self.assign_attributes(response.body) end self end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
faastruby-0.2.0 | lib/faastruby/workspace.rb |