Sha256: 849116012fff1a1dfc30b7cfa080cf7adaff1ef9f6006a93dc490dfee1c01eae

Contents?: true

Size: 751 Bytes

Versions: 4

Compression:

Stored size: 751 Bytes

Contents

require 'active_resource'

require_relative 'collections/base'
require_relative 'user'
require_relative 'group'

module RedmineRest
  module Models
    #
    # Membership model
    #
    class Membership < ActiveResource::Base
      self.format = :xml
      self.collection_parser = Collections::Base
      self.prefix = '/projects/:project_id/'

      has_one :user, class_name: User
      has_one :group, class_name: Group

      #
      # Overrides parent method.
      # When we want to fetch one membership, we need not to use prefix
      #
      def self.element_path(id, _prefix_options = {}, query_options = nil)
        "/memberships/#{URI.parser.escape id.to_s}#{format_extension}#{query_string(query_options)}"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redmine_rest-0.8.0 lib/redmine_rest/models/membership.rb
redmine_rest-0.7.0 lib/redmine_rest/models/membership.rb
redmine_rest-0.6.1 lib/redmine_rest/models/membership.rb
redmine_rest-0.6.0 lib/redmine_rest/models/membership.rb