item_models 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/item_models/version.rb +1 -1
- data/lib/models/item.rb +4 -0
- data/lib/models/item_listing.rb +8 -0
- data/lib/models/variant.rb +5 -0
- data/lib/models/variant_listing.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2093ffd195104bfddd2d79661d2e61a987f29046c52049633541c0fe19e6a0e5
|
4
|
+
data.tar.gz: 1e6f5a1c3d04f65ef36186e7ebc8cab503a79a0fa476680a927e000499e8c94c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dd4928eaaa427901f61e18c0f5ece615511f088b53ee5e563f17e47c65fa2517ef86e3b6e993b062bc4e038e35eee782ec0c152a8400ff59a71a2f5c6b2a64a
|
7
|
+
data.tar.gz: 649f591532485d598e0d0c4b1162b92e75ea3cfa1bd175d076c0bb5e12e148ffda801f348281fe06c8700d595bed5fc5b66f710ae2f35b7ec08343021a27aec0
|
data/lib/item_models/version.rb
CHANGED
data/lib/models/item.rb
CHANGED
data/lib/models/item_listing.rb
CHANGED
@@ -21,4 +21,12 @@ class ItemListing < ItemApplicationRecord
|
|
21
21
|
has_one :category,
|
22
22
|
dependent: :destroy,
|
23
23
|
autosave: true
|
24
|
+
|
25
|
+
def assign_from_item(item)
|
26
|
+
self.item_id = item.id
|
27
|
+
end
|
28
|
+
|
29
|
+
def assign_from_account(account)
|
30
|
+
self.channel_id = account.channel_id
|
31
|
+
end
|
24
32
|
end
|
data/lib/models/variant.rb
CHANGED
@@ -13,4 +13,9 @@ class Variant < ItemApplicationRecord
|
|
13
13
|
has_many :item_listing_variant_custom_field, foreign_key: :variant_id
|
14
14
|
has_many :item_listing_custom_field, foreign_key: :variant_id
|
15
15
|
has_one :master_catalog, foreign_key: :variant_id
|
16
|
+
|
17
|
+
def assign_from_item(item)
|
18
|
+
self.item_id = item.id
|
19
|
+
self.profile_id = item.profile_id
|
20
|
+
end
|
16
21
|
end
|
@@ -35,4 +35,17 @@ class VariantListing < ItemApplicationRecord
|
|
35
35
|
"channel_association_id = ? AND variant_id = ? AND account_id = ?", self.channel_association_id, self.variant_id, self.profile_channel_association_id
|
36
36
|
)
|
37
37
|
end
|
38
|
+
|
39
|
+
def assign_from_variant(variant)
|
40
|
+
self.variant_id = variant.id
|
41
|
+
end
|
42
|
+
|
43
|
+
def assign_from_item_listing(item)
|
44
|
+
self.channel_association_id = item.id
|
45
|
+
end
|
46
|
+
|
47
|
+
def assign_from_account(account)
|
48
|
+
self.profile_channel_association_id = account.id
|
49
|
+
self.channel_id = account.channel_id
|
50
|
+
end
|
38
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: item_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alexander
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|