spree_api 3.7.0.rc1 → 3.7.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 966dd14cce417e7119d423b7b05d052b85e0f0372f7bcb04c966f239cf8aafae
4
- data.tar.gz: e6903c09540a78763157058235d32dc07405747646dc24f2b980ab7df19249d6
3
+ metadata.gz: 27ba29a8ab5de5c7606f6707d735c73063ee4525961d8e22906b9145af89a9de
4
+ data.tar.gz: 4cc4d78e86ac737ce57d57c27a72f9759038edd6196b9315debdd9dda0cdc31f
5
5
  SHA512:
6
- metadata.gz: e8ad9bc26e1c98498461bd06975be490627cb53857cb2ca64a01a40e410e866978c7387ee46102d1a39b96f0f751bd14d2da33c3f8928617fb28e12d4b37e4cb
7
- data.tar.gz: cfc7d9802acc6f4a82bf5ccc56028ed303663fe1495292d2f0a1c507a7da63adcd82dbfbaea29fcf3c334e3c17aab63a811487d33a75c29f1a020671de62d06c
6
+ metadata.gz: 1fb141c57d7361926931e1a812273bbbee9f632fa2a8ff0755229b1abd0dfedcd36f504676516410f136190de522415c0f8e2497ad93936a4d774a67fa0c1fff
7
+ data.tar.gz: c8f51c67395b4b68133b856e9844b216cbfed071d0de7a4ae0a7a4053e4ac0053bfd5ba30fc95e46edf1532a3be220e951ae06c90f4b8700c574e2bdaca4b703
@@ -23,8 +23,8 @@ module Spree
23
23
  def dependencies
24
24
  {
25
25
  resource_finder: Spree::CreditCards::Find,
26
- collection_serializer: Spree::V2::Storefront::Account::CreditCardSerializer,
27
- resource_serializer: Spree::V2::Storefront::Account::CreditCardSerializer
26
+ collection_serializer: Spree::V2::Storefront::CreditCardSerializer,
27
+ resource_serializer: Spree::V2::Storefront::CreditCardSerializer
28
28
  }
29
29
  end
30
30
 
@@ -0,0 +1,80 @@
1
+ module Spree
2
+ module Api
3
+ module V2
4
+ module Storefront
5
+ module Account
6
+ class OrdersController < ::Spree::Api::V2::BaseController
7
+ include Spree::Api::V2::CollectionOptionsHelpers
8
+ before_action :require_spree_current_user
9
+
10
+ def index
11
+ render_serialized_payload { serialize_collection(paginated_collection) }
12
+ end
13
+
14
+ def show
15
+ spree_authorize! :show, resource
16
+
17
+ render_serialized_payload { serialize_resource(resource) }
18
+ end
19
+
20
+ private
21
+
22
+ def paginated_collection
23
+ dependencies[:collection_paginator].new(sorted_collection, params).call
24
+ end
25
+
26
+ def sorted_collection
27
+ dependencies[:collection_sorter].new(collection, params).call
28
+ end
29
+
30
+ def collection
31
+ dependencies[:collection_finder].new(user: spree_current_user).execute
32
+ end
33
+
34
+ def resource
35
+ resource = dependencies[:resource_finder].new(user: spree_current_user, number: params[:id]).execute.take
36
+ raise ActiveRecord::RecordNotFound if resource.nil?
37
+
38
+ resource
39
+ end
40
+
41
+ def serialize_collection(collection)
42
+ dependencies[:collection_serializer].new(
43
+ collection,
44
+ collection_options(collection)
45
+ ).serializable_hash
46
+ end
47
+
48
+ def serialize_resource(resource)
49
+ dependencies[:resource_serializer].new(
50
+ resource,
51
+ include: resource_includes,
52
+ sparse_fields: sparse_fields
53
+ ).serializable_hash
54
+ end
55
+
56
+ def dependencies
57
+ {
58
+ collection_sorter: Spree::Orders::Sort,
59
+ resource_finder: Spree::Orders::FindComplete,
60
+ resource_serializer: Spree::V2::Storefront::CartSerializer,
61
+ collection_serializer: Spree::V2::Storefront::CartSerializer,
62
+ collection_finder: Spree::Orders::FindComplete,
63
+ collection_paginator: Spree::Shared::Paginate
64
+ }
65
+ end
66
+
67
+ def collection_options(collection)
68
+ {
69
+ links: collection_links(collection),
70
+ meta: collection_meta(collection),
71
+ include: resource_includes,
72
+ sparse_fields: sparse_fields
73
+ }
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
@@ -24,7 +24,7 @@ module Spree
24
24
  end
