solidus_api 3.0.5 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/spree/api/base_controller.rb +6 -3
- data/app/controllers/spree/api/customer_returns_controller.rb +30 -1
- data/app/controllers/spree/api/shipments_controller.rb +1 -1
- data/app/controllers/spree/api/taxons_controller.rb +1 -1
- data/app/controllers/spree/api/variants_controller.rb +1 -1
- data/app/helpers/spree/api/api_helpers.rb +13 -134
- data/app/views/spree/api/products/_product.json.jbuilder +2 -2
- data/app/views/spree/api/variants/_small.json.jbuilder +2 -2
- data/lib/spree/api/engine.rb +4 -0
- data/lib/spree/api_configuration.rb +128 -0
- data/openapi/main.hub.yml +3 -3
- data/openapi/pagination-and-filtering.md +23 -0
- data/openapi/solidus-api.oas.yml +44 -2
- metadata +9 -9
- data/openapi/pagination.md +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95754df420b9b7e750d09379a5daed863451bb18fa0db4d74c30b8777fd7992f
|
4
|
+
data.tar.gz: b3d3f3692c91d9da3150269f2b0a86faab31b7e00034829f82067a6ad9b8c9f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 749a592b19194444127974f8f059256599c05137f9f5846221297fd6a8a92a2a2e4374c19fa91dfa061ed9fee1e38f9da219a59293b0a033bec8a93c172f9cd0
|
7
|
+
data.tar.gz: bc5947619160f92268d614f2723b5a36464ba0d1e1dcc025b169e6181649a02c0548392e270eec5c9a1eb402bf00b5ddae3a718de1e24d073f3f0fd58030e1bd
|
@@ -71,8 +71,11 @@ module Spree
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def gateway_error(exception)
|
74
|
-
|
75
|
-
|
74
|
+
# Fall back to a blank order if one isn't set, as we only need this for
|
75
|
+
# its errors interface.
|
76
|
+
model = @order || Spree::Order.new
|
77
|
+
model.errors.add(:base, exception.message)
|
78
|
+
invalid_resource!(model)
|
76
79
|
end
|
77
80
|
|
78
81
|
def parameter_missing_error(exception)
|
@@ -139,7 +142,7 @@ module Spree
|
|
139
142
|
end
|
140
143
|
|
141
144
|
def variants_associations
|
142
|
-
[{ option_values: :option_type }, :
|
145
|
+
[{ option_values: :option_type }, :prices, :images]
|
143
146
|
end
|
144
147
|
|
145
148
|
def product_includes
|
@@ -4,13 +4,14 @@ module Spree
|
|
4
4
|
module Api
|
5
5
|
class CustomerReturnsController < Spree::Api::BaseController
|
6
6
|
before_action :load_order
|
7
|
+
before_action :build_customer_return, only: [:create]
|
7
8
|
around_action :lock_order, only: [:create, :update, :destroy, :cancel]
|
8
9
|
|
9
10
|
rescue_from Spree::Order::InsufficientStock, with: :insufficient_stock_error
|
10
11
|
|
11
12
|
def create
|
12
13
|
authorize! :create, CustomerReturn
|
13
|
-
|
14
|
+
|
14
15
|
if @customer_return.save
|
15
16
|
respond_with(@customer_return, status: 201, default_template: :show)
|
16
17
|
else
|
@@ -62,6 +63,34 @@ module Spree
|
|
62
63
|
def customer_return_params
|
63
64
|
params.require(:customer_return).permit(permitted_customer_return_attributes)
|
64
65
|
end
|
66
|
+
|
67
|
+
def build_customer_return
|
68
|
+
customer_return_attributes = customer_return_params
|
69
|
+
return_items_params = customer_return_attributes.
|
70
|
+
delete(:return_items_attributes)
|
71
|
+
|
72
|
+
if return_items_params.is_a? ActionController::Parameters
|
73
|
+
return_items_params = return_items_params.values
|
74
|
+
Spree::Deprecation.warn(
|
75
|
+
"Passing `return_items_attributes` as a hash of hashes is \
|
76
|
+
deprecated and will be removed in future versions of Solidus."
|
77
|
+
)
|
78
|
+
end
|
79
|
+
|
80
|
+
@customer_return = CustomerReturn.new(customer_return_attributes)
|
81
|
+
|
82
|
+
@customer_return.return_items = return_items_params.map do |item_params|
|
83
|
+
return_item = if item_params[:id]
|
84
|
+
Spree::ReturnItem.find(item_params[:id])
|
85
|
+
else
|
86
|
+
Spree::ReturnItem.new
|
87
|
+
end
|
88
|
+
|
89
|
+
return_item.assign_attributes(item_params)
|
90
|
+
|
91
|
+
return_item
|
92
|
+
end
|
93
|
+
end
|
65
94
|
end
|
66
95
|
end
|
67
96
|
end
|
@@ -69,7 +69,7 @@ module Spree
|
|
69
69
|
# Products#index does not do the sorting.
|
70
70
|
taxon = Spree::Taxon.find(params[:id])
|
71
71
|
@products = paginate(taxon.products.ransack(params[:q]).result)
|
72
|
-
@products = @products.includes(master: :
|
72
|
+
@products = @products.includes(master: :prices)
|
73
73
|
|
74
74
|
if params[:simple]
|
75
75
|
@exclude_data = {
|
@@ -83,7 +83,7 @@ module Spree
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def include_list
|
86
|
-
[{ option_values: :option_type }, :product, :
|
86
|
+
[{ option_values: :option_type }, :product, :prices, :images, { stock_items: :stock_location }]
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
@@ -37,7 +37,16 @@ module Spree
|
|
37
37
|
:variant_property_attributes
|
38
38
|
]
|
39
39
|
|
40
|
-
|
40
|
+
ATTRIBUTES.each do |attribute|
|
41
|
+
define_method attribute do
|
42
|
+
Spree::Api::Config.send(attribute)
|
43
|
+
end
|
44
|
+
|
45
|
+
define_singleton_method attribute do
|
46
|
+
Spree::Deprecation.warn("Please use Spree::Api::Config::#{attribute} instead.")
|
47
|
+
Spree::Api::Config.send(attribute)
|
48
|
+
end
|
49
|
+
end
|
41
50
|
|
42
51
|
def required_fields_for(model)
|
43
52
|
required_fields = model._validators.select do |_field, validations|
|
@@ -51,142 +60,12 @@ module Spree
|
|
51
60
|
required_fields
|
52
61
|
end
|
53
62
|
|
54
|
-
@@product_attributes = [
|
55
|
-
:id, :name, :description, :available_on,
|
56
|
-
:slug, :meta_description, :meta_keywords, :shipping_category_id,
|
57
|
-
:taxon_ids, :total_on_hand, :meta_title
|
58
|
-
]
|
59
|
-
|
60
|
-
@@product_property_attributes = [
|
61
|
-
:id, :product_id, :property_id, :value, :property_name
|
62
|
-
]
|
63
|
-
|
64
|
-
@@variant_attributes = [
|
65
|
-
:id, :name, :sku, :weight, :height, :width, :depth, :is_master,
|
66
|
-
:slug, :description, :track_inventory
|
67
|
-
]
|
68
|
-
|
69
|
-
@@variant_property_attributes = [
|
70
|
-
:id, :property_id, :value, :property_name
|
71
|
-
]
|
72
|
-
|
73
|
-
@@image_attributes = [
|
74
|
-
:id, :position, :attachment_content_type, :attachment_file_name, :type,
|
75
|
-
:attachment_updated_at, :attachment_width, :attachment_height, :alt
|
76
|
-
]
|
77
|
-
|
78
|
-
@@option_value_attributes = [
|
79
|
-
:id, :name, :presentation, :option_type_name, :option_type_id,
|
80
|
-
:option_type_presentation
|
81
|
-
]
|
82
|
-
|
83
|
-
@@order_attributes = [
|
84
|
-
:id, :number, :item_total, :total, :ship_total, :state, :adjustment_total,
|
85
|
-
:user_id, :created_at, :updated_at, :completed_at, :payment_total,
|
86
|
-
:shipment_state, :payment_state, :email, :special_instructions, :channel,
|
87
|
-
:included_tax_total, :additional_tax_total, :display_included_tax_total,
|
88
|
-
:display_additional_tax_total, :tax_total, :currency,
|
89
|
-
:covered_by_store_credit, :display_total_applicable_store_credit,
|
90
|
-
:order_total_after_store_credit, :display_order_total_after_store_credit,
|
91
|
-
:total_applicable_store_credit, :display_total_available_store_credit,
|
92
|
-
:display_store_credit_remaining_after_capture, :canceler_id
|
93
|
-
|
94
|
-
]
|
95
|
-
|
96
|
-
@@line_item_attributes = [:id, :quantity, :price, :variant_id]
|
97
|
-
|
98
|
-
@@option_type_attributes = [:id, :name, :presentation, :position]
|
99
|
-
|
100
|
-
@@payment_attributes = [
|
101
|
-
:id, :source_type, :source_id, :amount, :display_amount,
|
102
|
-
:payment_method_id, :state, :avs_response, :created_at,
|
103
|
-
:updated_at
|
104
|
-
]
|
105
|
-
|
106
|
-
@@payment_method_attributes = [:id, :name, :description]
|
107
|
-
|
108
|
-
@@shipment_attributes = [:id, :tracking, :tracking_url, :number, :cost, :shipped_at, :state]
|
109
|
-
|
110
|
-
@@taxonomy_attributes = [:id, :name]
|
111
|
-
|
112
|
-
@@taxon_attributes = [
|
113
|
-
:id, :name, :pretty_name, :permalink, :parent_id,
|
114
|
-
:taxonomy_id
|
115
|
-
]
|
116
|
-
|
117
|
-
@@inventory_unit_attributes = [
|
118
|
-
:id, :state, :variant_id, :shipment_id
|
119
|
-
]
|
120
|
-
|
121
|
-
@@customer_return_attributes = [
|
122
|
-
:id, :number, :stock_location_id, :created_at, :updated_at
|
123
|
-
]
|
124
|
-
|
125
|
-
@@return_authorization_attributes = [
|
126
|
-
:id, :number, :state, :order_id, :memo, :created_at, :updated_at
|
127
|
-
]
|
128
|
-
|
129
|
-
@@address_attributes = [
|
130
|
-
:id, :name, :address1, :address2, :city, :zipcode, :phone, :company,
|
131
|
-
:alternative_phone, :country_id, :country_iso, :state_id, :state_name,
|
132
|
-
:state_text
|
133
|
-
]
|
134
|
-
|
135
|
-
@@country_attributes = [:id, :iso_name, :iso, :iso3, :name, :numcode]
|
136
|
-
|
137
|
-
@@state_attributes = [:id, :name, :abbr, :country_id]
|
138
|
-
|
139
|
-
@@adjustment_attributes = [
|
140
|
-
:id, :source_type, :source_id, :adjustable_type, :adjustable_id,
|
141
|
-
:amount, :label, :promotion_code_id,
|
142
|
-
:finalized, :eligible, :created_at, :updated_at
|
143
|
-
]
|
144
|
-
|
145
|
-
@@creditcard_attributes = [
|
146
|
-
:id, :month, :year, :cc_type, :last_digits, :name
|
147
|
-
]
|
148
|
-
|
149
|
-
@@payment_source_attributes = [
|
150
|
-
:id, :month, :year, :cc_type, :last_digits, :name
|
151
|
-
]
|
152
|
-
|
153
|
-
@@user_attributes = [:id, :email, :created_at, :updated_at]
|
154
|
-
|
155
|
-
@@property_attributes = [:id, :name, :presentation]
|
156
|
-
|
157
|
-
@@stock_location_attributes = [
|
158
|
-
:id, :name, :address1, :address2, :city, :state_id, :state_name,
|
159
|
-
:country_id, :zipcode, :phone, :active
|
160
|
-
]
|
161
|
-
|
162
|
-
@@stock_movement_attributes = [:id, :quantity, :stock_item_id]
|
163
|
-
|
164
|
-
@@stock_item_attributes = [
|
165
|
-
:id, :count_on_hand, :backorderable, :stock_location_id,
|
166
|
-
:variant_id
|
167
|
-
]
|
168
|
-
|
169
|
-
@@promotion_attributes = [
|
170
|
-
:id, :name, :description, :expires_at, :starts_at, :type, :usage_limit,
|
171
|
-
:match_policy, :advertise, :path
|
172
|
-
]
|
173
|
-
|
174
|
-
@@store_attributes = [
|
175
|
-
:id, :name, :url, :meta_description, :meta_keywords, :seo_title,
|
176
|
-
:mail_from_address, :default_currency, :code, :default, :available_locales,
|
177
|
-
:bcc_email
|
178
|
-
]
|
179
|
-
|
180
|
-
@@store_credit_history_attributes = [
|
181
|
-
:display_amount, :display_user_total_amount, :display_action,
|
182
|
-
:display_event_date, :display_remaining_amount
|
183
|
-
]
|
184
|
-
|
185
63
|
def variant_attributes
|
64
|
+
preference_attributes = Spree::Api::Config.variant_attributes
|
186
65
|
if @current_user_roles&.include?("admin")
|
187
|
-
|
66
|
+
preference_attributes + [:cost_price]
|
188
67
|
else
|
189
|
-
|
68
|
+
preference_attributes
|
190
69
|
end
|
191
70
|
end
|
192
71
|
|
@@ -4,8 +4,8 @@
|
|
4
4
|
json.cache! [I18n.locale, @current_user_roles.include?('admin'), current_pricing_options, @product_attributes, @exclude_data, product] do
|
5
5
|
json.(product, *(@product_attributes - [:total_on_hand]))
|
6
6
|
json.total_on_hand(total_on_hand_for(product))
|
7
|
-
json.price(product.
|
8
|
-
json.display_price(product.
|
7
|
+
json.price(product.price_for_options(current_pricing_options)&.amount)
|
8
|
+
json.display_price(product.price_for_options(current_pricing_options)&.money&.to_s)
|
9
9
|
|
10
10
|
@exclude_data ||= {}
|
11
11
|
unless @exclude_data[:variants]
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
json.cache! [I18n.locale, current_pricing_options, variant] do
|
4
4
|
json.(variant, *variant_attributes)
|
5
|
-
json.price(variant.
|
6
|
-
json.display_price(variant.
|
5
|
+
json.price(variant.price_for_options(current_pricing_options)&.amount)
|
6
|
+
json.display_price(variant.price_for_options(current_pricing_options)&.money&.to_s)
|
7
7
|
json.options_text(variant.options_text)
|
8
8
|
json.track_inventory(variant.should_track_inventory?)
|
9
9
|
json.in_stock(variant.in_stock?)
|
data/lib/spree/api/engine.rb
CHANGED
@@ -11,6 +11,10 @@ module Spree
|
|
11
11
|
# Leave initializer empty for backwards-compatibility. Other apps
|
12
12
|
# might still rely on this event.
|
13
13
|
initializer "spree.api.environment", before: :load_config_initializers do; end
|
14
|
+
|
15
|
+
config.after_initialize do
|
16
|
+
Spree::Api::Config.check_load_defaults_called('Spree::Api::Config')
|
17
|
+
end
|
14
18
|
end
|
15
19
|
end
|
16
20
|
end
|
@@ -3,5 +3,133 @@
|
|
3
3
|
module Spree
|
4
4
|
class ApiConfiguration < Preferences::Configuration
|
5
5
|
preference :requires_authentication, :boolean, default: true
|
6
|
+
|
7
|
+
preference :product_attributes, :array, default: [
|
8
|
+
:id, :name, :description, :available_on,
|
9
|
+
:slug, :meta_description, :meta_keywords, :shipping_category_id,
|
10
|
+
:taxon_ids, :total_on_hand, :meta_title
|
11
|
+
]
|
12
|
+
|
13
|
+
preference :product_property_attributes, :array, default: [:id, :product_id, :property_id, :value, :property_name]
|
14
|
+
|
15
|
+
preference :variant_attributes, :array, default: [
|
16
|
+
:id, :name, :sku, :weight, :height, :width, :depth, :is_master,
|
17
|
+
:slug, :description, :track_inventory
|
18
|
+
]
|
19
|
+
|
20
|
+
preference :image_attributes, :array, default: [
|
21
|
+
:id, :position, :attachment_content_type, :attachment_file_name, :type,
|
22
|
+
:attachment_updated_at, :attachment_width, :attachment_height, :alt
|
23
|
+
]
|
24
|
+
|
25
|
+
preference :option_value_attributes, :array, default: [
|
26
|
+
:id, :name, :presentation, :option_type_name, :option_type_id,
|
27
|
+
:option_type_presentation
|
28
|
+
]
|
29
|
+
|
30
|
+
preference :order_attributes, :array, default: [
|
31
|
+
:id, :number, :item_total, :total, :ship_total, :state, :adjustment_total,
|
32
|
+
:user_id, :created_at, :updated_at, :completed_at, :payment_total,
|
33
|
+
:shipment_state, :payment_state, :email, :special_instructions, :channel,
|
34
|
+
:included_tax_total, :additional_tax_total, :display_included_tax_total,
|
35
|
+
:display_additional_tax_total, :tax_total, :currency,
|
36
|
+
:covered_by_store_credit, :display_total_applicable_store_credit,
|
37
|
+
:order_total_after_store_credit, :display_order_total_after_store_credit,
|
38
|
+
:total_applicable_store_credit, :display_total_available_store_credit,
|
39
|
+
:display_store_credit_remaining_after_capture, :canceler_id
|
40
|
+
]
|
41
|
+
|
42
|
+
preference :line_item_attributes, :array, default: [:id, :quantity, :price, :variant_id]
|
43
|
+
|
44
|
+
preference :option_type_attributes, :array, default: [:id, :name, :presentation, :position]
|
45
|
+
|
46
|
+
preference :payment_attributes, :array, default: [
|
47
|
+
:id, :source_type, :source_id, :amount, :display_amount,
|
48
|
+
:payment_method_id, :state, :avs_response, :created_at,
|
49
|
+
:updated_at
|
50
|
+
]
|
51
|
+
|
52
|
+
preference :payment_method_attributes, :array, default: [:id, :name, :description]
|
53
|
+
|
54
|
+
preference :shipment_attributes, :array, default: [:id, :tracking, :tracking_url, :number, :cost, :shipped_at, :state]
|
55
|
+
|
56
|
+
preference :taxonomy_attributes, :array, default: [:id, :name]
|
57
|
+
|
58
|
+
preference :taxon_attributes, :array, default: [
|
59
|
+
:id, :name, :pretty_name, :permalink, :parent_id,
|
60
|
+
:taxonomy_id
|
61
|
+
]
|
62
|
+
|
63
|
+
preference :address_attributes, :array, default: [
|
64
|
+
:id, :name, :address1, :address2, :city, :zipcode, :phone, :company,
|
65
|
+
:alternative_phone, :country_id, :country_iso, :state_id, :state_name,
|
66
|
+
:state_text
|
67
|
+
]
|
68
|
+
|
69
|
+
preference :country_attributes, :array, default: [:id, :iso_name, :iso, :iso3, :name, :numcode]
|
70
|
+
|
71
|
+
preference :state_attributes, :array, default: [:id, :name, :abbr, :country_id]
|
72
|
+
|
73
|
+
preference :adjustment_attributes, :array, default: [
|
74
|
+
:id, :source_type, :source_id, :adjustable_type, :adjustable_id,
|
75
|
+
:amount, :label, :promotion_code_id,
|
76
|
+
:finalized, :eligible, :created_at, :updated_at
|
77
|
+
]
|
78
|
+
|
79
|
+
preference :inventory_unit_attributes, :array, default: [
|
80
|
+
:id, :state, :variant_id, :shipment_id
|
81
|
+
]
|
82
|
+
|
83
|
+
preference :customer_return_attributes, :array, default: [
|
84
|
+
:id, :number, :stock_location_id, :created_at, :updated_at
|
85
|
+
]
|
86
|
+
|
87
|
+
preference :return_authorization_attributes, :array, default: [
|
88
|
+
:id, :number, :state, :order_id, :memo, :created_at, :updated_at
|
89
|
+
]
|
90
|
+
|
91
|
+
preference :creditcard_attributes, :array, default: [
|
92
|
+
:id, :month, :year, :cc_type, :last_digits, :name
|
93
|
+
]
|
94
|
+
|
95
|
+
preference :payment_source_attributes, :array, default: [
|
96
|
+
:id, :month, :year, :cc_type, :last_digits, :name
|
97
|
+
]
|
98
|
+
|
99
|
+
preference :user_attributes, :array, default: [:id, :email, :created_at, :updated_at]
|
100
|
+
|
101
|
+
preference :property_attributes, :array, default: [:id, :name, :presentation]
|
102
|
+
|
103
|
+
preference :stock_location_attributes, :array, default: [
|
104
|
+
:id, :name, :address1, :address2, :city, :state_id, :state_name,
|
105
|
+
:country_id, :zipcode, :phone, :active
|
106
|
+
]
|
107
|
+
|
108
|
+
preference :stock_movement_attributes, :array, default: [:id, :quantity, :stock_item_id]
|
109
|
+
|
110
|
+
preference :stock_item_attributes, :array, default: [
|
111
|
+
:id, :count_on_hand, :backorderable, :stock_location_id,
|
112
|
+
:variant_id
|
113
|
+
]
|
114
|
+
|
115
|
+
preference :promotion_attributes, :array, default: [
|
116
|
+
:id, :name, :description, :expires_at, :starts_at, :type, :usage_limit,
|
117
|
+
:match_policy, :advertise, :path
|
118
|
+
]
|
119
|
+
|
120
|
+
preference :store_attributes, :array, default: [
|
121
|
+
:id, :name, :url, :meta_description, :meta_keywords, :seo_title,
|
122
|
+
:mail_from_address, :default_currency, :code, :default, :available_locales,
|
123
|
+
:bcc_email
|
124
|
+
]
|
125
|
+
|
126
|
+
preference :store_credit_history_attributes, :array, default: [
|
127
|
+
:display_amount, :display_user_total_amount, :display_action,
|
128
|
+
:display_event_date, :display_remaining_amount
|
129
|
+
]
|
130
|
+
|
131
|
+
preference :variant_property_attributes, :array, default: [
|
132
|
+
:id, :property_id, :value, :property_name
|
133
|
+
]
|
6
134
|
end
|
7
135
|
end
|
data/openapi/main.hub.yml
CHANGED
@@ -38,11 +38,11 @@ pages:
|
|
38
38
|
path: /authentication
|
39
39
|
data:
|
40
40
|
$ref: ./authentication.md
|
41
|
-
- title: Pagination
|
41
|
+
- title: Pagination and Filtering
|
42
42
|
route:
|
43
|
-
path: /pagination
|
43
|
+
path: /pagination-and-filtering
|
44
44
|
data:
|
45
|
-
$ref: ./pagination.md
|
45
|
+
$ref: ./pagination-and-filtering.md
|
46
46
|
- title: Errors
|
47
47
|
route:
|
48
48
|
path: /errors
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Pagination and Filtering
|
2
|
+
|
3
|
+
## Pagination
|
4
|
+
|
5
|
+
Most endpoints that return a collection are paginated. A paginated response contains metadata about the current page at the root level and the resources in the current page in a child key named after the resource (e.g. `orders`).
|
6
|
+
|
7
|
+
You can pass the `page` and `per_page` parameters to set the current page and the desired number of items per page. Note that the default and the maximum number of items per page is decided at the application level.
|
8
|
+
|
9
|
+
All pagination metadata is documented in the individual API endpoints, so take a look there if you're unsure what data you can expect.
|
10
|
+
|
11
|
+
## Filtering
|
12
|
+
|
13
|
+
Most endpoints that return a collection also have the ability to filter data using query params. This works taking advantage of the search filters provided by [Ransack](https://github.com/activerecord-hackery/ransack/).
|
14
|
+
|
15
|
+
For example, if we want to retrieve only products that contain the word "Watch" in their title we can make the following request:
|
16
|
+
|
17
|
+
```
|
18
|
+
GET /products?q[name_cont]=Watch
|
19
|
+
```
|
20
|
+
|
21
|
+
The `name_cont` matcher will generate a query using `LIKE` to retrieve all the products that contain the value specified. For an extensive list of search matchers supported, please refer to the Ransack documentation.
|
22
|
+
|
23
|
+
The result will be paginated as described in the paragraph above.
|
data/openapi/solidus-api.oas.yml
CHANGED
@@ -38,6 +38,7 @@ paths:
|
|
38
38
|
parameters:
|
39
39
|
- $ref: '#/components/parameters/page'
|
40
40
|
- $ref: '#/components/parameters/per_page'
|
41
|
+
- $ref: '#/components/parameters/q'
|
41
42
|
security:
|
42
43
|
- api-key: []
|
43
44
|
post:
|
@@ -117,6 +118,7 @@ paths:
|
|
117
118
|
parameters:
|
118
119
|
- $ref: '#/components/parameters/page'
|
119
120
|
- $ref: '#/components/parameters/per_page'
|
121
|
+
- $ref: '#/components/parameters/q'
|
120
122
|
security:
|
121
123
|
- api-key: []
|
122
124
|
'/orders/{number}':
|
@@ -257,6 +259,7 @@ paths:
|
|
257
259
|
parameters:
|
258
260
|
- $ref: '#/components/parameters/page'
|
259
261
|
- $ref: '#/components/parameters/per_page'
|
262
|
+
- $ref: '#/components/parameters/q'
|
260
263
|
'/countries/{id}':
|
261
264
|
get:
|
262
265
|
responses:
|
@@ -516,6 +519,7 @@ paths:
|
|
516
519
|
parameters:
|
517
520
|
- $ref: '#/components/parameters/page'
|
518
521
|
- $ref: '#/components/parameters/per_page'
|
522
|
+
- $ref: '#/components/parameters/q'
|
519
523
|
security:
|
520
524
|
- api-key: []
|
521
525
|
parameters:
|
@@ -837,6 +841,7 @@ paths:
|
|
837
841
|
parameters:
|
838
842
|
- $ref: '#/components/parameters/page'
|
839
843
|
- $ref: '#/components/parameters/per_page'
|
844
|
+
- $ref: '#/components/parameters/q'
|
840
845
|
security:
|
841
846
|
- api-key: []
|
842
847
|
post:
|
@@ -1203,6 +1208,7 @@ paths:
|
|
1203
1208
|
parameters:
|
1204
1209
|
- $ref: '#/components/parameters/page'
|
1205
1210
|
- $ref: '#/components/parameters/per_page'
|
1211
|
+
- $ref: '#/components/parameters/q'
|
1206
1212
|
security:
|
1207
1213
|
- api-key: []
|
1208
1214
|
'/users/{id}':
|
@@ -1398,6 +1404,7 @@ paths:
|
|
1398
1404
|
parameters:
|
1399
1405
|
- $ref: '#/components/parameters/page'
|
1400
1406
|
- $ref: '#/components/parameters/per_page'
|
1407
|
+
- $ref: '#/components/parameters/q'
|
1401
1408
|
security:
|
1402
1409
|
- api-key: []
|
1403
1410
|
parameters:
|
@@ -1520,6 +1527,7 @@ paths:
|
|
1520
1527
|
parameters:
|
1521
1528
|
- $ref: '#/components/parameters/page'
|
1522
1529
|
- $ref: '#/components/parameters/per_page'
|
1530
|
+
- $ref: '#/components/parameters/q'
|
1523
1531
|
security:
|
1524
1532
|
- api-key: []
|
1525
1533
|
parameters:
|
@@ -1682,6 +1690,7 @@ paths:
|
|
1682
1690
|
parameters:
|
1683
1691
|
- $ref: '#/components/parameters/page'
|
1684
1692
|
- $ref: '#/components/parameters/per_page'
|
1693
|
+
- $ref: '#/components/parameters/q'
|
1685
1694
|
security:
|
1686
1695
|
- api-key: []
|
1687
1696
|
parameters:
|
@@ -1898,6 +1907,7 @@ paths:
|
|
1898
1907
|
parameters:
|
1899
1908
|
- $ref: '#/components/parameters/page'
|
1900
1909
|
- $ref: '#/components/parameters/per_page'
|
1910
|
+
- $ref: '#/components/parameters/q'
|
1901
1911
|
security:
|
1902
1912
|
- api-key: []
|
1903
1913
|
post:
|
@@ -2053,6 +2063,7 @@ paths:
|
|
2053
2063
|
parameters:
|
2054
2064
|
- $ref: '#/components/parameters/page'
|
2055
2065
|
- $ref: '#/components/parameters/per_page'
|
2066
|
+
- $ref: '#/components/parameters/q'
|
2056
2067
|
security:
|
2057
2068
|
- api-key: []
|
2058
2069
|
- order-token: []
|
@@ -2213,6 +2224,7 @@ paths:
|
|
2213
2224
|
parameters:
|
2214
2225
|
- $ref: '#/components/parameters/page'
|
2215
2226
|
- $ref: '#/components/parameters/per_page'
|
2227
|
+
- $ref: '#/components/parameters/q'
|
2216
2228
|
security:
|
2217
2229
|
- api-key: []
|
2218
2230
|
parameters:
|
@@ -2803,6 +2815,7 @@ paths:
|
|
2803
2815
|
parameters:
|
2804
2816
|
- $ref: '#/components/parameters/page'
|
2805
2817
|
- $ref: '#/components/parameters/per_page'
|
2818
|
+
- $ref: '#/components/parameters/q'
|
2806
2819
|
security:
|
2807
2820
|
- api-key: []
|
2808
2821
|
parameters:
|
@@ -2964,6 +2977,7 @@ paths:
|
|
2964
2977
|
parameters:
|
2965
2978
|
- $ref: '#/components/parameters/page'
|
2966
2979
|
- $ref: '#/components/parameters/per_page'
|
2980
|
+
- $ref: '#/components/parameters/q'
|
2967
2981
|
security:
|
2968
2982
|
- api-key: []
|
2969
2983
|
post:
|
@@ -3153,6 +3167,7 @@ paths:
|
|
3153
3167
|
parameters:
|
3154
3168
|
- $ref: '#/components/parameters/page'
|
3155
3169
|
- $ref: '#/components/parameters/per_page'
|
3170
|
+
- $ref: '#/components/parameters/q'
|
3156
3171
|
security:
|
3157
3172
|
- api-key: []
|
3158
3173
|
post:
|
@@ -3303,6 +3318,7 @@ paths:
|
|
3303
3318
|
parameters:
|
3304
3319
|
- $ref: '#/components/parameters/page'
|
3305
3320
|
- $ref: '#/components/parameters/per_page'
|
3321
|
+
- $ref: '#/components/parameters/q'
|
3306
3322
|
security:
|
3307
3323
|
- api-key: []
|
3308
3324
|
parameters:
|
@@ -3454,6 +3470,7 @@ paths:
|
|
3454
3470
|
parameters:
|
3455
3471
|
- $ref: '#/components/parameters/page'
|
3456
3472
|
- $ref: '#/components/parameters/per_page'
|
3473
|
+
- $ref: '#/components/parameters/q'
|
3457
3474
|
security:
|
3458
3475
|
- api-key: []
|
3459
3476
|
parameters:
|
@@ -3671,6 +3688,7 @@ paths:
|
|
3671
3688
|
parameters:
|
3672
3689
|
- $ref: '#/components/parameters/page'
|
3673
3690
|
- $ref: '#/components/parameters/per_page'
|
3691
|
+
- $ref: '#/components/parameters/q'
|
3674
3692
|
security:
|
3675
3693
|
- api-key: []
|
3676
3694
|
post:
|
@@ -3729,6 +3747,13 @@ paths:
|
|
3729
3747
|
- Taxonomies
|
3730
3748
|
security:
|
3731
3749
|
- api-key: []
|
3750
|
+
parameters:
|
3751
|
+
- schema:
|
3752
|
+
type: string
|
3753
|
+
default: nested
|
3754
|
+
in: query
|
3755
|
+
name: set
|
3756
|
+
description: When `set=nested` it will recoursively return all the taxons of that taxonomy
|
3732
3757
|
parameters:
|
3733
3758
|
- name: id
|
3734
3759
|
in: path
|
@@ -3822,6 +3847,7 @@ paths:
|
|
3822
3847
|
parameters:
|
3823
3848
|
- $ref: '#/components/parameters/page'
|
3824
3849
|
- $ref: '#/components/parameters/per_page'
|
3850
|
+
- $ref: '#/components/parameters/q'
|
3825
3851
|
security:
|
3826
3852
|
- api-key: []
|
3827
3853
|
parameters:
|
@@ -3985,6 +4011,12 @@ paths:
|
|
3985
4011
|
parameters:
|
3986
4012
|
- $ref: '#/components/parameters/page'
|
3987
4013
|
- $ref: '#/components/parameters/per_page'
|
4014
|
+
- $ref: '#/components/parameters/q'
|
4015
|
+
- schema:
|
4016
|
+
type: boolean
|
4017
|
+
in: query
|
4018
|
+
name: without_children
|
4019
|
+
description: 'When set to `true`, it won''t recursively return all the taxons'' children.'
|
3988
4020
|
security:
|
3989
4021
|
- api-key: []
|
3990
4022
|
/users:
|
@@ -4012,6 +4044,7 @@ paths:
|
|
4012
4044
|
parameters:
|
4013
4045
|
- $ref: '#/components/parameters/page'
|
4014
4046
|
- $ref: '#/components/parameters/per_page'
|
4047
|
+
- $ref: '#/components/parameters/q'
|
4015
4048
|
security:
|
4016
4049
|
- api-key: []
|
4017
4050
|
post:
|
@@ -4071,6 +4104,7 @@ paths:
|
|
4071
4104
|
parameters:
|
4072
4105
|
- $ref: '#/components/parameters/page'
|
4073
4106
|
- $ref: '#/components/parameters/per_page'
|
4107
|
+
- $ref: '#/components/parameters/q'
|
4074
4108
|
security:
|
4075
4109
|
- api-key: []
|
4076
4110
|
post:
|
@@ -5666,12 +5700,15 @@ paths:
|
|
5666
5700
|
name: id
|
5667
5701
|
schema:
|
5668
5702
|
type: integer
|
5703
|
+
description: The id of the Taxon
|
5669
5704
|
- $ref: '#/components/parameters/page'
|
5670
5705
|
- $ref: '#/components/parameters/per_page'
|
5706
|
+
- $ref: '#/components/parameters/q'
|
5671
5707
|
- in: query
|
5672
5708
|
name: simple
|
5673
5709
|
schema:
|
5674
5710
|
type: boolean
|
5711
|
+
description: Returns a simplified version of the JSON
|
5675
5712
|
security:
|
5676
5713
|
- api-key: []
|
5677
5714
|
'/orders/{order_number}/customer_returns':
|
@@ -5702,6 +5739,7 @@ paths:
|
|
5702
5739
|
parameters:
|
5703
5740
|
- $ref: '#/components/parameters/page'
|
5704
5741
|
- $ref: '#/components/parameters/per_page'
|
5742
|
+
- $ref: '#/components/parameters/q'
|
5705
5743
|
security:
|
5706
5744
|
- api-key: []
|
5707
5745
|
parameters:
|
@@ -5794,6 +5832,12 @@ components:
|
|
5794
5832
|
schema:
|
5795
5833
|
type: integer
|
5796
5834
|
default: 25
|
5835
|
+
q:
|
5836
|
+
name: q
|
5837
|
+
in: query
|
5838
|
+
schema:
|
5839
|
+
example: '?q[attribute_eq]=value'
|
5840
|
+
description: 'Allows to query results based on search filters provided by Ransack (https://github.com/activerecord-hackery/ransack/).'
|
5797
5841
|
responses:
|
5798
5842
|
not-found:
|
5799
5843
|
description: ''
|
@@ -7021,8 +7065,6 @@ components:
|
|
7021
7065
|
type: string
|
7022
7066
|
available_on:
|
7023
7067
|
type: string
|
7024
|
-
permalink:
|
7025
|
-
type: string
|
7026
7068
|
meta_description:
|
7027
7069
|
type: string
|
7028
7070
|
meta_keywords:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jbuilder
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.0
|
61
|
+
version: 3.1.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.0
|
68
|
+
version: 3.1.0
|
69
69
|
description: REST API for the Solidus e-commerce framework.
|
70
70
|
email: contact@solidus.io
|
71
71
|
executables: []
|
@@ -248,7 +248,7 @@ files:
|
|
248
248
|
- openapi/errors.md
|
249
249
|
- openapi/lint.yml
|
250
250
|
- openapi/main.hub.yml
|
251
|
-
- openapi/pagination.md
|
251
|
+
- openapi/pagination-and-filtering.md
|
252
252
|
- openapi/solidus-api.oas.yml
|
253
253
|
- openapi/theme.css
|
254
254
|
- solidus_api.gemspec
|
@@ -256,7 +256,7 @@ homepage: http://solidus.io
|
|
256
256
|
licenses:
|
257
257
|
- BSD-3-Clause
|
258
258
|
metadata: {}
|
259
|
-
post_install_message:
|
259
|
+
post_install_message:
|
260
260
|
rdoc_options: []
|
261
261
|
require_paths:
|
262
262
|
- lib
|
@@ -271,8 +271,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
271
271
|
- !ruby/object:Gem::Version
|
272
272
|
version: 1.8.23
|
273
273
|
requirements: []
|
274
|
-
rubygems_version: 3.
|
275
|
-
signing_key:
|
274
|
+
rubygems_version: 3.2.20
|
275
|
+
signing_key:
|
276
276
|
specification_version: 4
|
277
277
|
summary: REST API for the Solidus e-commerce framework.
|
278
278
|
test_files: []
|
data/openapi/pagination.md
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# Pagination
|
2
|
-
|
3
|
-
Most endpoints that return a collection are paginated. A paginated response contains metadata about the current page at the root level and the resources in the current page in a child key named after the resource (e.g. `orders`).
|
4
|
-
|
5
|
-
You can pass the `page` and `per_page` parameters to set the current page and the desired number of items per page. Note that the default and the maximum number of items per page is decided at the application level.
|
6
|
-
|
7
|
-
All pagination metadata is documented in the individual API endpoints, so take a look there if you're unsure what data you can expect.
|