Sha256: 73d6461564ef43148d23dc9c370f32236c8e8a28f48843c970ee728cc94c6415

Contents?: true

Size: 932 Bytes

Versions: 6

Compression:

Stored size: 932 Bytes

Contents

require_relative "base_client"
require 'hashie'

module PortalConnectors
  class NoWarningMash < Hashie::Mash # disable warnings like: You are setting a key that conflicts with a built-in method PortalConnectors::MyMash#max , min
    disable_warnings
  end

  class ScreeningClient < BaseClient
    def self.singleton
      @singleton ||= new
    end

    def submit_action(params)
      params.merge!(
        nonce: next_nonce,
      )
      url = "#{host}/api/v1/actions"
      res = post_with_signature(url, params)
      [JSON.parse(res.body_str), res.response_code == 201]
    rescue => e
      return_error e
    end

    def fetch_user(params)
      params.merge!(
        nonce: next_nonce,
      )
      url = "#{host}/api/v1/users"
      res = get_with_signature(url, params)
      [JSON.parse(res.body_str), res.response_code == 200]
    rescue => e
      return_error e
    end

    private_class_method :new
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
portal-connectors-0.58.39xc lib/portal-connectors/screening_client.rb
portal-connectors-0.58.39xb lib/portal-connectors/screening_client.rb
portal-connectors-0.58.39xa lib/portal-connectors/screening_client.rb
portal-connectors-0.58.39fj lib/portal-connectors/screening_client.rb
portal-connectors-0.58.39fg lib/portal-connectors/screening_client.rb
portal-connectors-0.58.38xn lib/portal-connectors/screening_client.rb