Sha256: 0a5850a1afef768fbc7d98e5599fc6609f3c53a8daf158024cacf3f33c7b2ac7
Contents?: true
Size: 1.4 KB
Versions: 5
Compression:
Stored size: 1.4 KB
Contents
module Workarea module Forter class Gateway attr_reader :options def initialize(options = {}) @options = options end def create_decision(order_id, order_details) body = order_details.to_json connection.post do |req| req.url "v2/orders/#{order_id}", {} req.body = body end end def update_order_status(order_id, order_details) body = order_details.to_json connection.put do |req| req.url "v2/status/#{order_id}", {} req.body = body end end private def rest_endpoint "https://api.forter-secure.com" end def connection headers = { "Content-Type" => "application/json", "x-forter-siteid" => site_id, "api-version" => api_version } request_timeouts = { timeout: Workarea.config.forter[:api_timeout], open_timeout: Workarea.config.forter[:open_timeout] } conn = Faraday.new(url: rest_endpoint, headers: headers, request: request_timeouts) conn.basic_auth(secret_key, nil) conn end def api_version options[:api_version] || "2.2" end def secret_key options[:secret_key] end def site_id options[:site_id] end end end end
Version data entries
5 entries across 5 versions & 1 rubygems