spree_api 2.2.2 → 2.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 898408b377a8e9d880bf8eb6ba24b5e732df26fc
4
- data.tar.gz: 24fbb8abc05caf4c6a2f7a07c309690d44d0e3a2
3
+ metadata.gz: 023d49b32c382f815538ecd352d5aa66023229b1
4
+ data.tar.gz: ecab512bc91356f7caa6f885330b2d1f6bb15989
5
5
  SHA512:
6
- metadata.gz: 348fa6f5b63439eeaacda5659931402eefe300c0eac4d9922d0b2800ada8baf81a40c6015c757cb331c47c8aaac8b2c5d84ffba38a0a26aee87ccb8e5a4444e6
7
- data.tar.gz: cdaf932f2f3a76ab20e43d6b99bd49a9c2d41b58b525a72732187c7250296aa5f9835b78f1a49f665d33a903d4aa4f7d1ac4b8462dcceff39de2c4e243dd7895
6
+ metadata.gz: 55274ba4edc914b51eb726c77315569083b6cfa33d1a0758dba5002bc6a3d643a0f883179e42b3f3c19aa364696ec6590da2815cbb9bc75214ce07a79da5afbc
7
+ data.tar.gz: cdab9a3906f0919a652e3de59ab59d100da401170a8cbbe3ae5441b2880fc43b8caad2905e53a42155bbf1b04ffc7a0bcc55eb6c7eebfa8297c1883e870871e5
@@ -106,10 +106,6 @@ module Spree
106
106
  send(method_name) if respond_to?(method_name, true)
107
107
  end
108
108
 
109
- def before_payment
110
- @order.payments.destroy_all if request.put?
111
- end
112
-
113
109
  def next!(options={})
114
110
  if @order.valid? && @order.next
115
111
  render 'spree/api/orders/show', status: options[:status] || 200
@@ -51,7 +51,7 @@ module Spree
51
51
  end
52
52
 
53
53
  def option_value_params
54
- params.require(:option_value).permit(permitted_option_type_attributes)
54
+ params.require(:option_value).permit(permitted_option_value_attributes)
55
55
  end
56
56
  end
57
57
  end
@@ -30,18 +30,8 @@ module Spree
30
30
  @shipment = Spree::Shipment.accessible_by(current_ability, :update).readonly(false).find_by!(number: params[:id])
31
31
  end
32
32
 
33
- unlock = params[:shipment].delete(:unlock)
34
-
35
- if unlock == 'yes'
36
- @shipment.adjustment.open
37
- end
38
-
39
33
  @shipment.update_attributes(shipment_params)
40
34
 
41
- if unlock == 'yes'
42
- @shipment.adjustment.close
43
- end
44
-
45
35
  @shipment.reload
46
36
  respond_with(@shipment, default_template: :show)
47
37
  end
@@ -1,5 +1,5 @@
1
1
  object @address
2
- cache @address
2
+ cache [I18n.locale, root_object]
3
3
  attributes *address_attributes
4
4
 
5
5
  child(:country) do |address|
@@ -1,4 +1,4 @@
1
1
  object @adjustment
2
- cache @adjustment
2
+ cache [I18n.locale, root_object]
3
3
  attributes *adjustment_attributes
4
- node(:display_amount) { |a| a.display_amount.to_s }
4
+ node(:display_amount) { |a| a.display_amount.to_s }
@@ -1,3 +1,3 @@
1
1
  object @credit_card
2
- cache @credit_card
3
- attributes *creditcard_attributes
2
+ cache [I18n.locale, root_object]
3
+ attributes *creditcard_attributes
@@ -1,5 +1,5 @@
1
1
  object @line_item
2
- cache @line_item
2
+ cache [I18n.locale, root_object]
3
3
  attributes *line_item_attributes
4
4
  node(:single_display_amount) { |li| li.single_display_amount.to_s }
5
5
  node(:display_amount) { |li| li.display_amount.to_s }
@@ -1,4 +1,4 @@
1
- cache @order
1
+ cache [I18n.locale, root_object]
2
2
  attributes *order_attributes
3
3
  node(:display_item_total) { |o| o.display_item_total.to_s }
4
4
  node(:total_quantity) { |o| o.line_items.sum(:quantity) }
@@ -1,5 +1,5 @@
1
1
  object @product
2
- cache [current_currency, root_object]
2
+ cache [I18n.locale, current_currency, root_object]
3
3
  attributes *product_attributes
4
4
  node(:display_price) { |p| p.display_price.to_s }
5
5
  node(:has_variants) { |p| p.has_variants? }
@@ -1,5 +1,5 @@
1
1
  object @shipment
2
- cache @shipment
2
+ cache [I18n.locale, root_object]
3
3
  attributes *shipment_attributes
4
4
  node(:order_id) { |shipment| shipment.order.number }
5
5
  node(:stock_location_name) { |shipment| shipment.stock_location.name }
@@ -1,7 +1,7 @@
1
1
  object @variant
2
2
  attributes *variant_attributes
3
3
 
4
- cache ['big_variant', root_object]
4
+ cache [I18n.locale, 'big_variant', root_object]
5
5
 
6
6
  extends "spree/api/variants/small"
7
7
 
@@ -1,3 +1,3 @@
1
1
  object @variant
2
- cache ['show', root_object]
2
+ cache [I18n.locale, 'show', root_object]
3
3
  extends "spree/api/variants/big"
@@ -1,5 +1,5 @@
1
1
  attributes *variant_attributes
2
- cache ['small_variant', root_object]
2
+ cache [I18n.locale, 'small_variant', root_object]
3
3
 
4
4
  node(:display_price) { |p| p.display_price.to_s }
5
5
  node(:options_text) { |v| v.options_text }
@@ -111,6 +111,13 @@ module Spree
111
111
  option_value.name.should == "Option Value"
112
112
  end
113
113
 
114
+ it "permits the correct attributes" do
115
+ controller.should_receive(:permitted_option_value_attributes)
116
+ api_put :update, :id => option_value.id, :option_value => {
117
+ :name => ""
118
+ }
119
+ end
120
+
114
121
  it "cannot update an option value with invalid attributes" do
115
122
  api_put :update, :id => option_value.id, :option_value => {
116
123
  :name => ""
@@ -475,6 +475,23 @@ module Spree
475
475
  expect(updated_at.split("T").last).to have_content(milisecond)
476
476
  end
477
477
 
478
+ context "caching enabled" do
479
+ before do
480
+ ActionController::Base.perform_caching = true
481
+ 3.times { Order.create }
482
+ end
483
+
484
+ it "returns unique orders" do
485
+ api_get :index
486
+
487
+ orders = json_response["orders"]
488
+ expect(orders.count).to be >= 3
489
+ expect(orders.map { |o| o["id"] }.sort).to eq(Order.order(:id).pluck(:id))
490
+ end
491
+
492
+ after { ActionController::Base.perform_caching = false }
493
+ end
494
+
478
495
  context "with two orders" do
479
496
  before { create(:order) }
480
497
 
@@ -549,4 +566,3 @@ module Spree
549
566
  end
550
567
  end
551
568
  end
552
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bigg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-15 00:00:00.000000000 Z
11
+ date: 2014-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.2.2
19
+ version: 2.2.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.2.2
26
+ version: 2.2.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rabl
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -254,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
254
  version: '0'
255
255
  requirements: []
256
256
  rubyforge_project:
257
- rubygems_version: 2.2.0
257
+ rubygems_version: 2.2.2
258
258
  signing_key:
259
259
  specification_version: 4
260
260
  summary: Spree's API