...
Code Block | ||
---|---|---|
| ||
def request_widget_backend(path, method = :get, parameters = {}) request_params = { method: method, url: build_bpm_widget_path(path), user: bpm_config.login, password: bpm_config.password } if method == :get request_params.merge!({headers: {params: parameters.merge(bpm_parameters)}}) else request_params.merge!({payload: parameters.merge(bpm_parameters)}) end RestClient::Request.execute(request_params) end private def bpm_parameters { user_identifier: user_identifier, entity_type: params[:entity_type], entity_code: params[:entity_code], entity_class: params[:entity_class] } end def build_bpm_widget_path(path = '') URI.join(bpm_config.url, '/widget/', path).to_s end def request_params(path) { url: build_bpm_widget_path(path), user: configuration[:login], password: configuration[:password], headers: { 'Content-Type': 'application/json' } } end def bpm_config YourApplication::Config.widgets.bpm end |
...