Sha256: 25d05d8e813c854d86b60a634a50e406a1f3ad446da090fe074796f906b59781

Contents?: true

Size: 511 Bytes

Versions: 9

Compression:

Stored size: 511 Bytes

Contents

require "amaranth/request"

module Amaranth
  class Team < Struct.new(:name, :slug)
    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

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

    def projects
      Project.all(team_slug: slug)
    end

    def videos
      Video.all(team_slug: slug)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
amaranth-0.4.0 lib/amaranth/team.rb
amaranth-0.3.4 lib/amaranth/team.rb
amaranth-0.3.3 lib/amaranth/team.rb
amaranth-0.3.2 lib/amaranth/team.rb
amaranth-0.3.1 lib/amaranth/team.rb
amaranth-0.3.0 lib/amaranth/team.rb
amaranth-0.2.0 lib/amaranth/team.rb
amaranth-0.1.1 lib/amaranth/team.rb
amaranth-0.1.0 lib/amaranth/team.rb