item_models 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/item_models/version.rb +1 -1
- data/lib/models/item.rb +5 -0
- data/lib/models/item_listing.rb +8 -0
- data/lib/models/item_listing_brand.rb +4 -0
- data/lib/models/item_listing_category.rb +4 -0
- data/lib/models/item_listing_variant_custom_field.rb +4 -0
- data/lib/models/option_type.rb +8 -0
- data/lib/models/tokopedia_category.rb +22 -0
- data/lib/models/tokopedia_item_variant_custom_field.rb +5 -0
- data/lib/models/variant.rb +7 -0
- data/lib/models/variant_listing.rb +13 -0
- data/lib/models/variant_option_association.rb +2 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d872a325665c20b099296417ca9dc897438119060e8a7afdfba68af020ad42cf
|
4
|
+
data.tar.gz: 98d4410bda21cf5bec2e2064dabe9c5b290c518140105b6b26fa837b17bf9211
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e352df5cebe787d50cee89fd1b9fbfbc469182ad884827f4c828de9240c03baabc3565dcee5ba7f53e55f9d488f8c44ef7955026974de5ca71d4fa85cd8d27e
|
7
|
+
data.tar.gz: 8290b73f9aad00ee65f029138c7087f341e8402f841011ce77ff558856e62f19fce841a5577741149633625a0307b3c5b99822372becfe79e14f87b8ff664bda
|
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
|
@@ -10,4 +10,8 @@ class ItemListingCategory < ItemApplicationRecord
|
|
10
10
|
class_name: 'ShopeeCategory',
|
11
11
|
foreign_key: :shopee_category_id,
|
12
12
|
optional: true
|
13
|
+
belongs_to :tokopedia,
|
14
|
+
class_name: 'TokopediaCategory',
|
15
|
+
foreign_key: :tokopedia_category_id,
|
16
|
+
optional: true
|
13
17
|
end
|
@@ -10,4 +10,8 @@ class ItemListingVariantCustomField < ItemApplicationRecord
|
|
10
10
|
class_name: 'ShopeeItemVariantCustomField',
|
11
11
|
foreign_key: :shopee_item_variant_custom_field_id,
|
12
12
|
optional: true
|
13
|
+
belongs_to :tokopedia,
|
14
|
+
class_name: 'TokopediaItemVariantCustomField',
|
15
|
+
foreign_key: :tokopedia_custom_field_id,
|
16
|
+
optional: true
|
13
17
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class TokopediaCategory < ItemApplicationRecord
|
4
|
+
self.table_name = 'channel_tokopedia_categories'
|
5
|
+
|
6
|
+
belongs_to :parent_category,
|
7
|
+
class_name: 'TokopediaCategory',
|
8
|
+
foreign_key: :parent_category_id,
|
9
|
+
optional: true
|
10
|
+
belongs_to :primary_category,
|
11
|
+
class_name: 'TokopediaCategory',
|
12
|
+
foreign_key: :primary_category_id,
|
13
|
+
optional: true
|
14
|
+
has_many :child_categories,
|
15
|
+
class_name: 'TokopediaCategory',
|
16
|
+
foreign_key: :parent_category_id,
|
17
|
+
dependent: :destroy
|
18
|
+
|
19
|
+
has_many :item_channel_association_categories,
|
20
|
+
class_name: '::ItemListingCategory',
|
21
|
+
foreign_key: :tokopedia_category_id
|
22
|
+
end
|
data/lib/models/variant.rb
CHANGED
@@ -13,4 +13,11 @@ 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
|
+
has_many :option_associations, class_name: 'VariantOptionAssociation', foreign_key: :variant_id
|
17
|
+
has_many :options, through: :option_associations, source: :variant_option
|
18
|
+
|
19
|
+
def assign_from_item(item)
|
20
|
+
self.item_id = item.id
|
21
|
+
self.profile_id = item.profile_id
|
22
|
+
end
|
16
23
|
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.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alexander
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- lib/models/item_listing_variant_image.rb
|
79
79
|
- lib/models/master_catalog.rb
|
80
80
|
- lib/models/master_catalog_image.rb
|
81
|
+
- lib/models/option_type.rb
|
81
82
|
- lib/models/shopee_brand.rb
|
82
83
|
- lib/models/shopee_category.rb
|
83
84
|
- lib/models/shopee_item_custom_field.rb
|
@@ -85,6 +86,8 @@ files:
|
|
85
86
|
- lib/models/shopee_item_variant_custom_field.rb
|
86
87
|
- lib/models/shopee_logistic_address.rb
|
87
88
|
- lib/models/shopee_shipping_provider.rb
|
89
|
+
- lib/models/tokopedia_category.rb
|
90
|
+
- lib/models/tokopedia_item_variant_custom_field.rb
|
88
91
|
- lib/models/variant.rb
|
89
92
|
- lib/models/variant_image.rb
|
90
93
|
- lib/models/variant_listing.rb
|