Class: Dtmcli::Saga
- Inherits:
-
Object
- Object
- Dtmcli::Saga
- Defined in:
- lib/dtmcli/saga.rb
Constant Summary collapse
- TRANS_TYPE =
'saga'
Instance Attribute Summary collapse
-
#dtm ⇒ Object
readonly
Returns the value of attribute dtm.
-
#dtm_url ⇒ Object
readonly
Returns the value of attribute dtm_url.
-
#gid ⇒ Object
Returns the value of attribute gid.
-
#steps ⇒ Object
Returns the value of attribute steps.
Instance Method Summary collapse
- #add(action, compensate, post_data) ⇒ Object
- #gen_gid ⇒ Object
-
#initialize(dtm_url) ⇒ Saga
constructor
A new instance of Saga.
- #submit ⇒ Object
Constructor Details
Instance Attribute Details
#dtm ⇒ Object (readonly)
Returns the value of attribute dtm.
4 5 6 |
# File 'lib/dtmcli/saga.rb', line 4 def dtm @dtm end |
#dtm_url ⇒ Object (readonly)
Returns the value of attribute dtm_url.
4 5 6 |
# File 'lib/dtmcli/saga.rb', line 4 def dtm_url @dtm_url end |
#gid ⇒ Object
Returns the value of attribute gid.
3 4 5 |
# File 'lib/dtmcli/saga.rb', line 3 def gid @gid end |
#steps ⇒ Object
Returns the value of attribute steps.
3 4 5 |
# File 'lib/dtmcli/saga.rb', line 3 def steps @steps end |
Instance Method Details
#add(action, compensate, post_data) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/dtmcli/saga.rb', line 18 def add(action, compensate, post_data) step = { action: action, compensate: compensate, data: post_data.to_json, } @steps << step end |
#gen_gid ⇒ Object
14 15 16 |
# File 'lib/dtmcli/saga.rb', line 14 def gen_gid @gid = IdGenerator.gen_gid(dtm_url) end |
#submit ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/dtmcli/saga.rb', line 27 def submit tbody = { gid: gid, trans_type: TRANS_TYPE, steps: steps } dtm.submit(tbody) end |