Skip to content

Instantly share code, notes, and snippets.

View flavio-b's full-sized avatar

flavio-b

  • Vancouver, BC, Canada
View GitHub Profile
@flavio-b
flavio-b / shopify_api_graphql_client.rb
Last active November 28, 2018 07:23
Adding new GraphQL client to ShopifyAPI module.
require 'that_graphql_client'
module ShopifyAPI
class GraphQLClient < GraphQLClient
SHOPIFY_GRAPHQL_ENDPOINT_TEMPLATE = "https://<MYSHOPIFY_DOMAIN>/admin/api/graphql.json"
def initialize(**args)
raise(ArgumentError, 'Must provide an shop as an argument') unless args[:shop].present?
super.tap do |client|
@flavio-b
flavio-b / simple_graphql_wrapper.rb
Created November 28, 2018 07:03
A simple GraphQL wrapper around Faraday.
require 'faraday'
require 'json'
class GraphQLClient
class << self
attr_accessor :base_site, :base_headers
def base_headers
@base_headers ||= {
'Content-Type' => 'application/json',