Sha256: 0f837f12fa4c2b452a89cb46bd001036c9da461623eca73aa9f8168ed1ce3239
Contents?: true
Size: 915 Bytes
Versions: 3
Compression:
Stored size: 915 Bytes
Contents
# frozen_string_literal: true require 'shopify_cli' module Extension module Tasks class GetApps < ShopifyCli::Task def call(context:) organizations = ShopifyCli::PartnersAPI::Organizations.fetch_with_app(context) apps_from_organizations(organizations) end private def apps_from_organizations(organizations) organizations.flat_map do |organization| apps_owned_by_organization(organization) end end def apps_owned_by_organization(organization) return [] unless organization.key?('apps') && organization['apps'].any? organization['apps'].map do |app| Models::App.new( api_key: app['apiKey'], secret: app["apiSecretKeys"].first["secret"], title: app['title'], business_name: organization['businessName'] ) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems