Sha256: 92d8fafe2573d644109f9d6efeed02d43330ef4fbcf761e47cc761825bb75f5d

Contents?: true

Size: 525 Bytes

Versions: 2

Compression:

Stored size: 525 Bytes

Contents

# frozen_string_literal: true

module Services
  module FederatedGraphql
    def self.post(token, payload)
      url = URI(ENV.fetch('FED_GRAPHQL_URL'))

      http = Net::HTTP.new(url.host, url.port)
      http.use_ssl = (url.scheme == 'https')
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE

      request = Net::HTTP::Post.new(url)
      request['Authorization'] = "Bearer #{token}"
      request['Content-Type'] = 'application/json'
      request.body = payload.to_json

      http.request(request)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oct_td_factory-0.1.2 lib/oct_td_factory/services/federated_graphql.rb
oct_td_factory-0.1.1 lib/oct_td_factory/services/federated_graphql.rb