Sha256: 0c54d941b5b1b3f0552b658da37c0f8b97d14d85afa7da19ddc91d69d4bd0cb5

Contents?: true

Size: 616 Bytes

Versions: 2

Compression:

Stored size: 616 Bytes

Contents

# frozen_string_literal: true

module GQLi
  # Module for creating a Contentful GraphQL client
  module Contentful
    # Creates a Contentful GraphQL client
    def self.create(space, access_token, environment: nil, validate_query: true, options: {})
      api_url = "https://graphql.contentful.com/content/v1/spaces/#{space}"
      api_url += "/environments/#{environment}" unless environment.nil?

      GQLi::Client.new(
        api_url,
        headers: {
          'Authorization' => "Bearer #{access_token}"
        },
        validate_query: validate_query,
        options: options
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gqli-1.2.0 lib/gqli/clients/contentful.rb
gqli-1.1.0 lib/gqli/clients/contentful.rb