Sha256: 1a50ea9f1b668975b53da7b37756fd2fa7186a087e2f559c519de92500732b24

Contents?: true

Size: 656 Bytes

Versions: 20

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

20 entries across 20 versions & 1 rubygems

Version Path
shopify-cli-1.6.0 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.5.0 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.4.1 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.4.0 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.3.1 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.3.0 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.2.0 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.1.2 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.1.1 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.1.0 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.0.5 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.0.4 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.0.3 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.0.2 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.0.1 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-1.0.0 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-0.9.3 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-0.9.2 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-0.9.1 lib/shopify-cli/tasks/ensure_loopback_url.rb
shopify-cli-0.9.0 lib/shopify-cli/tasks/ensure_loopback_url.rb