Skip to content
This repository was archived by the owner on Aug 16, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion gems/operation/2.1/flow.md → 2.1/trailblazer/api.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
---
layout: operation-2-1
title: Trailblazer 2.1 API
title: Operation 2.1 API
gems:
- ["trailblazer-operation", "trailblazer/trailblazer-operation", "2.1"]
code: ../trailblazer/test/docs,trace_test.rb,master
---

## Overview

An operation or an activity provides two APIs: The wiring API focuses on defining the tasks and their connections. It is so versatile that it [deserves its own document](wiring.html). The other part is about actually _implementing_ those tasks (or "boxes") and is called the _operation API_, and this document describes it.

## Control Flow

As already discussed briefly, designing connections and tasks happens through the [wiring API](wiring.html). The goal of the separation is that tasks can focus on one thing: implementing the actual business logic without having to worry about the control flow. To do so, they simply emit (or `return`) special objects called _signals_, which are then translated into a connection. After this, the circuit engine will move on to the next task that is targeted by the connection.

## Task API

## Step API

## Result

### Primary Binary State
Expand Down
27 changes: 14 additions & 13 deletions _includes/sidebar-2-1.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<ul id="sidebar" class="side-nav accordion" data-accordion>

<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">
<i class="fa fa-caret-square-o-right" aria-hidden="true"></i>
<strong>OPERATION</strong>
<strong>OPERATION</strong> 2.1
</a>
<div class="accordion-content" data-tab-content>
<ul class="vertical menu">
<li><a href="/gems/operation/2.1/index.html">Overview</a></li>
<li><a href="/gems/operation/2.1/flow.html">Control flow</a></li>
<li><a href="/gems/operation/2.0/api.html">API</a></li>
<li><a href="/2.1/trailblazer/wiring.html">Wiring API</a></li>
<li><a href="/2.1/trailblazer/api.html">Operation API</a></li>
<li><a href="/gems/operation/2.0/contract.html">Contract</a></li>
<!--<li><a href="/gems/operation/2.0/representer.html">Representer</a></li>-->
<li><a href="/gems/operation/2.0/policy.html">Policy</a></li>
Expand All @@ -26,32 +26,33 @@
<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">
<i class="fa fa-caret-square-o-right" aria-hidden="true"></i>
<strong>ACTIVITY</strong>
<strong>TRAILBLAZER</strong> 2.1
</a>
<div class="accordion-content" data-tab-content>
<ul class="vertical menu">
<li><a href="/gems/activity/0.2/api.html">API</a></li>
<li><a href="/gems/activity/0.2/flow.html">Control flow</a></li>
<li><a href="/gems/trailblazer/index.html">Overview</a></li>
<li><a href="/gems/trailblazer/2.0/rails.html">Rails</a></li>
<li><a href="/gems/trailblazer/2.0/test.html">Test</a></li>
<li><a href="/gems/trailblazer/loader.html">Loader</a></li>
<li><a href="/gems/trailblazer/upgrading-1-to-2.html">Upgrading</a></li>
</ul>
</div>
</li>

<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">
<i class="fa fa-caret-square-o-right" aria-hidden="true"></i>
<strong>TRAILBLAZER</strong>
<strong>ACTIVITY</strong>
</a>
<div class="accordion-content" data-tab-content>
<ul class="vertical menu">
<li><a href="/gems/trailblazer/index.html">Overview</a></li>
<li><a href="/gems/trailblazer/2.0/rails.html">Rails</a></li>
<li><a href="/gems/trailblazer/2.0/test.html">Test</a></li>
<li><a href="/gems/trailblazer/loader.html">Loader</a></li>
<li><a href="/gems/trailblazer/upgrading-1-to-2.html">Upgrading</a></li>
<li><a href="/gems/activity/0.2/api.html">API</a></li>
<li><a href="/gems/activity/0.2/flow.html">Control flow</a></li>
</ul>
</div>
</li>


<li class="accordion-item" data-accordion-item>
<a href="#" class="accordion-title">
<i class="fa fa-caret-square-o-right" aria-hidden="true"></i>
Expand Down
21 changes: 19 additions & 2 deletions blog/2017-12-trailblazer-2-1-what-you-need-to-know.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Your steps use the existing API, and everything here is as it used to be before.

class Memo::Create < Trailblazer::Operation
step :create_model

def create_model(options, params:, **)
# ..
end
Expand Down Expand Up @@ -82,8 +82,25 @@ rewire

The coolest feature.

## 4. Extended Macro API
## 5. Extended Macro API

## 6. Application Workflows

## 7. Failure & Success vs Fail & Pass

Steps `failure` and `success` are renamed to `fail` and `pass`. Now operation with multiple steps is a bit more streamlined visually.
class Memo::Create < Trailblazer::Operation
step :create_mode
success :send_email
failure :handle_error
end

Becomes

class Memo::Create < Trailblazer::Operation
step :create_mode
pass :send_email
fail :handle_error
end
## 10. New Gems