Class: Amaranth::Team

Inherits:
Struct
  • Object
show all
Defined in:
lib/amaranth/team.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Team

Returns a new instance of Team.



11
12
13
14
15
# File 'lib/amaranth/team.rb', line 11

def initialize attributes={}
  attributes.each do |key, value|
    self[key] = value
  end
end

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



4
5
6
# File 'lib/amaranth/team.rb', line 4

def name
  @name
end

#slugObject

Returns the value of attribute slug

Returns:

  • (Object)

    the current value of slug



4
5
6
# File 'lib/amaranth/team.rb', line 4

def slug
  @slug
end

Class Method Details

.find_by_slug(slug) ⇒ Object



5
6
7
8
9
# File 'lib/amaranth/team.rb', line 5

def self.find_by_slug slug
  if attributes = Request.get("/api/teams/#{slug}/")
    new attributes.keep_if { |key, value| members.include? key.to_sym }
  end
end

Instance Method Details

#projectsObject



17
18
19
# File 'lib/amaranth/team.rb', line 17

def projects
  Project.all(team_slug: slug)
end

#videosObject



21
22
23
# File 'lib/amaranth/team.rb', line 21

def videos
  Video.all(team_slug: slug)
end