Sha256: edbc284d91faff2e8911aee66c7d332d87abdd35c52412b4abc4e97f36ce78b6

Contents?: true

Size: 577 Bytes

Versions: 11

Compression:

Stored size: 577 Bytes

Contents

# frozen_string_literal: true
require 'shopify_cli'

module Extension
  module Tasks
    class GetApp < ShopifyCli::Task
      GRAPHQL_FILE = 'get_app_by_api_key'

      RESPONSE_FIELD = %w(data)
      APP_FIELD = 'app'

      def call(context:, api_key:)
        input = { api_key: api_key }

        response = ShopifyCli::PartnersAPI.query(context, GRAPHQL_FILE, **input).dig(*RESPONSE_FIELD)
        context.abort(context.message('tasks.errors.parse_error')) if response.nil?

        Converters::AppConverter.from_hash(response.dig(APP_FIELD))
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
shopify-cli-1.6.0 lib/project_types/extension/tasks/get_app.rb
shopify-cli-1.5.0 lib/project_types/extension/tasks/get_app.rb
shopify-cli-1.4.1 lib/project_types/extension/tasks/get_app.rb
shopify-cli-1.4.0 lib/project_types/extension/tasks/get_app.rb
shopify-cli-1.3.1 lib/project_types/extension/tasks/get_app.rb
shopify-cli-1.3.0 lib/project_types/extension/tasks/get_app.rb
shopify-cli-1.2.0 lib/project_types/extension/tasks/get_app.rb
shopify-cli-1.1.2 lib/project_types/extension/tasks/get_app.rb
shopify-cli-1.1.1 lib/project_types/extension/tasks/get_app.rb
shopify-cli-1.1.0 lib/project_types/extension/tasks/get_app.rb
shopify-cli-1.0.5 lib/project_types/extension/tasks/get_app.rb