Top Level Namespace

Defined Under Namespace

Classes: Learndot

Constant Summary collapse

HTTP =

Configure GraphQL endpoint using the basic HTTP network adapter.

GraphQL::Client::HTTP.new("https://api.learndot.io/graphql/") do
  def headers(context)
    {
      "X-API-KEY" => ENV['LEARNDOT_TOKEN_V3']
    }
  end
end
SCHEMA =

DO NOT regularly get the schema from the API There is a bug on line 10211, part of the PriceInput object; you have to remove the amount’s default value. Otherwise, the schema will fail the graphql-client validation GraphQL::Client.dump_schema(HTTP, “schema.json”)

GraphQL::Client.load_schema('schema.json')
Client =
GraphQL::Client.new(
  schema: SCHEMA,
  execute: HTTP
)
Query =

Learning Component queries only return ELearning Component types Query = Client.parse <<-‘GRAPHQL’

{
  learningComponentByLdeId( ldeId: <int> ) {
    displayName
    description
  }
}

GRAPHQL

Client.parse <<-'GRAPHQL'
  { 
    allLearningComponents { 
      learningComponents { 
        __typename
      } 
    } 
  }
GRAPHQL