25
25
 
26
26
  def dependencies
27
- { resource_serializer: Spree::V2::Storefront::AccountSerializer }
27
+ { resource_serializer: Spree::V2::Storefront::UserSerializer }
28
28
  end
29
29
  end
30
30
  end
@@ -5,9 +5,10 @@ module Spree
5
5
  set_type :address
6
6
 
7
7
  attributes :firstname, :lastname, :address1, :address2, :city, :zipcode, :phone, :state_name,
8
- :company, :country_name, :country_iso3
8
+ :company, :country_name, :country_iso3, :country_iso
9
9
 
10
10
  attribute :state_code, &:state_abbr
11
+ attribute :state_name, &:state_name_text
11
12
  end
12
13
  end
13
14
  end
@@ -5,7 +5,7 @@ module Spree
5
5
  set_type :cart
6
6
 
7
7
  attributes :number, :item_total, :total, :ship_total, :adjustment_total, :created_at,
8
- :updated_at, :included_tax_total, :additional_tax_total, :display_additional_tax_total,
8
+ :updated_at, :completed_at, :included_tax_total, :additional_tax_total, :display_additional_tax_total,
9
9
  :display_included_tax_total, :tax_total, :currency, :state, :token, :email,
10
10
  :display_item_total, :display_ship_total, :display_adjustment_total, :display_tax_total,
11
11
  :promo_total, :display_promo_total, :item_count, :special_instructions, :display_total
@@ -0,0 +1,13 @@
1
+ module Spree
2
+ module V2
3
+ module Storefront
4
+ class CreditCardSerializer < BaseSerializer
5
+ set_type :credit_card
6
+
7
+ attributes :cc_type, :last_digits, :month, :year, :name, :default
8
+
9
+ belongs_to :payment_method
10
+ end
11
+ end
12
+ end
13
+ end
@@ -7,6 +7,7 @@ module Spree
7
7
  attributes :name, :quantity, :price, :slug, :options_text, :currency,
8
8
  :display_price, :total, :display_total, :adjustment_total,
9
9
  :display_adjustment_total, :additional_tax_total,
10
+ :discounted_amount, :display_discounted_amount,
10
11
  :display_additional_tax_total, :promo_total, :display_promo_total,
11
12
  :included_tax_total, :display_included_tax_total
12
13
 
@@ -4,7 +4,7 @@ module Spree
4
4
  class OptionTypeSerializer < BaseSerializer
5
5
  set_type :option_type
6
6
 
7
- attributes :id, :name, :presentation, :position
7
+ attributes :name, :presentation, :position
8
8
 
9
9
  has_many :option_values
10
10
  end
@@ -4,7 +4,9 @@ module Spree
4
4
  class OptionValueSerializer < BaseSerializer
5
5
  set_type :option_value
6
6
 
7
- attributes :id, :name, :presentation, :position
7
+ attributes :name, :presentation, :position
8
+
9
+ belongs_to :option_type
8
10
  end
9
11
  end
10
12
  end
@@ -4,6 +4,9 @@ module Spree
4
4
  class PaymentSerializer < BaseSerializer
5
5
  set_type :payment
6
6
 
7
+ has_one :source, polymorphic: true
8
+ has_one :payment_method
9
+
7
10
  attributes :amount, :response_code, :number, :cvv_response_code, :cvv_response_message,
8
11
  :payment_method_id, :payment_method_name
9
12
  end
