Sha256: b7464c8ccce7ab350d8c7885aa1869c7cb887e02d65259d14d3ba6aeca310470
Contents?: true
Size: 1.8 KB
Versions: 9
Compression:
Stored size: 1.8 KB
Contents
# Documentation ## Environment variables ```bash SHOPIFY_API_BRUV_LOGGER_ENABLED="true" # Enables logger, remove or set to false to disable SHOPIFY_API_BRUV_REQUEST_MAX_TRIES="3" # Max tries for resource class based requests SHOPIFY_API_BRUV_REQUEST_SLEEP_TIMER="4" # Sleep timer for resource class based requests SHOPIFY_API_BRUV_REQUEST_MINIMUM_CREDIT_LEFT="4" # Sleeps if credit left reaches this amount ``` ## Auth ```ruby # Initialize a config config = ShopifyApiBruv::Auth::Config.new( api_domain: "shop.myshopify.com", api_version: "2023-10", api_access_token: "ACCESS_TOKEN" ) ``` ## Usage (GraphQL) ### Simple request ```ruby # Initialize a graphql client and provide the config client = ShopifyApiBruv::Clients::Graphql::Client.new(config:) # Define a query query = <<~GRAPHQL query { products(first: 250) { edges { node { id title handle } } } } GRAPHQL # Make the request client.request(query:) ``` ### Using the resource class ```ruby class GetProducts < ShopifyApiBruv::Resources::Graphql::Resource def query <<~GRAPHQL query { products(first: 250) { edges { node { id title handle } } } } GRAPHQL end end # Usage GetProducts.request(config:) ``` ## Usage (Rest) ### Simple request ```ruby # Initialize a graphql client and provide the config client = ShopifyApiBruv::Clients::Rest::Client.new(config:) # Make the request client.get(path: '/products') ``` ### Using the resource class ```ruby class GetProducts < ShopifyApiBruv::Resources::Rest::Resource def initialize(config:) super( config:, method: :get, path: '/products' ) end end # Usage GetProducts.request(config:) ```
Version data entries
9 entries across 9 versions & 1 rubygems