Class: ShopifyCLI::Tasks::SelectOrgAndShop

Inherits:
ShopifyCLI::Task show all
Defined in:
lib/shopify_cli/tasks/select_org_and_shop.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ctxObject (readonly)

Returns the value of attribute ctx.



6
7
8
# File 'lib/shopify_cli/tasks/select_org_and_shop.rb', line 6

def ctx
  @ctx
end

Instance Method Details

#call(ctx, organization_id: nil, shop_domain: nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/shopify_cli/tasks/select_org_and_shop.rb', line 8

def call(ctx, organization_id: nil, shop_domain: nil)
  @ctx = ctx
  return response(organization_id.to_i, shop_domain) unless organization_id.nil? || shop_domain.nil?
  org = get_organization(organization_id)
  unless Shopifolk.acting_as_shopify_organization?
    shop_domain ||= get_shop_domain(org)
  end
  ShopifyCLI::Core::Monorail.[:organization_id] = org["id"].to_i
  response(org["id"].to_i, shop_domain)
end