@@ -0,0 +1,15 @@
1
+ module Spree
2
+ module V2
3
+ module Storefront
4
+ class StoreCreditEventSerializer < BaseSerializer
5
+ set_type :store_credit_event
6
+
7
+ attributes :action, :amount, :user_total_amount, :created_at
8
+
9
+ attribute :order_number do |object|
10
+ object.order&.number
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ module Spree
2
+ module V2
3
+ module Storefront
4
+ class StoreCreditSerializer < BaseSerializer
5
+ set_type :store_credit
6
+
7
+ belongs_to :category
8
+ has_many :store_credit_events
9
+ belongs_to :credit_type,
10
+ id_method_name: :type_id,
11
+ serializer: :store_credit_type
12
+
13
+ attributes :amount, :amount_used, :created_at
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,11 @@
1
+ module Spree
2
+ module V2
3
+ module Storefront
4
+ class StoreCreditTypeSerializer < BaseSerializer
5
+ set_type :store_credit_type
6
+
7
+ attributes :name
8
+ end
9
+ end
10
+ end
11
+ end
@@ -2,9 +2,27 @@ module Spree
2
2
  module V2
3
3
  module Storefront
4
4
  class UserSerializer < BaseSerializer
5
- set_type :user
5
+ set_type :user
6
6
 
7
7
  attributes :email
8
+
9
+ attribute :store_credits, &:total_available_store_credit
10
+
11
+ attribute :completed_orders do |object|
12
+ object.orders.complete.count
13
+ end
14
+
15
+ has_one :default_billing_address,
16
+ id_method_name: :bill_address_id,
17
+ object_method_name: :bill_address,
18
+ record_type: :address,
19
+ serializer: :address
20
+
21
+ has_one :default_shipping_address,
22
+ id_method_name: :ship_address_id,
23
+ object_method_name: :ship_address,
24
+ record_type: :address,
25
+ serializer: :address
8
26
  end
9
27
  end
10
28
  end
@@ -5,8 +5,7 @@ module Spree
5
5
  set_type :variant
6
6
 
7
7
  attributes :name, :sku, :price, :currency, :display_price, :weight, :height,
8
- :width, :depth, :is_master, :options_text, :slug, :description,
9
- :track_inventory
8
+ :width, :depth, :is_master, :options_text, :slug, :description
10
9
 
11
10
  attribute :purchasable, &:purchasable?
12
11
  attribute :in_stock, &:in_stock?
data/config/routes.rb CHANGED
@@ -153,6 +153,7 @@ Spree::Core::Engine.add_routes do
153
153
 
154
154
  namespace :account do
155
155
  resources :credit_cards, controller: :credit_cards, only: %i[index show]
156
+ resources :orders, controller: :orders, only: %i[index show]
156
157
  end
157
158
 
158
159
  resources :countries, only: %i[index]
@@ -90,6 +90,50 @@ paths:
90
90
  - $ref: '#/components/parameters/SparseFieldsParam'
91
91
  security:
92
92
  - bearerAuth: []
93
+ '/account/orders':
94
+ get:
95
+ description: Returns Orders placed by the User. Only completed ones.
96
+ tags:
97
+ - Account
98
+ operationId: 'Completed Orders'
99
+ responses:
100
+ '200':
101
+ description: Listing user completed orders.
102
+ content:
103
+ application/json:
104
+ schema:
105
+ $ref: '#/components/schemas/CartList'
106
+ '403':
107
+ $ref: '#/components/responses/403Forbidden'
108
+ parameters:
109
+ - $ref: '#/components/parameters/CartIncludeParam'
110
+ - $ref: '#/components/parameters/SparseFieldsParam'
111
+ - $ref: '#/components/parameters/PageParam'
112
+ - $ref: '#/components/parameters/PerPageParam'
113
+ security:
114
+ - bearerAuth: []
115
+ '/account/orders/{number}':
116
+ get:
117
+ description: >-
118
+ Return the User's completed Order
119
+ tags:
120
+ - Account
121
+ operationId: 'Completed User Order'
122
+ responses:
123
+ '200':
124
+ description: Listing user completed order.
125
+ content:
126
+ application/json:
127
+ schema:
128
+ $ref: '#/components/schemas/Cart'
129
+ '403':
130
+ $ref: '#/components/responses/403Forbidden'
131
+ parameters:
132
+ - $ref: '#/components/parameters/OrderParam'
133
+ - $ref: '#/components/parameters/CartIncludeParam'
134
+ - $ref: '#/components/parameters/SparseFieldsParam'
135
+ security:
136
+ - bearerAuth: []
93
137
  '/cart':
