item_models 0.0.4 → 0.0.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f51bf19bf4a1bbab4541178986357a7d2b82d870f666c2f19cf76bc8ad85f1ab
4
- data.tar.gz: 3e892f03c1d1e39f8d4c4637f2508156603bec1c1dd61b973c9c60985a49797c
3
+ metadata.gz: 9992d5a29e713769f3afca0e2715094e57eb6f15b97aeb1864e3e70b3d9185b9
4
+ data.tar.gz: c05a9d94ce8ff1eef97645c9c262fc4c9a6b5fb72ed11f644aa7260e7474efeb
5
5
  SHA512:
6
- metadata.gz: 7c2f0e7687ca7311c408ba16b589a4d7b86939397af734f1f418d48150d7094f1fb012dee8564e1dd60770ea97bb7ac340ea8a22cf0ccdcdebbdd05904cbba5e
7
- data.tar.gz: d8bf91c8f782c1303038fbb8e5779697074c77c67de77731931532060649896b483dc57dba209756ab90f246b6cd20229448357fa3bc468f92e76360696895d5
6
+ metadata.gz: f13c5f6079c665c16368a497bd63114bac36f79c7571fdc840469130b00556de259901598a91cf697b185798e53760448ba3630b27971d67cce9b2761cfe39f7
7
+ data.tar.gz: 1ea2479ce2640bb366d3db5b5ae0b6a71f7edf3b008128f11a7f8dc7a7b503fb71771e371d50555edbd8e95875563c44a7c857765448a34dea41d86b8eb0e378
@@ -6,6 +6,7 @@ module ItemModels
6
6
  class Error < StandardError; end
7
7
  # Your code goes here...
8
8
  def self.load
9
+ require directory + '/lib/models/item_application_record'
9
10
  files.each {|file| require file }
10
11
  end
11
12
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ItemModels
4
- VERSION = '0.0.4'
4
+ VERSION = '0.0.9'
5
5
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Activity < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class Activity < ItemAplicationRecord
5
4
  self.table_name = 'item_activities'
6
5
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class AvailabilityOption < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class AvailabilityOption < ItemAplicationRecord
5
4
  self.table_name = 'item_availability_options'
6
5
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Bundle < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class Bundle < ItemAplicationRecord
5
4
  self.table_name = 'item_bundles'
6
5
 
7
6
  belongs_to :variant
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class BundleVariant < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class BundleVariant < ItemApplicationRecord
5
4
  self.table_name = 'item_bundle_variants'
6
5
 
7
6
  belongs_to :bundle
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Image < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class Image < ItemApplicationRecord
5
4
  self.table_name = 'item_images'
6
5
 
7
6
  belongs_to :item
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Item < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class Item < ItemApplicationRecord
5
4
  has_many :variants
6
5
  has_many :item_listings
7
6
  has_many :bundles
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ItemAplicationRecord < ActiveRecord::Base
4
+ self.abstract_class = true
5
+ connects_to database: { writing: :item_model, reading: :item_model }
6
+ end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class ItemListing < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class ItemListing < ItemApplicationRecord
5
4
  self.table_name = 'item_channel_associations'
6
5
  belongs_to :item
7
6
  has_many :variant_listings, foreign_key: :channel_association_id
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class ItemListingBrand < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class ItemListingBrand < ItemApplicationRecord
5
4
  self.table_name = 'item_channel_association_brands'
6
5
 
7
6
  belongs_to :item_listing, foreign_key: :channel_association_id
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class ItemListingCategory < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class ItemListingCategory < ItemApplicationRecord
5
4
  self.table_name = 'item_channel_association_categories'
6
5
 
7
6
  belongs_to :item_listing, foreign_key: :channel_association_id
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class ItemListingCustomField < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class ItemListingCustomField < ItemApplicationRecord
5
4
  self.table_name = 'item_channel_association_custom_fields'
6
5
 
