Class: ShopifyCli::PartnersAPI::Organizations
- Inherits:
-
Object
- Object
- ShopifyCli::PartnersAPI::Organizations
- Defined in:
- lib/shopify-cli/partners_api/organizations.rb
Class Method Summary collapse
Class Method Details
.fetch(ctx, id:) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/shopify-cli/partners_api/organizations.rb', line 13 def fetch(ctx, id:) resp = PartnersAPI.query(ctx, 'find_organization', id: id) org = resp.dig('data', 'organizations', 'nodes').first return nil if org.nil? org['stores'] = (org.dig('stores', 'nodes') || []) org end |
.fetch_all(ctx) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/shopify-cli/partners_api/organizations.rb', line 5 def fetch_all(ctx) resp = PartnersAPI.query(ctx, 'all_organizations') (resp.dig('data', 'organizations', 'nodes') || []).map do |org| org['stores'] = (org.dig('stores', 'nodes') || []) org end end |
.fetch_with_app(ctx) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/shopify-cli/partners_api/organizations.rb', line 21 def fetch_with_app(ctx) resp = PartnersAPI.query(ctx, 'all_orgs_with_apps') (resp.dig('data', 'organizations', 'nodes') || []).map do |org| org['stores'] = (org.dig('stores', 'nodes') || []) org['apps'] = (org.dig('apps', 'nodes') || []) org end end |