94
138
  post:
95
139
  description: >-
@@ -363,7 +407,7 @@ paths:
363
407
  phone: '3014445002',
364
408
  zipcode: '20814',
365
409
  state_name: 'MD',
366
- country_id: 232
410
+ country_iso: 'US'
367
411
  }
368
412
  },
369
413
  ship_address_attributes: {
@@ -375,7 +419,7 @@ paths:
375
419
  phone: '3014445002',
376
420
  zipcode: '20814',
377
421
  state_name: 'MD',
378
- country_id: 232
422
+ country_iso: 'US'
379
423
  }
380
424
  }
381
425
  }
@@ -1015,149 +1059,12 @@ components:
1015
1059
  properties:
1016
1060
  data:
1017
1061
  type: object
1062
+ $ref: '#/components/schemas/CartAttributesWithRelationships'
1018
1063
  required:
1019
1064
  - id
1020
1065
  - type
1021
1066
  - attributes
1022
1067
  - relationships
1023
- properties:
1024
- id:
1025
- type: string
1026
- example: '1'
1027
- type:
1028
- type: string
1029
- default: 'cart'
1030
- attributes:
1031
- type: object
1032
- properties:
1033
- number:
1034
- type: string
1035
- example: 'R123456789'
1036
- email:
1037
- type: string
1038
- example: 'spree@example.com'
1039
- item_total:
1040
- type: string
1041
- example: '19.99'
1042
- display_item_total:
1043
- type: string
1044
- example: '$19.99'
1045
- total:
1046
- type: string
1047
- example: '29.99'
1048
- display_total:
1049
- type: string
1050
- example: '$29.99'
1051
- ship_total:
1052
- type: string
1053
- example: '0.0'
1054
- display_ship_total:
1055
- type: string
1056
- example: '$19.99'
1057
- adjustment_total:
1058
- type: string
1059
- example: '10.0'
1060
- display_adjustment_total:
1061
- type: string
1062
- example: '$10.00'
1063
- promo_total:
1064
- type: string
1065
- example: '-10.0'
1066
- display_promo_total:
1067
- type: string
1068
- example: '-$10.00'
1069
- created_at:
1070
- $ref: '#/components/schemas/Timestamp'
1071
- updated_at:
1072
- $ref: '#/components/schemas/Timestamp'
1073
- included_tax_total:
1074
- type: string
1075
- example: '5.00'
1076
- additional_tax_total:
1077
- type: string
1078
- example: '5.0'
1079
- display_additional_tax_total:
1080
- type: string
1081
- example: '$5.00'
1082
- display_included_tax_total:
1083
- type: string
1084
- example: '$5.00'
1085
- tax_total:
1086
- type: string
1087
- example: '10.0'
1088
- display_tax_total:
1089
- type: string
1090
- example: '$10.00'
1091
- item_count:
1092
- type: number
1093
- example: 2
1094
- description: 'Total quantity number of all items added to the Cart'
1095
- special_instructions:
1096
- type: string
1097
- example: 'Please wrap it as a gift'
1098
- description: 'Message added by the Customer'
1099
- currency:
1100
- type: string
1101
- example: 'USD'
1102
- state:
1103
- type: string
1104
- example: 'address'
1105
- description: 'State of the Cart in the Checkout flow'
1106
- token:
1107
- type: string
1108
- example: abcdef123456
1109
- description: >-
1110
- Used for authorizing any action for an order within Spree’s
1111
- API
1112
- relationships:
1113
- type: object
1114
- properties:
1115
- line_items:
1116
- type: object
1117
- properties:
1118
- data:
1119
- type: array
1120
- items:
1121
- $ref: '#/components/schemas/Relation'
1122
- promotions:
1123
- type: object
1124
- properties:
1125
- data:
1126
- type: array
1127
- items:
1128
- $ref: '#/components/schemas/Relation'
1129
- variants:
1130
- type: object
1131
- properties:
1132
- data:
1133
- type: array
1134
- items:
1135
- $ref: '#/components/schemas/Relation'
1136
- user:
1137
- type: object
1138
- properties:
1139
- data:
1140
- $ref: '#/components/schemas/Relation'
1141
- billing_address:
1142
- type: object
1143
- properties:
1144
- data:
1145
- $ref: '#/components/schemas/Relation'
1146
- shipping_address:
1147
- type: object
1148
- properties:
1149
- data:
1150
- $ref: '#/components/schemas/Relation'
1151
- payments:
1152
- type: object
1153
- properties:
1154
- data:
1155
- $ref: '#/components/schemas/Relation'
1156
- shipments:
1157
- type: object
1158
- properties:
1159
- data:
1160
- $ref: '#/components/schemas/Relation'
1161
1068
  included:
