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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2bb9091dc58e62a90422baf821b798b08387d1b13e4c9bfbf3d519e26dda5cae
4
- data.tar.gz: 3675c282105208b2d61e91c187479232110fe9278c076684517c768faf161c4e
3
+ metadata.gz: 2093ffd195104bfddd2d79661d2e61a987f29046c52049633541c0fe19e6a0e5
4
+ data.tar.gz: 1e6f5a1c3d04f65ef36186e7ebc8cab503a79a0fa476680a927e000499e8c94c
5
5
  SHA512:
6
- metadata.gz: a02f15bfc3f2f3cbac0b036acad9fac5a30c85c365b4b047ca937b5bb54338de3166b6ab07469779ca1eb55acd07ec58acc31b825654d8aa1620b41f49442321
7
- data.tar.gz: 63e1a4e82230dec57a8f3090f34cac08a45bf71021f71ad9ef8ca9217f2d782138554d0cb0d891310e0956f50044d8191981d5ac424bb39f4afc8ca396287b7d
6
+ metadata.gz: 4dd4928eaaa427901f61e18c0f5ece615511f088b53ee5e563f17e47c65fa2517ef86e3b6e993b062bc4e038e35eee782ec0c152a8400ff59a71a2f5c6b2a64a
7
+ data.tar.gz: 649f591532485d598e0d0c4b1162b92e75ea3cfa1bd175d076c0bb5e12e148ffda801f348281fe06c8700d595bed5fc5b66f710ae2f35b7ec08343021a27aec0
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ItemModels
4
- VERSION = '0.0.16'
4
+ VERSION = '0.0.17'
5
5
  end
data/lib/models/item.rb CHANGED
@@ -8,4 +8,8 @@ class Item < ItemApplicationRecord
8
8
  has_many :item_listings
9
9
  has_many :bundles
10
10
  has_many :images
11
+
12
+ def assign_from_profile(profile)
13
+ self.profile_id = profile.id
14
+ end
11
15
  end
@@ -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
@@ -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.16
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-03 00:00:00.000000000 Z
11
+ date: 2022-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler