Skip to content

Instantly share code, notes, and snippets.

@daniel-sim
Created February 1, 2021 15:09
Show Gist options
  • Save daniel-sim/4a68412d36932de46ada5c5ac05b37da to your computer and use it in GitHub Desktop.
Save daniel-sim/4a68412d36932de46ada5c5ac05b37da to your computer and use it in GitHub Desktop.
module ShopifyPartnerAPI
class HTTPClient < GraphQL::Client::HTTP
def initialize
super("https://partners.shopify.com/")
end
def headers(context)
{
"X-Shopify-Access-Token": context.fetch(:access_token)
}
end
def execute(document:, operation_name: nil, variables: {}, context: {})
@uri = URI.parse("https://partners.shopify.com/#{context.fetch(:organization_id)}/api/unstable/graphql.json")
super(document: document, operation_name: operation_name, variables: variables, context: context)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment