item_models_2 0.0.19

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.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/lib/item_models/version.rb +5 -0
  3. data/lib/item_models.rb +22 -0
  4. data/lib/models/activity.rb +5 -0
  5. data/lib/models/availability_option.rb +5 -0
  6. data/lib/models/bundle.rb +11 -0
  7. data/lib/models/bundle_variant.rb +10 -0
  8. data/lib/models/concerns/restorable.rb +28 -0
  9. data/lib/models/image.rb +103 -0
  10. data/lib/models/item.rb +16 -0
  11. data/lib/models/item_application_record.rb +6 -0
  12. data/lib/models/item_listing.rb +32 -0
  13. data/lib/models/item_listing_brand.rb +17 -0
  14. data/lib/models/item_listing_category.rb +17 -0
  15. data/lib/models/item_listing_custom_field.rb +16 -0
  16. data/lib/models/item_listing_image.rb +10 -0
  17. data/lib/models/item_listing_variant_custom_field.rb +17 -0
  18. data/lib/models/item_listing_variant_image.rb +9 -0
  19. data/lib/models/master_catalog.rb +8 -0
  20. data/lib/models/master_catalog_image.rb +8 -0
  21. data/lib/models/option_type.rb +8 -0
  22. data/lib/models/shopee_brand.rb +9 -0
  23. data/lib/models/shopee_category.rb +22 -0
  24. data/lib/models/shopee_item_custom_field.rb +8 -0
  25. data/lib/models/shopee_item_custom_field_category_associations.rb +5 -0
  26. data/lib/models/shopee_item_custom_field_option.rb +10 -0
  27. data/lib/models/shopee_item_variant_custom_field.rb +5 -0
  28. data/lib/models/shopee_logistic_address.rb +5 -0
  29. data/lib/models/shopee_shipping_provider.rb +5 -0
  30. data/lib/models/tokopedia_category.rb +22 -0
  31. data/lib/models/tokopedia_item_variant_custom_field.rb +5 -0
  32. data/lib/models/variant.rb +23 -0
  33. data/lib/models/variant_image.rb +10 -0
  34. data/lib/models/variant_listing.rb +51 -0
  35. data/lib/models/variant_listing_price_history.rb +7 -0
  36. data/lib/models/variant_listing_stock_allocation.rb +7 -0
  37. data/lib/models/variant_option.rb +9 -0
  38. data/lib/models/variant_option_association.rb +11 -0
  39. metadata +123 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 29abc0e0e6b52a4d5f689da49f0257d7617fcb8d3f527ea8078817988a3ddc82
