Class: ShopifyCLI::Services::App::Create::RailsService
- Inherits:
-
BaseService
- Object
- BaseService
- ShopifyCLI::Services::App::Create::RailsService
- Defined in:
- lib/shopify_cli/services/app/create/rails_service.rb
Constant Summary collapse
- USER_AGENT_CODE =
<<~USERAGENT module ShopifyAPI class Base < ActiveResource::Base self.headers['User-Agent'] << " | ShopifyApp/\#{ShopifyApp::VERSION} | Shopify CLI" end end USERAGENT
- DEFAULT_RAILS_FLAGS =
%w(--skip-spring)
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#db ⇒ Object
readonly
Returns the value of attribute db.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#organization_id ⇒ Object
readonly
Returns the value of attribute organization_id.
-
#rails_opts ⇒ Object
readonly
Returns the value of attribute rails_opts.
-
#store_domain ⇒ Object
readonly
Returns the value of attribute store_domain.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(name:, organization_id:, store_domain:, type:, db:, rails_opts:, context:) ⇒ RailsService
constructor
A new instance of RailsService.
Methods inherited from BaseService
Constructor Details
#initialize(name:, organization_id:, store_domain:, type:, db:, rails_opts:, context:) ⇒ RailsService
Returns a new instance of RailsService.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/shopify_cli/services/app/create/rails_service.rb', line 20 def initialize(name:, organization_id:, store_domain:, type:, db:, rails_opts:, context:) @name = name @organization_id = organization_id @store_domain = store_domain @type = type @db = db @rails_opts = rails_opts @context = context super() end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
18 19 20 |
# File 'lib/shopify_cli/services/app/create/rails_service.rb', line 18 def context @context end |
#db ⇒ Object (readonly)
Returns the value of attribute db.
18 19 20 |
# File 'lib/shopify_cli/services/app/create/rails_service.rb', line 18 def db @db end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
18 19 20 |
# File 'lib/shopify_cli/services/app/create/rails_service.rb', line 18 def name @name end |
#organization_id ⇒ Object (readonly)
Returns the value of attribute organization_id.
18 19 20 |
# File 'lib/shopify_cli/services/app/create/rails_service.rb', line 18 def organization_id @organization_id end |
#rails_opts ⇒ Object (readonly)
Returns the value of attribute rails_opts.
18 19 20 |
# File 'lib/shopify_cli/services/app/create/rails_service.rb', line 18 def rails_opts @rails_opts end |
#store_domain ⇒ Object (readonly)
Returns the value of attribute store_domain.
18 19 20 |
# File 'lib/shopify_cli/services/app/create/rails_service.rb', line 18 def store_domain @store_domain end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
18 19 20 |
# File 'lib/shopify_cli/services/app/create/rails_service.rb', line 18 def type @type end |
Instance Method Details
#call ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/shopify_cli/services/app/create/rails_service.rb', line 31 def call = { name: name, organization_id: organization_id, shop_domain: store_domain, type: type, } [:db] = db unless db.nil? [:rails_opts] = rails_opts unless rails_opts.nil? form = form_data() raise ShopifyCLI::AbortSilent if form.nil? check_dependencies build(form.name, form.db) set_custom_ua ShopifyCLI::Project.write( context, project_type: "rails", organization_id: form.organization_id, ) api_client = if ShopifyCLI::Environment.acceptance_test? { "apiKey" => "public_api_key", "apiSecretKeys" => [ { "secret" => "api_secret_key", }, ], } else ShopifyCLI::Tasks::CreateApiClient.call( context, org_id: form.organization_id, title: form.name, type: form.type, ) end ShopifyCLI::Resources::EnvFile.new( api_key: api_client["apiKey"], secret: api_client["apiSecretKeys"].first["secret"], shop: form.shop_domain, scopes: "write_products,write_customers,write_draft_orders", ).write(context) partners_url = ShopifyCLI::PartnersAPI.partners_url_for(form.organization_id, api_client["id"]) context.puts(context.("apps.create.info.created", form.name, partners_url)) context.puts(context.("apps.create.info.serve", form.name, ShopifyCLI::TOOL_NAME)) unless ShopifyCLI::Shopifolk.acting_as_shopify_organization? context.puts(context.("apps.create.info.install", partners_url, form.name)) end end |