Sha256: fe1ef9e6dcaffd87296998556024f3df0e07b1745a8fd11085df26237ee3e376

Contents?: true

Size: 579 Bytes

Versions: 6

Compression:

Stored size: 579 Bytes

Contents

module InternalAffairs
  module OperationManager
    def request_operation_approval(_target)
      uuid = SecureRandom.uuid

      response = InternalAffairs::ApiUtils.create_operation(
        uuid: uuid,
        user: _target.approvable_user,
        name: _target.approvable_operation,
        amount: _target.approvable_amount,
        resources: _target.approvable_resources
      )

      if response.state == 'approved'
        _target.approve!
      else
        InternalAffairs::PendingOperation.create! operation_uuid: uuid, target: _target
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
internal-affairs-1.2.0 lib/internal_affairs/operation_manager.rb
internal-affairs-1.1.2 lib/internal_affairs/operation_manager.rb
internal-affairs-1.1.1 lib/internal_affairs/operation_manager.rb
internal-affairs-1.1.0 lib/internal_affairs/operation_manager.rb
internal-affairs-1.0.1 lib/internal_affairs/operation_manager.rb
internal-affairs-1.0.0 lib/internal_affairs/operation_manager.rb