torg_api 0.0.8 → 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
  SHA1:
3
- metadata.gz: a1d232ea54a784e418f472ef55117987f7344017
4
- data.tar.gz: d978df9953b942273ed704a969a3a915e1114730
3
+ metadata.gz: 35e12319a45b503dcaf9c93b88c5485e02ee6c0c
4
+ data.tar.gz: dc94117af3d18ec47f58717537ae169bc01e9254
5
5
  SHA512:
6
- metadata.gz: 0310f82f3609efbc5e15952f9c58875f43233f940126bec474c323561f046f70c93d42a6d5349a4e0e87a84fd80275664e8e554db0a8170d807b9fc9f8b4ee52
7
- data.tar.gz: 451aea8a62f84888c6c3d2e485b86cba6f4211cdf271f2c18b14d940ed74c2a14002857faa85aac4dea94880ff308662807e16dbb40d921fe1f27ef1d566ea0e
6
+ metadata.gz: 6b161544a314431171999a2e89483e5721172ba80211ef3c72d32d8fc5a3e5ac4fb3a57c231f728adf82dff559f3153d78506ec7ee4675eac5a622486dbf3f51
7
+ data.tar.gz: b04d23cb0de3a83dd2ab008641aa9cc56be7c25440934a09a330d26992420344b26b7897a621ab29886f51d6a3263c8ebb4b011e04c4f74b2024ee682346cc1d
data/lib/torg_api/base.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'carrierwave'
2
2
  require 'carrierwave/orm/activerecord'
3
+ require 'torg_api/torg_database'
3
4
  require 'torg_api/models'
4
5
 
5
6
  module TorgApi
@@ -1,6 +1,6 @@
1
1
  module TorgApi
2
2
  module Models
3
- class Bidder < ActiveRecord::Base
3
+ class Bidder < TorgDatabase
4
4
  has_many :bidder_files
5
5
 
6
6
  def to_api
@@ -1,6 +1,6 @@
1
1
  module TorgApi
2
2
  module Models
3
- class BidderFile < ActiveRecord::Base
3
+ class BidderFile < TorgDatabase
4
4
  belongs_to :tender_file
5
5
 
6
6
  def self.file_exists?(file_name)
@@ -1,6 +1,6 @@
1
1
  module TorgApi
2
2
  module Models
3
- class Contractor < ActiveRecord::Base
3
+ class Contractor < TorgDatabase
4
4
  def to_api
5
5
  c = TorgApi::Api::Contractor.new
6
6
  c.id = id
@@ -1,6 +1,6 @@
1
1
  module TorgApi
2
2
  module Models
3
- class Cover < ActiveRecord::Base
3
+ class Cover < TorgDatabase
4
4
  end
5
5
  end
6
6
  end
@@ -1,7 +1,7 @@
1
1
  module TorgApi
2
2
  module Models
3
3
  # Лот
4
- class Lot < ActiveRecord::Base
4
+ class Lot < TorgDatabase
5
5
  def to_api
6
6
  t = TorgApi::Api::Lot.new
7
7
  t.id = id
@@ -1,7 +1,7 @@
1
1
  module TorgApi
2
2
  module Models
3
3
  # TORG Offer model
4
- class Offer < ActiveRecord::Base
4
+ class Offer < TorgDatabase
5
5
  has_many :offer_specifications
6
6
 
7
7
  def self.for_bid_lot_num(bidder_id, lot_id, num)
@@ -1,6 +1,6 @@
1
1
  module TorgApi
2
2
  module Models
3
- class OfferSpecification < ActiveRecord::Base
3
+ class OfferSpecification < TorgDatabase
4
4
  def self.for_offer_spec(offer_id, spec_id)
5
5
  where(offer_id: offer_id).where(specification_id: spec_id).take
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module TorgApi
2
2
  module Models
3
- class Specification < ActiveRecord::Base
3
+ class Specification < TorgDatabase
4
4
  end
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module TorgApi
2
2
  module Models
3
- class Tender < ActiveRecord::Base
3
+ class Tender < TorgDatabase
4
4
  def to_api
5
5
  t = TorgApi::Api::Tender.new
6
6
  t.id = id
@@ -1,6 +1,6 @@
1
1
  module TorgApi
2
2
  module Models
3
- class TenderFile < ActiveRecord::Base
3
+ class TenderFile < TorgDatabase
4
4
  mount_uploader :document, TenderFileUploader
5
5
 
6
6
  before_save :update_file_attributes
@@ -0,0 +1,6 @@
1
+ module TorgApi
2
+ class TorgDatabase < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ establish_connection :torg_db
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module TorgApi
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
data/lib/torg_api.rb CHANGED
@@ -1,17 +1,13 @@
1
+ require 'torg_api/settings'
1
2
  require 'active_record'
2
3
  require 'torg_api/version'
3
4
  require 'torg_api/constants'
4
5
  require 'torg_api/base'
5
6
  require 'torg_api/api'
6
- require 'torg_api/settings'
7
7
 
8
8
  CarrierWave::SanitizedFile.sanitize_regexp = /[^[:word:]\.\-\+]/
9
9
 
10
10
  module TorgApi
11
- def self.establish_connection(spec = nil)
12
- ActiveRecord::Base.establish_connection(spec)
13
- end
14
-
15
11
  def self.logger=(logger)
16
12
  ActiveRecord::Base.logger = logger
17
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torg_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Archakov Aleksandr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-03 00:00:00.000000000 Z
11
+ date: 2015-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -102,6 +102,7 @@ files:
102
102
  - lib/torg_api/models/tender_file.rb
103
103
  - lib/torg_api/models/tender_file_uploader.rb
104
104
  - lib/torg_api/settings.rb
105
+ - lib/torg_api/torg_database.rb
105
106
  - lib/torg_api/version.rb
106
107
  - torg_api.gemspec
107
108
  homepage: https://github.com/kodram/torg_api