Sha256: 115e1573dff91f3861033864656ea7c531db1c332d5fb105973a0b585b660a33
Contents?: true
Size: 1.69 KB
Versions: 2
Compression:
Stored size: 1.69 KB
Contents
require 'graphlient' module Ecoportal module API module Common module GraphQL class Client < ::Graphlient::Client attr_accessor :host READ_TIMEOUT = 90 WRITE_TIMEOUT = 90 include Ecoportal::API::Common::GraphQL::AuthService def initialize( email: nil, pass: nil, org_id: self.org_id, host: server, schema_path: host, no_schema: false ) @org_id = org_id @host = host @no_schema = no_schema @user_email = email @user_pass = pass puts "Configuring GraphQL Client onto '#{url}'" super(url, headers: { 'Authorization' => "Bearer #{session_token(host: host)}" }, http_options: { read_timeout: READ_TIMEOUT, write_timeout: WRITE_TIMEOUT }.tap do |options| options.merge!(schema_path: schema_path) unless @no_schema end ) end def new(org_id: self.org_id, host: self.host, schema_path: host, no_schema: @no_schema) self.class.new(org_id: org_id, host: host, schema_path: schema_path, no_schema: no_schema) end def org_id @org_id || fetch_env_required("ORGANIZATION_ID") end private def url "#{Ecoportal::API::Common::GraphQL::HttpClient.base_url(host)}/api/#{org_id}/graphql" end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ecoportal-api-graphql-0.4.2 | lib/ecoportal/api/common/graphql/client.rb |
ecoportal-api-graphql-0.4.1 | lib/ecoportal/api/common/graphql/client.rb |