Sha256: f05196868f9aa4d709b22e471e8d13e8aec7634d222aa326ad4e8af6319b4758

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 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, :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'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ecoportal-api-graphql-0.1.6 lib/ecoportal/api/graphql.rb
ecoportal-api-graphql-0.1.5 lib/ecoportal/api/graphql.rb