Sha256: 985809f7c817152808b4c0c18bd46f5d9b43c635b5ad553467f4786e9f888346

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

require_relative "model.rb"
module Figo
  # Start communication with bank server.
  #
  # @param task_token [Object] Task token object from the initial request
  def start_task(task_token)
    query_api("/task/start?id=" + task_token.task_token, nil, "GET");
  end

  # Poll the task progress.
  #
  # @param task [Object] - Task object
  # @param options [Object] - further options (optional)
  #    @param options.pin [Boolean] - submit PIN
  #    @param options.continue [Boolean] - this flag signals to continue after an error condition or to skip a PIN or challenge-response entry
  #    @param options.save_pin [Boolean] - this flag indicates whether the user has chosen to save the PIN on the figo Connect server
  #    @param options.response [Boolean] - submit response to challenge
  # @return [TaskState] The result parameter is a TaskState object which represents the current status of the task.
  def get_task_state(task, options)
    options ||= {}
    options["id"] = task["task_token"]
    if (options.pin)
      options.save_pin ||= 0
    end
    options.continue ||= 0

    query_api_object TaskState, "/task/progress?id=" + task.task_token, options.to_query, "POST", nil
  end

  # Cancel a task.
  #
  # @param task_token [Object] Task token object
  def cancel_task(task_token)
    options["id"] = task_token["task_token"]
    query_api_object TaskToken, "/task/cancel?id=" + task_token["task_token"], options.to_query, "POST", nil
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
figo-1.4.2 lib/task/api_call.rb
figo-1.4.1 lib/task/api_call.rb
figo-1.4.0 lib/task/api_call.rb
figo-1.3.3 lib/task/api_call.rb