Sha256: d1b9c695d61afb05bfeee96e179cee8346fdf76998d1e8d24f8b3c68f9521426

Contents?: true

Size: 656 Bytes

Versions: 11

Compression:

Stored size: 656 Bytes

Contents

module ShopifyCli
  module Tasks
    class EnsureLoopbackURL < ShopifyCli::Task
      def call(ctx)
        @ctx = ctx
        api_key = Project.current.env.api_key
        result = ShopifyCli::PartnersAPI.query(ctx, "get_app_urls", apiKey: api_key)
        loopback = OAuth::REDIRECT_HOST
        app = result["data"]["app"]
        urls = app["redirectUrlWhitelist"]
        if urls.grep(/#{loopback}/).empty?
          with_loopback = urls.push(loopback)
          ShopifyCli::PartnersAPI.query(@ctx, "update_dashboard_urls", input: {
            redirectUrlWhitelist: with_loopback, apiKey: api_key
          })
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
shopify-cli-1.14.0 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.13.1 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.13.0 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.12.0 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.11.0 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.10.0 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.9.1 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.9.0 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.8.0 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.7.1 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.7.0 lib/shopify-cli/tasks/ensure_loopback_url.rb