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, :fragments # 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'