spree_api 4.3.0 → 4.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/spree/api/v2/caching.rb +7 -3
- data/app/controllers/concerns/spree/api/v2/coupon_codes_helper.rb +29 -0
- data/app/controllers/concerns/spree/api/v2/number_resource.rb +11 -0
- data/app/controllers/concerns/spree/api/v2/platform/nested_set_reposition_concern.rb +37 -0
- data/app/controllers/concerns/spree/api/v2/platform/promotion_calculator_params.rb +17 -0
- data/app/controllers/concerns/spree/api/v2/platform/promotion_rule_params.rb +16 -0
- data/app/controllers/concerns/spree/api/v2/product_list_includes.rb +10 -8
- data/app/controllers/concerns/spree/api/v2/storefront/metadata_controller_concern.rb +18 -0
- data/app/controllers/spree/api/v2/base_controller.rb +7 -5
- data/app/controllers/spree/api/v2/platform/adjustments_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/classifications_controller.rb +1 -22
- data/app/controllers/spree/api/v2/platform/cms_pages_controller.rb +4 -0
- data/app/controllers/spree/api/v2/platform/cms_sections_controller.rb +13 -18
- data/app/controllers/spree/api/v2/platform/digital_links_controller.rb +25 -0
- data/app/controllers/spree/api/v2/platform/digitals_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/line_items_controller.rb +59 -0
- data/app/controllers/spree/api/v2/platform/menu_items_controller.rb +5 -19
- data/app/controllers/spree/api/v2/platform/menus_controller.rb +0 -4
- data/app/controllers/spree/api/v2/platform/orders_controller.rb +163 -0
- data/app/controllers/spree/api/v2/platform/payment_methods_controller.rb +27 -0
- data/app/controllers/spree/api/v2/platform/payments_controller.rb +17 -0
- data/app/controllers/spree/api/v2/platform/products_controller.rb +5 -1
- data/app/controllers/spree/api/v2/platform/promotion_actions_controller.rb +30 -0
- data/app/controllers/spree/api/v2/platform/promotion_categories_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/promotion_rules_controller.rb +25 -0
- data/app/controllers/spree/api/v2/platform/promotions_controller.rb +31 -0
- data/app/controllers/spree/api/v2/platform/resource_controller.rb +47 -16
- data/app/controllers/spree/api/v2/platform/roles_controller.rb +15 -0
- data/app/controllers/spree/api/v2/platform/shipments_controller.rb +143 -0
- data/app/controllers/spree/api/v2/platform/shipping_categories_controller.rb +15 -0
- data/app/controllers/spree/api/v2/platform/shipping_methods_controller.rb +24 -0
- data/app/controllers/spree/api/v2/platform/states_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/stock_items_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/stock_locations_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/store_credit_categories_controller.rb +15 -0
- data/app/controllers/spree/api/v2/platform/store_credit_types_controller.rb +15 -0
- data/app/controllers/spree/api/v2/platform/store_credits_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/tax_categories_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/tax_rates_controller.rb +23 -0
- data/app/controllers/spree/api/v2/platform/taxonomies_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/taxons_controller.rb +25 -0
- data/app/controllers/spree/api/v2/platform/users_controller.rb +4 -0
- data/app/controllers/spree/api/v2/platform/variants_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/webhooks/events_controller.rb +21 -0
- data/app/controllers/spree/api/v2/platform/webhooks/subscribers_controller.rb +21 -0
- data/app/controllers/spree/api/v2/platform/wished_items_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/wishlists_controller.rb +19 -0
- data/app/controllers/spree/api/v2/platform/zones_controller.rb +19 -0
- data/app/controllers/spree/api/v2/resource_controller.rb +3 -3
- data/app/controllers/spree/api/v2/storefront/account/addresses_controller.rb +2 -2
- data/app/controllers/spree/api/v2/storefront/account/credit_cards_controller.rb +4 -1
- data/app/controllers/spree/api/v2/storefront/cart_controller.rb +18 -28
- data/app/controllers/spree/api/v2/storefront/checkout_controller.rb +25 -1
- data/app/controllers/spree/api/v2/storefront/digitals_controller.rb +58 -0
- data/app/controllers/spree/api/v2/storefront/stores_controller.rb +4 -0
- data/app/controllers/spree/api/v2/storefront/wishlists_controller.rb +171 -0
- data/app/helpers/spree/api/v2/collection_options_helpers.rb +1 -1
- data/app/helpers/spree/api/v2/store_media_serializer_images_concern.rb +35 -0
- data/app/jobs/spree/webhooks/subscribers/make_request_job.rb +17 -0
- data/app/models/concerns/spree/webhooks/has_webhooks.rb +84 -0
- data/app/models/spree/api/webhooks/order_decorator.rb +43 -0
- data/app/models/spree/api/webhooks/payment_decorator.rb +26 -0
- data/app/models/spree/api/webhooks/product_decorator.rb +46 -0
- data/app/models/spree/api/webhooks/shipment_decorator.rb +21 -0
- data/app/models/spree/api/webhooks/stock_item_decorator.rb +43 -0
- data/app/models/spree/api/webhooks/stock_movement_decorator.rb +52 -0
- data/app/models/spree/api/webhooks/variant_decorator.rb +26 -0
- data/app/models/spree/oauth_access_grant.rb +7 -0
- data/app/models/spree/oauth_access_token.rb +7 -0
- data/app/models/spree/oauth_application.rb +15 -0
- data/app/models/spree/webhooks/base.rb +11 -0
- data/app/models/spree/webhooks/event.rb +12 -0
- data/app/models/spree/webhooks/subscriber.rb +61 -0
- data/app/serializers/concerns/spree/api/v2/resource_serializer_concern.rb +19 -1
- data/app/serializers/spree/api/v2/base_serializer.rb +11 -4
- data/app/serializers/spree/api/v2/platform/address_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/adjustment_serializer.rb +20 -0
- data/app/serializers/spree/api/v2/platform/asset_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/calculator_serializer.rb +17 -0
- data/app/serializers/spree/api/v2/platform/classification_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/cms_page_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/cms_section_image_one_serializer.rb +9 -0
- data/app/serializers/spree/api/v2/platform/cms_section_image_three_serializer.rb +9 -0
- data/app/serializers/spree/api/v2/platform/cms_section_image_two_serializer.rb +9 -0
- data/app/serializers/spree/api/v2/platform/cms_section_serializer.rb +8 -1
- data/app/serializers/spree/api/v2/platform/country_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/credit_card_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/customer_return_serializer.rb +17 -0
- data/app/serializers/spree/api/v2/platform/digital_link_serializer.rb +16 -0
- data/app/serializers/spree/api/v2/platform/digital_serializer.rb +30 -0
- data/app/serializers/spree/api/v2/platform/feature_page_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/hero_image_serializer.rb +10 -0
- data/app/serializers/spree/api/v2/platform/homepage_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/image_gallery_serializer.rb +10 -0
- data/app/serializers/spree/api/v2/platform/inventory_unit_serializer.rb +19 -0
- data/app/serializers/spree/api/v2/platform/line_item_serializer.rb +19 -0
- data/app/serializers/spree/api/v2/platform/log_entry_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/menu_item_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/menu_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/option_type_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/option_value_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/order_promotion_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/order_serializer.rb +31 -0
- data/app/serializers/spree/api/v2/platform/payment_capture_event_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/payment_method_serializer.rb +18 -0
- data/app/serializers/spree/api/v2/platform/payment_serializer.rb +21 -0
- data/app/serializers/spree/api/v2/platform/price_serializer.rb +19 -0
- data/app/serializers/spree/api/v2/platform/product_property_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/product_serializer.rb +7 -3
- data/app/serializers/spree/api/v2/platform/promotion_action_line_item_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/promotion_action_serializer.rb +19 -0
- data/app/serializers/spree/api/v2/platform/promotion_category_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/promotion_rule_serializer.rb +21 -0
- data/app/serializers/spree/api/v2/platform/promotion_serializer.rb +17 -0
- data/app/serializers/spree/api/v2/platform/property_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/prototype_serializer.rb +15 -0
- data/app/serializers/spree/api/v2/platform/refund_reason_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/refund_serializer.rb +16 -0
- data/app/serializers/spree/api/v2/platform/reimbursement_credit_serializer.rb +10 -0
- data/app/serializers/spree/api/v2/platform/reimbursement_serializer.rb +18 -0
- data/app/serializers/spree/api/v2/platform/reimbursement_type_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/return_authorization_reason_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/return_authorization_serializer.rb +17 -0
- data/app/serializers/spree/api/v2/platform/return_item_serializer.rb +16 -0
- data/app/serializers/spree/api/v2/platform/role_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/shipment_serializer.rb +22 -0
- data/app/serializers/spree/api/v2/platform/shipping_category_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/shipping_method_serializer.rb +16 -0
- data/app/serializers/spree/api/v2/platform/shipping_rate_serializer.rb +15 -0
- data/app/serializers/spree/api/v2/platform/side_by_side_image_serializer.rb +10 -0
- data/app/serializers/spree/api/v2/platform/standard_page_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/state_change_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/state_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/stock_item_serializer.rb +1 -3
- data/app/serializers/spree/api/v2/platform/stock_location_serializer.rb +2 -4
- data/app/serializers/spree/api/v2/platform/stock_movement_serializer.rb +11 -0
- data/app/serializers/spree/api/v2/platform/stock_transfer_serializer.rb +15 -0
- data/app/serializers/spree/api/v2/platform/store_credit_category_serializer.rb +12 -0
- data/app/serializers/spree/api/v2/platform/store_credit_event_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/store_credit_serializer.rb +18 -0
- data/app/serializers/spree/api/v2/platform/store_credit_type_serializer.rb +12 -0
- data/app/serializers/spree/api/v2/platform/store_serializer.rb +2 -1
- data/app/serializers/spree/api/v2/platform/tax_category_serializer.rb +2 -2
- data/app/serializers/spree/api/v2/platform/tax_rate_serializer.rb +14 -0
- data/app/serializers/spree/api/v2/platform/taxon_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/taxonomy_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/user_serializer.rb +1 -1
- data/app/serializers/spree/api/v2/platform/variant_serializer.rb +3 -2
- data/app/serializers/spree/api/v2/platform/webhooks/event_serializer.rb +15 -0
- data/app/serializers/spree/api/v2/platform/webhooks/subscriber_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/wished_item_serializer.rb +29 -0
- data/app/serializers/spree/api/v2/platform/wishlist_serializer.rb +19 -0
- data/app/serializers/spree/api/v2/platform/zone_member_serializer.rb +13 -0
- data/app/serializers/spree/api/v2/platform/zone_serializer.rb +13 -0
- data/app/serializers/spree/v2/storefront/address_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/cart_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/cms_section_serializer.rb +8 -4
- data/app/serializers/spree/v2/storefront/credit_card_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/digital_link_serializer.rb +11 -0
- data/app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb +2 -2
- data/app/serializers/spree/v2/storefront/line_item_serializer.rb +2 -1
- data/app/serializers/spree/v2/storefront/option_type_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/option_value_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/order_serializer.rb +9 -0
- data/app/serializers/spree/v2/storefront/payment_method_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/payment_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/product_property_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/product_serializer.rb +2 -2
- data/app/serializers/spree/v2/storefront/promotion_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/shipment_serializer.rb +5 -1
- data/app/serializers/spree/v2/storefront/store_credit_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/store_serializer.rb +5 -10
- data/app/serializers/spree/v2/storefront/taxon_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/taxonomy_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/user_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/variant_serializer.rb +1 -1
- data/app/serializers/spree/v2/storefront/wished_item_serializer.rb +29 -0
- data/app/serializers/spree/v2/storefront/wishlist_serializer.rb +17 -0
- data/app/services/spree/webhooks/subscribers/handle_request.rb +73 -0
- data/app/services/spree/webhooks/subscribers/make_request.rb +82 -0
- data/app/services/spree/webhooks/subscribers/queue_requests.rb +23 -0
- data/app/services/spree/webhooks.rb +13 -0
- data/config/i18n-tasks.yml +40 -0
- data/config/initializers/doorkeeper.rb +12 -12
- data/config/locales/en.yml +29 -27
- data/config/routes.rb +84 -179
- data/db/migrate/20210902162826_create_spree_webhooks_tables.rb +16 -0
- data/db/migrate/20210919183228_enable_polymorphic_resource_owner.rb +21 -0
- data/db/migrate/20211025162826_create_spree_webhooks_events.rb +14 -0
- data/docs/oauth/index.yml +126 -33
- data/docs/v2/platform/index.yaml +19696 -1734
- data/docs/v2/storefront/index.yaml +15050 -14553
- data/lib/spree/api/configuration.rb +11 -0
- data/lib/spree/api/dependencies.rb +165 -0
- data/lib/spree/api/engine.rb +10 -5
- data/lib/spree/api/testing_support/factories/oauth_application_factory.rb +6 -0
- data/lib/spree/api/testing_support/factories/webhook_event_factory.rb +27 -0
- data/lib/spree/api/testing_support/factories/webhook_subscriber_factory.rb +13 -0
- data/lib/spree/api/testing_support/factories.rb +3 -0
- data/lib/spree/api/testing_support/jobs.rb +18 -0
- data/lib/spree/api/testing_support/matchers/webhooks.rb +67 -0
- data/lib/spree/api/testing_support/serializers.rb +25 -0
- data/lib/spree/api/testing_support/spree_webhooks.rb +9 -0
- data/lib/spree/api/testing_support/v2/base.rb +1 -1
- data/lib/spree/api/testing_support/v2/current_order.rb +34 -1
- data/lib/spree/api/testing_support/v2/platform_contexts.rb +100 -52
- data/lib/spree/api/testing_support/v2/serializers_params.rb +3 -1
- data/lib/spree/api.rb +0 -3
- data/lib/spree_api.rb +0 -1
- data/spec/fixtures/files/icon_256x256.jpg +0 -0
- data/spree_api.gemspec +15 -16
- metadata +163 -177
- data/app/controllers/spree/api/base_controller.rb +0 -171
- data/app/controllers/spree/api/errors_controller.rb +0 -9
- data/app/controllers/spree/api/v1/addresses_controller.rb +0 -46
- data/app/controllers/spree/api/v1/checkouts_controller.rb +0 -106
- data/app/controllers/spree/api/v1/classifications_controller.rb +0 -21
- data/app/controllers/spree/api/v1/countries_controller.rb +0 -22
- data/app/controllers/spree/api/v1/credit_cards_controller.rb +0 -26
- data/app/controllers/spree/api/v1/customer_returns_controller.rb +0 -25
- data/app/controllers/spree/api/v1/images_controller.rb +0 -58
- data/app/controllers/spree/api/v1/inventory_units_controller.rb +0 -54
- data/app/controllers/spree/api/v1/line_items_controller.rb +0 -70
- data/app/controllers/spree/api/v1/option_types_controller.rb +0 -60
- data/app/controllers/spree/api/v1/option_values_controller.rb +0 -62
- data/app/controllers/spree/api/v1/orders_controller.rb +0 -160
- data/app/controllers/spree/api/v1/payments_controller.rb +0 -82
- data/app/controllers/spree/api/v1/product_properties_controller.rb +0 -73
- data/app/controllers/spree/api/v1/products_controller.rb +0 -131
- data/app/controllers/spree/api/v1/promotions_controller.rb +0 -30
- data/app/controllers/spree/api/v1/properties_controller.rb +0 -70
- data/app/controllers/spree/api/v1/reimbursements_controller.rb +0 -25
- data/app/controllers/spree/api/v1/return_authorizations_controller.rb +0 -70
- data/app/controllers/spree/api/v1/shipments_controller.rb +0 -196
- data/app/controllers/spree/api/v1/states_controller.rb +0 -36
- data/app/controllers/spree/api/v1/stock_items_controller.rb +0 -82
- data/app/controllers/spree/api/v1/stock_locations_controller.rb +0 -53
- data/app/controllers/spree/api/v1/stock_movements_controller.rb +0 -45
- data/app/controllers/spree/api/v1/stores_controller.rb +0 -56
- data/app/controllers/spree/api/v1/taxonomies_controller.rb +0 -67
- data/app/controllers/spree/api/v1/taxons_controller.rb +0 -100
- data/app/controllers/spree/api/v1/users_controller.rb +0 -97
- data/app/controllers/spree/api/v1/variants_controller.rb +0 -81
- data/app/controllers/spree/api/v1/zones_controller.rb +0 -55
- data/app/helpers/spree/api/api_helpers.rb +0 -190
- data/app/models/spree/api_configuration.rb +0 -10
- data/app/models/spree/api_dependencies.rb +0 -111
- data/app/views/spree/api/errors/gateway_error.rabl +0 -2
- data/app/views/spree/api/errors/invalid_api_key.rabl +0 -2
- data/app/views/spree/api/errors/invalid_resource.rabl +0 -3
- data/app/views/spree/api/errors/must_specify_api_key.rabl +0 -2
- data/app/views/spree/api/errors/not_found.rabl +0 -2
- data/app/views/spree/api/errors/unauthorized.rabl +0 -2
- data/app/views/spree/api/v1/addresses/show.rabl +0 -10
- data/app/views/spree/api/v1/adjustments/show.rabl +0 -4
- data/app/views/spree/api/v1/countries/index.rabl +0 -7
- data/app/views/spree/api/v1/countries/show.rabl +0 -5
- data/app/views/spree/api/v1/credit_cards/index.rabl +0 -7
- data/app/views/spree/api/v1/credit_cards/show.rabl +0 -3
- data/app/views/spree/api/v1/customer_returns/index.rabl +0 -7
- data/app/views/spree/api/v1/images/index.rabl +0 -4
- data/app/views/spree/api/v1/images/new.rabl +0 -3
- data/app/views/spree/api/v1/images/show.rabl +0 -6
- data/app/views/spree/api/v1/inventory_units/show.rabl +0 -2
- data/app/views/spree/api/v1/line_items/new.rabl +0 -3
- data/app/views/spree/api/v1/line_items/show.rabl +0 -14
- data/app/views/spree/api/v1/option_types/index.rabl +0 -3
- data/app/views/spree/api/v1/option_types/new.rabl +0 -3
- data/app/views/spree/api/v1/option_types/show.rabl +0 -5
- data/app/views/spree/api/v1/option_values/index.rabl +0 -3
- data/app/views/spree/api/v1/option_values/new.rabl +0 -3
- data/app/views/spree/api/v1/option_values/show.rabl +0 -2
- data/app/views/spree/api/v1/orders/address.rabl +0 -0
- data/app/views/spree/api/v1/orders/canceled.rabl +0 -0
- data/app/views/spree/api/v1/orders/cart.rabl +0 -0
- data/app/views/spree/api/v1/orders/complete.rabl +0 -0
- data/app/views/spree/api/v1/orders/could_not_apply_coupon.rabl +0 -2
- data/app/views/spree/api/v1/orders/could_not_transition.rabl +0 -3
- data/app/views/spree/api/v1/orders/index.rabl +0 -7
- data/app/views/spree/api/v1/orders/insufficient_quantity.rabl +0 -2
- data/app/views/spree/api/v1/orders/invalid_shipping_method.rabl +0 -2
- data/app/views/spree/api/v1/orders/mine.rabl +0 -9
- data/app/views/spree/api/v1/orders/order.rabl +0 -10
- data/app/views/spree/api/v1/orders/payment.rabl +0 -3
- data/app/views/spree/api/v1/orders/show.rabl +0 -51
- data/app/views/spree/api/v1/payments/credit_over_limit.rabl +0 -2
- data/app/views/spree/api/v1/payments/index.rabl +0 -7
- data/app/views/spree/api/v1/payments/new.rabl +0 -5
- data/app/views/spree/api/v1/payments/show.rabl +0 -2
- data/app/views/spree/api/v1/payments/update_forbidden.rabl +0 -2
- data/app/views/spree/api/v1/product_properties/index.rabl +0 -7
- data/app/views/spree/api/v1/product_properties/new.rabl +0 -2
- data/app/views/spree/api/v1/product_properties/show.rabl +0 -2
- data/app/views/spree/api/v1/products/index.rabl +0 -9
- data/app/views/spree/api/v1/products/new.rabl +0 -3
- data/app/views/spree/api/v1/products/product.rabl +0 -1
- data/app/views/spree/api/v1/products/show.rabl +0 -36
- data/app/views/spree/api/v1/promotions/handler.rabl +0 -5
- data/app/views/spree/api/v1/promotions/show.rabl +0 -2
- data/app/views/spree/api/v1/properties/index.rabl +0 -7
- data/app/views/spree/api/v1/properties/new.rabl +0 -2
- data/app/views/spree/api/v1/properties/show.rabl +0 -2
- data/app/views/spree/api/v1/reimbursements/index.rabl +0 -7
- data/app/views/spree/api/v1/return_authorizations/index.rabl +0 -7
- data/app/views/spree/api/v1/return_authorizations/new.rabl +0 -3
- data/app/views/spree/api/v1/return_authorizations/show.rabl +0 -2
- data/app/views/spree/api/v1/shared/stock_location_required.rabl +0 -2
- data/app/views/spree/api/v1/shipments/big.rabl +0 -48
- data/app/views/spree/api/v1/shipments/cannot_ready_shipment.rabl +0 -2
- data/app/views/spree/api/v1/shipments/mine.rabl +0 -9
- data/app/views/spree/api/v1/shipments/show.rabl +0 -32
- data/app/views/spree/api/v1/shipments/small.rabl +0 -37
- data/app/views/spree/api/v1/shipping_rates/show.rabl +0 -2
- data/app/views/spree/api/v1/states/index.rabl +0 -12
- data/app/views/spree/api/v1/states/show.rabl +0 -2
- data/app/views/spree/api/v1/stock_items/index.rabl +0 -7
- data/app/views/spree/api/v1/stock_items/show.rabl +0 -5
- data/app/views/spree/api/v1/stock_locations/index.rabl +0 -7
- data/app/views/spree/api/v1/stock_locations/show.rabl +0 -8
- data/app/views/spree/api/v1/stock_movements/index.rabl +0 -7
- data/app/views/spree/api/v1/stock_movements/show.rabl +0 -5
- data/app/views/spree/api/v1/stores/index.rabl +0 -4
- data/app/views/spree/api/v1/stores/show.rabl +0 -2
- data/app/views/spree/api/v1/tags/index.rabl +0 -9
- data/app/views/spree/api/v1/taxonomies/index.rabl +0 -7
- data/app/views/spree/api/v1/taxonomies/jstree.rabl +0 -7
- data/app/views/spree/api/v1/taxonomies/nested.rabl +0 -11
- data/app/views/spree/api/v1/taxonomies/new.rabl +0 -3
- data/app/views/spree/api/v1/taxonomies/show.rabl +0 -15
- data/app/views/spree/api/v1/taxons/index.rabl +0 -10
- data/app/views/spree/api/v1/taxons/jstree.rabl +0 -7
- data/app/views/spree/api/v1/taxons/new.rabl +0 -3
- data/app/views/spree/api/v1/taxons/show.rabl +0 -6
- data/app/views/spree/api/v1/taxons/taxons.rabl +0 -5
- data/app/views/spree/api/v1/users/index.rabl +0 -7
- data/app/views/spree/api/v1/users/new.rabl +0 -3
- data/app/views/spree/api/v1/users/show.rabl +0 -11
- data/app/views/spree/api/v1/variants/big.rabl +0 -14
- data/app/views/spree/api/v1/variants/index.rabl +0 -9
- data/app/views/spree/api/v1/variants/new.rabl +0 -2
- data/app/views/spree/api/v1/variants/show.rabl +0 -3
- data/app/views/spree/api/v1/variants/small.rabl +0 -18
- data/app/views/spree/api/v1/zones/index.rabl +0 -7
- data/app/views/spree/api/v1/zones/show.rabl +0 -6
- data/config/initializers/rabl.rb +0 -9
- data/lib/spree/api/controller_setup.rb +0 -19
- data/lib/spree/api/responders/rabl_template.rb +0 -28
- data/lib/spree/api/responders.rb +0 -11
- data/lib/spree/api/testing_support/helpers.rb +0 -44
- data/lib/spree/api/testing_support/setup.rb +0 -16
data/config/routes.rb
CHANGED
@@ -6,126 +6,6 @@ end
|
|
6
6
|
|
7
7
|
Spree::Core::Engine.add_routes do
|
8
8
|
namespace :api, defaults: { format: 'json' } do
|
9
|
-
namespace :v1 do
|
10
|
-
resources :promotions, only: [:show]
|
11
|
-
|
12
|
-
resources :customer_returns, only: [:index]
|
13
|
-
resources :reimbursements, only: [:index]
|
14
|
-
|
15
|
-
resources :products do
|
16
|
-
resources :images
|
17
|
-
resources :variants
|
18
|
-
resources :product_properties
|
19
|
-
end
|
20
|
-
|
21
|
-
concern :order_routes do
|
22
|
-
member do
|
23
|
-
put :approve
|
24
|
-
put :cancel
|
25
|
-
put :empty
|
26
|
-
put :apply_coupon_code
|
27
|
-
end
|
28
|
-
|
29
|
-
resources :line_items
|
30
|
-
resources :payments do
|
31
|
-
member do
|
32
|
-
put :authorize
|
33
|
-
put :capture
|
34
|
-
put :purchase
|
35
|
-
put :void
|
36
|
-
put :credit
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
resources :addresses, only: [:show, :update]
|
41
|
-
|
42
|
-
resources :return_authorizations do
|
43
|
-
member do
|
44
|
-
put :add
|
45
|
-
put :cancel
|
46
|
-
put :receive
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
resources :checkouts, only: [:update], concerns: :order_routes do
|
52
|
-
member do
|
53
|
-
put :next
|
54
|
-
put :advance
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
resources :variants do
|
59
|
-
resources :images
|
60
|
-
end
|
61
|
-
|
62
|
-
resources :option_types do
|
63
|
-
resources :option_values
|
64
|
-
end
|
65
|
-
resources :option_values
|
66
|
-
|
67
|
-
resources :option_values, only: :index
|
68
|
-
|
69
|
-
get '/orders/mine', to: 'orders#mine', as: 'my_orders'
|
70
|
-
get '/orders/current', to: 'orders#current', as: 'current_order'
|
71
|
-
|
72
|
-
resources :orders, concerns: :order_routes do
|
73
|
-
put :remove_coupon_code, on: :member
|
74
|
-
end
|
75
|
-
|
76
|
-
resources :zones
|
77
|
-
resources :countries, only: [:index, :show] do
|
78
|
-
resources :states, only: [:index, :show]
|
79
|
-
end
|
80
|
-
|
81
|
-
resources :shipments, only: [:create, :update] do
|
82
|
-
collection do
|
83
|
-
post 'transfer_to_location'
|
84
|
-
post 'transfer_to_shipment'
|
85
|
-
get :mine
|
86
|
-
end
|
87
|
-
|
88
|
-
member do
|
89
|
-
put :ready
|
90
|
-
put :ship
|
91
|
-
put :add
|
92
|
-
put :remove
|
93
|
-
end
|
94
|
-
end
|
95
|
-
resources :states, only: [:index, :show]
|
96
|
-
|
97
|
-
resources :taxonomies do
|
98
|
-
member do
|
99
|
-
get :jstree
|
100
|
-
end
|
101
|
-
resources :taxons do
|
102
|
-
member do
|
103
|
-
get :jstree
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
resources :taxons, only: [:index]
|
109
|
-
|
110
|
-
resources :inventory_units, only: [:show, :update]
|
111
|
-
|
112
|
-
resources :users do
|
113
|
-
resources :credit_cards, only: [:index]
|
114
|
-
end
|
115
|
-
|
116
|
-
resources :properties
|
117
|
-
resources :stock_locations do
|
118
|
-
resources :stock_movements
|
119
|
-
resources :stock_items
|
120
|
-
end
|
121
|
-
|
122
|
-
resources :stock_items, only: [:index, :update, :destroy]
|
123
|
-
resources :stores
|
124
|
-
|
125
|
-
put '/classifications', to: 'classifications#update', as: :classifications
|
126
|
-
get '/taxons/products', to: 'taxons#products', as: :taxon_products
|
127
|
-
end
|
128
|
-
|
129
9
|
namespace :v2 do
|
130
10
|
namespace :storefront do
|
131
11
|
resource :cart, controller: :cart, only: %i[show create destroy] do
|
@@ -145,10 +25,12 @@ Spree::Core::Engine.add_routes do
|
|
145
25
|
patch :next
|
146
26
|
patch :advance
|
147
27
|
patch :complete
|
28
|
+
post :create_payment
|
148
29
|
post :add_store_credit
|
149
30
|
post :remove_store_credit
|
150
31
|
get :payment_methods
|
151
32
|
get :shipping_rates
|
33
|
+
patch :select_shipping_method
|
152
34
|
end
|
153
35
|
|
154
36
|
resource :account, controller: :account, only: %i[show create update]
|
@@ -165,35 +47,51 @@ Spree::Core::Engine.add_routes do
|
|
165
47
|
resources :products, only: %i[index show]
|
166
48
|
resources :taxons, only: %i[index show], id: /.+/
|
167
49
|
get '/stores/:code', to: 'stores#show', as: :store
|
50
|
+
get '/store', to: 'stores#current', as: :current_store
|
168
51
|
|
169
52
|
resources :menus, only: %i[index show]
|
170
53
|
resources :cms_pages, only: %i[index show]
|
54
|
+
|
55
|
+
resources :wishlists do
|
56
|
+
get :default, on: :collection
|
57
|
+
|
58
|
+
member do
|
59
|
+
post :add_item
|
60
|
+
patch 'set_item_quantity/:item_id', to: 'wishlists#set_item_quantity', as: :set_item_quantity
|
61
|
+
delete 'remove_item/:item_id', to: 'wishlists#remove_item', as: :remove_item
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
get '/digitals/:token', to: 'digitals#download', as: 'digital'
|
171
66
|
end
|
172
67
|
|
173
68
|
namespace :platform do
|
174
69
|
# Promotions API
|
175
70
|
resources :promotions
|
71
|
+
resources :promotion_actions
|
72
|
+
resources :promotion_categories
|
73
|
+
resources :promotion_rules
|
176
74
|
|
177
75
|
# Returns API
|
178
76
|
resources :customer_returns
|
179
77
|
resources :reimbursements
|
180
78
|
resources :return_authorizations do
|
181
79
|
member do
|
182
|
-
|
183
|
-
|
184
|
-
|
80
|
+
patch :add
|
81
|
+
patch :cancel
|
82
|
+
patch :receive
|
185
83
|
end
|
186
84
|
end
|
187
85
|
|
188
86
|
# Product Catalog API
|
189
87
|
resources :products
|
190
88
|
resources :taxonomies
|
191
|
-
resources :taxons
|
192
|
-
resources :classifications do
|
89
|
+
resources :taxons do
|
193
90
|
member do
|
194
|
-
|
91
|
+
patch :reposition
|
195
92
|
end
|
196
93
|
end
|
94
|
+
resources :classifications
|
197
95
|
resources :images
|
198
96
|
resources :variants
|
199
97
|
resources :properties
|
@@ -204,26 +102,38 @@ Spree::Core::Engine.add_routes do
|
|
204
102
|
# Order API
|
205
103
|
resources :orders do
|
206
104
|
member do
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
105
|
+
patch :next
|
106
|
+
patch :advance
|
107
|
+
patch :approve
|
108
|
+
patch :cancel
|
109
|
+
patch :empty
|
110
|
+
patch :apply_coupon_code
|
111
|
+
patch :complete
|
112
|
+
patch :use_store_credit
|
113
|
+
patch :cancel
|
114
|
+
patch :approve
|
214
115
|
end
|
215
116
|
end
|
216
117
|
resources :line_items
|
118
|
+
resources :adjustments
|
119
|
+
|
120
|
+
# Payments API
|
217
121
|
resources :payments do
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
122
|
+
# TODO: support custom actions
|
123
|
+
# member do
|
124
|
+
# patch :authorize
|
125
|
+
# patch :capture
|
126
|
+
# patch :purchase
|
127
|
+
# patch :void
|
128
|
+
# patch :credit
|
129
|
+
# end
|
225
130
|
end
|
226
131
|
|
132
|
+
# Store Credit API
|
133
|
+
resources :store_credits
|
134
|
+
resources :store_credit_categories
|
135
|
+
resources :store_credit_types
|
136
|
+
|
227
137
|
# Geo API
|
228
138
|
resources :zones
|
229
139
|
resources :countries, only: [:index, :show]
|
@@ -231,18 +141,21 @@ Spree::Core::Engine.add_routes do
|
|
231
141
|
|
232
142
|
# Shipment API
|
233
143
|
resources :shipments do
|
234
|
-
collection do
|
235
|
-
post 'transfer_to_location'
|
236
|
-
post 'transfer_to_shipment'
|
237
|
-
end
|
238
144
|
member do
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
145
|
+
%w[ready ship cancel resume pend].each do |state|
|
146
|
+
patch state.to_sym
|
147
|
+
end
|
148
|
+
patch :add_item
|
149
|
+
patch :remove_item
|
150
|
+
patch :transfer_to_location
|
151
|
+
patch :transfer_to_shipment
|
243
152
|
end
|
244
153
|
end
|
245
154
|
|
155
|
+
# Tax API
|
156
|
+
resources :tax_rates
|
157
|
+
resources :tax_categories
|
158
|
+
|
246
159
|
# Inventory API
|
247
160
|
resources :inventory_units
|
248
161
|
resources :stock_items
|
@@ -254,6 +167,8 @@ Spree::Core::Engine.add_routes do
|
|
254
167
|
resources :credit_cards
|
255
168
|
resources :addresses
|
256
169
|
|
170
|
+
resources :roles
|
171
|
+
|
257
172
|
# Menu API
|
258
173
|
resources :menus
|
259
174
|
resources :menu_items do
|
@@ -262,46 +177,36 @@ Spree::Core::Engine.add_routes do
|
|
262
177
|
end
|
263
178
|
end
|
264
179
|
|
265
|
-
# CMS
|
266
|
-
resources :cms_pages
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
180
|
+
# CMS
|
181
|
+
resources :cms_pages
|
182
|
+
resources :cms_sections
|
183
|
+
|
184
|
+
# Wishlists API
|
185
|
+
resources :wishlists
|
186
|
+
resources :wished_items
|
271
187
|
|
272
|
-
|
188
|
+
# Digitals API
|
189
|
+
resources :digitals
|
190
|
+
resources :digital_links do
|
273
191
|
member do
|
274
|
-
patch :
|
192
|
+
patch :reset
|
275
193
|
end
|
276
194
|
end
|
277
195
|
|
278
196
|
# Store API
|
279
197
|
resources :stores
|
280
|
-
end
|
281
|
-
end
|
282
|
-
|
283
|
-
get '/404', to: 'errors#render_404'
|
284
198
|
|
285
|
-
|
286
|
-
|
287
|
-
|
199
|
+
# Configurations API
|
200
|
+
resources :payment_methods
|
201
|
+
resources :shipping_categories
|
202
|
+
resources :shipping_methods
|
288
203
|
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
}, via: [:get, :post, :put, :patch, :delete]
|
295
|
-
|
296
|
-
match '*path', to: redirect { |params, request|
|
297
|
-
format = ".#{params[:format]}" unless params[:format].blank?
|
298
|
-
query = "?#{request.query_string}" unless request.query_string.blank?
|
299
|
-
|
300
|
-
if request.path == "#{spree_path}api/v1/#{params[:path]}#{format}#{query}"
|
301
|
-
"#{spree_path}api/404"
|
302
|
-
else
|
303
|
-
"#{spree_path}api/v1/#{params[:path]}#{format}#{query}"
|
204
|
+
# Webhooks API
|
205
|
+
namespace :webhooks do
|
206
|
+
resources :events, only: :index
|
207
|
+
resources :subscribers
|
208
|
+
end
|
304
209
|
end
|
305
|
-
|
210
|
+
end
|
306
211
|
end
|
307
212
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateSpreeWebhooksTables < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :spree_webhooks_subscribers do |t|
|
4
|
+
t.string :url, null: false
|
5
|
+
t.boolean :active, default: false, index: true
|
6
|
+
|
7
|
+
if t.respond_to? :jsonb
|
8
|
+
t.jsonb :subscriptions
|
9
|
+
else
|
10
|
+
t.json :subscriptions
|
11
|
+
end
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class EnablePolymorphicResourceOwner < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
add_column :spree_oauth_access_tokens, :resource_owner_type, :string
|
4
|
+
add_column :spree_oauth_access_grants, :resource_owner_type, :string
|
5
|
+
change_column_null :spree_oauth_access_grants, :resource_owner_type, false
|
6
|
+
|
7
|
+
add_index :spree_oauth_access_tokens,
|
8
|
+
[:resource_owner_id, :resource_owner_type],
|
9
|
+
name: 'polymorphic_owner_oauth_access_tokens'
|
10
|
+
|
11
|
+
add_index :spree_oauth_access_grants,
|
12
|
+
[:resource_owner_id, :resource_owner_type],
|
13
|
+
name: 'polymorphic_owner_oauth_access_grants'
|
14
|
+
|
15
|
+
Spree::OauthAccessToken.reset_column_information
|
16
|
+
Spree::OauthAccessToken.update_all(resource_owner_type: Spree.user_class)
|
17
|
+
|
18
|
+
Spree::OauthAccessGrant.reset_column_information
|
19
|
+
Spree::OauthAccessGrant.update_all(resource_owner_type: Spree.user_class)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateSpreeWebhooksEvents < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :spree_webhooks_events do |t|
|
4
|
+
t.integer "execution_time"
|
5
|
+
t.string "name", null: false
|
6
|
+
t.string "request_errors"
|
7
|
+
t.string "response_code", index: true
|
8
|
+
t.belongs_to "subscriber", null: false, index: true
|
9
|
+
t.boolean "success", index: true
|
10
|
+
t.string "url", null: false
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/docs/oauth/index.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
openapi: 3.0.
|
1
|
+
openapi: 3.0.3
|
2
2
|
servers:
|
3
3
|
- url: 'https://demo.spreecommerce.org'
|
4
4
|
description: demo
|
@@ -7,7 +7,7 @@ servers:
|
|
7
7
|
info:
|
8
8
|
version: 1.0.0
|
9
9
|
title: Authentication
|
10
|
-
description:
|
10
|
+
description: Spree uses oAuth based Authentication via short-lived Bearer tokens. You can either create a new one or refresh existing token.
|
11
11
|
contact:
|
12
12
|
name: Spark Solutions
|
13
13
|
url: 'https://sparksolutions.co'
|
@@ -18,26 +18,35 @@ info:
|
|
18
18
|
paths:
|
19
19
|
/spree_oauth/token:
|
20
20
|
post:
|
21
|
-
description:
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
description: |-
|
22
|
+
This endpoint creates a new Bearer Token or refreshes an existing Bearer Token.
|
23
|
+
|
24
|
+
The `token` found in the response body is required to authorize API calls.
|
25
|
+
operationId: create-or-refresh-token
|
25
26
|
responses:
|
26
27
|
'200':
|
27
|
-
description: Token was successfully created or refreshed
|
28
|
+
description: Token was successfully created or refreshed.
|
28
29
|
content:
|
29
30
|
application/json:
|
30
31
|
schema:
|
31
32
|
$ref: '#/components/schemas/Token'
|
32
33
|
examples:
|
33
|
-
|
34
|
+
Storefront User Token:
|
34
35
|
value:
|
35
36
|
access_token: SfM3k8kq5Wkc6xz6rgMlsl-mbygJ1ptq4DR0Ah51vjA
|
36
37
|
token_type: Bearer
|
37
38
|
expires_in: 7200
|
38
39
|
refresh_token: SqJDIwX00fehqHxS6xmb-kzqAlrYe_0EHgekMexVT8k
|
39
40
|
created_at: 1581873931
|
40
|
-
|
41
|
+
Platform User Token:
|
42
|
+
value:
|
43
|
+
access_token: 2480c16561d1391ea81ca5336b651e9a29f4524f6dee8c7f3f02a600159189c3
|
44
|
+
token_type: Bearer
|
45
|
+
expires_in: 7200
|
46
|
+
refresh_token: f5d78642252eeb3f3001f67b196ac21a27afc030462a54060b0ebbdae2b8dc9c
|
47
|
+
scope: admin
|
48
|
+
created_at: 1539863418
|
49
|
+
Refreshed Token:
|
41
50
|
value:
|
42
51
|
access_token: Es9lLPW2mVaDB80I-I_OdQCw3JfOT1s19YN1naFWx98
|
43
52
|
token_type: Bearer
|
@@ -51,21 +60,57 @@ paths:
|
|
51
60
|
schema:
|
52
61
|
oneOf:
|
53
62
|
- $ref: '#/components/schemas/CreateTokenBody'
|
63
|
+
- $ref: '#/components/schemas/ClientTokenBody'
|
54
64
|
- $ref: '#/components/schemas/RefreshTokenBody'
|
55
65
|
examples:
|
56
|
-
|
66
|
+
Create Storefront API User Token:
|
67
|
+
value:
|
68
|
+
grant_type: password
|
69
|
+
username: spree@example.com
|
70
|
+
password: spree123
|
71
|
+
Create Platform API User Token:
|
57
72
|
value:
|
73
|
+
client_id: 7ZY15L7crVZul8i3PZPrnpOkEURK7xnXEWRZdE6K39M
|
74
|
+
client_secret: cxMZ0tbe604qj_13hibNmc3GDsXUQfpzHt9PvweihFc
|
58
75
|
grant_type: password
|
59
76
|
username: spree@example.com
|
60
77
|
password: spree123
|
61
|
-
|
78
|
+
scope: admin
|
79
|
+
Create Platform API Application Token:
|
80
|
+
value:
|
81
|
+
grant_type: client_credentials
|
82
|
+
client_id: 7ZY15L7crVZul8i3PZPrnpOkEURK7xnXEWRZdE6K39M
|
83
|
+
client_secret: cxMZ0tbe604qj_13hibNmc3GDsXUQfpzHt9PvweihFc
|
84
|
+
scope: admin
|
85
|
+
Refresh a Token:
|
62
86
|
value:
|
63
87
|
grant_type: refresh_token
|
64
88
|
refresh_token: SqJDIwX00fehqHxS6xmb-kzqAlrYe_0EHgekMexVT8k
|
89
|
+
application/xml:
|
90
|
+
schema:
|
91
|
+
type: object
|
92
|
+
properties: {}
|
65
93
|
description: ''
|
94
|
+
summary: Create or Refresh a Token
|
95
|
+
tags:
|
96
|
+
- Token
|
66
97
|
components:
|
67
98
|
schemas:
|
68
99
|
Token:
|
100
|
+
x-examples:
|
101
|
+
create token:
|
102
|
+
access_token: SfM3k8kq5Wkc6xz6rgMlsl-mbygJ1ptq4DR0Ah51vjA
|
103
|
+
token_type: Bearer
|
104
|
+
expires_in: 7200
|
105
|
+
refresh_token: SqJDIwX00fehqHxS6xmb-kzqAlrYe_0EHgekMexVT8k
|
106
|
+
created_at: 1581873931
|
107
|
+
refresh token:
|
108
|
+
access_token: Es9lLPW2mVaDB80I-I_OdQCw3JfOT1s19YN1naFWx98
|
109
|
+
token_type: Bearer
|
110
|
+
expires_in: 7200
|
111
|
+
refresh_token: j92BxulqIIYtiiaBsuAM1TzGsGSVxaykT4kk8OYHGNY
|
112
|
+
created_at: 1581876572
|
113
|
+
type: object
|
69
114
|
properties:
|
70
115
|
access_token:
|
71
116
|
type: string
|
@@ -81,34 +126,42 @@ components:
|
|
81
126
|
refresh_token:
|
82
127
|
type: string
|
83
128
|
example: f5d78642252eeb3f3001f67b196ac21a27afc030462a54060b0ebbdae2b8dc9c
|
129
|
+
scope:
|
130
|
+
type: string
|
131
|
+
example: admin
|
132
|
+
default: admin
|
84
133
|
created_at:
|
85
134
|
type: integer
|
86
135
|
example: 1539863418
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
refresh token:
|
95
|
-
access_token: Es9lLPW2mVaDB80I-I_OdQCw3JfOT1s19YN1naFWx98
|
96
|
-
token_type: Bearer
|
97
|
-
expires_in: 7200
|
98
|
-
refresh_token: j92BxulqIIYtiiaBsuAM1TzGsGSVxaykT4kk8OYHGNY
|
99
|
-
created_at: 1581876572
|
136
|
+
required:
|
137
|
+
- access_token
|
138
|
+
- token_type
|
139
|
+
- expires_in
|
140
|
+
- refresh_token
|
141
|
+
- created_at
|
142
|
+
x-internal: true
|
100
143
|
CreateTokenBody:
|
101
144
|
type: object
|
102
145
|
x-examples:
|
103
|
-
|
146
|
+
User Token:
|
147
|
+
grant_type: password
|
148
|
+
username: spree@example.com
|
149
|
+
password: spree123
|
150
|
+
Application Token:
|
104
151
|
grant_type: password
|
105
152
|
username: spree@example.com
|
106
153
|
password: spree123
|
154
|
+
scope: admin
|
155
|
+
x-internal: true
|
156
|
+
title: 'Create a new token (grant_type: password)'
|
157
|
+
description: ''
|
107
158
|
properties:
|
108
159
|
grant_type:
|
109
160
|
type: string
|
110
|
-
|
111
|
-
|
161
|
+
description: ''
|
162
|
+
example: password
|
163
|
+
enum:
|
164
|
+
- password
|
112
165
|
username:
|
113
166
|
type: string
|
114
167
|
description: User email address
|
@@ -117,24 +170,64 @@ components:
|
|
117
170
|
type: string
|
118
171
|
description: User password
|
119
172
|
example: spree123
|
173
|
+
scope:
|
174
|
+
type: string
|
175
|
+
enum:
|
176
|
+
- admin
|
177
|
+
description: 'Pass the value `admin` to create a Platform User Token, allowing access to the Platform API.'
|
178
|
+
nullable: true
|
120
179
|
required:
|
121
180
|
- grant_type
|
122
181
|
- username
|
123
182
|
- password
|
124
|
-
|
183
|
+
ClientTokenBody:
|
125
184
|
type: object
|
185
|
+
x-examples:
|
186
|
+
example-1:
|
187
|
+
grant_type: refresh_token
|
188
|
+
refresh_token: SqJDIwX00fehqHxS6xmb-kzqAlrYe_0EHgekMexVT8k
|
189
|
+
x-internal: true
|
190
|
+
title: 'Create a new token (grant_type: client_credentials)'
|
191
|
+
description: ''
|
126
192
|
properties:
|
127
193
|
grant_type:
|
128
194
|
type: string
|
129
|
-
|
130
|
-
|
195
|
+
example: client_credentials
|
196
|
+
enum:
|
197
|
+
- client_credentials
|
198
|
+
client_id:
|
131
199
|
type: string
|
132
|
-
description:
|
133
|
-
example:
|
200
|
+
description: Use the client id
|
201
|
+
example: 27af95fd57a424e5d01aaf5eab
|
202
|
+
client_secret:
|
203
|
+
type: string
|
204
|
+
example: 1324a8d5c0ca57daf384fae39f811a5144330143301'
|
205
|
+
description: Client secret key.
|
134
206
|
required:
|
135
207
|
- grant_type
|
136
|
-
-
|
208
|
+
- client_id
|
209
|
+
- client_secret
|
210
|
+
RefreshTokenBody:
|
211
|
+
type: object
|
137
212
|
x-examples:
|
138
213
|
example-1:
|
139
214
|
grant_type: refresh_token
|
140
215
|
refresh_token: SqJDIwX00fehqHxS6xmb-kzqAlrYe_0EHgekMexVT8k
|
216
|
+
x-internal: true
|
217
|
+
title: 'Refresh an existing token (grant_type: refresh_token)'
|
218
|
+
description: ''
|
219
|
+
properties:
|
220
|
+
grant_type:
|
221
|
+
type: string
|
222
|
+
example: refresh_token
|
223
|
+
enum:
|
224
|
+
- refresh_token
|
225
|
+
refresh_token:
|
226
|
+
type: string
|
227
|
+
description: Refresh token obtained from the create token response
|
228
|
+
example: 27af95fd57a424e5d01aaf5eab1324a8d5c0ca57daf384fae39f811a5144330143301'
|
229
|
+
required:
|
230
|
+
- grant_type
|
231
|
+
- refresh_token
|
232
|
+
tags:
|
233
|
+
- name: Token
|