Sha256: 257b62c5c9e5f84fb5c539c4c4631659b230d8858527750dc5c0a99249646053
Contents?: true
Size: 729 Bytes
Versions: 3
Compression:
Stored size: 729 Bytes
Contents
module ShopifyTheme class APIChecker class APIResult OK = 200 UNAUTHORIZED = 401 SERVER_ERROR_CODES = (500..599) attr_reader :response def initialize(http_response) @response = http_response end def accessed_api? response.code == OK end def cannot_access_api? !accessed_api? end def invalid_config? response.code == UNAUTHORIZED end def api_down? SERVER_ERROR_CODES.include?(response.code) end end def initialize(client) @client = client end def test_connectivity return APIResult.new(client.get_index) end private attr_reader :client end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
shopify_theme-0.0.25 | lib/shopify_theme/api_checker.rb |
shopify_theme-0.0.24 | lib/shopify_theme/api_checker.rb |
shopify_theme-0.0.23 | lib/shopify_theme/api_checker.rb |