item_models 0.0.4

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f51bf19bf4a1bbab4541178986357a7d2b82d870f666c2f19cf76bc8ad85f1ab
4
+ data.tar.gz: 3e892f03c1d1e39f8d4c4637f2508156603bec1c1dd61b973c9c60985a49797c
5
+ SHA512:
6
+ metadata.gz: 7c2f0e7687ca7311c408ba16b589a4d7b86939397af734f1f418d48150d7094f1fb012dee8564e1dd60770ea97bb7ac340ea8a22cf0ccdcdebbdd05904cbba5e
7
+ data.tar.gz: d8bf91c8f782c1303038fbb8e5779697074c77c67de77731931532060649896b483dc57dba209756ab90f246b6cd20229448357fa3bc468f92e76360696895d5
@@ -0,0 +1,21 @@
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
+ files.each {|file| require file }
10
+ end
11
+
12
+ private
13
+
14
+ def self.files
15
+ Dir[ directory + '/lib/models/*.rb']
16
+ end
17
+
18
+ def self.directory
19
+ Gem::Specification.find_by_name("item_models").gem_dir
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ItemModels
4
+ VERSION = '0.0.4'
5
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Activity < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_activities'
6
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AvailabilityOption < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_availability_options'
6
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Bundle < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_bundles'
6
+
7
+ belongs_to :variant
8
+ belongs_to :item
9
+ has_many :bundle_variants
10
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class BundleVariant < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_bundle_variants'
6
+
7
+ belongs_to :bundle
8
+ belongs_to :variant
9
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Image < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_images'
6
+
7
+ belongs_to :item
8
+ has_many :item_listing_images
9
+ has_many :variant_images, foreign_key: :item_image_id
10
+ has_many :master_catalog_images
11
+ has_many :item_listing_variant_custom_fields
12
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Item < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ has_many :variants
6
+ has_many :item_listings
7
+ has_many :bundles
8
+ has_many :images
9
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ItemListing < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_channel_associations'
6
+ belongs_to :item
7
+ has_many :variant_listings, foreign_key: :channel_association_id
8
+ has_many :item_listing_images, foreign_key: :channel_association_id
9
+ has_many :item_listing_categories, foreign_key: :channel_association_id
10
+ has_many :item_listing_brands, foreign_key: :channel_association_id
11
+ has_many :item_listing_variant_custom_fields, foreign_key: :channel_association_id
12
+ has_many :item_listing_custom_fields, foreign_key: :channel_association_id
13
+ has_many :item_listing_variant_images, foreign_key: :channel_association_id
14
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ItemListingBrand < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_channel_association_brands'
6
+
7
+ belongs_to :item_listing, foreign_key: :channel_association_id
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ItemListingCategory < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_channel_association_categories'
6
+
7
+ belongs_to :item_listing, foreign_key: :channel_association_id
8
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ItemListingCustomField < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_channel_association_custom_fields'
6
+
7
+ belongs_to :item_listing, foreign_key: :channel_association_id
8
+ belongs_to :variant
9
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ItemListingImage < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_channel_association_images'
6
+ belongs_to :image
7
+ belongs_to :item_listing, foreign_key: :channel_association_id
8
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ItemListingVariantCustomField < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_channel_association_variant_images'
6
+
7
+ belongs_to :item_listing, foreign_key: :channel_association_id
8
+ belongs_to :variant
9
+ belongs_to :image
10
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ItemListingVariantImage < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_channel_association_variant_images'
6
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class MasterCatalog < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_variant_master_assocs'
6
+
7
+ belongs_to :variant
8
+ has_many :master_catalog_images, foreign_key: :master_assoc_id
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class MasterCatalogImage < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_variant_master_image_assocs'
6
+
7
+ belongs_to :master_catalog, foreign_key: :master_assoc_id
8
+ belongs_to :image, foreign_key: :image_id
9
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Variant < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_variants'
6
+ belongs_to :item
7
+ has_many :variant_images, foreign_key: :item_variant_id
8
+ has_many :bundles
9
+ has_many :variant_listings, foreign_key: :variant_id
10
+ has_many :item_listing_variant_images, foreign_key: :variant_id
11
+ has_many :item_listing_variant_custom_field, foreign_key: :variant_id
12
+ has_many :item_listing_custom_field, foreign_key: :variant_id
13
+ has_one :master_catalog, foreign_key: :variant_id
14
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class VariantImage < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_variant_images'
6
+
7
+ belongs_to :image
8
+ belongs_to :variant
9
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ class VariantListing < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_channel_association_variant_associations'
6
+
7
+ belongs_to :variant
8
+ belongs_to :item_listing
9
+ has_many :variant_listing_stock_allocations, foreign_key: :variant_association_id
10
+ has_many :variant_listing_price_histories, foreign_key: :variant_association_id
11
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class VariantListingPriceHistory < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_channel_association_variant_association_stock_allocations'
6
+
7
+ belongs_to :variant_listing, foreign_key: :variant_association_id
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class VariantListingStockAllocation < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_channel_association_variant_association_stock_allocations'
6
+
7
+ belongs_to :variant_listing, foreign_key: :variant_association_id
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class VariantOption < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_variant_options'
6
+
7
+ has_many :variant_option_associations, foreign_key: :option_id
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class VariantOptionAssociation < ApplicationRecord
4
+ establish_connection ActiveRecord::Base.configurations.fetch('item_model')
5
+ self.table_name = 'item_variant_option_associations'
6
+
7
+ belongs_to :variant_option, foreign_key: :option_id
8
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: item_models
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ platform: ruby
6
+ authors:
7
+ - alexander
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-02-11 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/image.rb
69
+ - lib/models/item.rb
70
+ - lib/models/item_listing.rb
71
+ - lib/models/item_listing_brand.rb
72
+ - lib/models/item_listing_category.rb
73
+ - lib/models/item_listing_custom_field.rb
74
+ - lib/models/item_listing_image.rb
75
+ - lib/models/item_listing_variant_custom_field.rb
76
+ - lib/models/item_listing_variant_image.rb
77
+ - lib/models/master_catalog.rb
78
+ - lib/models/master_catalog_image.rb
79
+ - lib/models/variant.rb
80
+ - lib/models/variant_image.rb
81
+ - lib/models/variant_listing.rb
82
+ - lib/models/variant_listing_price_history.rb
83
+ - lib/models/variant_listing_stock_allocation.rb
84
+ - lib/models/variant_option.rb
85
+ - lib/models/variant_option_association.rb
86
+ homepage:
87
+ licenses:
88
+ - MIT
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ - lib/models
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubygems_version: 3.0.3
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: gem for active record item models
110
+ test_files: []