Sha256: cd1f622567438ed25c6dfdd94de64b28589e0130a5bd78e99058b0783ee15524

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

module Ecoportal
  module API
    # @attr_reader client [Common::GraphQL::Client] a client object that holds the configuration of the api connection.
    # @attr_reader logger [Logger] the logger.
    class GraphQL
      include Ecoportal::API::Common::GraphQL::ClassHelpers

      attr_reader :client

      # Creates a `GraphQL` object to interact with the ecoPortal `GraphQL API`.
      # @param org_id [String] the id of the target organization.
      #    It defaults to the environmental variable `ORGANIZATION_ID`, if defined
      # @param logger [Logger] an object with `Logger` interface to generate logs.
      def initialize(org_id: ENV['ORGANIZATION_ID'])
        @client = Ecoportal::API::Common::GraphQL::Client.new(org_id: org_id, no_schema: true)
        @fragments = Ecoportal::API::GraphQL::Fragment.new(client)
      end

      def currentOrganizationClass
        API::GraphQL::Model::Organization.tap do |org_class|
          org_class.client = client
        end
      end

      def currentOrganization
        currentOrganizationClass
      end
    end
  end
end

require 'ecoportal/api/graphql/base'
require 'ecoportal/api/graphql/model'
require 'ecoportal/api/graphql/connection'
require 'ecoportal/api/graphql/payload'
require 'ecoportal/api/graphql/input'
require 'ecoportal/api/graphql/fragment'
require 'ecoportal/api/graphql/query'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ecoportal-api-graphql-0.1.0 lib/ecoportal/api/graphql.rb