Class: Wordsmith::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/wordsmith/project.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/wordsmith/project.rb', line 3

def name
  @name
end

#schemaObject (readonly)

Returns the value of attribute schema.



3
4
5
# File 'lib/wordsmith/project.rb', line 3

def schema
  @schema
end

#slugObject (readonly)

Returns the value of attribute slug.



3
4
5
# File 'lib/wordsmith/project.rb', line 3

def slug
  @slug
end

#templatesObject (readonly)

Returns the value of attribute templates.



3
4
5
# File 'lib/wordsmith/project.rb', line 3

def templates
  @templates
end

Class Method Details

.allObject



5
6
7
8
# File 'lib/wordsmith/project.rb', line 5

def self.all
  projects_attributes = Wordsmith.client.get('projects')
  projects_attributes.map {|p| new(**p)}
end

.find(slug) ⇒ Object



10
11
12
13
# File 'lib/wordsmith/project.rb', line 10

def self.find(slug)
  project = all.find { |p| p.slug == slug }
  project || raise(%Q(Project not found with slug: "#{slug}"))
end