class Dtmcli::Dtm

Attributes

dtm_url[R]

Public Class Methods

new(dtm_url) click to toggle source
# File lib/dtmcli/dtm.rb, line 24
def initialize(dtm_url)
  @dtm_url = dtm_url
end
new_gid(dtm_url) click to toggle source
# File lib/dtmcli/dtm.rb, line 18
def new_gid(dtm_url)
  data = Proxy.execute(:get, dtm_url + '/newGid', {}, &parse)
  return data["gid"]
end
parse() click to toggle source
# File lib/dtmcli/dtm.rb, line 10
def parse
  lambda do |resp|
    body = JSON.parse(resp.body)
    raise DtmSvrError, "dtm server error: data = #{body}" if !succ?(body)
    body
  end
end
succ?(data) click to toggle source
# File lib/dtmcli/dtm.rb, line 6
def succ?(data)
  data['dtm_result'] == 'SUCCESS'
end

Public Instance Methods

abort(body) click to toggle source
# File lib/dtmcli/dtm.rb, line 36
def abort(body)
  Proxy.execute(:post, dtm_url + '/abort', {body: body}, &Dtm::parse)
end
prepare(body) click to toggle source
# File lib/dtmcli/dtm.rb, line 28
def prepare(body)
  Proxy.execute(:post, dtm_url + '/prepare', {body: body}, &Dtm::parse)
end
query(params) click to toggle source
# File lib/dtmcli/dtm.rb, line 48
def query(params)
  Proxy.execute(:get, dtm_url + '/query',{params: params}, &Dtm::parse)
end
register_tcc_branch(body) click to toggle source
# File lib/dtmcli/dtm.rb, line 44
def register_tcc_branch(body)
  Proxy.execute(:post, dtm_url + '/registerTccBranch',{body: body}, &Dtm::parse)
end
register_xa_branch(body) click to toggle source
# File lib/dtmcli/dtm.rb, line 40
def register_xa_branch(body)
  Proxy.execute(:post, dtm_url + '/registerXaBranch',{body: body}, &Dtm::parse)
end
submit(body) click to toggle source
# File lib/dtmcli/dtm.rb, line 32
def submit(body)
  Proxy.execute(:post, dtm_url + '/submit', {body: body}, &Dtm::parse)
end