shopify_app 5.0.2 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +4 -1
- data/.travis.yml +9 -0
- data/CHANGELOG +12 -1
- data/README.md +73 -108
- data/Rakefile +0 -1
- data/app/controllers/sessions_controller.rb +3 -0
- data/app/views/sessions/new.html.erb +17 -0
- data/config/routes.rb +10 -0
- data/lib/generators/shopify_app/controllers/controllers_generator.rb +29 -0
- data/lib/generators/shopify_app/install/install_generator.rb +83 -0
- data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +22 -0
- data/lib/generators/shopify_app/install/templates/home_controller.rb +11 -0
- data/lib/generators/shopify_app/install/templates/index.html.erb +12 -0
- data/lib/generators/shopify_app/install/templates/omniauth.rb +2 -0
- data/lib/generators/shopify_app/install/templates/shopify_app.rb +6 -0
- data/lib/generators/shopify_app/install/templates/shopify_app_ready_script.html +8 -0
- data/lib/generators/shopify_app/install/templates/shopify_provider.rb +11 -0
- data/lib/generators/shopify_app/{templates/config/initializers → install/templates}/shopify_session_repository.rb +3 -3
- data/lib/generators/shopify_app/routes/routes_generator.rb +31 -0
- data/lib/generators/shopify_app/routes/templates/routes.rb +7 -0
- data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +42 -0
- data/lib/generators/shopify_app/shop_model/templates/db/migrate/create_shops.rb +15 -0
- data/lib/generators/shopify_app/shop_model/templates/session_storage.rb +16 -0
- data/lib/generators/shopify_app/shop_model/templates/shop.rb +3 -0
- data/lib/generators/shopify_app/shop_model/templates/shopify_session_repository.rb +7 -0
- data/lib/generators/shopify_app/shopify_app_generator.rb +10 -63
- data/lib/generators/shopify_app/views/views_generator.rb +29 -0
- data/lib/shopify_app.rb +14 -13
- data/lib/shopify_app/configuration.rb +26 -36
- data/lib/shopify_app/controller.rb +18 -0
- data/lib/shopify_app/engine.rb +5 -0
- data/lib/shopify_app/login_protection.rb +34 -32
- data/lib/shopify_app/sessions_controller.rb +64 -0
- data/lib/shopify_app/shop.rb +15 -0
- data/lib/shopify_app/shopify_session_repository.rb +23 -21
- data/lib/shopify_app/version.rb +1 -1
- data/shopify_app.gemspec +5 -10
- data/test/app_templates/app/controllers/application_controller.rb +2 -0
- data/test/app_templates/config/application.rb +24 -0
- data/test/app_templates/config/initializers/shopify_app.rb +6 -0
- data/test/app_templates/config/routes.rb +3 -0
- data/test/controllers/sessions_controller_test.rb +82 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/home_controller.rb +7 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/shopify_app.rb +6 -0
- data/test/dummy/config/routes.rb +10 -0
- data/test/dummy/config/secrets.yml +17 -0
- data/test/generators/install_generator_test.rb +103 -0
- data/test/generators/routes_generator_test.rb +33 -0
- data/test/generators/shop_model_generator_test.rb +40 -0
- data/test/generators/shopify_app_generator.rb +15 -0
- data/test/generators/views_generator_test.rb +15 -0
- data/test/shopify_app/configuration_test.rb +17 -0
- data/test/{lib/shopify_app → shopify_app}/in_memory_session_store_test.rb +6 -6
- data/test/{lib/shopify_app → shopify_app}/login_protection_test.rb +10 -7
- data/test/shopify_app/shopify_session_repository_test.rb +73 -0
- data/test/support/generator_test_helpers.rb +29 -0
- data/test/test_helper.rb +11 -3
- metadata +79 -61
- metadata.gz.sig +0 -0
- data/install.rb +0 -25
- data/lib/generators/shopify_app/README +0 -23
- data/lib/generators/shopify_app/USAGE +0 -22
- data/lib/generators/shopify_app/templates/app/assets/images/favicon.png +0 -0
- data/lib/generators/shopify_app/templates/app/assets/images/grid-18px.png +0 -0
- data/lib/generators/shopify_app/templates/app/assets/images/shopify-114.png +0 -0
- data/lib/generators/shopify_app/templates/app/assets/images/shopify-57.png +0 -0
- data/lib/generators/shopify_app/templates/app/assets/images/shopify-72.png +0 -0
- data/lib/generators/shopify_app/templates/app/assets/images/shopify.png +0 -0
- data/lib/generators/shopify_app/templates/app/assets/javascripts/application.js +0 -15
- data/lib/generators/shopify_app/templates/app/assets/stylesheets/application.css +0 -10
- data/lib/generators/shopify_app/templates/app/assets/stylesheets/imports.css.less +0 -5
- data/lib/generators/shopify_app/templates/app/assets/stylesheets/shopify_app.css.scss +0 -150
- data/lib/generators/shopify_app/templates/app/assets/stylesheets/shopify_app_buttons.css.less +0 -77
- data/lib/generators/shopify_app/templates/app/controllers/application_controller.rb +0 -13
- data/lib/generators/shopify_app/templates/app/controllers/home_controller.rb +0 -18
- data/lib/generators/shopify_app/templates/app/controllers/sessions_controller.rb +0 -52
- data/lib/generators/shopify_app/templates/app/helpers/home_helper.rb +0 -9
- data/lib/generators/shopify_app/templates/app/helpers/login_helper.rb +0 -3
- data/lib/generators/shopify_app/templates/app/helpers/tabs_helper.rb +0 -11
- data/lib/generators/shopify_app/templates/app/views/home/design.html.erb +0 -3542
- data/lib/generators/shopify_app/templates/app/views/home/index.html.erb +0 -168
- data/lib/generators/shopify_app/templates/app/views/home/welcome.html.erb +0 -110
- data/lib/generators/shopify_app/templates/app/views/layouts/application.html.erb +0 -79
- data/lib/generators/shopify_app/templates/app/views/sessions/new.html.erb +0 -21
- data/lib/generators/shopify_app/templates/config/initializers/omniauth.rb +0 -14
- data/lib/generators/shopify_app/templates/config/initializers/rails_4_shim.rb +0 -1
- data/lib/generators/shopify_app/templates/public/404.html +0 -40
- data/lib/generators/shopify_app/templates/public/422.html +0 -40
- data/lib/generators/shopify_app/templates/public/500.html +0 -40
- data/lib/generators/shopify_app/templates/public/favicon.png +0 -0
- data/lib/generators/shopify_app/templates/public/shopify-114.png +0 -0
- data/lib/generators/shopify_app/templates/public/shopify-57.png +0 -0
- data/lib/generators/shopify_app/templates/public/shopify-72.png +0 -0
- data/lib/shopify_app/railtie.rb +0 -17
- data/test/config/development_config_file.yml +0 -8
- data/test/config/empty_config_file.yml +0 -1
- data/test/config/other_config_file.yml +0 -4
- data/test/config/shopify_app.yml +0 -4
- data/test/lib/shopify_app/configuration_test.rb +0 -91
- data/test/lib/shopify_app/shopify_session_repository_test.rb +0 -70
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<title>Shopify Embedded Example App</title>
|
|
5
|
+
|
|
6
|
+
<script src="//cdn.shopify.com/s/assets/external/app.js?<%= Time.now.strftime('%Y%m%d%H') %>"></script>
|
|
7
|
+
<script type="text/javascript">
|
|
8
|
+
ShopifyApp.init({
|
|
9
|
+
apiKey: "<%= ShopifyApp.configuration.api_key %>",
|
|
10
|
+
shopOrigin: '<%= "https://#{ @shop_session.url }" if @shop_session %>'
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<%= stylesheet_link_tag 'application' %>
|
|
15
|
+
<%= javascript_include_tag 'application' %>
|
|
16
|
+
<%= csrf_meta_tags %>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<%= yield %>
|
|
21
|
+
</body>
|
|
22
|
+
</html>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<h3>Products</h3>
|
|
2
|
+
<table>
|
|
3
|
+
<tbody>
|
|
4
|
+
<% @products.each do |product| %>
|
|
5
|
+
<tr>
|
|
6
|
+
<td>
|
|
7
|
+
<a href='https://<%="#{@shop_session.url}/admin/products/#{product.id}"%>' target="_blank"> <%= product.id %> </a>
|
|
8
|
+
</td>
|
|
9
|
+
</tr>
|
|
10
|
+
<% end %>
|
|
11
|
+
</tbody>
|
|
12
|
+
</table>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
ShopifyApp.configure do |config|
|
|
2
|
+
config.api_key = "<%= opts[:api_key] || '<api_key>' %>"
|
|
3
|
+
config.secret = "<%= opts[:secret] || '<secret>' %>"
|
|
4
|
+
config.scope = "<%= opts[:scope] || 'read_orders, read_products' %>"
|
|
5
|
+
config.embedded_app = <%= opts[:embedded_app] || true %>
|
|
6
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
provider :shopify,
|
|
2
|
+
ShopifyApp.configuration.api_key,
|
|
3
|
+
ShopifyApp.configuration.secret,
|
|
4
|
+
|
|
5
|
+
:scope => ShopifyApp.configuration.scope,
|
|
6
|
+
|
|
7
|
+
:setup => lambda {|env|
|
|
8
|
+
params = Rack::Utils.parse_query(env['QUERY_STRING'])
|
|
9
|
+
site_url = "https://#{params['shop']}"
|
|
10
|
+
env['omniauth.strategy'].options[:client_options][:site] = site_url
|
|
11
|
+
}
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
#
|
|
9
9
|
# class Shop < ActiveRecord::Base
|
|
10
10
|
# def self.store(session)
|
|
11
|
-
# shop =
|
|
11
|
+
# shop = self.new(domain: session.url, token: session.token)
|
|
12
12
|
# shop.save!
|
|
13
13
|
# shop.id
|
|
14
14
|
# end
|
|
15
15
|
#
|
|
16
16
|
# def self.retrieve(id)
|
|
17
|
-
# if shop =
|
|
17
|
+
# if shop = self.where(id: id).first
|
|
18
18
|
# ShopifyAPI::Session.new(shop.domain, shop.token)
|
|
19
19
|
# end
|
|
20
20
|
# end
|
|
21
21
|
# end
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
ShopifyApp::SessionRepository.storage = InMemorySessionStore
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'rails/generators/base'
|
|
2
|
+
|
|
3
|
+
module ShopifyApp
|
|
4
|
+
module Generators
|
|
5
|
+
class RoutesGenerator < Rails::Generators::Base
|
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
7
|
+
|
|
8
|
+
def inject_shopify_app_routes_into_application_routes
|
|
9
|
+
route(session_routes)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def disable_engine_routes
|
|
13
|
+
inject_into_file(
|
|
14
|
+
'config/initializers/shopify_app.rb',
|
|
15
|
+
" config.routes = false\n",
|
|
16
|
+
before: 'end'
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def session_routes
|
|
23
|
+
File.read(routes_file_path)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def routes_file_path
|
|
27
|
+
File.expand_path(find_in_source_paths('routes.rb'))
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'rails/generators/base'
|
|
2
|
+
require 'rails/generators/active_record'
|
|
3
|
+
|
|
4
|
+
module ShopifyApp
|
|
5
|
+
module Generators
|
|
6
|
+
class ShopModelGenerator < Rails::Generators::Base
|
|
7
|
+
include Rails::Generators::Migration
|
|
8
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
9
|
+
|
|
10
|
+
def create_shop_model
|
|
11
|
+
copy_file 'shop.rb', 'app/models/shop.rb'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def create_shop_migration
|
|
15
|
+
copy_migration 'create_shops.rb'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def create_session_storage
|
|
19
|
+
copy_file 'session_storage.rb', 'app/models/session_storage.rb'
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create_session_storage_initializer
|
|
23
|
+
copy_file 'shopify_session_repository.rb', 'config/initializers/shopify_session_repository.rb', force: true
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def copy_migration(migration_name, config = {})
|
|
29
|
+
migration_template(
|
|
30
|
+
"db/migrate/#{migration_name}",
|
|
31
|
+
"db/migrate/#{migration_name}",
|
|
32
|
+
config
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# for generating a timestamp when using `create_migration`
|
|
37
|
+
def self.next_migration_number(dir)
|
|
38
|
+
ActiveRecord::Generators::Base.next_migration_number(dir)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class CreateShops < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :shops do |t|
|
|
4
|
+
t.string :shopify_domain, null: false
|
|
5
|
+
t.string :shopify_token, null: false
|
|
6
|
+
t.timestamps
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
add_index :shops, :shopify_domain, unique: true
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.down
|
|
13
|
+
drop_table :shops
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class SessionStorage
|
|
2
|
+
def self.store(session)
|
|
3
|
+
shop = self.find_or_initialize_by(shopify_domain: session.url)
|
|
4
|
+
shop.shopify_token = session.token
|
|
5
|
+
shop.save!
|
|
6
|
+
shop.id
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def self.retrieve(id)
|
|
10
|
+
return unless id
|
|
11
|
+
shop = self.find(id)
|
|
12
|
+
ShopifyAPI::Session.new(shop.shopify_domain, shop.shopify_token)
|
|
13
|
+
rescue ActiveRecord::RecordNotFound
|
|
14
|
+
nil
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -1,69 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
module ShopifyApp
|
|
2
|
+
module Generators
|
|
3
|
+
class ShopifyAppGenerator < Rails::Generators::Base
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
def run_all_generators
|
|
6
|
+
generate "shopify_app:install"
|
|
7
|
+
generate "shopify_app:shop_model"
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
generate "shopify_app:controllers"
|
|
10
|
+
generate "shopify_app:views"
|
|
11
|
+
generate "shopify_app:routes"
|
|
12
|
+
end
|
|
8
13
|
|
|
9
|
-
def self.source_root
|
|
10
|
-
File.join(File.dirname(__FILE__), 'templates')
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def copy_files
|
|
14
|
-
directory 'app'
|
|
15
|
-
directory 'public'
|
|
16
|
-
directory 'config'
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def remove_static_index
|
|
20
|
-
remove_file 'public/index.html'
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def add_config_variables
|
|
24
|
-
return if api_key.blank? || secret.blank?
|
|
25
|
-
|
|
26
|
-
inject_into_file 'config/application.rb', <<-DATA, :after => "class Application < Rails::Application\n"
|
|
27
|
-
|
|
28
|
-
# Shopify API connection credentials:
|
|
29
|
-
config.shopify.api_key = '#{api_key}'
|
|
30
|
-
config.shopify.secret = '#{secret}'
|
|
31
|
-
DATA
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def add_bootstrap_gem
|
|
35
|
-
gem_group :development, :test do
|
|
36
|
-
gem "less-rails-bootstrap"
|
|
37
|
-
gem 'therubyracer', :platforms => :ruby
|
|
38
14
|
end
|
|
39
15
|
end
|
|
40
|
-
|
|
41
|
-
def add_routes
|
|
42
|
-
unless options[:skip_routes]
|
|
43
|
-
route_without_newline "root :to => 'home#index'"
|
|
44
|
-
route "end"
|
|
45
|
-
route_without_newline " delete 'logout' => :destroy"
|
|
46
|
-
route_without_newline " get 'auth/shopify/callback' => :show"
|
|
47
|
-
route_without_newline " post 'login' => :create"
|
|
48
|
-
route_without_newline " get 'login' => :new"
|
|
49
|
-
route_without_newline "controller :sessions do"
|
|
50
|
-
route "get 'design' => 'home#design'"
|
|
51
|
-
route_without_newline "get 'welcome' => 'home#welcome'"
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def display_readme
|
|
56
|
-
Bundler.with_clean_env do
|
|
57
|
-
run 'bundle install'
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
readme '../README'
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
private
|
|
64
|
-
|
|
65
|
-
def route_without_newline(routing_code)
|
|
66
|
-
sentinel = /\.routes\.draw do(?:\s*\|map\|)?\s*$/
|
|
67
|
-
inject_into_file 'config/routes.rb', "\n #{routing_code}", { after: sentinel, verbose: false }
|
|
68
|
-
end
|
|
69
16
|
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'rails/generators/base'
|
|
2
|
+
|
|
3
|
+
module ShopifyApp
|
|
4
|
+
module Generators
|
|
5
|
+
class ViewsGenerator < Rails::Generators::Base
|
|
6
|
+
source_root File.expand_path("../../../../..", __FILE__)
|
|
7
|
+
|
|
8
|
+
def create_views
|
|
9
|
+
views.each do |view|
|
|
10
|
+
copy_file view
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def views
|
|
17
|
+
files_within_root('.', 'app/views/**/*.*')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def files_within_root(prefix, glob)
|
|
21
|
+
root = "#{self.class.source_root}/#{prefix}"
|
|
22
|
+
|
|
23
|
+
Dir["#{root}/#{glob}"].sort.map do |full_path|
|
|
24
|
+
full_path.sub(root, '.').gsub('/./', '/')
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
data/lib/shopify_app.rb
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
require 'shopify_app/version'
|
|
2
|
+
|
|
3
|
+
# deps
|
|
1
4
|
require 'shopify_api'
|
|
2
5
|
require 'omniauth-shopify-oauth2'
|
|
3
6
|
|
|
4
|
-
|
|
7
|
+
# config
|
|
8
|
+
require 'shopify_app/configuration'
|
|
9
|
+
|
|
10
|
+
# engine
|
|
11
|
+
require 'shopify_app/engine'
|
|
5
12
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
ShopifyAPI::Session.setup(:api_key => ShopifyApp.configuration.api_key, :secret => ShopifyApp.configuration.secret)
|
|
12
|
-
end
|
|
13
|
-
end
|
|
13
|
+
# helpers and concerns
|
|
14
|
+
require 'shopify_app/shop'
|
|
15
|
+
require 'shopify_app/controller'
|
|
16
|
+
require 'shopify_app/sessions_controller'
|
|
17
|
+
require 'shopify_app/login_protection'
|
|
14
18
|
|
|
19
|
+
# session repository
|
|
15
20
|
require 'shopify_app/shopify_session_repository'
|
|
16
21
|
require 'shopify_app/in_memory_session_store'
|
|
17
|
-
require 'shopify_app/login_protection'
|
|
18
|
-
require 'shopify_app/configuration'
|
|
19
|
-
require 'shopify_app/railtie'
|
|
20
|
-
require 'shopify_app/version'
|
|
@@ -1,46 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
module ShopifyApp
|
|
2
|
+
class Configuration
|
|
3
|
+
|
|
4
|
+
# Shopify App settings. These values should match the configuration
|
|
5
|
+
# for the app in your Shopify Partners page. Change your settings in
|
|
6
|
+
# `config/initializers/shopify_app.rb`
|
|
7
|
+
attr_accessor :api_key
|
|
8
|
+
attr_accessor :secret
|
|
9
|
+
attr_accessor :scope
|
|
10
|
+
attr_accessor :embedded_app
|
|
11
|
+
alias_method :embedded_app?, :embedded_app
|
|
12
|
+
|
|
13
|
+
# use the built in session routes?
|
|
14
|
+
attr_accessor :routes
|
|
15
|
+
|
|
16
|
+
def routes_enabled?
|
|
17
|
+
@routes
|
|
13
18
|
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
private
|
|
17
|
-
|
|
18
|
-
attr_accessor :params
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def config_from_rails(meth)
|
|
25
|
-
instance_variable_get("@#{meth}")
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def config_from_file(meth)
|
|
29
|
-
@config_file ||= load_config
|
|
30
|
-
@config_file[Rails.env].try(:[], meth) || @config_file['common'].try(:[], meth)
|
|
20
|
+
def initialize
|
|
21
|
+
@routes = true
|
|
22
|
+
end
|
|
31
23
|
end
|
|
32
24
|
|
|
33
|
-
def
|
|
34
|
-
|
|
25
|
+
def self.configuration
|
|
26
|
+
@configuration ||= Configuration.new
|
|
35
27
|
end
|
|
36
28
|
|
|
37
|
-
def
|
|
38
|
-
|
|
29
|
+
def self.configuration=(config)
|
|
30
|
+
@configuration = config
|
|
39
31
|
end
|
|
40
32
|
|
|
41
|
-
def
|
|
42
|
-
|
|
43
|
-
config_file: File.join(Rails.root, 'config', 'shopify_app.yml')
|
|
44
|
-
}
|
|
33
|
+
def self.configure
|
|
34
|
+
yield configuration
|
|
45
35
|
end
|
|
46
36
|
end
|