Sha256: 9244c16a1b21ea0c66b7432599960cf2fffac48657f0e319fbd471104126c063

Contents?: true

Size: 1.17 KB

Versions: 9

Compression:

Stored size: 1.17 KB

Contents

# typed: strict
# frozen_string_literal: true

module ShopifyAPI
  module Clients
    module Graphql
      class Storefront < Client
        sig { params(shop: String, storefront_access_token: String, api_version: T.nilable(String)).void }
        def initialize(shop, storefront_access_token, api_version: nil)
          session = Auth::Session.new(
            id: shop,
            shop: shop,
            access_token: "",
            is_online: false,
          )
          super(session: session, base_path: "/api", api_version: api_version)
          @storefront_access_token = storefront_access_token
        end

        sig do
          params(
            query: String,
            variables: T.nilable(T::Hash[T.any(Symbol, String), T.untyped]),
            headers: T.nilable(T::Hash[T.any(Symbol, String), T.untyped]),
            tries: Integer,
          ).returns(HttpResponse)
        end
        def query(query:, variables: nil, headers: {}, tries: 1)
          T.must(headers).merge!({ "X-Shopify-Storefront-Access-Token": @storefront_access_token })
          super(query: query, variables: variables, headers: headers, tries: tries)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
shopify_api-14.0.1 lib/shopify_api/clients/graphql/storefront.rb
shopify_api-14.0.0 lib/shopify_api/clients/graphql/storefront.rb
shopify_api-13.4.0 lib/shopify_api/clients/graphql/storefront.rb
shopify_api-13.3.1 lib/shopify_api/clients/graphql/storefront.rb
shopify_api-13.3.0 lib/shopify_api/clients/graphql/storefront.rb
shopify_api-13.2.0 lib/shopify_api/clients/graphql/storefront.rb
shopify_api-13.1.0 lib/shopify_api/clients/graphql/storefront.rb
shopify_api-13.0.0 lib/shopify_api/clients/graphql/storefront.rb
shopify_api-12.5.0 lib/shopify_api/clients/graphql/storefront.rb