spree_api 5.3.0.rc2 → 5.3.0

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
  SHA256:
3
- metadata.gz: 2bbb546eb54b2cff0a413d9989bbeb324c6b7b8db6bf5cd323b297a6e23fe0cc
4
- data.tar.gz: a36baaff83201059e4c4b96b3d97e73c7e6eb8e94644fdc74c67320c4eed9eee
3
+ metadata.gz: 759a825eaed204d12c89d99b5ea72e458d3798c9afe452bf61e438492fc3d8b6
4
+ data.tar.gz: 98f44fdc93e9c4cad74c52ccb58b2b82d62064c53dc9f7fa9d963ca78ed37b41
5
5
  SHA512:
6
- metadata.gz: 2b62449e706304aa30971e2eb1dadda2429d3308e34cd98aafe1029a31842c2e6bdf9684dd216e0182309d2c6d6cb0d42e25f114794ff36af86574ceb1fc063e
7
- data.tar.gz: 1894f064a469b4afd3952f04728972486bdac54090e2b0100bb31e6e5a9ce0313a31142499cc1c4fd2a17079fe7ad17d93e37d7bff1f7702fd2675d31ab0896e
6
+ metadata.gz: 7f72604d32947620decb96ee56abe7009d460c04ea8ff1646ab0b0bcd2713ac18e5f589ad05f99e0dc9d11d1ce1acc78bc0fcf3a54bbaaede17959b2bb7c1181
7
+ data.tar.gz: 5d8809fcfe387e374449bb285df5c10df363a2e972e8b3c0fba5c2d7644841e437e70b166bd981765801390c706361bdcb2423c2922a0c7e588735a5d9adf2f9
data/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # Spree API
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/spree_api.svg)](https://badge.fury.io/rb/spree_api)
4
+
5
+ Spree API provides RESTful API endpoints for building custom storefronts, mobile applications, and third-party integrations with Spree Commerce.
6
+
7
+ ## Overview
8
+
9
+ This gem includes:
10
+
11
+ - **Storefront API** - Customer-facing endpoints for cart, checkout, products, and accounts
12
+ - **Platform API** - Administrative endpoints for managing orders, products, and store settings
13
+ - **Webhooks** - Event-driven notifications to external systems
14
+ - **OAuth2 Authentication** - Token-based authentication via Doorkeeper
15
+ - **JSONAPI Serializers** - Standardized API responses
16
+
17
+ ## Installation
18
+
19
+ This gem is included in every Spree installation. No additional steps are required.
20
+
21
+ ## API Endpoints
22
+
23
+ ### Storefront API (v2)
24
+
25
+ The Storefront API is designed for building custom frontends:
26
+
27
+ ```
28
+ GET /api/v2/storefront/products
29
+ GET /api/v2/storefront/products/:id
30
+ GET /api/v2/storefront/taxons
31
+ POST /api/v2/storefront/cart
32
+ PATCH /api/v2/storefront/cart/add_item
33
+ PATCH /api/v2/storefront/checkout
34
+ POST /api/v2/storefront/account
35
+ ```
36
+
37
+ ### Platform API
38
+
39
+ The Platform API provides administrative access:
40
+
41
+ ```
42
+ GET /api/v2/platform/orders
43
+ POST /api/v2/platform/products
44
+ PATCH /api/v2/platform/variants/:id
45
+ DELETE /api/v2/platform/line_items/:id
46
+ ```
47
+
48
+ ## Authentication
49
+
50
+ ### OAuth2 Token Authentication
51
+
52
+ ```bash
53
+ # Request access token
54
+ curl -X POST https://your-store.com/spree_oauth/token \
55
+ -d "grant_type=password&username=user@example.com&password=secret"
56
+
57
+ # Use token in requests
58
+ curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
59
+ https://your-store.com/api/v2/storefront/account
60
+ ```
61
+
62
+ ### Guest Cart Token
63
+
64
+ For guest checkout, use the `X-Spree-Order-Token` header:
65
+
66
+ ```bash
67
+ curl -H "X-Spree-Order-Token: ORDER_TOKEN" \
68
+ https://your-store.com/api/v2/storefront/cart
69
+ ```
70
+
71
+ ## Serializers
72
+
73
+ API responses use JSONAPI format. Customize serializers by creating your own:
74
+
75
+ ```ruby
76
+ # app/serializers/my_app/product_serializer.rb
77
+ module MyApp
78
+ class ProductSerializer < Spree::V2::Storefront::ProductSerializer
79
+ attribute :custom_field
80
+ end
81
+ end
82
+
83
+ # Configure in initializer
84
+ Spree.api.storefront_product_serializer = 'MyApp::ProductSerializer'
85
+ ```
86
+
87
+ ## Testing
88
+
89
+ ```bash
90
+ cd api
91
+ bundle exec rake test_app # First time only
92
+ bundle exec rspec
93
+ ```
94
+
95
+ ## Documentation
96
+
97
+ - [Storefront API Reference](https://docs.spreecommerce.org/api/storefront)
98
+ - [Platform API Reference](https://docs.spreecommerce.org/api/platform)
99
+ - [Authentication Guide](https://docs.spreecommerce.org/developer/api/authentication)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.0.rc2
4
+ version: 5.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bigg
@@ -115,14 +115,14 @@ dependencies:
115
115
  requirements:
116
116
  - - '='
117
117
  - !ruby/object:Gem::Version
118
- version: 5.3.0.rc2
118
+ version: 5.3.0
119
119
  type: :runtime
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - '='
124
124
  - !ruby/object:Gem::Version
125
- version: 5.3.0.rc2
125
+ version: 5.3.0
126
126
  description: Spree's API
127
127
  email:
128
128
  - hello@spreecommerce.org
@@ -131,6 +131,7 @@ extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
133
  - LICENSE.md
134
+ - README.md
134
135
  - Rakefile
135
136
  - app/controllers/concerns/spree/api/v2/caching.rb
136
137
  - app/controllers/concerns/spree/api/v2/coupon_codes_helper.rb
@@ -203,7 +204,6 @@ files:
203
204
  - app/helpers/spree/api/v2/collection_options_helpers.rb
204
205
  - app/helpers/spree/api/v2/display_money_helper.rb
205
206
  - app/helpers/spree/api/v2/store_media_serializer_images_concern.rb
206
- - app/jobs/spree/products/queue_status_changed_webhook_job.rb
207
207
  - app/jobs/spree/webhook_delivery_job.rb
208
208
  - app/models/concerns/spree/user_api_authentication.rb
209
209
  - app/models/concerns/spree/user_api_methods.rb
@@ -330,7 +330,6 @@ files:
330
330
  - app/serializers/spree/v2/storefront/variant_serializer.rb
331
331
  - app/serializers/spree/v2/storefront/wished_item_serializer.rb
332
332
  - app/serializers/spree/v2/storefront/wishlist_serializer.rb
333
- - app/services/spree/products/queue_status_changed_webhook.rb
334
333
  - app/services/spree/webhooks/deliver_webhook.rb
335
334
  - app/subscribers/spree/webhook_event_subscriber.rb
336
335
  - config/brakeman.ignore
@@ -369,9 +368,9 @@ licenses:
369
368
  - BSD-3-Clause
370
369
  metadata:
371
370
  bug_tracker_uri: https://github.com/spree/spree/issues
372
- changelog_uri: https://github.com/spree/spree/releases/tag/v5.3.0.rc2
371
+ changelog_uri: https://github.com/spree/spree/releases/tag/v5.3.0
373
372
  documentation_uri: https://docs.spreecommerce.org/
374
- source_code_uri: https://github.com/spree/spree/tree/v5.3.0.rc2
373
+ source_code_uri: https://github.com/spree/spree/tree/v5.3.0
375
374
  rdoc_options: []
376
375
  require_paths:
377
376
  - lib
@@ -1,12 +0,0 @@
1
- module Spree
2
- module Products
3
- class QueueStatusChangedWebhookJob < Spree::BaseJob
4
- queue_as Spree.queues.webhooks
5
-
6
- def perform(product_id, event)
7
- product = Spree::Product.find(product_id)
8
- product.queue_webhooks_requests!("product.#{event}")
9
- end
10
- end
11
- end
12
- end
@@ -1,17 +0,0 @@
1
- module Spree
2
- module Products
3
- class QueueStatusChangedWebhook
4
- def self.call(ids:, event:)
5
- return false if ids.blank? || event.blank?
6
-
7
- # for ActiveJob 7.1+
8
- if ActiveJob.respond_to?(:perform_all_later)
9
- jobs = ids.map { |id| Spree::Products::QueueStatusChangedWebhookJob.new(id, event) }
10
- ActiveJob.perform_all_later(jobs)
11
- else
12
- ids.each { |id| Spree::Products::QueueStatusChangedWebhookJob.perform_later(id, event) }
13
- end
14
- end
15
- end
16
- end
17
- end