Browse Source

Merge pull request #541 from Shopify/update-call-limit-header

Update call limit header
Scott Walkinshaw 6 years ago
parent
commit
af17ecf759
2 changed files with 7 additions and 7 deletions
  1. 5 5
      lib/shopify_api/limits.rb
  2. 2 2
      test/limits_test.rb

+ 5 - 5
lib/shopify_api/limits.rb

@@ -7,14 +7,14 @@ module ShopifyAPI
     end
 
     module ClassMethods
-
-      # Takes form num_requests_executed/max_requests
-      # Eg: 101/3000
+      # Takes form <call count>/<bucket size>
+      # See https://help.shopify.com/en/api/getting-started/api-call-limit
+      # Eg: 2/40
       CREDIT_LIMIT_HEADER_PARAM = {
-        :shop => 'http_x_shopify_shop_api_call_limit'
+        shop: 'X-Shopify-Shop-Api-Call-Limit',
       }
 
-        ##
+      ##
       # How many more API calls can I make?
       # @return {Integer}
       #

+ 2 - 2
test/limits_test.rb

@@ -3,7 +3,7 @@ require 'test_helper'
 class LimitsTest < Test::Unit::TestCase
   def setup
     super
-    @header_hash = {'http_x_shopify_shop_api_call_limit' => '100/300'}
+    @header_hash = { 'X-Shopify-Shop-Api-Call-Limit' => '100/300' }
     ShopifyAPI::Base.connection.expects(:response).at_least(0).returns(@header_hash)
   end
 
@@ -22,7 +22,7 @@ class LimitsTest < Test::Unit::TestCase
 
     should "flag maxed out credits" do
       assert !ShopifyAPI.maxed?
-      @header_hash = {'http_x_shopify_shop_api_call_limit' => '299/300'}
+      @header_hash = { 'X-Shopify-Shop-Api-Call-Limit' => '299/300' }
       ShopifyAPI::Base.connection.expects(:response).at_least(1).returns(@header_hash)
       assert ShopifyAPI.maxed?
     end