shopify_app 5.0.1 → 5.0.2
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/lib/generators/shopify_app/templates/app/views/home/index.html.erb +32 -32
- data/lib/generators/shopify_app/templates/config/initializers/shopify_session_repository.rb +3 -2
- data/lib/shopify_app/configuration.rb +1 -1
- data/lib/shopify_app/version.rb +1 -1
- data/test/config/development_config_file.yml +1 -0
- data/test/config/other_config_file.yml +1 -0
- data/test/config/shopify_app.yml +1 -0
- data/test/lib/shopify_app/configuration_test.rb +13 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4074fe532a9c1606f958f24ce1c9ef8f07c58fb7
|
4
|
+
data.tar.gz: 8d9832af0f7999c33225fb4d2e1c83c151bff70e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00c8fffe2c5f445fe0ef959b62156d032bae66260df5704fb2fdbc566f853475f5a4f66d848733cb1233ce3c82e8e5898a997da350014bbb08716544e1ffb50e
|
7
|
+
data.tar.gz: a0178aeb4ac85acfd59d44d763a67de03ace96a0e426000b772db29f8f4c1e12ff3de68aac7fade16c715d335bddbdae298d7d8e76e91701ca1a8e7350d86268
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
@@ -11,21 +11,21 @@
|
|
11
11
|
|
12
12
|
<div class="row">
|
13
13
|
<div class="span3">
|
14
|
-
<div class="well">
|
14
|
+
<div class="well">
|
15
15
|
<h3>Check out the <code>home_controller</code></h3>
|
16
16
|
<hr style="margin:2px 0 7px"/>
|
17
17
|
<p>The controller in this demo application fetches the newest 5 orders and products and makes them available as instance variables <code>@orders</code> and <code>@products</code></p>
|
18
|
-
|
18
|
+
|
19
19
|
<br/>
|
20
|
-
|
20
|
+
|
21
21
|
<h3>Take a look at <code>index.html.erb</code></h3>
|
22
22
|
<hr style="margin:2px 0 7px"/>
|
23
23
|
<p>Index is the Ruby template you are currently viewing. Have a look at the markup and Ruby code to see how the Shopify API is being used. It's located at <code>views/home/index.html.erb</code></p>
|
24
24
|
</div>
|
25
|
-
|
25
|
+
|
26
26
|
<h3>Additional Docs</h3>
|
27
27
|
<p>You can become an expert pretty quickly by reading up on these docs:</p>
|
28
|
-
|
28
|
+
|
29
29
|
<ul>
|
30
30
|
<li>
|
31
31
|
<%= link_to 'API documentation', 'http://docs.shopify.com/api' %>
|
@@ -44,15 +44,15 @@
|
|
44
44
|
<span class="note">Ask questions and see what others already wanted to know</span>
|
45
45
|
</li>
|
46
46
|
</ul>
|
47
|
-
|
47
|
+
|
48
48
|
<hr/>
|
49
|
-
|
49
|
+
|
50
50
|
<h3>Once you're ready</h3>
|
51
|
-
|
51
|
+
|
52
52
|
<p>We'd love to see what you create using the Shopify API. You can keep up to date on the latest and greatest via the <%= link_to 'Shopify Developers Twitter Account', 'https://twitter.com/shopifydevs' %>. You can also read the latest information on the <%= link_to 'Building a Shopify App', 'http://docs.shopify.com/partners/partner-resources/for-partners/building-a-shopify-app' %>.</p>
|
53
|
-
|
53
|
+
|
54
54
|
<br/>
|
55
|
-
|
55
|
+
|
56
56
|
<a href="https://twitter.com/shopifydevs" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @ShopifyDevs</a>
|
57
57
|
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
58
58
|
</div> <!-- span3 / left-column -->
|
@@ -60,16 +60,16 @@
|
|
60
60
|
|
61
61
|
<div class="span8 offset1">
|
62
62
|
<h2>Recent orders</h2>
|
63
|
-
|
64
|
-
<% if @orders.
|
63
|
+
|
64
|
+
<% if @orders.none? %>
|
65
65
|
<table class="table table-striped">
|
66
66
|
<tr>
|
67
67
|
<td><em>There are no orders in your store.</em></td>
|
68
68
|
</tr>
|
69
69
|
</table>
|
70
|
-
|
70
|
+
|
71
71
|
<% else %>
|
72
|
-
|
72
|
+
|
73
73
|
<table class="table table-striped">
|
74
74
|
<thead>
|
75
75
|
<tr>
|
@@ -99,43 +99,43 @@
|
|
99
99
|
</tr>
|
100
100
|
<% end %>
|
101
101
|
</table>
|
102
|
-
|
102
|
+
|
103
103
|
<% end %>
|
104
|
-
|
104
|
+
|
105
105
|
<br/>
|
106
|
-
|
106
|
+
|
107
107
|
<h2>New Products</h2>
|
108
|
-
|
109
|
-
<div class="accordion" id="accordion">
|
110
|
-
|
111
|
-
<% if @products.
|
112
|
-
|
108
|
+
|
109
|
+
<div class="accordion" id="accordion">
|
110
|
+
|
111
|
+
<% if @products.none? %>
|
112
|
+
|
113
113
|
<div class="accordion-group">
|
114
114
|
<div class="accordion-heading">
|
115
115
|
<em>There are no products in your store.</em>
|
116
116
|
</div>
|
117
117
|
</div>
|
118
|
-
|
118
|
+
|
119
119
|
<% else %>
|
120
|
-
|
120
|
+
|
121
121
|
<% @products.each_with_index do |product, index| %>
|
122
122
|
<div class="accordion-group">
|
123
123
|
<div class="accordion-heading">
|
124
|
-
|
124
|
+
|
125
125
|
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#<%= product.id %>">
|
126
126
|
<%= product.title %> <span class="pull-right muted"><%= product.price_range %> <%= shop_session.shop.currency %></span>
|
127
127
|
</a>
|
128
128
|
</div>
|
129
|
-
|
129
|
+
|
130
130
|
<div id="<%= product.id %>" class="accordion-body collapse <% if index == 1 %>in<% end %>">
|
131
131
|
<div class="accordion-inner">
|
132
|
-
|
132
|
+
|
133
133
|
<% if !product.images.empty? %>
|
134
134
|
<div class="polaroid">
|
135
135
|
<%= link_to image_tag(product.images.first.medium), '#modal-'+product.id.to_s, :'data-toggle' => 'modal' %>
|
136
136
|
</div>
|
137
137
|
<% end %>
|
138
|
-
|
138
|
+
|
139
139
|
<p><strong>Type:</strong> <%= product.product_type %></p>
|
140
140
|
<p><strong>Vendor:</strong> <%= product.vendor %></p>
|
141
141
|
<p><%= raw(product.body_html) %></p><br/>
|
@@ -144,10 +144,10 @@
|
|
144
144
|
<% end %>
|
145
145
|
<p><%= link_to raw('View in your Shopify Admin <i class="icon-chevron-right" style="opacity:.25"></i>'), "https://#{shop_session.url}/admin/products/#{product.id}", :target => 'blank', :class => 'btn btn-primary' %></p>
|
146
146
|
</div>
|
147
|
-
|
147
|
+
|
148
148
|
</div>
|
149
149
|
</div>
|
150
|
-
|
150
|
+
|
151
151
|
<div class="modal hide fade" id="modal-<%= product.id %>" style="display:none;">
|
152
152
|
<div class="modal-header">
|
153
153
|
<a class="close" data-dismiss="modal">×</a>
|
@@ -160,9 +160,9 @@
|
|
160
160
|
</div>
|
161
161
|
</div>
|
162
162
|
<% end %>
|
163
|
-
|
163
|
+
|
164
164
|
<% end %>
|
165
|
-
|
165
|
+
|
166
166
|
</div> <!-- accordion -->
|
167
167
|
</div> <!-- span8 / right-column -->
|
168
168
|
</div>
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# You should replace InMemorySessionStore with what you will be using
|
2
|
-
# in Production
|
2
|
+
# in Production. For example a model called "Shop":
|
3
3
|
#
|
4
|
-
#
|
4
|
+
# ShopifySessionRepository.storage = 'Shop'
|
5
5
|
#
|
6
|
+
# Interface to implement are self.retrieve(id) and self.store(ShopifyAPI::Session)
|
6
7
|
# Here is how you would add these functions to an ActiveRecord:
|
7
8
|
#
|
8
9
|
# class Shop < ActiveRecord::Base
|
data/lib/shopify_app/version.rb
CHANGED
data/test/config/shopify_app.yml
CHANGED
@@ -14,6 +14,7 @@ class ConfigurationTest < Minitest::Test
|
|
14
14
|
config = ShopifyApp::Configuration.new
|
15
15
|
config.respond_to?(:api_key)
|
16
16
|
config.respond_to?(:secret)
|
17
|
+
config.respond_to?(:myshopify_domain)
|
17
18
|
end
|
18
19
|
|
19
20
|
def test_defaults_to_empty_string
|
@@ -21,6 +22,7 @@ class ConfigurationTest < Minitest::Test
|
|
21
22
|
|
22
23
|
assert_equal '', config.api_key
|
23
24
|
assert_equal '', config.secret
|
25
|
+
assert_equal '', config.myshopify_domain
|
24
26
|
end
|
25
27
|
|
26
28
|
def test_environment_has_precedence_over_common
|
@@ -28,6 +30,7 @@ class ConfigurationTest < Minitest::Test
|
|
28
30
|
|
29
31
|
assert_equal 'development key', config.api_key
|
30
32
|
assert_equal 'development secret', config.secret
|
33
|
+
assert_equal 'myshopify.com', config.myshopify_domain
|
31
34
|
end
|
32
35
|
|
33
36
|
def test_rails_has_precedence_over_environment
|
@@ -35,44 +38,54 @@ class ConfigurationTest < Minitest::Test
|
|
35
38
|
|
36
39
|
assert_equal 'development key', config.api_key
|
37
40
|
assert_equal 'development secret', config.secret
|
41
|
+
assert_equal 'myshopify.com', config.myshopify_domain
|
38
42
|
|
39
43
|
config.api_key = 'rails key'
|
40
44
|
config.secret = 'rails secret'
|
45
|
+
config.myshopify_domain = 'example.com'
|
41
46
|
|
42
47
|
assert_equal 'rails key', config.api_key
|
43
48
|
assert_equal 'rails secret', config.secret
|
49
|
+
assert_equal 'example.com', config.myshopify_domain
|
44
50
|
end
|
45
51
|
|
46
52
|
def test_env_has_precedence_over_rails
|
47
53
|
config = ShopifyApp::Configuration.new
|
48
54
|
config.api_key = 'rails key'
|
49
55
|
config.secret = 'rails secret'
|
56
|
+
config.myshopify_domain = 'myshopify.com'
|
50
57
|
|
51
58
|
assert_equal 'rails key', config.api_key
|
52
59
|
assert_equal 'rails secret', config.secret
|
60
|
+
assert_equal 'myshopify.com', config.myshopify_domain
|
53
61
|
|
54
62
|
ENV.expects(:[]).with('SHOPIFY_APP_API_KEY').returns('env key')
|
55
63
|
ENV.expects(:[]).with('SHOPIFY_APP_SECRET').returns('env secret')
|
64
|
+
ENV.expects(:[]).with('SHOPIFY_APP_MYSHOPIFY_DOMAIN').returns('example.com')
|
56
65
|
|
57
66
|
assert_equal 'env key', config.api_key
|
58
67
|
assert_equal 'env secret', config.secret
|
68
|
+
assert_equal 'example.com', config.myshopify_domain
|
59
69
|
end
|
60
70
|
|
61
71
|
def test_reads_config_from_default_config_file
|
62
72
|
config = ShopifyApp::Configuration.new
|
63
73
|
assert_equal 'api key from default file', config.api_key
|
64
74
|
assert_equal 'secret from default file', config.secret
|
75
|
+
assert_equal 'myshopify.com', config.myshopify_domain
|
65
76
|
end
|
66
77
|
|
67
78
|
def test_reads_config_from_specified_config_file
|
68
79
|
config = ShopifyApp::Configuration.new(config_file: config_file('other_config_file.yml'))
|
69
80
|
assert_equal 'api key from other file', config.api_key
|
70
81
|
assert_equal 'secret from other file', config.secret
|
82
|
+
assert_equal 'example.com', config.myshopify_domain
|
71
83
|
end
|
72
84
|
|
73
85
|
def test_handles_missing_config_file
|
74
86
|
config = ShopifyApp::Configuration.new(config_file: config_file('missing_config_file.yml'))
|
75
87
|
assert_equal '', config.api_key
|
76
88
|
assert_equal '', config.secret
|
89
|
+
assert_equal '', config.myshopify_domain
|
77
90
|
end
|
78
91
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
fl3hbtVFTqbOlwL9vy1fudXcolIE/ZTcxQ+er07ZFZdKCXayR9PPs64heamfn0fp
|
31
31
|
TConQSX2BnZdhIEYW+cKzEC/bLc=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
33
|
+
date: 2015-02-20 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: rails
|
metadata.gz.sig
CHANGED
Binary file
|