1162
1069
  type: array
1163
1070
  items:
@@ -1169,10 +1076,172 @@ components:
1169
1076
  - $ref: '#/components/schemas/User'
1170
1077
  - $ref: '#/components/schemas/Address'
1171
1078
  - $ref: '#/components/schemas/ShipmentAttributesWithoutRelationsips'
1172
- CreditCardList:
1079
+ CartList:
1173
1080
  required:
1174
1081
  - data
1175
1082
  - included
1083
+ properties:
1084
+ data:
1085
+ required:
1086
+ - id
1087
+ - type
1088
+ - attributes
1089
+ - relationships
1090
+ type: array
1091
+ items:
1092
+ $ref: '#/components/schemas/CartAttributesWithRelationships'
1093
+ included:
1094
+ type: array
1095
+ items:
1096
+ type: object
1097
+ oneOf:
1098
+ - $ref: '#/components/schemas/VariantAttributesAndRelationships'
1099
+ - $ref: '#/components/schemas/LineItem'
1100
+ - $ref: '#/components/schemas/Promotion'
1101
+ - $ref: '#/components/schemas/User'
1102
+ - $ref: '#/components/schemas/Address'
1103
+ - $ref: '#/components/schemas/ShipmentAttributesWithoutRelationsips'
1104
+ CartAttributesWithRelationships:
1105
+ properties:
1106
+ id:
1107
+ type: string
1108
+ example: '1'
1109
+ type:
1110
+ type: string
1111
+ example: 'cart'
1112
+ attributes:
1113
+ $ref: '#/components/schemas/CartAttributes'
1114
+ relationships:
1115
+ $ref: '#/components/schemas/CartRelationships'
1116
+ CartRelationships:
1117
+ type: object
1118
+ properties:
1119
+ line_items:
1120
+ type: object
1121
+ description: ''
1122
+ properties:
1123
+ data:
1124
+ $ref: '#/components/schemas/Relation'
1125
+ promotions:
1126
+ type: object
1127
+ properties:
1128
+ data:
1129
+ $ref: '#/components/schemas/Relation'
1130
+ variants:
1131
+ type: object
1132
+ properties:
1133
+ data:
1134
+ $ref: '#/components/schemas/Relation'
1135
+ user:
1136
+ type: object
1137
+ properties:
1138
+ data:
1139
+ $ref: '#/components/schemas/Relation'
1140
+ billing_address:
1141
+ type: object
1142
+ properties:
1143
+ data:
1144
+ $ref: '#/components/schemas/Relation'
1145
+ shipping_address:
1146
+ type: object
1147
+ properties:
1148
+ data:
1149
+ $ref: '#/components/schemas/Relation'
1150
+ payments:
1151
+ type: object
1152
+ properties:
1153
+ data:
1154
+ $ref: '#/components/schemas/Relation'
1155
+ shipments:
1156
+ type: object
1157
+ properties:
1158
+ data:
1159
+ $ref: '#/components/schemas/Relation'
1160
+ CartAttributes:
1161
+ type: object
1162
+ properties:
1163
+ number:
1164
+ type: string
1165
+ example: 'R123456789'
1166
+ email:
1167
+ type: string
1168
+ example: 'spree@example.com'
1169
+ item_total:
1170
+ type: string
1171
+ example: '19.99'
1172
+ display_item_total:
1173
+ type: string
1174
+ example: '$19.99'
1175
+ total:
1176
+ type: string
1177
+ example: '29.99'
1178
+ display_total:
1179
+ type: string
1180
+ example: '$29.99'
1181
+ ship_total:
1182
+ type: string
1183
+ example: '0.0'
1184
+ display_ship_total:
1185
+ type: string
1186
+ example: '$19.99'
1187
+ adjustment_total:
1188
+ type: string
1189
+ example: '10.0'
1190
+ display_adjustment_total:
1191
+ type: string
1192
+ example: '$10.00'
1193
+ promo_total:
1194
+ type: string
1195
+ example: '-10.0'
1196
+ display_promo_total:
1197
+ type: string
1198
+ example: '-$10.00'
1199
+ created_at:
1200
+ $ref: '#/components/schemas/Timestamp'
1201
+ updated_at:
1202
+ $ref: '#/components/schemas/Timestamp'
1203
+ included_tax_total:
1204
+ type: string
1205
+ example: '5.00'
1206
+ additional_tax_total:
1207
+ type: string
1208
+ example: '5.0'
1209
+ display_additional_tax_total:
1210
+ type: string
1211
+ example: '$5.00'
1212
+ display_included_tax_total:
1213
+ type: string
1214
+ example: '$5.00'
1215
+ tax_total:
1216
+ type: string
1217
+ example: '10.0'
1218
+ display_tax_total:
1219
+ type: string
1220
+ example: '$10.00'
1221
+ item_count:
1222
+ type: number
1223
+ example: 2
1224
+ description: 'Total quantity number of all items added to the Cart'
1225
+ special_instructions:
1226
+ type: string
1227
+ example: 'Please wrap it as a gift'
1228
+ description: 'Message added by the Customer'
1229
+ currency:
1230
+ type: string
1231
+ example: 'USD'
1232
+ state:
1233
+ type: string
1234
+ example: 'address'
1235
+ description: 'State of the Cart in the Checkout flow'
1236
+ token:
1237
+ type: string
1238
+ example: abcdef123456
1239
+ description: >-
1240
+ Used for authorizing any action for an order within Spree’s
1241
+ API
1242
+ CreditCardList:
1243
+ required:
1244
+ - included
1176
1245
  properties:
