Sha256: db0b1a7c6427f9e4f66381ea7f8fcd9e98714612fb6350b50b28c58bdfa3a94e

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

require "fog/brightbox/model"

module Fog
  module Compute
    class Brightbox
      class Collaboration < Fog::Brightbox::Model
        identity :id
        attribute :status
        attribute :email
        attribute :role
        attribute :role_label
        attribute :account
        attribute :user
        attribute :inviter

        def account_id
          account["id"] || account[:id]
        end

        def save
          raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if identity

          options = {
            :role => role,
            :email => email
          }.delete_if { |_k, v| v.nil? || v == "" }

          data = service.create_collaboration(options)
          merge_attributes(data)
          true
        end

        def resend
          requires :identity
          data = service.resend_collaboration(identity)
          merge_attributes(data)
          true
        end

        def destroy
          requires :identity
          data = service.destroy_collaboration(identity)
          merge_attributes(data)
          true
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
fog-brightbox-0.7.2 lib/fog/brightbox/models/compute/collaboration.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-brightbox-0.7.1/lib/fog/brightbox/models/compute/collaboration.rb
fog-brightbox-0.7.1 lib/fog/brightbox/models/compute/collaboration.rb
fog-brightbox-0.7.0 lib/fog/brightbox/models/compute/collaboration.rb