Sha256: d6b6ca90c52dce99242838b783ddc57008d4b329809bb607d70ad45a4b312d38

Contents?: true

Size: 950 Bytes

Versions: 6

Compression:

Stored size: 950 Bytes

Contents

module Ribose
  class JoinSpaceRequest < Ribose::Base
    include Ribose::Actions::All
    include Ribose::Actions::Fetch
    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

6 entries across 6 versions & 1 rubygems

Version Path
ribose-0.5.0 lib/ribose/join_space_request.rb
ribose-0.4.1 lib/ribose/join_space_request.rb
ribose-0.4.0 lib/ribose/join_space_request.rb
ribose-0.3.2 lib/ribose/join_space_request.rb
ribose-0.3.1 lib/ribose/join_space_request.rb
ribose-0.3.0 lib/ribose/join_space_request.rb