spree_api 0.70.7 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +2 -2
- data/app/assets/javascripts/admin/spree.js +0 -1
- data/app/assets/javascripts/store/spree.js +0 -1
- data/app/assets/stylesheets/admin/spree.css +0 -1
- data/app/assets/stylesheets/store/spree.css +0 -1
- data/app/controllers/{admin → spree/admin}/users_controller_decorator.rb +1 -3
- data/app/controllers/{api → spree/api}/base_controller.rb +17 -19
- data/app/controllers/spree/api/countries_controller.rb +3 -0
- data/app/controllers/{api → spree/api}/inventory_units_controller.rb +5 -6
- data/app/controllers/{api → spree/api}/line_items_controller.rb +4 -6
- data/app/controllers/spree/api/orders_controller.rb +19 -0
- data/app/controllers/{api → spree/api}/products_controller.rb +2 -2
- data/app/controllers/spree/api/shipments_controller.rb +35 -0
- data/app/controllers/spree/api/states_controller.rb +8 -0
- data/app/models/line_item_decorator.rb +2 -2
- data/app/models/order_decorator.rb +3 -3
- data/app/models/shipment_decorator.rb +3 -3
- data/app/models/user_decorator.rb +5 -8
- data/app/overrides/api_admin_user_edit_form.rb +2 -2
- data/app/views/spree/admin/users/_api_fields.html.erb +16 -0
- data/config/routes.rb +2 -2
- data/db/migrate/20100107141738_add_api_key_to_users.rb +3 -7
- data/lib/spree/api/engine.rb +21 -0
- data/lib/spree/api.rb +10 -0
- data/lib/spree_api.rb +2 -19
- metadata +39 -30
- data/app/controllers/api/countries_controller.rb +0 -3
- data/app/controllers/api/orders_controller.rb +0 -20
- data/app/controllers/api/shipments_controller.rb +0 -37
- data/app/controllers/api/states_controller.rb +0 -8
- data/app/views/admin/users/_api_fields.html.erb +0 -16
- data/config/cucumber.yml +0 -10
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2007-2011,
|
1
|
+
Copyright (c) 2007-2011, Spree Commerce, Inc. and other contributors
|
2
2
|
All rights reserved.
|
3
3
|
|
4
4
|
Redistribution and use in source and binary forms, with or without modification,
|
@@ -23,4 +23,4 @@ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
23
23
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
24
24
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25
25
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
26
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
26
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -1,5 +1,4 @@
|
|
1
|
-
Admin::UsersController.class_eval do
|
2
|
-
|
1
|
+
Spree::Admin::UsersController.class_eval do
|
3
2
|
before_filter :load_roles, :only => [:edit, :new, :update, :create, :generate_api_key, :clear_api_key]
|
4
3
|
|
5
4
|
def generate_api_key
|
@@ -15,5 +14,4 @@ Admin::UsersController.class_eval do
|
|
15
14
|
end
|
16
15
|
redirect_to edit_admin_user_path(@user)
|
17
16
|
end
|
18
|
-
|
19
17
|
end
|
@@ -1,9 +1,8 @@
|
|
1
|
-
class Api::BaseController < Spree::BaseController
|
1
|
+
class Spree::Api::BaseController < Spree::BaseController
|
2
2
|
before_filter :check_http_authorization
|
3
3
|
before_filter :load_resource
|
4
4
|
skip_before_filter :verify_authenticity_token, :if => lambda { admin_token_passed_in_headers }
|
5
|
-
|
6
|
-
|
5
|
+
|
7
6
|
respond_to :json
|
8
7
|
|
9
8
|
def index
|
@@ -71,13 +70,13 @@ class Api::BaseController < Spree::BaseController
|
|
71
70
|
|
72
71
|
protected
|
73
72
|
def model_class
|
74
|
-
controller_name.classify.constantize
|
73
|
+
"Spree::#{controller_name.classify}".constantize
|
75
74
|
end
|
76
|
-
|
75
|
+
|
77
76
|
def object_name
|
78
77
|
controller_name.singularize
|
79
78
|
end
|
80
|
-
|
79
|
+
|
81
80
|
def load_resource
|
82
81
|
if member_action?
|
83
82
|
@object ||= load_resource_instance
|
@@ -87,7 +86,7 @@ class Api::BaseController < Spree::BaseController
|
|
87
86
|
instance_variable_set("@#{controller_name}", @collection)
|
88
87
|
end
|
89
88
|
end
|
90
|
-
|
89
|
+
|
91
90
|
def load_resource_instance
|
92
91
|
if new_actions.include?(params[:action].to_sym)
|
93
92
|
build_resource
|
@@ -95,7 +94,7 @@ class Api::BaseController < Spree::BaseController
|
|
95
94
|
find_resource
|
96
95
|
end
|
97
96
|
end
|
98
|
-
|
97
|
+
|
99
98
|
def parent
|
100
99
|
nil
|
101
100
|
end
|
@@ -107,7 +106,7 @@ class Api::BaseController < Spree::BaseController
|
|
107
106
|
model_class.includes(eager_load_associations).find(params[:id])
|
108
107
|
end
|
109
108
|
end
|
110
|
-
|
109
|
+
|
111
110
|
def build_resource
|
112
111
|
if parent.present?
|
113
112
|
parent.send(controller_name).build(params[object_name])
|
@@ -115,14 +114,14 @@ class Api::BaseController < Spree::BaseController
|
|
115
114
|
model_class.new(params[object_name])
|
116
115
|
end
|
117
116
|
end
|
118
|
-
|
117
|
+
|
119
118
|
def collection
|
120
|
-
return @search unless @search.nil?
|
119
|
+
return @search unless @search.nil?
|
121
120
|
params[:search] = {} if params[:search].blank?
|
122
121
|
params[:search][:meta_sort] = 'created_at.desc' if params[:search][:meta_sort].blank?
|
123
|
-
|
122
|
+
|
124
123
|
scope = parent.present? ? parent.send(controller_name) : model_class.scoped
|
125
|
-
|
124
|
+
|
126
125
|
@search = scope.metasearch(params[:search]).relation.limit(100)
|
127
126
|
@search
|
128
127
|
end
|
@@ -151,7 +150,7 @@ class Api::BaseController < Spree::BaseController
|
|
151
150
|
send "admin_#{object_name}_url", target, options
|
152
151
|
end
|
153
152
|
end
|
154
|
-
|
153
|
+
|
155
154
|
def collection_actions
|
156
155
|
[:index]
|
157
156
|
end
|
@@ -165,10 +164,9 @@ class Api::BaseController < Spree::BaseController
|
|
165
164
|
end
|
166
165
|
|
167
166
|
private
|
168
|
-
|
169
|
-
|
170
|
-
|
167
|
+
def check_http_authorization
|
168
|
+
if request.headers['HTTP_AUTHORIZATION'].blank?
|
169
|
+
render :text => "Access Denied\n", :status => 401
|
170
|
+
end
|
171
171
|
end
|
172
|
-
end
|
173
|
-
|
174
172
|
end
|
@@ -1,19 +1,18 @@
|
|
1
|
-
class Api::InventoryUnitsController < Api::BaseController
|
1
|
+
class Spree::Api::InventoryUnitsController < Spree::Api::BaseController
|
2
2
|
private
|
3
3
|
def parent
|
4
4
|
if params[:order_id]
|
5
|
-
@parent = Order.find_by_param(params[:order_id])
|
5
|
+
@parent = Spree::Order.find_by_param(params[:order_id])
|
6
6
|
elsif params[:shipment_id]
|
7
|
-
@parent = Shipment.find_by_param(params[:shipment_id])
|
7
|
+
@parent = Spree::Shipment.find_by_param(params[:shipment_id])
|
8
8
|
end
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def parent_data
|
12
12
|
[params[:order_id], params[:shipment_id]].compact
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def eager_load_associations
|
16
16
|
[:variant]
|
17
17
|
end
|
18
|
-
|
19
18
|
end
|
@@ -1,16 +1,15 @@
|
|
1
|
-
class Api::LineItemsController < Api::BaseController
|
2
|
-
|
1
|
+
class Spree::Api::LineItemsController < Spree::Api::BaseController
|
3
2
|
private
|
4
3
|
def parent
|
5
4
|
if params[:order_id]
|
6
|
-
@parent ||= Order.find_by_param(params[:order_id])
|
5
|
+
@parent ||= Spree::Order.find_by_param(params[:order_id])
|
7
6
|
end
|
8
7
|
end
|
9
|
-
|
8
|
+
|
10
9
|
def parent_data
|
11
10
|
params[:order_id]
|
12
11
|
end
|
13
|
-
|
12
|
+
|
14
13
|
def collection_serialization_options
|
15
14
|
{ :include => [:variant], :methods => [:description] }
|
16
15
|
end
|
@@ -18,5 +17,4 @@ class Api::LineItemsController < Api::BaseController
|
|
18
17
|
def object_serialization_options
|
19
18
|
collection_serialization_options
|
20
19
|
end
|
21
|
-
|
22
20
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Spree::Api::OrdersController < Spree::Api::BaseController
|
2
|
+
before_filter :access_denied, :except => [:index, :show]
|
3
|
+
authorize_resource :class => Spree::Order
|
4
|
+
|
5
|
+
private
|
6
|
+
def find_resource
|
7
|
+
Spree::Order.find_by_param(params[:id])
|
8
|
+
end
|
9
|
+
|
10
|
+
def object_serialization_options
|
11
|
+
{ :include => {
|
12
|
+
:bill_address => { :include => [:country, :state] },
|
13
|
+
:ship_address => { :include => [:country, :state] },
|
14
|
+
:shipments => { :include => [:shipping_method, :address] },
|
15
|
+
:line_items => { :include => [:variant] }
|
16
|
+
}
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class Spree::Api::ShipmentsController < Spree::Api::BaseController
|
2
|
+
private
|
3
|
+
def parent
|
4
|
+
if params[:order_id]
|
5
|
+
@parent ||= Spree::Order.find_by_param(params[:order_id])
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def collection_serialization_options
|
10
|
+
{ :include => { :shipping_method => {}, :address => {}, :inventory_units => { :include => :variant } },
|
11
|
+
:except => [:shipping_method_id, :address_id] }
|
12
|
+
end
|
13
|
+
|
14
|
+
def object_serialization_options
|
15
|
+
{ :include => {
|
16
|
+
:shipping_method => {},
|
17
|
+
:address => { :include => [:country, :state] },
|
18
|
+
:inventory_units => {
|
19
|
+
:include => {
|
20
|
+
:variant => {
|
21
|
+
:include => {
|
22
|
+
:product => { :only => [:name] }
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
},
|
28
|
+
:except => [:shipping_method_id, :address_id]
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def eager_load_associations
|
33
|
+
[:shipping_method, :address, { :inventory_units => [:variant] }]
|
34
|
+
end
|
35
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
Shipment.class_eval do
|
1
|
+
Spree::Shipment.class_eval do
|
2
2
|
def self.find_by_param(param)
|
3
3
|
if param.to_i > 0
|
4
|
-
Shipment.find(param)
|
4
|
+
Spree::Shipment.find(param)
|
5
5
|
else
|
6
|
-
Shipment.where(:number => param).first
|
6
|
+
Spree::Shipment.where(:number => param).first
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
@@ -1,5 +1,4 @@
|
|
1
|
-
User.class_eval do
|
2
|
-
|
1
|
+
Spree::User.class_eval do
|
3
2
|
def clear_api_key!
|
4
3
|
self.update_attribute(:authentication_token, "")
|
5
4
|
end
|
@@ -14,9 +13,7 @@ User.class_eval do
|
|
14
13
|
#end
|
15
14
|
|
16
15
|
private
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
16
|
+
def secure_digest(*args)
|
17
|
+
Digest::SHA1.hexdigest(args.flatten.join('--'))
|
18
|
+
end
|
19
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Deface::Override.new(:virtual_path => "admin/users/edit",
|
1
|
+
Deface::Override.new(:virtual_path => "spree/admin/users/edit",
|
2
2
|
:name => "api_admin_user_edit_form",
|
3
3
|
:insert_after => "[data-hook='admin_user_edit_form'], #admin_user_edit_form[data-hook]",
|
4
|
-
:partial => "admin/users/api_fields",
|
4
|
+
:partial => "spree/admin/users/api_fields",
|
5
5
|
:disabled => false)
|
6
6
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h2><%= t('api.access') %></h2>
|
2
|
+
|
3
|
+
<% if @user.authentication_token.present? %>
|
4
|
+
<p><strong><%= t('api.key') %></strong> <%= @user.authentication_token %></p>
|
5
|
+
<%= form_tag spree.clear_api_key_admin_user_path(@user), :method => :put do %>
|
6
|
+
<%= button t('api.clear_key') %>
|
7
|
+
<% end %>
|
8
|
+
<%= form_tag spree.generate_api_key_admin_user_path(@user), :method => :put do %>
|
9
|
+
<%= button t('api.regenerate_key') %>
|
10
|
+
<% end %>
|
11
|
+
<% else %>
|
12
|
+
<p><%= t('api.no_key') %></p>
|
13
|
+
<%= form_tag spree.generate_api_key_admin_user_path(@user), :method => :put do %>
|
14
|
+
<%= button t('api.generate_key') %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
data/config/routes.rb
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
class AddApiKeyToUsers < ActiveRecord::Migration
|
2
|
-
def
|
3
|
-
add_column
|
2
|
+
def change
|
3
|
+
add_column :spree_users, :api_key, :string, :limit => 40
|
4
4
|
end
|
5
|
-
|
6
|
-
def self.down
|
7
|
-
remove_column "users", "api_key"
|
8
|
-
end
|
9
|
-
end
|
5
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Spree
|
2
|
+
module Api
|
3
|
+
class Engine < Rails::Engine
|
4
|
+
isolate_namespace Spree
|
5
|
+
engine_name 'spree_api'
|
6
|
+
|
7
|
+
def self.activate
|
8
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../../../app/**/*_decorator*.rb")) do |c|
|
9
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
10
|
+
end
|
11
|
+
|
12
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../../../app/overrides/*.rb")) do |c|
|
13
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
config.autoload_paths += %W(#{config.root}/lib)
|
18
|
+
config.to_prepare &method(:activate).to_proc
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/spree/api.rb
ADDED
data/lib/spree_api.rb
CHANGED
@@ -1,20 +1,3 @@
|
|
1
|
-
require '
|
1
|
+
require 'spree/api'
|
2
|
+
require 'spree/core'
|
2
3
|
require 'spree_auth'
|
3
|
-
|
4
|
-
module SpreeApi
|
5
|
-
class Engine < Rails::Engine
|
6
|
-
engine_name 'spree_api'
|
7
|
-
|
8
|
-
def self.activate
|
9
|
-
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
|
10
|
-
Rails.application.config.cache_classes ? require(c) : load(c)
|
11
|
-
end
|
12
|
-
Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/*.rb")) do |c|
|
13
|
-
Rails.application.config.cache_classes ? require(c) : load(c)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
config.autoload_paths += %W(#{config.root}/lib)
|
18
|
-
config.to_prepare &method(:activate).to_proc
|
19
|
-
end
|
20
|
-
end
|
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 15424055
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
|
9
|
+
- 0
|
10
|
+
- rc
|
11
|
+
- 1
|
12
|
+
version: 1.0.0.rc1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- David North
|
@@ -15,7 +17,7 @@ autorequire:
|
|
15
17
|
bindir: bin
|
16
18
|
cert_chain: []
|
17
19
|
|
18
|
-
date:
|
20
|
+
date: 2011-12-23 00:00:00 Z
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
21
23
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -23,12 +25,14 @@ dependencies:
|
|
23
25
|
requirements:
|
24
26
|
- - "="
|
25
27
|
- !ruby/object:Gem::Version
|
26
|
-
hash:
|
28
|
+
hash: 15424055
|
27
29
|
segments:
|
30
|
+
- 1
|
31
|
+
- 0
|
28
32
|
- 0
|
29
|
-
-
|
30
|
-
-
|
31
|
-
version: 0.
|
33
|
+
- rc
|
34
|
+
- 1
|
35
|
+
version: 1.0.0.rc1
|
32
36
|
requirement: *id001
|
33
37
|
type: :runtime
|
34
38
|
prerelease: false
|
@@ -39,12 +43,14 @@ dependencies:
|
|
39
43
|
requirements:
|
40
44
|
- - "="
|
41
45
|
- !ruby/object:Gem::Version
|
42
|
-
hash:
|
46
|
+
hash: 15424055
|
43
47
|
segments:
|
48
|
+
- 1
|
49
|
+
- 0
|
44
50
|
- 0
|
45
|
-
-
|
46
|
-
-
|
47
|
-
version: 0.
|
51
|
+
- rc
|
52
|
+
- 1
|
53
|
+
version: 1.0.0.rc1
|
48
54
|
requirement: *id002
|
49
55
|
type: :runtime
|
50
56
|
prerelease: false
|
@@ -72,24 +78,25 @@ files:
|
|
72
78
|
- app/assets/stylesheets/store/all.css
|
73
79
|
- app/assets/stylesheets/store/spree.css
|
74
80
|
- app/assets/stylesheets/store/spree_api.css
|
75
|
-
- app/controllers/admin/users_controller_decorator.rb
|
76
|
-
- app/controllers/api/base_controller.rb
|
77
|
-
- app/controllers/api/countries_controller.rb
|
78
|
-
- app/controllers/api/inventory_units_controller.rb
|
79
|
-
- app/controllers/api/line_items_controller.rb
|
80
|
-
- app/controllers/api/orders_controller.rb
|
81
|
-
- app/controllers/api/products_controller.rb
|
82
|
-
- app/controllers/api/shipments_controller.rb
|
83
|
-
- app/controllers/api/states_controller.rb
|
81
|
+
- app/controllers/spree/admin/users_controller_decorator.rb
|
82
|
+
- app/controllers/spree/api/base_controller.rb
|
83
|
+
- app/controllers/spree/api/countries_controller.rb
|
84
|
+
- app/controllers/spree/api/inventory_units_controller.rb
|
85
|
+
- app/controllers/spree/api/line_items_controller.rb
|
86
|
+
- app/controllers/spree/api/orders_controller.rb
|
87
|
+
- app/controllers/spree/api/products_controller.rb
|
88
|
+
- app/controllers/spree/api/shipments_controller.rb
|
89
|
+
- app/controllers/spree/api/states_controller.rb
|
84
90
|
- app/models/line_item_decorator.rb
|
85
91
|
- app/models/order_decorator.rb
|
86
92
|
- app/models/shipment_decorator.rb
|
87
93
|
- app/models/user_decorator.rb
|
88
94
|
- app/overrides/api_admin_user_edit_form.rb
|
89
|
-
- app/views/admin/users/_api_fields.html.erb
|
90
|
-
- config/cucumber.yml
|
95
|
+
- app/views/spree/admin/users/_api_fields.html.erb
|
91
96
|
- config/locales/en.yml
|
92
97
|
- config/routes.rb
|
98
|
+
- lib/spree/api/engine.rb
|
99
|
+
- lib/spree/api.rb
|
93
100
|
- lib/spree_api.rb
|
94
101
|
- db/migrate/20100107141738_add_api_key_to_users.rb
|
95
102
|
homepage: http://spreecommerce.com
|
@@ -114,15 +121,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
122
|
none: false
|
116
123
|
requirements:
|
117
|
-
- - "
|
124
|
+
- - ">"
|
118
125
|
- !ruby/object:Gem::Version
|
119
|
-
hash:
|
126
|
+
hash: 25
|
120
127
|
segments:
|
121
|
-
-
|
122
|
-
|
128
|
+
- 1
|
129
|
+
- 3
|
130
|
+
- 1
|
131
|
+
version: 1.3.1
|
123
132
|
requirements:
|
124
133
|
- none
|
125
|
-
rubyforge_project:
|
134
|
+
rubyforge_project:
|
126
135
|
rubygems_version: 1.8.10
|
127
136
|
signing_key:
|
128
137
|
specification_version: 3
|
@@ -1,20 +0,0 @@
|
|
1
|
-
class Api::OrdersController < Api::BaseController
|
2
|
-
before_filter :access_denied, :except => [:index, :show]
|
3
|
-
|
4
|
-
private
|
5
|
-
|
6
|
-
def find_resource
|
7
|
-
Order.find_by_param(params[:id])
|
8
|
-
end
|
9
|
-
|
10
|
-
def object_serialization_options
|
11
|
-
{ :include => {
|
12
|
-
:bill_address => {:include => [:country, :state]},
|
13
|
-
:ship_address => {:include => [:country, :state]},
|
14
|
-
:shipments => {:include => [:shipping_method, :address]},
|
15
|
-
:line_items => {:include => [:variant]}
|
16
|
-
}
|
17
|
-
}
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
class Api::ShipmentsController < Api::BaseController
|
2
|
-
|
3
|
-
private
|
4
|
-
def parent
|
5
|
-
if params[:order_id]
|
6
|
-
@parent ||= Order.find_by_param(params[:order_id])
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
def collection_serialization_options
|
11
|
-
{ :include => {:shipping_method => {}, :address => {}, :inventory_units => {:include => :variant}},
|
12
|
-
:except => [:shipping_method_id, :address_id] }
|
13
|
-
end
|
14
|
-
|
15
|
-
def object_serialization_options
|
16
|
-
{ :include => {
|
17
|
-
:shipping_method => {},
|
18
|
-
:address => {:include => [:country, :state]},
|
19
|
-
:inventory_units => {
|
20
|
-
:include => {
|
21
|
-
:variant => {
|
22
|
-
:include => {
|
23
|
-
:product => {:only => [:name]}
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}
|
28
|
-
},
|
29
|
-
:except => [:shipping_method_id, :address_id]
|
30
|
-
}
|
31
|
-
end
|
32
|
-
|
33
|
-
def eager_load_associations
|
34
|
-
[:shipping_method, :address, {:inventory_units => [:variant]}]
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<h2><%= t('api.access') %></h2>
|
2
|
-
|
3
|
-
<% if @user.authentication_token.present? %>
|
4
|
-
<p><strong><%= t('api.key') %></strong> <%= @user.authentication_token %></p>
|
5
|
-
<%= form_tag clear_api_key_admin_user_path(@user), :method => :put do %>
|
6
|
-
<%= button t("api.clear_key") %>
|
7
|
-
<% end %>
|
8
|
-
<%= form_tag generate_api_key_admin_user_path(@user), :method => :put do %>
|
9
|
-
<%= button t("api.regenerate_key") %>
|
10
|
-
<% end %>
|
11
|
-
<% else %>
|
12
|
-
<p><%= t('api.no_key') %></p>
|
13
|
-
<%= form_tag generate_api_key_admin_user_path(@user), :method => :put do %>
|
14
|
-
<%= button t("api.generate_key") %>
|
15
|
-
<% end %>
|
16
|
-
<% end %>
|
data/config/cucumber.yml
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
3
|
-
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
4
|
-
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
|
5
|
-
ci_opts = "--format progress --strict"
|
6
|
-
%>
|
7
|
-
default: <%= std_opts %> features
|
8
|
-
wip: --tags @wip:3 --wip features
|
9
|
-
ci: <%= ci_opts %> features CI=true
|
10
|
-
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
|