Class: ShopifyAPI::GraphQL

Inherits:
Object
  • Object
show all
Defined in:
lib/shopify_api/resources/graphql.rb

Overview

GraphQL API.

Instance Method Summary collapse

Constructor Details

#initializeGraphQL

Returns a new instance of GraphQL.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/shopify_api/resources/graphql.rb', line 8

def initialize
  uri = Base.site.dup
  uri.path = Base.api_version.construct_graphql_path
  @http = ::GraphQL::Client::HTTP.new(uri.to_s) do
    define_method(:headers) do |_context|
      Base.headers
    end
  end
  @schema = ::GraphQL::Client.load_schema(@http)
  @client = ::GraphQL::Client.new(schema: @schema, execute: @http)
end