1177
1246
  data:
1178
1247
  type: array
@@ -1206,15 +1275,23 @@ components:
1206
1275
  last_digits:
1207
1276
  type: string
1208
1277
  example: '1232'
1278
+ description: 'Last 4 digits of CC number'
1209
1279
  month:
1210
1280
  type: integer
1211
1281
  example: 10
1282
+ description: 'Expiration date month'
1212
1283
  year:
1213
1284
  type: integer
1214
1285
  example: 2019
1286
+ description: 'Expiration date year'
1215
1287
  name:
1216
1288
  type: string
1217
1289
  example: 'John Doe'
1290
+ description: 'Card holder name'
1291
+ default:
1292
+ type: boolean
1293
+ example: true
1294
+ description: 'Defines if this is the default CC for a signed in user'
1218
1295
  CreditCardAttributesWithRelationships:
1219
1296
  properties:
1220
1297
  id:
@@ -1347,6 +1424,12 @@ components:
1347
1424
  display_additional_tax_total:
1348
1425
  type: string
1349
1426
  example: '$5.00'
1427
+ discounted_amount:
1428
+ type: string
1429
+ example: '125.0'
1430
+ display_discounted_amount:
1431
+ type: string
1432
+ example: '$125.00'
1350
1433
  promo_total:
1351
1434
  type: string
