Module: Teambition2::API::StageTemplate
- Included in:
- Client
- Defined in:
- lib/teambition2/api/stage_template.rb
Instance Method Summary collapse
- #create_stage_template(title, stages) ⇒ Object
- #stage_template(title, key: 'title', limit: 1) ⇒ Object
- #stage_templates ⇒ Object
Instance Method Details
#create_stage_template(title, stages) ⇒ Object
22 23 24 |
# File 'lib/teambition2/api/stage_template.rb', line 22 def create_stage_template(title, stages) post('/api/stagetemplates', { title: title, stages: stages } ) end |
#stage_template(title, key: 'title', limit: 1) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/teambition2/api/stage_template.rb', line 8 def stage_template(title, key: 'title', limit: 1) result = stage_templates.select { |p| p[key].include?(title) } return nil if result.empty? case limit when 0 result when 1 result[0] else result.size >= limit ? result[0..limit] : result end end |
#stage_templates ⇒ Object
4 5 6 |
# File 'lib/teambition2/api/stage_template.rb', line 4 def stage_templates get('/api/stagetemplates') end |