Sha256: 9e262032190e1074938568d75bc9549d422de06b012c93e1d2102cb42dfcf0ad

Contents?: true

Size: 986 Bytes

Versions: 2

Compression:

Stored size: 986 Bytes

Contents

module Onfido
  class Check < Resource
    def create(applicant_id, payload)
      post(
        url: url_for("applicants/#{applicant_id}/checks"),
        payload: payload
      )
    end

    def find(applicant_id, check_id, expand: nil)
      querystring = "&expand=#{expand}" if expand
      get(url: url_for("applicants/#{applicant_id}/checks/#{check_id}?" \
                       "#{querystring}"))
    end

    def find_by_url(url, expand: nil)
      url_path = url.sub(%r/^https\:\/\/api\.onfido\.com\/v2\//, '')
      querystring = "&expand=#{expand}" if expand
      get(url: url_for("#{url_path}?#{querystring}"))
    end

    def all(applicant_id, page: 1, per_page: 20, expand: nil)
      querystring = "page=#{page}&per_page=#{per_page}"
      querystring += "&expand=#{expand}" if expand
      get(url: url_for("applicants/#{applicant_id}/checks?#{querystring}"))
    end

    def resume(check_id)
      post(url: url_for("checks/#{check_id}/resume"))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
onfido-0.15.1 lib/onfido/resources/check.rb
onfido-0.15.0 lib/onfido/resources/check.rb