Sha256: 657c96984e500ba2f817650f6755fa7d6e41a081c6fd732dcdf01317e2b41861

Contents?: true

Size: 725 Bytes

Versions: 10

Compression:

Stored size: 725 Bytes

Contents

module Clubhouse
	class Member < ClubhouseResource
		def self.properties
			[ :created_at, :disabled, :id, :profile, :role, :updated_at ]
		end

		def initialize(client:, object:)
			super
			@profile = Profile.new(client: client, object: @profile)

			# Create accessors for profile properties
			Profile.properties.each do |property|
				self.class.send(:define_method, (property.to_sym)) { @profile.send(property) }
			end
		end

		def self.api_url
			'members'
		end

		def stories_requested
			@client.projects.collect(&:stories).reduce(:+).select { |s| s.requested_by_id == @id }
		end

		def stories_following
			@client.projects.collect(&:stories).reduce(:+).select { |s| s.follower_ids.include? @id }
		end
	end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
clubhouse2-1.0.11 lib/clubhouse2/member.rb
clubhouse2-1.0.10 lib/clubhouse2/member.rb
clubhouse2-1.0.8 lib/clubhouse2/member.rb
clubhouse2-1.0.7 lib/clubhouse2/member.rb
clubhouse2-1.0.6 lib/clubhouse2/member.rb
clubhouse2-1.0.5 lib/clubhouse2/member.rb
clubhouse2-1.0.4 lib/clubhouse2/member.rb
clubhouse2-1.0.3 lib/clubhouse2/member.rb
clubhouse2-0.0.2 lib/clubhouse2/member.rb
clubhouse2-0.0.1 lib/clubhouse2/member.rb