Sha256: b6883cc32c175a96aef05c12a7d9aec51792043d050d124909bc8b263e7e7517

Contents?: true

Size: 915 Bytes

Versions: 1

Compression:

Stored size: 915 Bytes

Contents

module Ribose
  class JoinSpaceRequest < Ribose::Base
    include Ribose::Actions::All
    include Ribose::Actions::Create
    include Ribose::Actions::Update

    def self.accept(invitation_id, options = {})
      new(resource_id: invitation_id, state: 1, **options).update
    end

    def self.reject(invitation_id, options = {})
      new(resource_id: invitation_id, state: 2, **options).update
    end

    def self.update(invitation_id, attributes)
      new(attributes.merge(resource_id: invitation_id)).update
    end

    private

    def resource
      "join_space_request"
    end

    def resource_key
      "invitation"
    end

    def resources_path
      "invitations/join_space_request"
    end

    def validate(space_id:, **attributes)
      attributes.merge(space_id: space_id)
    end

    def extract_local_attributes
      @invitation_id = attributes.delete(:invitation_id)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ribose-0.2.0 lib/ribose/join_space_request.rb