Sha256: fb8fa89dfb9cb7ec94286470a112154618123e1a023a19553f49aa7f55e9469e
Contents?: true
Size: 1 KB
Versions: 31
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true require "shopify_cli" module Extension module Tasks class GetExtensions < ShopifyCLI::Task def call(context:, type:) organizations = ShopifyCLI::PartnersAPI::Organizations.fetch_with_extensions(context, type) extensions_from_organizations(organizations, context: context) end private def extensions_from_organizations(organizations, context:) organizations.flat_map do |organization| extensions_owned_by_organization(organization, context: context) end end def extensions_owned_by_organization(organization, context:) return [] unless organization.key?("apps") && organization["apps"].any? organization["apps"].flat_map do |app| app["extensionRegistrations"].map do |registration| [Converters::AppConverter.from_hash(app, organization), Converters::RegistrationConverter.from_hash(context, registration)] end end end end end end
Version data entries
31 entries across 31 versions & 1 rubygems