Module: Waveapps
- Defined in:
- lib/waveapps.rb,
lib/waveapps/ruby/version.rb
Defined Under Namespace
Modules: Ruby Classes: Error, Invoice
Constant Summary collapse
- API_URL =
"https://gql.waveapps.com/graphql/public"- WAVEAPPS_TOKEN =
ENV.fetch('WAVEAPPS_TOKEN')
- HTTP =
GraphQL::Client::HTTP.new(API_URL) do def headers(context) # Optionally set any HTTP headers { "Authorization" => "Bearer #{WAVEAPPS_TOKEN}" } end end
- Schema =
Fetch latest schema on init, this will make a network request
GraphQL::Client.load_schema(HTTP)
- Client =
However, it’s smart to dump this to a JSON file and load from disk
Run it from a script or rake task rake schema:dump
Schema = GraphQL::Client.load_schema(“./tmp/schema.json”)
GraphQL::Client.new(schema: Schema, execute: HTTP)