1352
1435
  example: '-5.0'
@@ -2237,9 +2320,13 @@ components:
2237
2320
  state_name:
2238
2321
  type: string
2239
2322
  description: 'State/region/province 2 letter abbrevation'
2240
- country_id:
2241
- type: number
2242
- description: 'ID number of Country in the database'
2323
+ country_iso:
2324
+ type: string
2325
+ description: >-
2326
+ Country ISO (2-chars) or ISO3 (3-chars) code, list of codes:
2327
+ <a href="https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes" target="_blank" rel="noopener">
2328
+ https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
2329
+ </a>
2243
2330
  example:
2244
2331
  firstname: 'John'
2245
2332
  lastname: 'Snow'
@@ -2249,7 +2336,7 @@ components:
2249
2336
  phone: '3014445002'
2250
2337
  zipcode: '20814'
2251
2338
  state_name: 'MD'
2252
- country_id: 232
2339
+ country_iso: 'US'
2253
2340
 
2254
2341
  parameters:
2255
2342
  CreditCardIncludeParam:
@@ -2306,7 +2393,15 @@ components:
2306
2393
  description: Number of requested records per page when paginating collection
2307
2394
  schema:
2308
2395
  type: integer
2309
- example: 10
2396
+ example:
2397
+ OrderParam:
2398
+ name: number
2399
+ in: path
2400
+ required: true
2401
+ description: Number of Order
2402
+ schema:
2403
+ type: string
2404
+ example: 'R653163382'
2310
2405
  CartIncludeParam:
2311
2406
  name: include
2312
2407
  in: query
@@ -2435,10 +2530,18 @@ components:
2435
2530
  content:
2436
2531
  application/json:
2437
2532
  schema:
2438
- $ref: '#/components/schemas/Error'
2533
+ properties:
2534
+ error:
2535
+ type: string
2536
+ example: 'The resource you were looking for could not be found.'
2537
+ default: 'The resource you were looking for could not be found.'
2439
2538
  403Forbidden:
2440
2539
  description: You are not authorized to access this page.
2441
2540
  content:
2442
2541
  application/json:
2443
2542
  schema:
2444
- $ref: '#/components/schemas/Error'
2543
+ properties:
2544
+ error:
2545
+ type: string
2546
+ example: 'You are not authorized to access this page.'
2547
+ default: 'You are not authorized to access this page.'
@@ -39,6 +39,10 @@ module Spree
39
39
  Spree::Api::Config = Spree::ApiConfiguration.new
40
40
  end
41
41
 
42
+ initializer 'spree.api.checking_migrations' do
43
+ Migrations.new(config, engine_name).check
44
+ end
45
+
42
46
  def self.activate
43
47
  Dir.glob(File.join(File.dirname(__FILE__), '../../../app/**/*_decorator*.rb')) do |c|
44
48
  Rails.configuration.cache_classes ? require(c) : load(c)
data/spree_api.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.homepage = 'http://spreecommerce.org'
10
10
  s.license = 'BSD-3-Clause'
11
11
 
12
- s.required_ruby_version = '>= 2.3.0'
12
+ s.required_ruby_version = '>= 2.3.3'
13
13
 
14
14
  s.files = `git ls-files`.split($\).reject { |f| f.match(/^spec/) && !f.match(/^spec\/fixtures/) }
15
15
  s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
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: 3.7.0.rc1
4
+ version: 3.7.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bigg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-11 00:00:00.000000000 Z
11
+ date: 2019-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-rspec
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.7.0.rc1
33
+ version: 3.7.0.rc2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.7.0.rc1
40
+ version: 3.7.0.rc2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rabl
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -143,6 +143,7 @@ files:
143
143
  - app/controllers/spree/api/v1/zones_controller.rb
144
144
  - app/controllers/spree/api/v2/base_controller.rb
145
145
  - app/controllers/spree/api/v2/storefront/account/credit_cards_controller.rb
