Class: Dtmcli::Msg
- Inherits:
-
Object
- Object
- Dtmcli::Msg
- Defined in:
- lib/dtmcli/msg.rb
Constant Summary collapse
- TRANS_TYPE =
'msg'
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.
-
#query_prepared ⇒ Object
Returns the value of attribute query_prepared.
-
#steps ⇒ Object
Returns the value of attribute steps.
Instance Method Summary collapse
- #add(action, post_data) ⇒ Object
- #gen_gid ⇒ Object
-
#initialize(dtm_url) ⇒ Msg
constructor
A new instance of Msg.
- #prepare(p_url) ⇒ Object
- #submit ⇒ Object
- #wrap_tbody ⇒ Object
Constructor Details
Instance Attribute Details
#dtm ⇒ Object (readonly)
Returns the value of attribute dtm.
4 5 6 |
# File 'lib/dtmcli/msg.rb', line 4 def dtm @dtm end |
#dtm_url ⇒ Object (readonly)
Returns the value of attribute dtm_url.
4 5 6 |
# File 'lib/dtmcli/msg.rb', line 4 def dtm_url @dtm_url end |
#gid ⇒ Object
Returns the value of attribute gid.
3 4 5 |
# File 'lib/dtmcli/msg.rb', line 3 def gid @gid end |
#query_prepared ⇒ Object
Returns the value of attribute query_prepared.
3 4 5 |
# File 'lib/dtmcli/msg.rb', line 3 def query_prepared @query_prepared end |
#steps ⇒ Object
Returns the value of attribute steps.
3 4 5 |
# File 'lib/dtmcli/msg.rb', line 3 def steps @steps end |
Instance Method Details
#add(action, post_data) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/dtmcli/msg.rb', line 19 def add(action, post_data) step = { action: action, data: post_data.to_json, } @steps << step end |
#gen_gid ⇒ Object
15 16 17 |
# File 'lib/dtmcli/msg.rb', line 15 def gen_gid @gid = IdGenerator.gen_gid(dtm_url) end |
#prepare(p_url) ⇒ Object
27 28 29 30 |
# File 'lib/dtmcli/msg.rb', line 27 def prepare(p_url) @query_prepared = p_url if !p_url.nil? dtm.prepare(wrap_tbody) end |
#submit ⇒ Object
32 33 34 |
# File 'lib/dtmcli/msg.rb', line 32 def submit dtm.submit(wrap_tbody) end |
#wrap_tbody ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/dtmcli/msg.rb', line 36 def wrap_tbody { gid: gid, trans_type: TRANS_TYPE, steps: steps, query_prepared: query_prepared } end |