4
+ data.tar.gz: 305722c08a0bcc97cba80afc90005a92d27ef778caa315f909198ec23cd0dbc4
5
+ SHA512:
6
+ metadata.gz: 94f3eb447d5dd94c67bb135f07547b15607a2394d3d447582779e66e92ab4985089b1e5b8ccd90d35c717088cd46b2a829454192f5c3715f7afc7da82c9a2ef6
7
+ data.tar.gz: 18db553231544bb32991259b909a6f9be646f2ce40f5aedca31f4b6789b3aee57e403dd7e32e4c51c676572cde80e725e4d8319759b306007adb0d8c55db6aaa
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ItemModels
4
+ VERSION = '0.0.19'
5
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'item_models/version'
4
+
5
+ module ItemModels
6
+ class Error < StandardError; end
7
+ # Your code goes here...
8
+ def self.load
9
+ require directory + '/lib/models/item_application_record'
10
+ files.each {|file| require file }
11
+ end
12
+
13
+ private
14
+
15
+ def self.files
16
+ Dir[ directory + '/lib/models/*.rb']
17
+ end
18
+
19
+ def self.directory
20
+ Gem::Specification.find_by_name("item_models").gem_dir
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Activity < ItemApplicationRecord
4
+ self.table_name = 'item_activities'
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AvailabilityOption < ItemApplicationRecord
4
+ self.table_name = 'item_availability_options'
5
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'concerns/restorable'
4
+ class Bundle < ItemApplicationRecord
5
+ self.table_name = 'item_bundles'
6
+ include ::Restorable
7
+
8
+ belongs_to :variant
9
+ belongs_to :item
10
+ has_many :bundle_variants
11
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'concerns/restorable'
4
+ class BundleVariant < ItemApplicationRecord
5
+ self.table_name = 'item_bundle_variants'
6
+ include ::Restorable
7
+
8
+ belongs_to :bundle
9
+ belongs_to :variant
10
+ end
@@ -0,0 +1,28 @@
1
+ module Restorable
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ acts_as_paranoid column: :removed, sentinel_value: false
6
+ acts_as_paranoid column: :removed_at, sentinel_value: false
7
+
8
+ # It seems paranoia bug: method_missing `deleted_at`
9
+ # when restore with `recovery_window`
10
+ alias_attribute :deleted_at, :removed_at
11
+
12
+ private
13
+
14
+ def paranoia_restore_attributes
15
+ {
16
+ removed_at: nil,
17
+ removed: false
18
+ }
19
+ end
20
+
21
+ def paranoia_destroy_attributes
22
+ {
23
+ removed_at: current_time_from_proper_timezone,
24
+ removed: nil
25
+ }
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'concerns/restorable'
4
+ class Image < ItemApplicationRecord
5
+ self.table_name = 'item_images'
6
+ include ::Restorable
7
+
8
+ belongs_to :item
9
+ has_many :item_listing_images
10
+ has_many :variant_images, foreign_key: :item_image_id
11
+ has_many :master_catalog_images
12
+ has_many :item_listing_variant_custom_fields
13
+
14
+ has_attached_file :image,
15
+ path: '/system/item/:class/:attachment/:id_partition/:style/:fingerprint.:extension',
16
+ default_url: lambda { |attach|
17
+ attach.instance.url || '/public/missing/missing-item.jpg'
18
+ },
19
+ styles: lambda { |attachment|
20
+ object = attachment.instance.image.queued_for_write[:original]
21
+ width, height =
22
+ if object
23
+ FastImage.size(object) || [0,0]
24
+ else
25
+ [(attachment.instance.width || 500), (attachment.instance.height || 500)]
26
+ end
27
+
28
+ dim = [width, height]
29
+ clamped_dim = dim.max && [600, dim.max, 2000].sort[1]
30
+ big_clamped_dim = dim.max && [1100, dim.max, 2000].sort[1]
31
+
32
+ # max hxw and ratio (1100 x 762)
33
+ ratio_381_550 = 1100/762.to_f
34
+ real_ratio = height/width.to_f
35
+
36
+ # If real ratio is smaller, then width is thicker than desired width, therefor
37
+ # adjust height to fit desired ratio.
38
+ if real_ratio < ratio_381_550
39
+ w_381_550 = width
40
+ h_381_550 = width * ratio_381_550
41
+ else
42
+ w_381_550 = height / ratio_381_550
43
+ h_381_550 = height
44
+ end
45
+
46
+ {
47
+ xlarge: {
48
+ geometry: '1600x1600>',
49
+ format: :jpg,
50
+ convert_options: '-strip -interlace Plane -background white -alpha remove -flatten -alpha off'
51
+ },
52
+ large: {
53
+ geometry: '1000x1000>',
54
+ format: :jpg,
55
+ convert_options: '-strip -interlace Plane -background white -alpha remove -flatten -alpha off'
56
+ },
57
+ medium: {
58
+ geometry: '800x800>',
59
+ format: :jpg,
60
+ convert_options: '-strip -interlace Plane -background white -alpha remove -flatten -alpha off'
61
+ },
62
+ small: {
63
+ geometry: '500x500>',
64
+ format: :jpg,
65
+ convert_options: '-strip -interlace Plane -background white -alpha remove -flatten -alpha off'
66
+ },
67
+ thumb: {
68
+ geometry: '100x100>',
69
+ format: :jpg,
70
+ convert_options: '-strip -interlace Plane -background white -alpha remove -flatten -alpha off'
71
+ },
72
+ marketplace: {
73
+ geometry: '500x500<',
74
+ format: :jpg,
75
+ convert_options: '-strip -interlace Plane -background white -alpha remove -flatten -alpha off'
76
+ },
77
+ # Lazada needs colorspace to be sRGB. CMYK colorspace will produce error
78
+ square: {
79
+ geometry: dim.max && dim.max < 600 ? '600x600<' : '2000x2000>',
80
+ format: :jpg,
81
+ convert_options: "-strip -colorspace sRGB -interlace Plane -background white -alpha remove -flatten -alpha off -gravity center -extent #{clamped_dim}x#{clamped_dim}"
82
+ },
83
+ # Zalora
84
+ big_square: {
85
+ geometry: dim.max && dim.max < 1100 ? '1100x1100<' : '2000x2000>',
86
+ format: :jpg,
87
+ convert_options: "-strip -colorspace sRGB -interlace Plane -background white -alpha remove -flatten -alpha off -gravity center -extent #{big_clamped_dim}x#{big_clamped_dim}"
88
+ },
89
+ # lyke
90
+ ratio_381_550: {
91
+ geometry: w_381_550 <= 762 ? '762x1100<' : '762x1100>',
92
+ format: :jpeg,
93
+ convert_options: "-strip -colorspace sRGB -interlace Plane -background white -alpha remove -flatten -alpha off -gravity center -extent 762x1100"
94
+ },
95
+ # elevenia
96
+ width_780_or_less: {
97
+ geometry: '780x>',
98
+ format: :jpg,
99
+ convert_options: '-strip -interlace Plane -background white -alpha remove -flatten -alpha off'
100
+ }
101
+ }
102
+ }
103
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'concerns/restorable'
4
+ class Item < ItemApplicationRecord
5
+ include ::Restorable
6
+
7
+ has_many :variants
8
+ has_many :item_listings
9
+ has_many :bundles
10
+ has_many :images
11
+ has_many :option_types, foreign_key: :item_id
12
+
13
+ def assign_from_profile(profile)
14
+ self.profile_id = profile.id
15
+ end
16
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ItemApplicationRecord < ActiveRecord::Base
4
+ self.abstract_class = true
5
+ connects_to database: { writing: :item_model, reading: :item_model }
6
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'concerns/restorable'
4
+ class ItemListing < ItemApplicationRecord
5
+ self.table_name = 'item_channel_associations'
6
+ include ::Restorable
7
+
8
+ belongs_to :item
9
+ has_many :variant_listings, foreign_key: :channel_association_id
10
+ has_many :item_listing_images, foreign_key: :channel_association_id
11
+ has_one :item_listing_category, foreign_key: :channel_association_id
12
+ has_one :item_listing_brand, foreign_key: :channel_association_id
13
+ has_many :item_listing_variant_custom_fields, foreign_key: :channel_association_id
14
+ has_many :item_listing_custom_fields, foreign_key: :channel_association_id
15
+ has_many :item_listing_variant_images, foreign_key: :channel_association_id
16
+ has_many :images,
17
+ class_name: 'ItemListingImage',
18
+ dependent: :destroy,
19
+ autosave: true,
20
+ foreign_key: :channel_association_id
21
+ has_one :category,
22
+ dependent: :destroy,
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
32
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'concerns/restorable'
4
+ class ItemListingBrand < ItemApplicationRecord
5
+ self.table_name = 'item_channel_association_brands'
6
+ include ::Restorable
7
+
8
+ belongs_to :item_listing, foreign_key: :channel_association_id
9
+ belongs_to :shopee,
10
+ class_name: 'ShopeeBrand',
11
+ foreign_key: :shopee_brand_id,
12
+ optional: true
13
+ belongs_to :tokopedia,
14
+ class_name: 'ShopeeBrand',
15
+ foreign_key: :shopee_brand_id,
16
+ optional: true
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'concerns/restorable'
4
+ class ItemListingCategory < ItemApplicationRecord
5
+ self.table_name = 'item_channel_association_categories'
6
+ include ::Restorable
7
+
8
+ belongs_to :item_listing, foreign_key: :channel_association_id
9
+ belongs_to :shopee,
10
+ class_name: 'ShopeeCategory',
11
+ foreign_key: :shopee_category_id,
12
+ optional: true
13
+ belongs_to :tokopedia,
14
+ class_name: 'TokopediaCategory',
15
+ foreign_key: :tokopedia_category_id,
16
+ optional: true
17
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'concerns/restorable'
4
+ class ItemListingCustomField < ItemApplicationRecord
5
+ self.table_name = 'item_channel_association_custom_fields'
6
+ include ::Restorable
7
+
8
+ belongs_to :item_listing, foreign_key: :channel_association_id
9
+ belongs_to :variant
10
+ belongs_to :shopee,
11
+ class_name: 'ShopeeItemCustomField',
12
+ foreign_key: :shopee_item_custom_field_id,
13
+ optional: true
14
+
15
+ serialize :value
16
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'concerns/restorable'
4
+ class ItemListingImage < ItemApplicationRecord
5
+ self.table_name = 'item_channel_association_images'
6
+ include ::Restorable
7
+
8
+ belongs_to :image
9
+ belongs_to :item_listing, foreign_key: :channel_association_id
10
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ItemListingVariantCustomField < ItemApplicationRecord
4
+ self.table_name = 'item_channel_association_variant_custom_fields'
5
+
6
+ belongs_to :item_listing, foreign_key: :channel_association_id
7
+ belongs_to :variant
8
+ belongs_to :image
9
+ belongs_to :shopee,
10
+ class_name: 'ShopeeItemVariantCustomField',
11
+ foreign_key: :shopee_item_variant_custom_field_id,
12
+ optional: true
13
+ belongs_to :tokopedia,
14
+ class_name: 'TokopediaItemVariantCustomField',
15
+ foreign_key: :tokopedia_custom_field_id,
16
+ optional: true
17
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ItemListingVariantImage < ItemApplicationRecord
4
+ self.table_name = 'item_channel_association_variant_images'
5
+
6
+ belongs_to :image,
7
+ class_name: 'Image',
8
+ optional: true
9
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class MasterCatalog < ItemApplicationRecord
4
+ self.table_name = 'item_variant_master_assocs'
5
+
6
+ belongs_to :variant
7
+ has_many :master_catalog_images, foreign_key: :master_assoc_id
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class MasterCatalogImage < ItemApplicationRecord
4
+ self.table_name = 'item_variant_master_image_assocs'
5
+
6
+ belongs_to :master_catalog, foreign_key: :master_assoc_id
7
+ belongs_to :image, foreign_key: :image_id
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class OptionType < ItemApplicationRecord
4
+ self.table_name = 'item_variant_option_types'
5
+
6
+ belongs_to :item
7
+ has_many :options, class_name: 'VariantOption', foreign_key: :option_type_id
8
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ShopeeBrand < ItemApplicationRecord
4
+ self.table_name = 'channel_shopee_brands'
5
+
6
+ has_many :item_listing_brands,
7
+ class_name: 'ItemListingBrand',
8
+ foreign_key: :shopee_brand_id
9
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ShopeeCategory < ItemApplicationRecord
4
+ self.table_name = 'channel_shopee_categories'
5
+
6
+ belongs_to :parent_category,
7
+ class_name: 'ShopeeCategory',
8
+ foreign_key: :parent_category_id,
9
+ optional: true
10
+ belongs_to :primary_category,
11
+ class_name: 'ShopeeCategory',
12
+ foreign_key: :primary_category_id,
13
+ optional: true
14
+ has_many :child_categories,
15
+ class_name: 'ShopeeCategory',
16
+ foreign_key: :parent_category_id,
17
+ dependent: :destroy
18
+
19
+ has_many :item_channel_association_categories,
20
+ class_name: '::ItemListingCategory',
21
+ foreign_key: :shopee_category_id
22
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ShopeeItemCustomField < ItemApplicationRecord
4
+ self.table_name = 'channel_shopee_item_custom_fields'
5
+
6
+ has_many :associated_custom_fields, class_name: 'ItemListingCustomField'
7
+ has_many :options, foreign_key: :custom_field_id, class_name: 'ShopeeItemCustomFieldOption'
8
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ShopeeItemCustomFieldCategoryAssociation < ItemApplicationRecord
4
+ self.table_name = 'channel_shopee_item_custom_field_category_associations'
5
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ShopeeItemCustomFieldOption < ItemApplicationRecord
4
+ self.table_name = 'channel_shopee_item_custom_field_options'
5
+
6
+ belongs_to :custom_field,
7
+ class_name: 'ShopeeItemCustomField',
8
+ foreign_key: :custom_field_id,
9
+ optional: true
10
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ShopeeItemVariantCustomField < ItemApplicationRecord
4
+ self.table_name = 'channel_shopee_variant_custom_fields'
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ShopeeLogisticAddress < ItemApplicationRecord
4
+ self.table_name = 'channel_shopee_logistic_addresses'
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ShopeeShippingProvider < ItemApplicationRecord
4
+ self.table_name = 'channel_shopee_shipping_providers'
5
+ 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
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class TokopediaItemVariantCustomField < ItemApplicationRecord
4
+ self.table_name = 'channel_tokopedia_item_variant_custom_fields'
5
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'concerns/restorable'
4
+ class Variant < ItemApplicationRecord
5
+ self.table_name = 'item_variants'
6
+ include ::Restorable
7
+
8
+ belongs_to :item
9
+ has_many :variant_images, foreign_key: :item_variant_id
10
+ has_many :bundles
11
+ has_many :variant_listings, foreign_key: :variant_id
12
+ has_many :item_listing_variant_images, foreign_key: :variant_id
13
+ has_many :item_listing_variant_custom_field, foreign_key: :variant_id
14
+ has_many :item_listing_custom_field, foreign_key: :variant_id
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
23
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'concerns/restorable'
4
+ class VariantImage < ItemApplicationRecord
5
+ self.table_name = 'item_variant_images'
6
+ include ::Restorable
7
+
8
+ belongs_to :image
9
+ belongs_to :variant
10
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'concerns/restorable'
4
+ class VariantListing < ItemApplicationRecord
5
+ self.table_name = 'item_channel_association_variant_associations'
6
+ include ::Restorable
7
+
8
+ belongs_to :variant
9
+ belongs_to :item_listing, foreign_key: :channel_association_id
10
+ has_one :variant_listing_stock_allocation,
11
+ class_name: 'VariantListingStockAllocation',
12
+ foreign_key: :variant_association_id
13
+ has_many :variant_listing_price_histories, foreign_key: :variant_association_id
14
+
15
+ serialize :option2_value
16
+ serialize :option_value
17
+ serialize :name_option
18
+ serialize :qc_reason
19
+ serialize :last_log
20
+ serialize :bukalapak_free_shipping
21
+ serialize :shopee_shipping_providers
22
+ serialize :description
23
+ serialize :description_unique_selling_point
24
+
25
+ def item_listing_custom_fields
26
+ ItemListingCustomField.where("channel_association_id = ? AND variant_id = ?", self.channel_association_id, self.variant_id)
27
+ end
28
+
29
+ def item_listing_variant_custom_fields
30
+ ItemListingVariantCustomField.where("channel_association_id = ? AND variant_id = ?", self.channel_association_id, self.variant_id)
31
+ end
32
+
33
+ def item_listing_variant_images
34
+ ItemListingVariantImage.where(
35
+ "channel_association_id = ? AND variant_id = ? AND account_id = ?", self.channel_association_id, self.variant_id, self.profile_channel_association_id
36
+ )
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
51
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class VariantListingPriceHistory < ItemApplicationRecord
4
+ self.table_name = 'item_channel_association_variant_association_stock_allocations'
5
+
6
+ belongs_to :variant_listing, foreign_key: :variant_association_id
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class VariantListingStockAllocation < ItemApplicationRecord
4
+ self.table_name = 'item_channel_association_variant_association_stock_allocations'
5
+
6
+ belongs_to :variant_listing, foreign_key: :variant_association_id
7
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'concerns/restorable'
4
+ class VariantOption < ItemApplicationRecord
5
+ self.table_name = 'item_variant_options'
6
+ include ::Restorable
7
+
8
+ has_many :variant_option_associations, foreign_key: :option_id
9
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'concerns/restorable'
4
+ class VariantOptionAssociation < ItemApplicationRecord
5
+ self.table_name = 'item_variant_option_associations'
6
+ include ::Restorable
7
+
8
+ belongs_to :variant_option, foreign_key: :option_id
9
+ belongs_to :variant, foreign_key: :variant_id
10
+ belongs_to :option_type, foreign_key: :option_type_id
11
+ end
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: item_models_2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.19
5
+ platform: ruby
6
+ authors:
7
+ - alexander
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-01-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description:
56
+ email:
57
+ - alxibra@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/item_models.rb
63
+ - lib/item_models/version.rb
64
+ - lib/models/activity.rb
65
+ - lib/models/availability_option.rb
66
+ - lib/models/bundle.rb
67
+ - lib/models/bundle_variant.rb
68
+ - lib/models/concerns/restorable.rb
69
+ - lib/models/image.rb
70
+ - lib/models/item.rb
71
+ - lib/models/item_application_record.rb
72
+ - lib/models/item_listing.rb
73
+ - lib/models/item_listing_brand.rb
74
+ - lib/models/item_listing_category.rb
75
+ - lib/models/item_listing_custom_field.rb
76
+ - lib/models/item_listing_image.rb
77
+ - lib/models/item_listing_variant_custom_field.rb
78
+ - lib/models/item_listing_variant_image.rb
79
+ - lib/models/master_catalog.rb
80
+ - lib/models/master_catalog_image.rb
81
+ - lib/models/option_type.rb
82
+ - lib/models/shopee_brand.rb
83
+ - lib/models/shopee_category.rb
84
+ - lib/models/shopee_item_custom_field.rb
85
+ - lib/models/shopee_item_custom_field_category_associations.rb
86
+ - lib/models/shopee_item_custom_field_option.rb
87
+ - lib/models/shopee_item_variant_custom_field.rb
88
+ - lib/models/shopee_logistic_address.rb
89
+ - lib/models/shopee_shipping_provider.rb
90
+ - lib/models/tokopedia_category.rb
91
+ - lib/models/tokopedia_item_variant_custom_field.rb
92
+ - lib/models/variant.rb
93
+ - lib/models/variant_image.rb
94
+ - lib/models/variant_listing.rb
95
+ - lib/models/variant_listing_price_history.rb
96
+ - lib/models/variant_listing_stock_allocation.rb
97
+ - lib/models/variant_option.rb
98
+ - lib/models/variant_option_association.rb
99
+ homepage:
100
+ licenses:
101
+ - MIT
102
+ metadata: {}
103
+ post_install_message:
104
+ rdoc_options: []
105
+ require_paths:
106
+ - lib
107
+ - lib/models
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ requirements: []
119
+ rubygems_version: 3.3.7
120
+ signing_key:
121
+ specification_version: 4
122
+ summary: gem for active record item models
123
+ test_files: []