146
+ - app/controllers/spree/api/v2/storefront/account/orders_controller.rb
146
147
  - app/controllers/spree/api/v2/storefront/account_controller.rb
147
148
  - app/controllers/spree/api/v2/storefront/cart_controller.rb
148
149
  - app/controllers/spree/api/v2/storefront/checkout_controller.rb
@@ -157,12 +158,11 @@ files:
157
158
  - app/models/doorkeeper/access_token_decorator.rb
158
159
  - app/models/doorkeeper/application_decorator.rb
159
160
  - app/models/spree/api_configuration.rb
160
- - app/serializers/spree/v2/storefront/account/credit_card_serializer.rb
161
- - app/serializers/spree/v2/storefront/account_serializer.rb
162
161
  - app/serializers/spree/v2/storefront/address_serializer.rb
163
162
  - app/serializers/spree/v2/storefront/base_serializer.rb
164
163
  - app/serializers/spree/v2/storefront/cart_serializer.rb
165
164
  - app/serializers/spree/v2/storefront/country_serializer.rb
165
+ - app/serializers/spree/v2/storefront/credit_card_serializer.rb
166
166
  - app/serializers/spree/v2/storefront/image_serializer.rb
167
167
  - app/serializers/spree/v2/storefront/line_item_serializer.rb
168
168
  - app/serializers/spree/v2/storefront/option_type_serializer.rb
@@ -175,6 +175,9 @@ files:
175
175
  - app/serializers/spree/v2/storefront/shipment_serializer.rb
176
176
  - app/serializers/spree/v2/storefront/shipping_rate_serializer.rb
177
177
  - app/serializers/spree/v2/storefront/state_serializer.rb
178
+ - app/serializers/spree/v2/storefront/store_credit_event_serializer.rb
179
+ - app/serializers/spree/v2/storefront/store_credit_serializer.rb
180
+ - app/serializers/spree/v2/storefront/store_credit_type_serializer.rb
178
181
  - app/serializers/spree/v2/storefront/taxon_image_serializer.rb
179
182
  - app/serializers/spree/v2/storefront/taxon_serializer.rb
180
183
  - app/serializers/spree/v2/storefront/taxonomy_serializer.rb
@@ -313,7 +316,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
313
316
  requirements:
314
317
  - - ">="
315
318
  - !ruby/object:Gem::Version
316
- version: 2.3.0
319
+ version: 2.3.3
317
320
  required_rubygems_version: !ruby/object:Gem::Requirement
318
321
  requirements:
319
322
  - - ">"
@@ -321,7 +324,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
321
324
  version: 1.3.1
322
325
  requirements: []
323
326
  rubyforge_project:
324
- rubygems_version: 2.7.6
327
+ rubygems_version: 2.7.8
325
328
  signing_key:
326
329
  specification_version: 4
327
330
  summary: Spree's API
@@ -1,16 +0,0 @@
1
- module Spree
2
- module V2
3
- module Storefront
4
- module Account
5
- class CreditCardSerializer < BaseSerializer
6
- set_type :credit_card
7
-
8
- attributes :cc_type, :last_digits, :month, :year, :name
9
-
10
- belongs_to :payment_method,
11
- serializer: Spree::V2::Storefront::PaymentMethodSerializer
12
- end
13
- end
14
- end
15
- end
16
- end
@@ -1,29 +0,0 @@
1
- module Spree
2
- module V2
3
- module Storefront
4
- class AccountSerializer < BaseSerializer
5
- set_type :user
6
-
7
- attributes :email
8
-
9
- attribute :store_credits, &:total_available_store_credit
10
-
11
- attribute :completed_orders do |object|
12
- object.orders.complete.count
13
- end
14
-
15
- has_one :default_billing_address,
16
- id_method_name: :bill_address_id,
17
- object_method_name: :bill_address,
18
- record_type: :address,
19
- serializer: :address
20
-
21
- has_one :default_shipping_address,
22
- id_method_name: :ship_address_id,
23
- object_method_name: :ship_address,
24
- record_type: :address,
25
- serializer: :address
26
- end
27
- end
28
- end
29
- end