Sha256: 6629ed90096ba687a16eb5d0f7c9afd8d85c144c4abbf8b117580540a04ec6dc

Contents?: true

Size: 1.11 KB

Versions: 10

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

10 entries across 10 versions & 1 rubygems

Version Path
fog-brightbox-0.6.1 lib/fog/brightbox/models/compute/collaboration.rb
fog-brightbox-0.6.0 lib/fog/brightbox/models/compute/collaboration.rb
fog-brightbox-0.5.1 lib/fog/brightbox/models/compute/collaboration.rb
fog-brightbox-0.5.0 lib/fog/brightbox/models/compute/collaboration.rb
fog-brightbox-0.4.1 lib/fog/brightbox/models/compute/collaboration.rb
fog-brightbox-0.4.0 lib/fog/brightbox/models/compute/collaboration.rb
fog-brightbox-0.3.0 lib/fog/brightbox/models/compute/collaboration.rb
fog-brightbox-0.2.0 lib/fog/brightbox/models/compute/collaboration.rb
fog-brightbox-0.1.1 lib/fog/brightbox/models/compute/collaboration.rb
fog-brightbox-0.1.0 lib/fog/brightbox/models/compute/collaboration.rb