Sha256: 2704f6d9698a9a078dd05d406662c302338689138fbe5908da1dac3855bc2f74

Contents?: true

Size: 1.4 KB

Versions: 4

Compression:

Stored size: 1.4 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(email: nil, pass: nil, org_id: nil)
        @client = Ecoportal::API::Common::GraphQL::Client.new(email: email, pass: pass, 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

4 entries across 4 versions & 1 rubygems

Version Path
ecoportal-api-graphql-0.1.4 lib/ecoportal/api/graphql.rb
ecoportal-api-graphql-0.1.3 lib/ecoportal/api/graphql.rb
ecoportal-api-graphql-0.1.2 lib/ecoportal/api/graphql.rb
ecoportal-api-graphql-0.1.1 lib/ecoportal/api/graphql.rb