Class: Clubhouse::Member

Inherits:
ClubhouseResource show all
Defined in:
lib/clubhouse2/member.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ClubhouseResource

#api_url, #delete!, #flush, inherited, property_filter_create, property_filter_update, #resolve_to_ids, #set_properties, subclass, #to_h, #update, validate, #value_format

Constructor Details

#initialize(client:, object:) ⇒ Member

Returns a new instance of Member.



7
8
9
10
11
12
13
14
15
# File 'lib/clubhouse2/member.rb', line 7

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

Class Method Details

.api_urlObject



17
18
19
# File 'lib/clubhouse2/member.rb', line 17

def self.api_url
	'members'
end

.propertiesObject



3
4
5
# File 'lib/clubhouse2/member.rb', line 3

def self.properties
	[ :created_at, :disabled, :id, :profile, :role, :updated_at ]
end

Instance Method Details

#stories_followingObject



25
26
27
# File 'lib/clubhouse2/member.rb', line 25

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

#stories_requestedObject



21
22
23
# File 'lib/clubhouse2/member.rb', line 21

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