7
6
  belongs_to :item_listing, foreign_key: :channel_association_id
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class ItemListingImage < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class ItemListingImage < ItemApplicationRecord
5
4
  self.table_name = 'item_channel_association_images'
6
5
  belongs_to :image
7
6
  belongs_to :item_listing, foreign_key: :channel_association_id
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class ItemListingVariantCustomField < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class ItemListingVariantCustomField < ItemApplicationRecord
5
4
  self.table_name = 'item_channel_association_variant_images'
6
5
 
7
6
  belongs_to :item_listing, foreign_key: :channel_association_id
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class ItemListingVariantImage < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class ItemListingVariantImage < ItemApplicationRecord
5
4
  self.table_name = 'item_channel_association_variant_images'
6
5
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class MasterCatalog < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class MasterCatalog < ItemApplicationRecord
5
4
  self.table_name = 'item_variant_master_assocs'
6
5
 
7
6
  belongs_to :variant
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class MasterCatalogImage < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class MasterCatalogImage < ItemApplicationRecord
5
4
  self.table_name = 'item_variant_master_image_assocs'
6
5
 
7
6
  belongs_to :master_catalog, foreign_key: :master_assoc_id
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Variant < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class Variant < ItemApplicationRecord
5
4
  self.table_name = 'item_variants'
6
5
  belongs_to :item
7
6
  has_many :variant_images, foreign_key: :item_variant_id
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class VariantImage < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class VariantImage < ItemApplicationRecord
5
4
  self.table_name = 'item_variant_images'
6
5
 
7
6
  belongs_to :image
@@ -1,11 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class VariantListing < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class VariantListing < ItemApplicationRecord
5
4
  self.table_name = 'item_channel_association_variant_associations'
6
5
 
7
6
  belongs_to :variant
8
7
  belongs_to :item_listing
9
- has_many :variant_listing_stock_allocations, foreign_key: :variant_association_id
8
+ has_one :variant_listing_stock_allocation, foreign_key: :variant_association_id
10
9
  has_many :variant_listing_price_histories, foreign_key: :variant_association_id
11
10
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class VariantListingPriceHistory < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class VariantListingPriceHistory < ItemApplicationRecord
5
4
  self.table_name = 'item_channel_association_variant_association_stock_allocations'
6
5
 
7
6
  belongs_to :variant_listing, foreign_key: :variant_association_id
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class VariantListingStockAllocation < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class VariantListingStockAllocation < ItemApplicationRecord
5
4
  self.table_name = 'item_channel_association_variant_association_stock_allocations'
6
5
 
7
6
  belongs_to :variant_listing, foreign_key: :variant_association_id
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class VariantOption < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class VariantOption < ItemApplicationRecord
5
4
  self.table_name = 'item_variant_options'
6
5
 
7
6
  has_many :variant_option_associations, foreign_key: :option_id
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class VariantOptionAssociation < ApplicationRecord
4
- establish_connection ActiveRecord::Base.configurations.fetch('item_model')
3
+ class VariantOptionAssociation < ItemApplicationRecord
5
4
  self.table_name = 'item_variant_option_associations'
6
5
 
7
6
  belongs_to :variant_option, foreign_key: :option_id
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: item_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - alexander
8
+ - kevin
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2020-02-11 00:00:00.000000000 Z
12
+ date: 2020-06-25 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -55,6 +56,7 @@ dependencies:
55
56
  description:
56
57
  email:
57
58
  - alxibra@gmail.com
59
+ - ivanderkevin1@gmail.com
58
60
  executables: []
59
61
  extensions: []
60
62
  extra_rdoc_files: []
@@ -67,6 +69,7 @@ files:
67
69
  - lib/models/bundle_variant.rb
68
70
  - lib/models/image.rb
69
71
  - lib/models/item.rb
72
+ - lib/models/item_application_record.rb
70
73
  - lib/models/item_listing.rb
71
74
  - lib/models/item_listing_brand.rb
72
75
  - lib/models/item_listing_category.rb