Module: Mingle4r::Project::InstanceMethods

Defined in:
lib/mingle4r/project.rb

Instance Method Summary collapse

Instance Method Details

#cards(refresh = false) ⇒ Object

returns the cards for the project. To hit the resource server without returning cached results pass true as an argument.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/mingle4r/project.rb', line 6

def cards(refresh = false)
  return @cards if(!refresh && @cards_cached)
  cards_site = File.join(self.class.site.to_s, "projects/#{self.identifier()}")
  Mingle4r::Card.site = cards_site
  Mingle4r::Card.user = self.class.user
  Mingle4r::Card.password = self.class.password
  card_class = Mingle4r::Card.send(:create_resource_class)
  @cards = card_class.find_without_pagination(:all)
  @cards_cached = true
  @cards
end

#property_definitions(refresh = false) ⇒ Object

returns the property definitions for the project. To hit the resource server pass true as an argument



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/mingle4r/project.rb', line 49

def property_definitions(refresh = false)
  return @prop_definitions if(!refresh && @prop_definitions_cached)
  properties_site = File.join(@site.to_s, "projects/#{self.identifier}")
  PropertyDefinition.site = properties_site
  PropertyDefinition.user = @user
  PropertyDefinition.password = @password
  prop_defn_class = Mingle4r::PropertyDefinition.send(:create_resource_class)
  @prop_definitions = prop_defn_class.find(:all)
  @prop_definitions_cached = true
  @prop_definitions
end

#users(refresh = false) ⇒ Object

returns the users for the project. To hit the resource server without returning cached results pass true as an argument.



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/mingle4r/project.rb', line 20

def users(refresh = false)
  return @users if(!refresh && @users_cached)
  users_site = File.join(self.class.site.to_s, "projects/#{self.identifier()}")
  Mingle4r::User.site = users_site
  Mingle4r::User.user = self.class.user
  Mingle4r::User.password = self.class.password
  Mingle4r::User.element_name = nil # reset
  user_class = Mingle4r::User.send(:create_resource_class)
  @users = user_class.find(:all)
  @users_cached = true
  @users
end

#wikis(refresh = false) ⇒ Object

returns the wikis for the project. To hit the resource server without returning cached results pass true as an argument.



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/mingle4r/project.rb', line 35

def wikis(refresh = false)
  return @wikis if(!refresh && @wikis_cached)
  wiki_site = File.join(self.class.site.to_s, "projects/#{self.identifier()}")
  Mingle4r::Wiki.site = wiki_site
  Mingle4r::Wiki.user = self.class.user
  Mingle4r::Wiki.password = self.class.password
  wiki_class = Mingle4r::Wiki.send(:create_resource_class)
  @wikis = wiki_class.find(:all)
  @wikis_cached = true
  @wikis
end