Class: Wordsmith::Project
- Inherits:
-
Object
- Object
- Wordsmith::Project
- Defined in:
- lib/wordsmith/project.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
-
#templates ⇒ Object
readonly
Returns the value of attribute templates.
Class Method Summary collapse
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/wordsmith/project.rb', line 3 def name @name end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
3 4 5 |
# File 'lib/wordsmith/project.rb', line 3 def schema @schema end |
#slug ⇒ Object (readonly)
Returns the value of attribute slug.
3 4 5 |
# File 'lib/wordsmith/project.rb', line 3 def slug @slug end |
#templates ⇒ Object (readonly)
Returns the value of attribute templates.
3 4 5 |
# File 'lib/wordsmith/project.rb', line 3 def templates @templates end |
Class Method Details
.all ⇒ Object
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 |