Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Add tests for Spree::DigitalLink and Spree::Digital

Matthew Kennedye08fc574facb
diff --git a/api/docs/v2/platform/index.yaml b/api/docs/v2/platform/index.yaml
index 5ab39baf69..bd86823e13 100644
--- a/api/docs/v2/platform/index.yaml
+++ b/api/docs/v2/platform/index.yaml
@@ -69,8 +69,8 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-10-12T12:14:06.662Z'
- updated_at: '2021-10-12T12:14:06.662Z'
+ created_at: '2021-10-13T07:50:43.386Z'
+ updated_at: '2021-10-13T07:50:43.386Z'
deleted_at:
label:
relationships:
@@ -97,8 +97,8 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-10-12T12:14:06.666Z'
- updated_at: '2021-10-12T12:14:06.666Z'
+ created_at: '2021-10-13T07:50:43.390Z'
+ updated_at: '2021-10-13T07:50:43.390Z'
deleted_at:
label:
relationships:
@@ -168,8 +168,8 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-10-12T12:14:06.833Z'
- updated_at: '2021-10-12T12:14:06.833Z'
+ created_at: '2021-10-13T07:50:43.575Z'
+ updated_at: '2021-10-13T07:50:43.575Z'
deleted_at:
label:
relationships:
@@ -259,8 +259,8 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-10-12T12:14:06.878Z'
- updated_at: '2021-10-12T12:14:06.878Z'
+ created_at: '2021-10-13T07:50:43.621Z'
+ updated_at: '2021-10-13T07:50:43.621Z'
deleted_at:
label:
relationships:
@@ -333,8 +333,8 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-10-12T12:14:06.930Z'
- updated_at: '2021-10-12T12:14:06.938Z'
+ created_at: '2021-10-13T07:50:43.674Z'
+ updated_at: '2021-10-13T07:50:43.682Z'
deleted_at:
label:
relationships:
@@ -466,8 +466,8 @@ paths:
label: Shipping
mandatory:
eligible: true
- created_at: '2021-10-12T12:14:07.157Z'
- updated_at: '2021-10-12T12:14:07.157Z'
+ created_at: '2021-10-13T07:50:43.899Z'
+ updated_at: '2021-10-13T07:50:43.899Z'
state: open
included: false
display_amount: "$100.00"
@@ -493,8 +493,8 @@ paths:
label: Shipping
mandatory:
eligible: true
- created_at: '2021-10-12T12:14:07.182Z'
- updated_at: '2021-10-12T12:14:07.182Z'
+ created_at: '2021-10-13T07:50:43.927Z'
+ updated_at: '2021-10-13T07:50:43.927Z'
state: open
included: false
display_amount: "$100.00"
@@ -563,8 +563,8 @@ paths:
label: Shipping
mandatory:
eligible: true
- created_at: '2021-10-12T12:14:07.473Z'
- updated_at: '2021-10-12T12:14:07.473Z'
+ created_at: '2021-10-13T07:50:44.218Z'
+ updated_at: '2021-10-13T07:50:44.218Z'
state: open
included: false
display_amount: "$100.00"
@@ -642,8 +642,8 @@ paths:
label: Shipping
mandatory:
eligible: true
- created_at: '2021-10-12T12:14:07.572Z'
- updated_at: '2021-10-12T12:14:07.576Z'
+ created_at: '2021-10-13T07:50:44.319Z'
+ updated_at: '2021-10-13T07:50:44.323Z'
state: open
included: false
display_amount: "$1.00"
@@ -715,8 +715,8 @@ paths:
label: New label
mandatory:
eligible: true
- created_at: '2021-10-12T12:14:07.755Z'
- updated_at: '2021-10-12T12:14:07.769Z'
+ created_at: '2021-10-13T07:50:44.502Z'
+ updated_at: '2021-10-13T07:50:44.516Z'
state: open
included: false
display_amount: "$15.00"
@@ -844,8 +844,8 @@ paths:
type: classification
attributes:
position: 1
- created_at: '2021-10-12T12:14:08.350Z'
- updated_at: '2021-10-12T12:14:08.350Z'
+ created_at: '2021-10-13T07:50:45.194Z'
+ updated_at: '2021-10-13T07:50:45.194Z'
relationships:
product:
data:
@@ -859,8 +859,8 @@ paths:
type: classification
attributes:
position: 1
- created_at: '2021-10-12T12:14:08.453Z'
- updated_at: '2021-10-12T12:14:08.453Z'
+ created_at: '2021-10-13T07:50:45.312Z'
+ updated_at: '2021-10-13T07:50:45.312Z'
relationships:
product:
data:
@@ -917,8 +917,8 @@ paths:
type: classification
attributes:
position: 1
- created_at: '2021-10-12T12:14:08.851Z'
- updated_at: '2021-10-12T12:14:08.851Z'
+ created_at: '2021-10-13T07:50:45.728Z'
+ updated_at: '2021-10-13T07:50:45.728Z'
relationships:
product:
data:
@@ -981,8 +981,8 @@ paths:
type: classification
attributes:
position: 1
- created_at: '2021-10-12T12:14:09.006Z'
- updated_at: '2021-10-12T12:14:09.006Z'
+ created_at: '2021-10-13T07:50:45.884Z'
+ updated_at: '2021-10-13T07:50:45.884Z'
relationships:
product:
data:
@@ -1042,8 +1042,8 @@ paths:
type: classification
attributes:
position: 1
- created_at: '2021-10-12T12:14:09.291Z'
- updated_at: '2021-10-12T12:14:09.291Z'
+ created_at: '2021-10-13T07:50:46.164Z'
+ updated_at: '2021-10-13T07:50:46.164Z'
relationships:
product:
data:
@@ -1153,8 +1153,8 @@ paths:
type: classification
attributes:
position: 2
- created_at: '2021-10-12T12:14:10.001Z'
- updated_at: '2021-10-12T12:14:10.029Z'
+ created_at: '2021-10-13T07:50:46.860Z'
+ updated_at: '2021-10-13T07:50:46.887Z'
relationships:
product:
data:
@@ -1245,35 +1245,34 @@ paths:
- id: '1'
type: cms_page
attributes:
- title: Aliquid sequi inventore hic praesentium dolorem.
+ title: Itaque ea assumenda blanditiis minima.
meta_title:
content:
meta_description:
visible: true
- slug: aliquid-sequi-inventore-hic-praesentium-dolorem
+ slug: itaque-ea-assumenda-blanditiis-minima
type: Spree::Cms::Pages::StandardPage
locale: en
deleted_at:
- created_at: '2021-10-12T12:14:10.347Z'
- updated_at: '2021-10-12T12:14:10.347Z'
+ created_at: '2021-10-13T07:50:47.195Z'
+ updated_at: '2021-10-13T07:50:47.195Z'
relationships:
cms_sections:
data: []
- id: '2'
type: cms_page
attributes:
- title: Dicta doloribus aut voluptate repellat assumenda maiores
- est.
+ title: Alias maxime magni pariatur velit labore illum vero.
meta_title:
content:
meta_description:
visible: true
- slug: dicta-doloribus-aut-voluptate-repellat-assumenda-maiores-est
+ slug: alias-maxime-magni-pariatur-velit-labore-illum-vero
type: Spree::Cms::Pages::StandardPage
locale: en
deleted_at:
- created_at: '2021-10-12T12:14:10.351Z'
- updated_at: '2021-10-12T12:14:10.351Z'
+ created_at: '2021-10-13T07:50:47.199Z'
+ updated_at: '2021-10-13T07:50:47.199Z'
relationships:
cms_sections:
data: []
@@ -1323,17 +1322,17 @@ paths:
id: '5'
type: cms_page
attributes:
- title: Nihil commodi dolor assumenda accusamus ea.
+ title: Reiciendis debitis voluptate deleniti quaerat minima.
meta_title:
content:
meta_description:
visible: true
- slug: nihil-commodi-dolor-assumenda-accusamus-ea
+ slug: reiciendis-debitis-voluptate-deleniti-quaerat-minima
type: Spree::Cms::Pages::StandardPage
locale: en
deleted_at:
- created_at: '2021-10-12T12:14:10.424Z'
- updated_at: '2021-10-12T12:14:10.424Z'
+ created_at: '2021-10-13T07:50:47.271Z'
+ updated_at: '2021-10-13T07:50:47.271Z'
relationships:
cms_sections:
data: []
@@ -1389,17 +1388,17 @@ paths:
id: '6'
type: cms_page
attributes:
- title: Esse veritatis officiis exercitationem velit repellat.
+ title: Eligendi eveniet saepe eos officia impedit voluptatibus.
meta_title:
content:
meta_description:
visible: true
- slug: esse-veritatis-officiis-exercitationem-velit-repellat
+ slug: eligendi-eveniet-saepe-eos-officia-impedit-voluptatibus
type: Spree::Cms::Pages::StandardPage
locale: en
deleted_at:
- created_at: '2021-10-12T12:14:10.455Z'
- updated_at: '2021-10-12T12:14:10.455Z'
+ created_at: '2021-10-13T07:50:47.304Z'
+ updated_at: '2021-10-13T07:50:47.304Z'
relationships:
cms_sections:
data: []
@@ -1457,12 +1456,12 @@ paths:
content:
meta_description:
visible: true
- slug: repellendus-quae-architecto-itaque-quisquam-ipsa
+ slug: necessitatibus-fugit-placeat-nulla-officia-perferendis-error
type: Spree::Cms::Pages::StandardPage
locale: en
deleted_at:
- created_at: '2021-10-12T12:14:10.508Z'
- updated_at: '2021-10-12T12:14:10.521Z'
+ created_at: '2021-10-13T07:50:47.354Z'
+ updated_at: '2021-10-13T07:50:47.368Z'
relationships:
cms_sections:
data: []
@@ -1576,7 +1575,7 @@ paths:
- id: '1'
type: cms_section
attributes:
- name: Perferendis molestiae rem neque ducimus culpa optio.
+ name: Voluptatem rerum enim optio repellat minima adipisci.
content: {}
settings:
gutters: No Gutters
@@ -1585,8 +1584,8 @@ paths:
type: Spree::Cms::Sections::HeroImage
position: 1
linked_resource_type: Spree::Taxon
- created_at: '2021-10-12T12:14:10.681Z'
- updated_at: '2021-10-12T12:14:10.681Z'
+ created_at: '2021-10-13T07:50:47.521Z'
+ updated_at: '2021-10-13T07:50:47.521Z'
relationships:
cms_page:
data:
@@ -1597,8 +1596,7 @@ paths:
- id: '2'
type: cms_section
attributes:
- name: Nisi fugiat labore corporis totam in impedit perspiciatis
- quas.
+ name: Incidunt unde beatae sed atque magni dolore.
content:
link_type_one: Spree::Taxon
link_type_two: Spree::Taxon
@@ -1610,8 +1608,8 @@ paths:
type: Spree::Cms::Sections::ImageGallery
position: 2
linked_resource_type:
- created_at: '2021-10-12T12:14:10.685Z'
- updated_at: '2021-10-12T12:14:10.685Z'
+ created_at: '2021-10-13T07:50:47.525Z'
+ updated_at: '2021-10-13T07:50:47.525Z'
relationships:
cms_page:
data:
@@ -1622,8 +1620,7 @@ paths:
- id: '3'
type: cms_section
attributes:
- name: Occaecati est unde culpa repudiandae expedita vel quo
- porro.
+ name: Necessitatibus iusto magni blanditiis eveniet.
content: {}
settings:
gutters: No Gutters
@@ -1632,8 +1629,8 @@ paths:
type: Spree::Cms::Sections::FeaturedArticle
position: 3
linked_resource_type: Spree::Taxon
- created_at: '2021-10-12T12:14:10.694Z'
- updated_at: '2021-10-12T12:14:10.694Z'
+ created_at: '2021-10-13T07:50:47.539Z'
+ updated_at: '2021-10-13T07:50:47.539Z'
relationships:
cms_page:
data:
@@ -1644,8 +1641,7 @@ paths:
- id: '4'
type: cms_section
attributes:
- name: Reiciendis excepturi voluptas deserunt perspiciatis
- laboriosam minima exercitationem.
+ name: Numquam rem velit dolores temporibus qui.
content: {}
settings:
gutters: No Gutters
@@ -1654,8 +1650,8 @@ paths:
type: Spree::Cms::Sections::HeroImage
position: 4
linked_resource_type: Spree::Product
- created_at: '2021-10-12T12:14:10.706Z'
- updated_at: '2021-10-12T12:14:10.706Z'
+ created_at: '2021-10-13T07:50:47.547Z'
+ updated_at: '2021-10-13T07:50:47.547Z'
relationships:
cms_page:
data:
@@ -1668,7 +1664,7 @@ paths:
- id: '5'
type: cms_section
attributes:
- name: Doloremque corrupti officia quaerat soluta nam.
+ name: Ducimus quam minus quibusdam consectetur.
content: {}
settings:
gutters: No Gutters
@@ -1677,8 +1673,8 @@ paths:
type: Spree::Cms::Sections::HeroImage
position: 5
linked_resource_type: Spree::Product
- created_at: '2021-10-12T12:14:10.714Z'
- updated_at: '2021-10-12T12:14:10.714Z'
+ created_at: '2021-10-13T07:50:47.555Z'
+ updated_at: '2021-10-13T07:50:47.555Z'
relationships:
cms_page:
data:
@@ -1734,8 +1730,7 @@ paths:
id: '14'
type: cms_section
attributes:
- name: Quo eaque veritatis laboriosam dolores est necessitatibus
- nulla.
+ name: Velit adipisci eaque omnis amet nihil.
content: {}
settings:
gutters: No Gutters
@@ -1744,8 +1739,8 @@ paths:
type: Spree::Cms::Sections::HeroImage
position: 4
linked_resource_type: Spree::Product
- created_at: '2021-10-12T12:14:10.864Z'
- updated_at: '2021-10-12T12:14:10.864Z'
+ created_at: '2021-10-13T07:50:47.729Z'
+ updated_at: '2021-10-13T07:50:47.729Z'
relationships:
cms_page:
data:
@@ -1807,7 +1802,8 @@ paths:
id: '21'
type: cms_section
attributes:
- name: Quisquam corporis doloremque sit vero.
+ name: Nihil nesciunt quidem expedita iure eligendi debitis
+ natus eos.
content: {}
settings:
gutters: No Gutters
@@ -1816,8 +1812,8 @@ paths:
type: Spree::Cms::Sections::HeroImage
position: 4
linked_resource_type: Spree::Product
- created_at: '2021-10-12T12:14:11.064Z'
- updated_at: '2021-10-12T12:14:11.064Z'
+ created_at: '2021-10-13T07:50:47.921Z'
+ updated_at: '2021-10-13T07:50:47.921Z'
relationships:
cms_page:
data:
@@ -1885,8 +1881,8 @@ paths:
type: Spree::Cms::Sections::HeroImage
position: 4
linked_resource_type: Spree::Product
- created_at: '2021-10-12T12:14:11.274Z'
- updated_at: '2021-10-12T12:14:11.287Z'
+ created_at: '2021-10-13T07:50:48.110Z'
+ updated_at: '2021-10-13T07:50:48.121Z'
relationships:
cms_page:
data:
@@ -1988,7 +1984,7 @@ paths:
id: '58'
type: cms_section
attributes:
- name: Omnis nemo libero repellendus adipisci sit ad quod.
+ name: Dolorem soluta assumenda eum quibusdam.
content: {}
settings:
gutters: No Gutters
@@ -1997,8 +1993,8 @@ paths:
type: Spree::Cms::Sections::HeroImage
position: 3
linked_resource_type: Spree::Product
- created_at: '2021-10-12T12:14:11.976Z'
- updated_at: '2021-10-12T12:14:11.991Z'
+ created_at: '2021-10-13T07:50:48.578Z'
+ updated_at: '2021-10-13T07:50:48.587Z'
relationships:
cms_page:
data:
@@ -2056,9 +2052,9 @@ paths:
name: United States of America
numcode: 840
states_required: true
- updated_at: '2021-10-12T12:14:12.156Z'
+ updated_at: '2021-10-13T07:50:48.718Z'
zipcode_required: true
- created_at: '2021-10-12T12:14:12.156Z'
+ created_at: '2021-10-13T07:50:48.718Z'
relationships:
states:
data: []
@@ -2071,9 +2067,9 @@ paths:
name: NAME_2
numcode: 840
states_required: false
- updated_at: '2021-10-12T12:14:12.161Z'
+ updated_at: '2021-10-13T07:50:48.724Z'
zipcode_required: true
- created_at: '2021-10-12T12:14:12.161Z'
+ created_at: '2021-10-13T07:50:48.724Z'
relationships:
states:
data: []
@@ -2086,9 +2082,9 @@ paths:
name: NAME_3
numcode: 840
states_required: false
- updated_at: '2021-10-12T12:14:12.162Z'
+ updated_at: '2021-10-13T07:50:48.726Z'
zipcode_required: true
- created_at: '2021-10-12T12:14:12.162Z'
+ created_at: '2021-10-13T07:50:48.726Z'
relationships:
states:
data: []
@@ -2143,9 +2139,9 @@ paths:
name: NAME_6
numcode: 840
states_required: false
- updated_at: '2021-10-12T12:14:12.202Z'
+ updated_at: '2021-10-13T07:50:48.768Z'
zipcode_required: true
- created_at: '2021-10-12T12:14:12.202Z'
+ created_at: '2021-10-13T07:50:48.768Z'
relationships:
states:
data: []
@@ -2197,7 +2193,7 @@ paths:
- id: '1'
type: digital_link
attributes:
- token: FyWXxbAvDbrK5Xc2wjMs3Kod
+ token: uHp7DG9trNHenaJpMN2cApP4
access_counter: 0
relationships:
digital:
@@ -2211,7 +2207,7 @@ paths:
- id: '2'
type: digital_link
attributes:
- token: rDsmXsv7ps1tmrKxREmXWiX5
+ token: QmKCCvuT6MqKszH8suX3gj9y
access_counter: 0
relationships:
digital:
@@ -2261,7 +2257,7 @@ paths:
id: '5'
type: digital_link
attributes:
- token: bPbt2zDEpzdpmKMaE6DgQoSj
+ token: dXVZTMtam4VtqgL1RKPPhZs4
access_counter: 0
relationships:
digital:
@@ -2320,7 +2316,7 @@ paths:
id: '6'
type: digital_link
attributes:
- token: jEmBoBHFDKQqPegscXRt9iLw
+ token: iZXrwfj4GJfoTWWDrH3Axpv2
access_counter: 0
relationships:
digital:
@@ -2373,7 +2369,7 @@ paths:
id: '8'
type: digital_link
attributes:
- token: hH1dqCeR1MTAdqaLSEBE1tNV
+ token: Yvhv4YSDXdWGya58VW1ZQ1Bd
access_counter: 0
relationships:
digital:
@@ -2476,7 +2472,7 @@ paths:
id: '13'
type: digital_link
attributes:
- token: WuBgL7q6mGXKEgY37hoWHZ6e
+ token: Z38kyCqfebvRu3riNyDKYT9K
access_counter: 0
relationships:
digital:
@@ -2487,6 +2483,22 @@ paths:
data:
id: '21'
type: line_item
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
"/api/v2/platform/digitals":
get:
summary: Return a list of Digital Assets
@@ -2523,41 +2535,41 @@ paths:
Example:
value:
data:
- - id: '14'
+ - id: '15'
type: digital
attributes:
- url: "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBJZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--6c02e9ec8f004d052becb50e7fcc54f9c99b2df5/thinking-cat.jpg"
+ url: "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBJdz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--927a49277b240016a5103d40e713c6456d0d53ec/thinking-cat.jpg"
content_type: image/jpeg
filename: thinking-cat.jpg
byte_size: 18090
relationships:
variant:
data:
- id: '83'
+ id: '86'
type: variant
- - id: '15'
+ - id: '16'
type: digital
attributes:
- url: "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBJdz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--927a49277b240016a5103d40e713c6456d0d53ec/thinking-cat.jpg"
+ url: "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBKQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--4d97d12ab027b7bc8fc342f95656ad9edd69a3b1/thinking-cat.jpg"
content_type: image/jpeg
filename: thinking-cat.jpg
byte_size: 18090
relationships:
variant:
data:
- id: '85'
+ id: '88'
type: variant
- - id: '16'
+ - id: '17'
type: digital
attributes:
- url: "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBKQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--4d97d12ab027b7bc8fc342f95656ad9edd69a3b1/thinking-cat.jpg"
+ url: "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBKUT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--cdff6a1a507edade4568c6480233bacf467c93f2/thinking-cat.jpg"
content_type: image/jpeg
filename: thinking-cat.jpg
byte_size: 18090
relationships:
variant:
data:
- id: '87'
+ id: '90'
type: variant
meta:
count: 3
@@ -2602,17 +2614,17 @@ paths:
Example:
value:
data:
- id: '23'
+ id: '24'
type: digital
attributes:
- url: "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBLdz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--6f3bdef01fb09e651ae684add9f27e22803d96ef/icon_256x256.jpg"
+ url: "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBMQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--bc0831200cac88ed09c7f0cd2210f346c14ac3fb/icon_256x256.jpg"
content_type: image/png
filename: icon_256x256.jpg
byte_size: 818
relationships:
variant:
data:
- id: '97'
+ id: '100'
type: variant
'422':
description: invalid request
@@ -2663,17 +2675,17 @@ paths:
Example:
value:
data:
- id: '27'
+ id: '28'
type: digital
attributes:
- url: "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBMdz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--cd8884ff4dfd8dbbc9a0df9d53d710d22fe34a77/thinking-cat.jpg"
+ url: "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBNQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--b4e6b492bc326309c993b31737157737be621509/thinking-cat.jpg"
content_type: image/jpeg
filename: thinking-cat.jpg
byte_size: 18090
relationships:
variant:
data:
- id: '115'
+ id: '118'
type: variant
'404':
description: Record not found
@@ -2721,17 +2733,17 @@ paths:
Example:
value:
data:
- id: '35'
+ id: '36'
type: digital
attributes:
- url: "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBPZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--d728da5484299ca0d43c9a3001688faa9786f9e2/icon_256x256.jpg"
+ url: "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBPdz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--891473e7db1050cd599e9595b20c5ad9c5d2c7cf/icon_256x256.jpg"
content_type: image/png
filename: icon_256x256.jpg
byte_size: 818
relationships:
variant:
data:
- id: '137'
+ id: '140'
type: variant
'422':
description: invalid request
@@ -2840,13 +2852,13 @@ paths:
Example:
value:
data:
- - id: '22'
+ - id: '23'
type: line_item
attributes:
quantity: 1
price: '10.0'
- created_at: '2021-10-12T12:14:19.083Z'
- updated_at: '2021-10-12T12:14:19.099Z'
+ created_at: '2021-10-13T07:50:55.963Z'
+ updated_at: '2021-10-13T07:50:55.970Z'
currency: USD
cost_price: '17.0'
adjustment_total: '0.0'
@@ -2871,15 +2883,15 @@ paths:
relationships:
order:
data:
- id: '28'
+ id: '29'
type: order
tax_category:
data:
- id: '75'
+ id: '76'
type: tax_category
variant:
data:
- id: '186'
+ id: '189'
type: variant
adjustments:
data: []
@@ -2887,13 +2899,13 @@ paths:
data: []
digital_links:
data: []
- - id: '23'
+ - id: '24'
type: line_item
attributes:
quantity: 1
price: '10.0'
- created_at: '2021-10-12T12:14:19.140Z'
- updated_at: '2021-10-12T12:14:19.147Z'
+ created_at: '2021-10-13T07:50:56.005Z'
+ updated_at: '2021-10-13T07:50:56.011Z'
currency: USD
cost_price: '17.0'
adjustment_total: '0.0'
@@ -2918,15 +2930,15 @@ paths:
relationships:
order:
data:
- id: '28'
+ id: '29'
type: order
tax_category:
data:
- id: '75'
+ id: '76'
type: tax_category
variant:
data:
- id: '187'
+ id: '190'
type: variant
adjustments:
data: []
@@ -2977,13 +2989,13 @@ paths:
Example:
value:
data:
- id: '26'
+ id: '27'
type: line_item
attributes:
quantity: 1
price: '10.0'
- created_at: '2021-10-12T12:14:19.428Z'
- updated_at: '2021-10-12T12:14:19.466Z'
+ created_at: '2021-10-13T07:50:56.211Z'
+ updated_at: '2021-10-13T07:50:56.248Z'
currency: USD
cost_price: '17.0'
adjustment_total: '0.0'
@@ -3008,15 +3020,15 @@ paths:
relationships:
order:
data:
- id: '30'
+ id: '31'
type: order
tax_category:
data:
- id: '77'
+ id: '78'
type: tax_category
variant:
data:
- id: '190'
+ id: '193'
type: variant
adjustments:
data: []
@@ -3076,13 +3088,13 @@ paths:
Example:
value:
data:
- id: '27'
+ id: '28'
type: line_item
attributes:
quantity: 1
price: '10.0'
- created_at: '2021-10-12T12:14:19.602Z'
- updated_at: '2021-10-12T12:14:19.610Z'
+ created_at: '2021-10-13T07:50:56.383Z'
+ updated_at: '2021-10-13T07:50:56.390Z'
currency: USD
cost_price: '17.0'
adjustment_total: '0.0'
@@ -3107,15 +3119,15 @@ paths:
relationships:
order:
data:
- id: '32'
+ id: '33'
type: order
tax_category:
data:
- id: '78'
+ id: '79'
type: tax_category
variant:
data:
- id: '191'
+ id: '194'
type: variant
adjustments:
data: []
@@ -3169,13 +3181,13 @@ paths:
Example:
value:
data:
- id: '29'
+ id: '30'
type: line_item
attributes:
quantity: 4
price: '10.0'
- created_at: '2021-10-12T12:14:19.889Z'
- updated_at: '2021-10-12T12:14:19.931Z'
+ created_at: '2021-10-13T07:50:56.601Z'
+ updated_at: '2021-10-13T07:50:56.637Z'
currency: USD
cost_price: '17.0'
adjustment_total: '0.0'
@@ -3200,15 +3212,15 @@ paths:
relationships:
order:
data:
- id: '34'
+ id: '35'
type: order
tax_category:
data:
- id: '80'
+ id: '81'
type: tax_category
variant:
data:
- id: '195'
+ id: '198'
type: variant
adjustments:
data: []
@@ -3223,10 +3235,10 @@ paths:
examples:
Example:
value:
- error: 'Quantity selected of "Product #131 - 6294" is not available.'
+ error: 'Quantity selected of "Product #133 - 3659" is not available.'
errors:
quantity:
- - 'selected of "Product #131 - 6294" is not available.'
+ - 'selected of "Product #133 - 3659" is not available.'
'404':
description: Record not found
content:
@@ -3336,8 +3348,8 @@ paths:
lft: 2
rgt: 3
depth: 1
- created_at: '2021-10-12T12:14:20.515Z'
- updated_at: '2021-10-12T12:14:20.520Z'
+ created_at: '2021-10-13T07:50:57.386Z'
+ updated_at: '2021-10-13T07:50:57.390Z'
link:
is_container: false
is_root: false
@@ -3373,8 +3385,8 @@ paths:
lft: 4
rgt: 5
depth: 1
- created_at: '2021-10-12T12:14:20.568Z'
- updated_at: '2021-10-12T12:14:20.573Z'
+ created_at: '2021-10-13T07:50:57.440Z'
+ updated_at: '2021-10-13T07:50:57.446Z'
link:
is_container: false
is_root: false
@@ -3410,8 +3422,8 @@ paths:
lft: 6
rgt: 7
depth: 1
- created_at: '2021-10-12T12:14:20.629Z'
- updated_at: '2021-10-12T12:14:20.633Z'
+ created_at: '2021-10-13T07:50:57.497Z'
+ updated_at: '2021-10-13T07:50:57.502Z'
link:
is_container: false
is_root: false
@@ -3447,8 +3459,8 @@ paths:
lft: 8
rgt: 9
depth: 1
- created_at: '2021-10-12T12:14:20.681Z'
- updated_at: '2021-10-12T12:14:20.685Z'
+ created_at: '2021-10-13T07:50:57.560Z'
+ updated_at: '2021-10-13T07:50:57.565Z'
link:
is_container: false
is_root: false
@@ -3484,8 +3496,8 @@ paths:
lft: 10
rgt: 11
depth: 1
- created_at: '2021-10-12T12:14:20.732Z'
- updated_at: '2021-10-12T12:14:20.736Z'
+ created_at: '2021-10-13T07:50:57.615Z'
+ updated_at: '2021-10-13T07:50:57.620Z'
link:
is_container: false
is_root: false
@@ -3521,8 +3533,8 @@ paths:
lft: 12
rgt: 13
depth: 1
- created_at: '2021-10-12T12:14:20.782Z'
- updated_at: '2021-10-12T12:14:20.786Z'
+ created_at: '2021-10-13T07:50:57.673Z'
+ updated_at: '2021-10-13T07:50:57.677Z'
link:
is_container: false
is_root: false
@@ -3558,8 +3570,8 @@ paths:
lft: 14
rgt: 15
depth: 1
- created_at: '2021-10-12T12:14:20.834Z'
- updated_at: '2021-10-12T12:14:20.838Z'
+ created_at: '2021-10-13T07:50:57.727Z'
+ updated_at: '2021-10-13T07:50:57.732Z'
link:
is_container: false
is_root: false
@@ -3585,7 +3597,7 @@ paths:
- id: '1'
type: menu_item
attributes:
- name: Alias totam nulla officia voluptates iure numquam.
+ name: Odit reprehenderit eum reiciendis adipisci unde.
subtitle:
destination:
new_window: false
@@ -3595,8 +3607,8 @@ paths:
lft: 1
rgt: 16
depth: 0
- created_at: '2021-10-12T12:14:20.460Z'
- updated_at: '2021-10-12T12:14:20.849Z'
+ created_at: '2021-10-13T07:50:57.331Z'
+ updated_at: '2021-10-13T07:50:57.743Z'
link:
is_container: true
is_root: true
@@ -3685,8 +3697,8 @@ paths:
lft: 8
rgt: 9
depth: 1
- created_at: '2021-10-12T12:14:21.459Z'
- updated_at: '2021-10-12T12:14:21.463Z'
+ created_at: '2021-10-13T07:50:58.384Z'
+ updated_at: '2021-10-13T07:50:58.387Z'
link:
is_container: false
is_root: false
@@ -3772,8 +3784,8 @@ paths:
lft: 8
rgt: 9
depth: 1
- created_at: '2021-10-12T12:14:21.974Z'
- updated_at: '2021-10-12T12:14:21.978Z'
+ created_at: '2021-10-13T07:50:58.821Z'
+ updated_at: '2021-10-13T07:50:58.826Z'
link:
is_container: false
is_root: false
@@ -3855,8 +3867,8 @@ paths:
lft: 8
rgt: 9
depth: 1
- created_at: '2021-10-12T12:14:22.637Z'
- updated_at: '2021-10-12T12:14:22.659Z'
+ created_at: '2021-10-13T07:50:59.589Z'
+ updated_at: '2021-10-13T07:50:59.613Z'
link:
is_container: false
is_root: false
@@ -3981,8 +3993,8 @@ paths:
lft: 5
rgt: 6
depth: 2
- created_at: '2021-10-12T12:14:24.198Z'
- updated_at: '2021-10-12T12:14:24.222Z'
+ created_at: '2021-10-13T07:51:01.198Z'
+ updated_at: '2021-10-13T07:51:01.222Z'
link:
is_container: false
is_root: false
@@ -4074,25 +4086,25 @@ paths:
name: Main Menu
location: header
locale: en
- created_at: '2021-10-12T12:14:24.669Z'
- updated_at: '2021-10-12T12:14:24.792Z'
+ created_at: '2021-10-13T07:51:01.656Z'
+ updated_at: '2021-10-13T07:51:01.775Z'
relationships:
menu_items:
data:
- - id: '89'
- type: menu_item
- id: '87'
type: menu_item
- id: '90'
type: menu_item
+ - id: '89'
+ type: menu_item
- id: '19'
type: menu
attributes:
name: Footer Menu
location: footer
locale: en
- created_at: '2021-10-12T12:14:24.679Z'
- updated_at: '2021-10-12T12:14:24.954Z'
+ created_at: '2021-10-13T07:51:01.665Z'
+ updated_at: '2021-10-13T07:51:01.877Z'
relationships:
menu_items:
data:
@@ -4151,8 +4163,8 @@ paths:
name: Main Menu
location: header
locale: en
- created_at: '2021-10-12T12:14:25.251Z'
- updated_at: '2021-10-12T12:14:25.258Z'
+ created_at: '2021-10-13T07:51:02.160Z'
+ updated_at: '2021-10-13T07:51:02.167Z'
relationships:
menu_items:
data:
@@ -4216,8 +4228,8 @@ paths:
name: Main Menu
location: header
locale: en
- created_at: '2021-10-12T12:14:25.296Z'
- updated_at: '2021-10-12T12:14:25.304Z'
+ created_at: '2021-10-13T07:51:02.201Z'
+ updated_at: '2021-10-13T07:51:02.208Z'
relationships:
menu_items:
data:
@@ -4275,8 +4287,8 @@ paths:
name: Main Menu
location: header
locale: en
- created_at: '2021-10-12T12:14:25.375Z'
- updated_at: '2021-10-12T12:14:25.382Z'
+ created_at: '2021-10-13T07:51:02.345Z'
+ updated_at: '2021-10-13T07:51:02.353Z'
relationships:
menu_items:
data:
@@ -4393,26 +4405,26 @@ paths:
Example:
value:
data:
- - id: '67'
+ - id: '68'
type: option_type
attributes:
- name: foo-size-67
+ name: foo-size-68
presentation: Size
position: 1
- created_at: '2021-10-12T12:14:25.552Z'
- updated_at: '2021-10-12T12:14:25.552Z'
+ created_at: '2021-10-13T07:51:02.516Z'
+ updated_at: '2021-10-13T07:51:02.516Z'
filterable: true
relationships:
option_values:
data: []
- - id: '68'
+ - id: '69'
type: option_type
attributes:
- name: foo-size-68
+ name: foo-size-69
presentation: Size
position: 2
- created_at: '2021-10-12T12:14:25.554Z'
- updated_at: '2021-10-12T12:14:25.554Z'
+ created_at: '2021-10-13T07:51:02.517Z'
+ updated_at: '2021-10-13T07:51:02.517Z'
filterable: true
relationships:
option_values:
@@ -4453,14 +4465,14 @@ paths:
Example:
value:
data:
- id: '71'
+ id: '72'
type: option_type
attributes:
- name: foo-size-71
+ name: foo-size-72
presentation: Size
position: 1
- created_at: '2021-10-12T12:14:25.607Z'
- updated_at: '2021-10-12T12:14:25.607Z'
+ created_at: '2021-10-13T07:51:02.568Z'
+ updated_at: '2021-10-13T07:51:02.568Z'
filterable: true
relationships:
option_values:
@@ -4507,14 +4519,14 @@ paths:
Example:
value:
data:
- id: '72'
+ id: '73'
type: option_type
attributes:
- name: foo-size-72
+ name: foo-size-73
presentation: Size
position: 1
- created_at: '2021-10-12T12:14:25.637Z'
- updated_at: '2021-10-12T12:14:25.637Z'
+ created_at: '2021-10-13T07:51:02.596Z'
+ updated_at: '2021-10-13T07:51:02.596Z'
filterable: true
relationships:
option_values:
@@ -4558,14 +4570,14 @@ paths:
Example:
value:
data:
- id: '74'
+ id: '75'
type: option_type
attributes:
name: Size-X
presentation: Size
position: 1
- created_at: '2021-10-12T12:14:25.685Z'
- updated_at: '2021-10-12T12:14:25.693Z'
+ created_at: '2021-10-13T07:51:02.643Z'
+ updated_at: '2021-10-13T07:51:02.651Z'
filterable: true
relationships:
option_values:
@@ -4683,31 +4695,31 @@ paths:
Example:
value:
data:
- - id: '67'
+ - id: '68'
type: option_value
attributes:
position: 1
- name: Size-67
+ name: Size-68
presentation: S
- created_at: '2021-10-12T12:14:25.815Z'
- updated_at: '2021-10-12T12:14:25.815Z'
+ created_at: '2021-10-13T07:51:02.772Z'
+ updated_at: '2021-10-13T07:51:02.772Z'
relationships:
option_type:
data:
- id: '79'
+ id: '80'
type: option_type
- - id: '68'
+ - id: '69'
type: option_value
attributes:
position: 1
- name: Size-68
+ name: Size-69
presentation: S
- created_at: '2021-10-12T12:14:25.821Z'
- updated_at: '2021-10-12T12:14:25.821Z'
+ created_at: '2021-10-13T07:51:02.778Z'
+ updated_at: '2021-10-13T07:51:02.778Z'
relationships:
option_type:
data:
- id: '80'
+ id: '81'
type: option_type
meta:
count: 2
@@ -4752,14 +4764,14 @@ paths:
Example:
value:
data:
- id: '71'
+ id: '72'
type: option_value
attributes:
position: 1
- name: Size-71
+ name: Size-72
presentation: S
- created_at: '2021-10-12T12:14:25.878Z'
- updated_at: '2021-10-12T12:14:25.878Z'
+ created_at: '2021-10-13T07:51:02.832Z'
+ updated_at: '2021-10-13T07:51:02.832Z'
relationships:
option_type:
data:
@@ -4812,18 +4824,18 @@ paths:
Example:
value:
data:
- id: '72'
+ id: '73'
type: option_value
attributes:
position: 1
- name: Size-72
+ name: Size-73
presentation: S
- created_at: '2021-10-12T12:14:25.911Z'
- updated_at: '2021-10-12T12:14:25.911Z'
+ created_at: '2021-10-13T07:51:02.863Z'
+ updated_at: '2021-10-13T07:51:02.863Z'
relationships:
option_type:
data:
- id: '83'
+ id: '84'
type: option_type
'404':
description: Record not found
@@ -4871,18 +4883,18 @@ paths:
Example:
value:
data:
- id: '74'
+ id: '75'
type: option_value
attributes:
position: 1
name: M
presentation: S
- created_at: '2021-10-12T12:14:25.974Z'
- updated_at: '2021-10-12T12:14:25.983Z'
+ created_at: '2021-10-13T07:51:02.920Z'
+ updated_at: '2021-10-13T07:51:02.927Z'
relationships:
option_type:
data:
- id: '85'
+ id: '86'
type: option_type
'422':
description: invalid request
@@ -4991,10 +5003,10 @@ paths:
Example:
value:
data:
- - id: '39'
+ - id: '40'
type: order
attributes:
- number: R770782125
+ number: R586780677
item_total: '0.0'
total: '0.0'
state: cart
@@ -5003,10 +5015,10 @@ paths:
payment_total: '0.0'
shipment_state:
payment_state:
special_instructions:
- created_at: '2021-10-12T12:14:26.129Z'
- updated_at: '2021-10-12T12:14:26.129Z'
+ created_at: '2021-10-13T07:51:03.068Z'
+ updated_at: '2021-10-13T07:51:03.068Z'
currency: USD
last_ip_address:
shipment_total: '0.0'
@@ -5043,7 +5055,7 @@ paths:
relationships:
user:
data:
- id: '40'
+ id: '41'
type: user
created_by:
data:
@@ -5053,7 +5065,7 @@ paths:
data:
bill_address:
data:
- id: '51'
+ id: '52'
type: address
ship_address:
data:
@@ -5075,10 +5087,10 @@ paths:
data: []
order_promotions:
data: []
- - id: '40'
+ - id: '41'
type: order
attributes:
- number: R626003161
+ number: R529704821
item_total: '0.0'
total: '0.0'
state: cart
@@ -5087,10 +5099,10 @@ paths:
payment_total: '0.0'
shipment_state:
payment_state:
special_instructions:
- created_at: '2021-10-12T12:14:26.138Z'
- updated_at: '2021-10-12T12:14:26.138Z'
+ created_at: '2021-10-13T07:51:03.076Z'
+ updated_at: '2021-10-13T07:51:03.076Z'
currency: USD
last_ip_address:
shipment_total: '0.0'
@@ -5127,7 +5139,7 @@ paths:
relationships:
user:
data:
- id: '41'
+ id: '42'
type: user
created_by:
data:
@@ -5137,7 +5149,7 @@ paths:
data:
bill_address:
data:
- id: '52'
+ id: '53'
type: address
ship_address:
data:
@@ -5202,10 +5214,10 @@ paths:
Example:
value:
data:
- id: '43'
+ id: '44'
type: order
attributes:
- number: R743801575
+ number: R865647839
item_total: '0.0'
total: '0.0'
state: cart
@@ -5216,8 +5228,8 @@ paths:
payment_state:
email:
special_instructions:
- created_at: '2021-10-12T12:14:26.423Z'
- updated_at: '2021-10-12T12:14:26.448Z'
+ created_at: '2021-10-13T07:51:03.344Z'
+ updated_at: '2021-10-13T07:51:03.361Z'
currency: USD
last_ip_address:
shipment_total: '0.0'
@@ -5262,15 +5274,15 @@ paths:
data:
bill_address:
data:
- id: '55'
+ id: '56'
type: address
ship_address:
data:
- id: '55'
+ id: '56'
type: address
line_items:
data:
- - id: '34'
+ - id: '35'
type: line_item
payments:
data:
@@ -5326,10 +5338,10 @@ paths:
Example:
value:
data:
- id: '44'
+ id: '45'
type: order
attributes:
- number: R156465321
+ number: R879311018
item_total: '10.0'
total: '110.0'
state: delivery
@@ -5338,10 +5350,10 @@ paths:
payment_total: '0.0'
shipment_state:
payment_state:
special_instructions:
- created_at: '2021-10-12T12:14:26.490Z'
- updated_at: '2021-10-12T12:14:26.728Z'
+ created_at: '2021-10-13T07:51:03.398Z'
+ updated_at: '2021-10-13T07:51:03.538Z'
currency: USD
last_ip_address:
shipment_total: '100.0'
@@ -5378,7 +5390,7 @@ paths:
relationships:
user:
data:
- id: '44'
+ id: '45'
type: user
created_by:
data:
@@ -5388,15 +5400,15 @@ paths:
data:
bill_address:
data:
- id: '56'
+ id: '57'
type: address
ship_address:
data:
- id: '57'
+ id: '58'
type: address
line_items:
data:
- - id: '35'
+ - id: '36'
type: line_item
payments:
data: []
@@ -5462,10 +5474,10 @@ paths:
Example:
value:
data:
- id: '46'
+ id: '47'
type: order
attributes:
- number: R866525468
+ number: R727237345
item_total: '10.0'
total: '110.0'
state: delivery
@@ -5476,8 +5488,8 @@ paths:
payment_state:
special_instructions:
- created_at: '2021-10-12T12:14:26.903Z'
- updated_at: '2021-10-12T12:14:27.006Z'
+ created_at: '2021-10-13T07:51:03.765Z'
+ updated_at: '2021-10-13T07:51:03.852Z'
currency: USD
last_ip_address:
shipment_total: '100.0'
@@ -5514,7 +5526,7 @@ paths:
relationships:
user:
data:
- id: '46'
+ id: '47'
type: user
created_by:
data:
@@ -5524,15 +5536,15 @@ paths:
data:
bill_address:
data:
- id: '60'
+ id: '61'
type: address
ship_address:
data:
- id: '61'
+ id: '62'
type: address
line_items:
data:
- - id: '37'
+ - id: '38'
type: line_item
payments:
data: []
@@ -5648,10 +5660,10 @@ paths:
Example:
value:
data:
- id: '51'
+ id: '52'
type: order
attributes:
- number: R312033482
+ number: R037018199
item_total: '10.0'
total: '110.0'
state: payment
@@ -5660,10 +5672,10 @@ paths:
payment_total: '0.0'
shipment_state:
payment_state:
special_instructions:
- created_at: '2021-10-12T12:14:27.603Z'
- updated_at: '2021-10-12T12:14:27.740Z'
+ created_at: '2021-10-13T07:51:04.349Z'
+ updated_at: '2021-10-13T07:51:04.470Z'
currency: USD
last_ip_address:
shipment_total: '100.0'
@@ -5700,7 +5712,7 @@ paths:
relationships:
user:
data:
- id: '51'
+ id: '52'
type: user
created_by:
data:
@@ -5710,15 +5722,15 @@ paths:
data:
bill_address:
data:
- id: '70'
+ id: '71'
type: address
ship_address:
data:
- id: '71'
+ id: '72'
type: address
line_items:
data:
- - id: '42'
+ - id: '43'
type: line_item
payments:
data: []
@@ -5787,10 +5799,10 @@ paths:
Example:
value:
data:
- id: '53'
+ id: '54'
type: order
attributes:
- number: R344796239
+ number: R647786110
item_total: '10.0'
total: '110.0'
state: payment
@@ -5799,10 +5811,10 @@ paths:
payment_total: '0.0'
shipment_state:
payment_state:
special_instructions:
- created_at: '2021-10-12T12:14:27.914Z'
- updated_at: '2021-10-12T12:14:28.043Z'
+ created_at: '2021-10-13T07:51:04.631Z'
+ updated_at: '2021-10-13T07:51:04.754Z'
currency: USD
last_ip_address:
shipment_total: '100.0'
@@ -5839,7 +5851,7 @@ paths:
relationships:
user:
data:
- id: '53'
+ id: '54'
type: user
created_by:
data:
@@ -5849,15 +5861,15 @@ paths:
data:
bill_address:
data:
- id: '74'
+ id: '75'
type: address
ship_address:
data:
- id: '75'
+ id: '76'
type: address
line_items:
data:
- - id: '44'
+ - id: '45'
type: line_item
payments:
data: []
@@ -5926,22 +5938,22 @@ paths:
Example:
value:
data:
- id: '55'
+ id: '56'
type: order
attributes:
- number: R810227114
+ number: R074201771
item_total: '10.0'
total: '110.0'
state: complete
adjustment_total: '0.0'
- completed_at: '2021-10-12T12:14:28.420Z'
+ completed_at: '2021-10-13T07:51:05.101Z'
payment_total: '0.0'
shipment_state: pending
payment_state: balance_due
special_instructions:
- created_at: '2021-10-12T12:14:28.205Z'
- updated_at: '2021-10-12T12:14:28.420Z'
+ created_at: '2021-10-13T07:51:04.904Z'
+ updated_at: '2021-10-13T07:51:05.101Z'
currency: USD
last_ip_address:
shipment_total: '100.0'
@@ -5978,7 +5990,7 @@ paths:
relationships:
user:
data:
- id: '55'
+ id: '56'
type: user
created_by:
data:
@@ -5988,15 +6000,15 @@ paths:
data:
bill_address:
data:
- id: '78'
+ id: '79'
type: address
ship_address:
data:
- id: '79'
+ id: '80'
type: address
line_items:
data:
- - id: '46'
+ - id: '47'
type: line_item
payments:
data:
@@ -6076,10 +6088,10 @@ paths:
Example:
value:
data:
- id: '58'
+ id: '59'
type: order
attributes:
- number: R704160949
+ number: R806463802
item_total: '0.0'
total: '0.0'
state: cart
@@ -6088,10 +6100,10 @@ paths:
payment_total: '0.0'
shipment_state:
payment_state:
special_instructions:
- created_at: '2021-10-12T12:14:28.714Z'
- updated_at: '2021-10-12T12:14:28.815Z'
+ created_at: '2021-10-13T07:51:05.358Z'
+ updated_at: '2021-10-13T07:51:05.451Z'
currency: USD
last_ip_address:
shipment_total: '0.0'
@@ -6128,7 +6140,7 @@ paths:
relationships:
user:
data:
- id: '58'
+ id: '59'
type: user
created_by:
data:
@@ -6138,11 +6150,11 @@ paths:
data:
bill_address:
data:
- id: '84'
+ id: '85'
type: address
ship_address:
data:
- id: '85'
+ id: '86'
type: address
line_items:
data: []
@@ -6210,10 +6222,10 @@ paths:
Example:
value:
data:
- id: '60'
+ id: '61'
type: order
attributes:
- number: R794269450
+ number: R084329893
item_total: '10.0'
total: '110.0'
state: delivery
@@ -6222,10 +6234,10 @@ paths:
payment_total: '0.0'
shipment_state:
payment_state:
special_instructions:
- created_at: '2021-10-12T12:14:28.974Z'
- updated_at: '2021-10-12T12:14:29.058Z'
+ created_at: '2021-10-13T07:51:05.600Z'
+ updated_at: '2021-10-13T07:51:05.674Z'
currency: USD
last_ip_address:
shipment_total: '100.0'
@@ -6262,7 +6274,7 @@ paths:
relationships:
user:
data:
- id: '60'
+ id: '61'
type: user
created_by:
data:
@@ -6272,15 +6284,15 @@ paths:
data:
bill_address:
data:
- id: '88'
+ id: '89'
type: address
ship_address:
data:
- id: '89'
+ id: '90'
type: address
line_items:
data:
- - id: '51'
+ - id: '52'
type: line_item
payments:
data: []
@@ -6348,22 +6360,22 @@ paths:
Example:
value:
data:
- id: '62'
+ id: '63'
type: order
attributes:
- number: R257527409
+ number: R834268409
item_total: '10.0'
total: '10.0'
state: canceled
adjustment_total: '0.0'
- completed_at: '2021-10-12T12:14:29.316Z'
+ completed_at: '2021-10-13T07:51:05.922Z'
payment_total: '0.0'
shipment_state: canceled
payment_state: void
special_instructions:
- created_at: '2021-10-12T12:14:29.218Z'
- updated_at: '2021-10-12T12:14:29.374Z'
+ created_at: '2021-10-13T07:51:05.827Z'
+ updated_at: '2021-10-13T07:51:05.978Z'
currency: USD
last_ip_address:
shipment_total: '0.0'
@@ -6400,7 +6412,7 @@ paths:
relationships:
user:
data:
- id: '62'
+ id: '63'
type: user
created_by:
data:
@@ -6410,15 +6422,15 @@ paths:
data:
bill_address:
data:
- id: '92'
+ id: '93'
type: address
ship_address:
data:
- id: '93'
+ id: '94'
type: address
line_items:
data:
- - id: '53'
+ - id: '54'
type: line_item
payments:
data: []
@@ -6502,10 +6514,10 @@ paths:
Example:
value:
data:
- id: '65'
+ id: '66'
type: order
attributes:
- number: R978357975
+ number: R063089203
item_total: '10.0'
total: '110.0'
state: delivery
@@ -6514,10 +6526,10 @@ paths:
payment_total: '0.0'
shipment_state:
payment_state:
special_instructions:
- created_at: '2021-10-12T12:14:29.656Z'
- updated_at: '2021-10-12T12:14:29.803Z'
+ created_at: '2021-10-13T07:51:06.248Z'
+ updated_at: '2021-10-13T07:51:06.396Z'
currency: USD
last_ip_address:
shipment_total: '100.0'
@@ -6554,7 +6566,7 @@ paths:
relationships:
user:
data:
- id: '65'
+ id: '66'
type: user
created_by:
data:
@@ -6564,15 +6576,15 @@ paths:
data:
bill_address:
data:
- id: '98'
+ id: '99'
type: address
ship_address:
data:
- id: '99'
+ id: '100'
type: address
line_items:
data:
- - id: '56'
+ - id: '57'
type: line_item
payments:
data:
@@ -6655,10 +6667,10 @@ paths:
Example:
value:
data:
- id: '68'
+ id: '69'
type: order
attributes:
- number: R608270954
+ number: R867227975
item_total: '10.0'
total: '10.0'
state: delivery
@@ -6667,10 +6679,10 @@ paths:
payment_total: '0.0'
shipment_state:
payment_state:
special_instructions:
- created_at: '2021-10-12T12:14:30.132Z'
- updated_at: '2021-10-12T12:14:30.267Z'
+ created_at: '2021-10-13T07:51:06.700Z'
+ updated_at: '2021-10-13T07:51:06.833Z'
currency: USD
last_ip_address:
shipment_total: '100.0'
@@ -6707,7 +6719,7 @@ paths:
relationships:
user:
data:
- id: '69'
+ id: '70'
type: user
created_by:
data:
@@ -6717,15 +6729,15 @@ paths:
data:
bill_address:
data:
- id: '104'
+ id: '105'
type: address
ship_address:
data:
- id: '105'
+ id: '106'
type: address
line_items:
data:
- - id: '59'
+ - id: '60'
type: line_item
payments:
data: []
@@ -6820,18 +6832,18 @@ paths:
Example:
value:
data:
- - id: '102'
- type: shipping_category
- attributes:
- name: 'ShippingCategory #102'
- created_at: '2021-10-12T12:14:30.547Z'
- updated_at: '2021-10-12T12:14:30.547Z'
- id: '103'
type: shipping_category
attributes:
name: 'ShippingCategory #103'
- created_at: '2021-10-12T12:14:30.548Z'
- updated_at: '2021-10-12T12:14:30.548Z'
+ created_at: '2021-10-13T07:51:07.097Z'
+ updated_at: '2021-10-13T07:51:07.097Z'
+ - id: '104'
+ type: shipping_category
+ attributes:
+ name: 'ShippingCategory #104'
+ created_at: '2021-10-13T07:51:07.098Z'
+ updated_at: '2021-10-13T07:51:07.098Z'
meta:
count: 2
total_count: 2
@@ -6875,12 +6887,12 @@ paths:
Example:
value:
data:
- id: '106'
+ id: '107'
type: shipping_category
attributes:
- name: 'ShippingCategory #106'
- created_at: '2021-10-12T12:14:30.597Z'
- updated_at: '2021-10-12T12:14:30.597Z'
+ name: 'ShippingCategory #107'
+ created_at: '2021-10-13T07:51:07.144Z'
+ updated_at: '2021-10-13T07:51:07.144Z'
'422':
description: invalid request
content:
@@ -6928,12 +6940,12 @@ paths:
Example:
value:
data:
- id: '107'
+ id: '108'
type: shipping_category
attributes:
- name: 'ShippingCategory #107'
- created_at: '2021-10-12T12:14:30.627Z'
- updated_at: '2021-10-12T12:14:30.627Z'
+ name: 'ShippingCategory #108'
+ created_at: '2021-10-13T07:51:07.174Z'
+ updated_at: '2021-10-13T07:51:07.174Z'
'404':
description: Record not found
content:
@@ -6980,12 +6992,12 @@ paths:
Example:
value:
data:
- id: '109'
+ id: '110'
type: shipping_category
attributes:
name: Default
- created_at: '2021-10-12T12:14:30.676Z'
- updated_at: '2021-10-12T12:14:30.682Z'
+ created_at: '2021-10-13T07:51:07.223Z'
+ updated_at: '2021-10-13T07:51:07.229Z'
'422':
description: invalid request
content:
@@ -7108,8 +7120,8 @@ paths:
lft: 2
rgt: 3
description:
- created_at: '2021-10-12T12:14:30.847Z'
- updated_at: '2021-10-12T12:14:30.851Z'
+ created_at: '2021-10-13T07:51:07.395Z'
+ updated_at: '2021-10-13T07:51:07.399Z'
meta_title:
meta_description:
meta_keywords:
@@ -7143,8 +7155,8 @@ paths:
lft: 4
rgt: 5
description:
- created_at: '2021-10-12T12:14:30.898Z'
- updated_at: '2021-10-12T12:14:30.901Z'
+ created_at: '2021-10-13T07:51:07.445Z'
+ updated_at: '2021-10-13T07:51:07.449Z'
meta_title:
meta_description:
meta_keywords:
@@ -7178,8 +7190,8 @@ paths:
lft: 1
rgt: 6
description:
- created_at: '2021-10-12T12:14:30.792Z'
- updated_at: '2021-10-12T12:14:30.910Z'
+ created_at: '2021-10-13T07:51:07.341Z'
+ updated_at: '2021-10-13T07:51:07.458Z'
meta_title:
meta_description:
meta_keywords:
@@ -7256,8 +7268,8 @@ paths:
lft: 2
rgt: 3
description:
- created_at: '2021-10-12T12:14:31.109Z'
- updated_at: '2021-10-12T12:14:31.114Z'
+ created_at: '2021-10-13T07:51:07.659Z'
+ updated_at: '2021-10-13T07:51:07.663Z'
meta_title:
meta_description:
meta_keywords:
@@ -7338,8 +7350,8 @@ paths:
lft: 2
rgt: 3
description:
- created_at: '2021-10-12T12:14:31.224Z'
- updated_at: '2021-10-12T12:14:31.228Z'
+ created_at: '2021-10-13T07:51:07.771Z'
+ updated_at: '2021-10-13T07:51:07.774Z'
meta_title:
meta_description:
meta_keywords:
@@ -7421,8 +7433,8 @@ paths:
lft: 2
rgt: 3
description:
- created_at: '2021-10-12T12:14:31.420Z'
- updated_at: '2021-10-12T12:14:31.444Z'
+ created_at: '2021-10-13T07:51:07.964Z'
+ updated_at: '2021-10-13T07:51:07.991Z'
meta_title:
meta_description:
meta_keywords:
@@ -7560,12 +7572,12 @@ paths:
Example:
value:
data:
- - id: '72'
+ - id: '73'
type: user
attributes:
- created_at: '2021-10-12T12:14:31.873Z'
- updated_at: '2021-10-12T12:14:31.873Z'
+ created_at: '2021-10-13T07:51:08.401Z'
+ updated_at: '2021-10-13T07:51:08.401Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -7574,12 +7586,12 @@ paths:
data:
ship_address:
data:
- - id: '73'
+ - id: '74'
type: user
attributes:
- created_at: '2021-10-12T12:14:31.878Z'
- updated_at: '2021-10-12T12:14:31.878Z'
+ created_at: '2021-10-13T07:51:08.406Z'
+ updated_at: '2021-10-13T07:51:08.406Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -7588,12 +7600,12 @@ paths:
data:
ship_address:
data:
- - id: '74'
+ - id: '75'
type: user
attributes:
- created_at: '2021-10-12T12:14:31.880Z'
- updated_at: '2021-10-12T12:14:31.880Z'
+ created_at: '2021-10-13T07:51:08.407Z'
+ updated_at: '2021-10-13T07:51:08.407Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -7645,12 +7657,12 @@ paths:
Example:
value:
data:
- id: '79'
+ id: '80'
type: user
attributes:
- created_at: '2021-10-12T12:14:31.950Z'
- updated_at: '2021-10-12T12:14:31.950Z'
+ created_at: '2021-10-13T07:51:08.480Z'
+ updated_at: '2021-10-13T07:51:08.480Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -7706,12 +7718,12 @@ paths:
Example:
value:
data:
- id: '82'
+ id: '83'
type: user
attributes:
- created_at: '2021-10-12T12:14:31.995Z'
- updated_at: '2021-10-12T12:14:31.995Z'
+ created_at: '2021-10-13T07:51:08.526Z'
+ updated_at: '2021-10-13T07:51:08.526Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -7766,12 +7778,12 @@ paths:
Example:
value:
data:
- id: '87'
+ id: '88'
type: user
attributes:
- created_at: '2021-10-12T12:14:32.060Z'
- updated_at: '2021-10-12T12:14:32.068Z'
+ created_at: '2021-10-13T07:51:08.594Z'
+ updated_at: '2021-10-13T07:51:08.603Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -7885,8 +7897,8 @@ paths:
type: wished_item
attributes:
quantity: 1
- created_at: '2021-10-12T12:14:32.371Z'
- updated_at: '2021-10-12T12:14:32.371Z'
+ created_at: '2021-10-13T07:51:08.890Z'
+ updated_at: '2021-10-13T07:51:08.890Z'
display_price: "$19.99"
display_total: "$19.99"
price: '19.99'
@@ -7894,14 +7906,14 @@ paths:
relationships:
variant:
data:
- id: '237'
+ id: '240'
type: variant
- id: '2'
type: wished_item
attributes:
quantity: 1
- created_at: '2021-10-12T12:14:32.424Z'
- updated_at: '2021-10-12T12:14:32.424Z'
+ created_at: '2021-10-13T07:51:08.933Z'
+ updated_at: '2021-10-13T07:51:08.933Z'
display_price: "$19.99"
display_total: "$19.99"
price: '19.99'
@@ -7909,14 +7921,14 @@ paths:
relationships:
variant:
data:
- id: '239'
+ id: '242'
type: variant
- id: '3'
type: wished_item
attributes:
quantity: 1
- created_at: '2021-10-12T12:14:32.474Z'
- updated_at: '2021-10-12T12:14:32.474Z'
+ created_at: '2021-10-13T07:51:08.976Z'
+ updated_at: '2021-10-13T07:51:08.976Z'
display_price: "$19.99"
display_total: "$19.99"
price: '19.99'
@@ -7924,14 +7936,14 @@ paths:
relationships:
variant:
data:
- id: '241'
+ id: '244'
type: variant
- id: '4'
type: wished_item
attributes:
quantity: 1
- created_at: '2021-10-12T12:14:32.523Z'
- updated_at: '2021-10-12T12:14:32.523Z'
+ created_at: '2021-10-13T07:51:09.021Z'
+ updated_at: '2021-10-13T07:51:09.021Z'
display_price: "$19.99"
display_total: "$19.99"
price: '19.99'
@@ -7939,7 +7951,7 @@ paths:
relationships:
variant:
data:
- id: '243'
+ id: '246'
type: variant
meta:
count: 4
@@ -7988,8 +8000,8 @@ paths:
type: wished_item
attributes:
quantity: 1
- created_at: '2021-10-12T12:14:32.896Z'
- updated_at: '2021-10-12T12:14:32.896Z'
+ created_at: '2021-10-13T07:51:09.368Z'
+ updated_at: '2021-10-13T07:51:09.368Z'
display_price: "$19.99"
display_total: "$19.99"
price: '19.99'
@@ -7997,7 +8009,7 @@ paths:
relationships:
variant:
data:
- id: '255'
+ id: '258'
type: variant
'422':
description: invalid request
@@ -8055,8 +8067,8 @@ paths:
type: wished_item
attributes:
quantity: 1
- created_at: '2021-10-12T12:14:33.112Z'
- updated_at: '2021-10-12T12:14:33.112Z'
+ created_at: '2021-10-13T07:51:09.563Z'
+ updated_at: '2021-10-13T07:51:09.563Z'
display_price: "$19.99"
display_total: "$19.99"
price: '19.99'
@@ -8064,7 +8076,7 @@ paths:
relationships:
variant:
data:
- id: '261'
+ id: '264'
type: variant
'404':
description: Record not found
@@ -8116,8 +8128,8 @@ paths:
type: wished_item
attributes:
quantity: 3
- created_at: '2021-10-12T12:14:33.463Z'
- updated_at: '2021-10-12T12:14:33.472Z'
+ created_at: '2021-10-13T07:51:09.902Z'
+ updated_at: '2021-10-13T07:51:09.909Z'
display_price: "$19.99"
display_total: "$59.97"
price: '19.99'
@@ -8125,7 +8137,7 @@ paths:
relationships:
variant:
data:
- id: '271'
+ id: '274'
type: variant
'422':
description: invalid request
@@ -8240,9 +8252,9 @@ paths:
name: Black Friday
is_private: true
is_default: false
- created_at: '2021-10-12T12:14:34.193Z'
- updated_at: '2021-10-12T12:14:34.193Z'
- token: ZtZ6ofWTbQizRMfrhfUjxy5S
+ created_at: '2021-10-13T07:51:10.560Z'
+ updated_at: '2021-10-13T07:51:10.560Z'
+ token: 9wfVNp8Juoyam27G9mK96gKa
variant_included: false
relationships:
wished_items:
@@ -8257,9 +8269,9 @@ paths:
name: Birthday
is_private: true
is_default: false
- created_at: '2021-10-12T12:14:34.194Z'
- updated_at: '2021-10-12T12:14:34.194Z'
- token: Jd3vk8B9huhtxbgaxE1YfZ3S
+ created_at: '2021-10-13T07:51:10.561Z'
+ updated_at: '2021-10-13T07:51:10.561Z'
+ token: irsy8fb8sVMMLsmHatgh9ggW
variant_included: false
relationships:
wished_items:
@@ -8317,9 +8329,9 @@ paths:
name: Wishlist_26
is_private: true
is_default: false
- created_at: '2021-10-12T12:14:34.662Z'
- updated_at: '2021-10-12T12:14:34.662Z'
- token: 5yBrFZ9SUqVTaMumh6z1qb3Q
+ created_at: '2021-10-13T07:51:11.009Z'
+ updated_at: '2021-10-13T07:51:11.009Z'
+ token: ZM7d9HjC8AWq2DGm5h7a3js3
variant_included: false
relationships:
wished_items:
@@ -8379,9 +8391,9 @@ paths:
name: My Wishlist
is_private: true
is_default: false
- created_at: '2021-10-12T12:14:34.700Z'
- updated_at: '2021-10-12T12:14:34.700Z'
- token: iGmdoY2jHHiYg8WGgGu2EJGn
+ created_at: '2021-10-13T07:51:11.045Z'
+ updated_at: '2021-10-13T07:51:11.045Z'
+ token: TvHHWcamCWpZpUNH4xZKbYYu
variant_included: false
relationships:
wished_items:
@@ -8438,9 +8450,9 @@ paths:
name: My Super Wishlist
is_private: true
is_default: false
- created_at: '2021-10-12T12:14:34.760Z'
- updated_at: '2021-10-12T12:14:34.768Z'
- token: nGZ7kz3KVuPAgjjEgsxyjnYv
+ created_at: '2021-10-13T07:51:11.109Z'
+ updated_at: '2021-10-13T07:51:11.117Z'
+ token: U9XEczeb428DWeJ9W4MqoRtE
variant_included: false
relationships:
wished_items:
@@ -8714,7 +8726,7 @@ components:
completed_at:
type: string
format: date_time
- example: 2021-10-12 12:14:06 UTC
+ example: 2021-10-13 07:50:42 UTC
bill_address_id:
type: string
example: '1'
@@ -8782,7 +8794,7 @@ components:
approved_at:
type: string
format: date_time
- example: 2021-10-12 12:14:06 UTC
+ example: 2021-10-13 07:50:42 UTC
confirmation_delivered:
type: boolean
example: true
diff --git a/api/spec/integration/api/v2/platform/digital_links_spec.rb b/api/spec/integration/api/v2/platform/digital_links_spec.rb
index b5871da085..246ae121ad 100644
--- a/api/spec/integration/api/v2/platform/digital_links_spec.rb
+++ b/api/spec/integration/api/v2/platform/digital_links_spec.rb
@@ -37,6 +37,8 @@ describe 'Digital Link API', swagger: true do
parameter name: :id, in: :path, type: :string
it_behaves_like 'record updated'
+ it_behaves_like 'record not found'
+ it_behaves_like 'authentication failed'
end
end
end
diff --git a/core/app/models/spree/digital_link.rb b/core/app/models/spree/digital_link.rb
index 3f33688c9a..b16c08ccf2 100644
--- a/core/app/models/spree/digital_link.rb
+++ b/core/app/models/spree/digital_link.rb
@@ -14,15 +14,19 @@ module Spree
end
def expired?
- return unless line_item.order.store.limit_digital_download_days
-
- created_at <= line_item.order.store.digital_asset_authorized_days.day.ago
+ if line_item.order.store.limit_digital_download_days
+ created_at <= line_item.order.store.digital_asset_authorized_days.day.ago
+ else
+ false
+ end
end
def access_limit_exceeded?
- return unless line_item.order.store.limit_digital_download_count
-
- access_counter >= line_item.order.store.digital_asset_authorized_clicks
+ if line_item.order.store.limit_digital_download_count
+ access_counter >= line_item.order.store.digital_asset_authorized_clicks
+ else
+ false
+ end
end
# This method should be called when a download is initiated.
diff --git a/core/spec/models/spree/digital_link_spec.rb b/core/spec/models/spree/digital_link_spec.rb
new file mode 100644
index 0000000000..03fc415f3e
--- /dev/null
+++ b/core/spec/models/spree/digital_link_spec.rb
@@ -0,0 +1,181 @@
+require 'spec_helper'
+
+describe Spree::DigitalLink, type: :model do
+ let(:store) { Spree::Store.default }
+ let(:digital) { create(:digital) }
+ let(:variant) { digital.variant }
+ let(:line_item) { create(:line_item, variant: variant) }
+
+ it 'validates presence of digital and line_item' do
+ expect(described_class.new(digital: digital, line_item: line_item)).to be_valid
+ end
+
+ it 'validates presence of line_item' do
+ expect(described_class.new(digital: digital)).not_to be_valid
+ end
+
+ it 'validates presence of digital' do
+ expect(described_class.new(line_item: line_item)).not_to be_valid
+ end
+
+ context 'validates access_counter' do
+ it 'validates access_counter numericality' do
+ expect(described_class.new(digital: digital, line_item: line_item, access_counter: 'string')).not_to be_valid
+ end
+
+ it 'validates access_counter 0 or greater' do
+ expect(described_class.new(digital: digital, line_item: line_item, access_counter: -3)).not_to be_valid
+ end
+
+ it 'validates access_counter 0 is valid' do
+ expect(described_class.new(digital: digital, line_item: line_item, access_counter: 0)).to be_valid
+ end
+ end
+
+ describe '#reset!' do
+ let!(:digital_link_count_check) { create(:digital_link, access_counter: 5) }
+ let!(:digital_link_created_at_check) { create(:digital_link) }
+
+ it 'resets created at and access_counter' do
+ expect { digital_link_created_at_check.reset! }.to change(digital_link_created_at_check, :created_at)
+ expect { digital_link_count_check.reset! }.to change(digital_link_count_check, :access_counter)
+ end
+ end
+
+ describe '#expired?' do
+ context 'out of date' do
+ let(:digital_link) { create(:digital_link) }
+
+ before do
+ digital_link.update(created_at: 3.years.ago)
+ digital_link.save!
+ digital_link.reload
+ end
+
+ it { expect(digital_link.expired?).to be true }
+ end
+
+ context 'out of date but the store does not track date of expire' do
+ let(:digital_link) { create(:digital_link) }
+
+ before do
+ digital_link.line_item.order.store.update(limit_digital_download_days: false)
+ digital_link.line_item.order.store.save!
+ digital_link.line_item.order.store.reload
+ end
+
+ it { expect(digital_link.expired?).to be false }
+ end
+
+ context 'still in date' do
+ let(:digital_link) { create(:digital_link) }
+
+ it { expect(digital_link.expired?).to be false }
+ end
+ end
+
+ describe '#access_limit_exceeded?' do
+ context 'count exceeded' do
+ let(:digital_link) { create(:digital_link) }
+
+ before do
+ digital_link.update(access_counter: 1000)
+ digital_link.save!
+ digital_link.reload
+ end
+
+ it { expect(digital_link.access_limit_exceeded?).to be true }
+ end
+
+ context 'count exceeded but the store does not limit digital download count' do
+ let(:digital_link) { create(:digital_link) }
+
+ before do
+ digital_link.line_item.order.store.update(limit_digital_download_count: false)
+ digital_link.line_item.order.store.save!
+ digital_link.line_item.order.store.reload
+ end
+
+ it { expect(digital_link.access_limit_exceeded?).to be false }
+ end
+
+ context 'still in count range' do
+ let(:digital_link) { create(:digital_link) }
+
+ it { expect(digital_link.access_limit_exceeded?).to be false }
+ end
+ end
+
+ describe '#authorizable?' do
+ context 'count exceeded' do
+ let(:digital_link) { create(:digital_link) }
+
+ before do
+ digital_link.update(access_counter: 1000)
+ digital_link.save!
+ digital_link.reload
+ end
+
+ it { expect(digital_link.authorizable?).to be false }
+ end
+
+ context 'count exceeded but the store does not limit digital download count' do
+ let(:digital_link) { create(:digital_link) }
+
+ before do
+ digital_link.line_item.order.store.update(limit_digital_download_count: false)
+ digital_link.line_item.order.store.save!
+ digital_link.line_item.order.store.reload
+ end
+
+ it { expect(digital_link.authorizable?).to be true }
+ end
+
+ context 'still in count range' do
+ let(:digital_link) { create(:digital_link) }
+
+ it { expect(digital_link.authorizable?).to be true }
+ end
+
+ context 'out of date' do
+ let(:digital_link) { create(:digital_link) }
+
+ before do
+ digital_link.update(created_at: 3.years.ago)
+ digital_link.save!
+ digital_link.reload
+ end
+
+ it { expect(digital_link.authorizable?).to be false }
+ end
+
+ context 'out of date but the store does not track date of expire' do
+ let(:digital_link) { create(:digital_link) }
+
+ before do
+ digital_link.line_item.order.store.update(limit_digital_download_days: false)
+ digital_link.line_item.order.store.save!
+ digital_link.line_item.order.store.reload
+ end
+
+ it { expect(digital_link.authorizable?).to be true }
+ end
+
+ context 'still in date' do
+ let(:digital_link) { create(:digital_link) }
+
+ it { expect(digital_link.authorizable?).to be true }
+ end
+ end
+
+ describe 'authorize!' do
+ let(:digital_link) { create(:digital_link, access_counter: 2) }
+
+ it 'resets the access counter' do
+ digital_link.authorize!
+ expect(digital_link.access_counter).to eq(3)
+ digital_link.reset!
+ expect(digital_link.access_counter).to eq(0)
+ end
+ end
+end
diff --git a/core/spec/models/spree/digital_spec.rb b/core/spec/models/spree/digital_spec.rb
new file mode 100644
index 0000000000..fec84852da
--- /dev/null
+++ b/core/spec/models/spree/digital_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe Spree::Digital, type: :model do
+ include ActionDispatch::TestProcess::FixtureFile
+
+ let(:file_upload) { fixture_file_upload(file_fixture('icon_256x256.png'), 'image/png') }
+ let(:variant) { create(:variant) }
+
+ it 'validates presence of variant' do
+ expect(described_class.new(attachment: file_upload)).not_to be_valid
+ end
+
+ it 'validates presence of attachment' do
+ expect(described_class.new(variant: variant)).not_to be_valid
+ end
+
+ it 'validates presence of attachment and variant' do
+ expect(described_class.new(variant: variant, attachment: file_upload)).to be_valid
+ end
+end