shopify_app 6.2.0 → 6.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +6 -0
- data/README.md +17 -5
- data/lib/generators/shopify_app/install/install_generator.rb +1 -1
- data/lib/generators/shopify_app/install/templates/shopify_provider.rb +2 -0
- data/lib/shopify_app/version.rb +1 -1
- data/test/generators/install_generator_test.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24a872186951e1f4c991d937f7f2a30e798f357e
|
4
|
+
data.tar.gz: 38c56b9a5e8255b6b59a425819b3390d5962ad7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2ccfb1a9ef061db062030078ee3015d9e832abedf8ba01a65eb826dc3a51c7f2f47787b3cf822c2bb4ac31b08b4c6dbc2ee2615981631d30459a7aff9cbe615
|
7
|
+
data.tar.gz: 1b7dee2021821fe6182b747b6392ae9887d746f33c86c8b41b292d3e4b041220c225d86c7df54c4ec48194e139c998d5f93548bbac26304f118b84ac8fbda889
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -57,18 +57,19 @@ $ rails generate shopify_app:install
|
|
57
57
|
|
58
58
|
# or optionally with arguments:
|
59
59
|
|
60
|
-
$ rails generate shopify_app:install -api_key=<your_api_key> -secret=<your_app_secret>
|
60
|
+
$ rails generate shopify_app:install -api_key=<your_api_key> -secret=<your_app_secret>
|
61
61
|
```
|
62
62
|
|
63
63
|
Other options include:
|
64
64
|
* `scope` - the Oauth access scope required for your app, eg 'read_products, write_orders'. For more information read the [docs](http://docs.shopify.com/api/tutorials/oauth)
|
65
65
|
* `embedded` - the default is to generate an [embedded app](http://docs.shopify.com/embedded-app-sdk), if you want a legacy non-embedded app then set this to false, `-embedded false`
|
66
|
+
* `redirect_uri` - the default is `http://localhost:3000/auth/shopify/callback` which will allow you to develop locally. You'll need to change it to match your domain for production.
|
66
67
|
|
67
68
|
You can update any of these settings later on easily, the arguments are simply for convenience.
|
68
69
|
|
69
70
|
The generator creates a basic SessionsController for authenticating with your shop and a HomeController which displays basic information about your products using the ShopifyAPI. The generated controllers include concerns provided by this gem - in this way code sharing is possible and if some of these core methods are updated everyone can benefit. It is completely safe to override any of the methods provided by this gem in your application.
|
70
71
|
|
71
|
-
After running the `install` generator you can start your app with `bundle exec rails server` and install your app by visiting localhost.
|
72
|
+
After running the `install` generator, you can start your app with `bundle exec rails server` and install your app by visiting localhost.
|
72
73
|
|
73
74
|
|
74
75
|
### Shop Model Generator
|
@@ -77,7 +78,7 @@ After running the `install` generator you can start your app with `bundle exec r
|
|
77
78
|
$ rails generate shopify_app:shop_model
|
78
79
|
```
|
79
80
|
|
80
|
-
The install generator doesn't create any database models for you and if you are starting a new app its quite likely that you will want one (most our internally developed apps do!). This generator creates a simple shop model and a migration. It also
|
81
|
+
The install generator doesn't create any database models for you and if you are starting a new app its quite likely that you will want one (most our internally developed apps do!). This generator creates a simple shop model and a migration. It also creates a model called `SessionStorage` which interacts with `ShopifyApp::SessionRepository`. Check out the later section to learn more about `ShopifyApp::SessionRepository`
|
81
82
|
|
82
83
|
*Note that you will need to run rake db:migrate after this generator*
|
83
84
|
|
@@ -95,13 +96,13 @@ If you just run `rails generate shopify_app` then all the generators will be run
|
|
95
96
|
Managing Api Keys
|
96
97
|
-----------------
|
97
98
|
|
98
|
-
The `install` generator places your Api credentials directly into the shopify_app initializer which is
|
99
|
+
The `install` generator places your Api credentials directly into the shopify_app initializer which is convenient and fine for development but once your app goes into production **your api credentials should not be in source control**. When we develop apps we keep our keys in environment variables so a production shopify_app initializer would look like this:
|
99
100
|
|
100
101
|
```ruby
|
101
102
|
ShopifyApp.configure do |config|
|
102
103
|
config.api_key = ENV['SHOPIFY_CLIENT_API_KEY']
|
103
104
|
config.secret = ENV['SHOPIFY_CLIENT_API_SECRET']
|
104
|
-
config.redirect_uri = "
|
105
|
+
config.redirect_uri = "http://localhost:3000/auth/shopify/callback"
|
105
106
|
config.scope = 'read_customers, read_orders, write_products'
|
106
107
|
config.embedded_app = true
|
107
108
|
end
|
@@ -157,6 +158,17 @@ AuthenticatedController
|
|
157
158
|
|
158
159
|
The engine includes a controller called `AuthenticatedController` which inherits from `ApplicationController`. It adds some before_filters which ensure the user is authenticated and will redirect to the login page if not. It is best practice to have all controllers that belong to the Shopify part of your app inherit from this controller. The HomeController that is generated already inherits from AuthenticatedController.
|
159
160
|
|
161
|
+
Troubleshooting
|
162
|
+
---------------
|
163
|
+
|
164
|
+
### Generator shopify_app:install hangs
|
165
|
+
|
166
|
+
Rails uses spring by default to speed up development. To run the generator, spring has to be stopped:
|
167
|
+
```sh
|
168
|
+
$ bundle exec spring stop
|
169
|
+
```
|
170
|
+
Run shopify_app generator again.
|
171
|
+
|
160
172
|
|
161
173
|
Questions or problems?
|
162
174
|
----------------------
|
data/lib/shopify_app/version.rb
CHANGED
@@ -17,7 +17,7 @@ class InstallGeneratorTest < Rails::Generators::TestCase
|
|
17
17
|
assert_file "config/initializers/shopify_app.rb" do |shopify_app|
|
18
18
|
assert_match 'config.api_key = "<api_key>"', shopify_app
|
19
19
|
assert_match 'config.secret = "<secret>"', shopify_app
|
20
|
-
assert_match 'config.redirect_uri = "
|
20
|
+
assert_match 'config.redirect_uri = "http://localhost:3000/auth/shopify/callback"', shopify_app
|
21
21
|
assert_match 'config.scope = "read_orders, read_products"', shopify_app
|
22
22
|
assert_match "config.embedded_app = true", shopify_app
|
23
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.2.
|
4
|
+
version: 6.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|