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.



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

def name
  @name
end

#schemaObject (readonly)

Returns the value of attribute schema.



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

def schema
  @schema
end

#slugObject (readonly)

Returns the value of attribute slug.



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

def slug
  @slug
end

#templatesObject (readonly)

Returns the value of attribute templates.



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

def templates
  @templates
end

Class Method Details

.allObject



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

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

.find(slug) ⇒ Object



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

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