bridge_cache 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a35c0992d0691e11da837e2ad1e7691cc9e9bbb1
4
- data.tar.gz: 1aa774a9a0e9b783a532e42c862a135300a67398
2
+ SHA256:
3
+ metadata.gz: 110d173f33a5e55200a2d8646bb04a2126c319d85e17a443ce257d01048aa55c
4
+ data.tar.gz: 6f745a0fd1a4071f7b8f081e573c9fea844cb8dc8e1aa91ed1b11d74a980cad4
5
5
  SHA512:
6
- metadata.gz: 2b7006f250c4341996dc5f21da65fd0194cc5bd4b288b494e52a778857ead974c3b4a9c6b401e3015eb3b37f25fdeab5d52a3ee20e2ef6cec35652f04c0e584f
7
- data.tar.gz: f8db3aed90110b8192246e94125252a732e6bcadfe1d9b521a98007eb03191dfed1d2c9ba01b22c1cb89552d4c895c52f9ff2c63843063b249e7be7ceb8df88e
6
+ metadata.gz: 3bfc00b9a9d1c3fbb4c8bf74ed89a8f66a05599ecceb000de74d482210683cabc99c60d8401b9759b34a14d17048c6a293e6da0d0b8a1fa26d023b24d59e3812
7
+ data.tar.gz: 0a791e182bcb19b4f267719aeb0cd34d818217980ce9044416a5247d0df5de3f72805ff6e2dbfa1e79e0b69620b9af3e5c69c57bd412470943bcf2d44afc7230
@@ -9,5 +9,11 @@ module BridgeCache::Plugins
9
9
  row
10
10
  end
11
11
 
12
+ def self.valid_json?(json)
13
+ json = JSON.parse(json) unless json.class == Hash
14
+ return json
15
+ rescue JSON::ParserError => e
16
+ return false
17
+ end
12
18
  end
13
19
  end
@@ -10,7 +10,7 @@ module BridgeCache
10
10
  private
11
11
 
12
12
  def fix_item_type
13
- self.item_type = "BridgeCache::#{self.item_type}" unless self.item_type.starts_with?("BridgeCache::")
13
+ self.item_type = "BridgeCache::#{self.item_type}" unless self.item_type&.starts_with?("BridgeCache::")
14
14
  end
15
15
 
16
16
  def self.cleanup(current_row_ids)
@@ -10,6 +10,7 @@ module BridgeCache
10
10
  has_many :affiliated_sub_accounts, primary_key: BridgeCache.primary_key, class_name: BridgeCache::AffiliatedSubAccount.name, as: :item
11
11
  has_many :domains, through: :affiliated_sub_accounts
12
12
  belongs_to :sub_account, foreign_key: :sub_account_id, primary_key: BridgeCache.primary_key, class_name: BridgeCache::Domain.name, optional: true
13
+ has_many :enrollment_profiles, as: :enrollable, primary_key: BridgeCache.primary_key, class_name: BridgeCache::EnrollmentProfile.name
13
14
 
14
15
  def self.for_domain(domain_id)
15
16
  includes(:domains)
@@ -0,0 +1,19 @@
1
+ module BridgeCache
2
+ class EnrollmentProfile < BridgeBaseModel
3
+ extend BridgeCache::Data::BridgeModel
4
+
5
+ belongs_to :enrollable, primary_key: BridgeCache.primary_key, polymorphic: true
6
+ before_validation :namespace_enrollable_type
7
+ before_save :parse_json
8
+
9
+ def namespace_enrollable_type
10
+ self.enrollable_type = "BridgeCache::#{self.enrollable_type}" unless self.enrollable_type&.include? 'BridgeCache::'
11
+ end
12
+
13
+ def parse_json
14
+ json = BridgeCache::Plugins::DataTransform::valid_json?(self.config)
15
+ self.config = json if json.present?
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ class CreateBridgeCacheEnrollmentProfiles < ActiveRecord::Migration[5.1]
2
+ def change
3
+ return unless BridgeCache.use_internal_database
4
+ create_table :bridge_cache_enrollment_profiles do |t|
5
+ t.integer :bridge_id, limit: 8
6
+ t.integer :enrollable_id, limit: 8
7
+ t.string :enrollable_type
8
+ t.datetime :created_at
9
+ t.datetime :updated_at
10
+ t.integer :domain_id, limit: 8
11
+ t.string :uuid
12
+ t.datetime :deleted_at
13
+ t.jsonb :config, default: '{}'
14
+ t.boolean :expires
15
+ t.boolean :auto_re_enroll
16
+ t.boolean :open_enrollment
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ class AddIndexToEnrollmentProfile < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_index :bridge_cache_enrollment_profiles, :config, using: :gin
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module BridgeCache
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridge_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - jshaffer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-16 00:00:00.000000000 Z
11
+ date: 2018-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -210,6 +210,7 @@ files:
210
210
  - app/models/bridge_cache/custom_field.rb
211
211
  - app/models/bridge_cache/domain.rb
212
212
  - app/models/bridge_cache/enrollment.rb
213
+ - app/models/bridge_cache/enrollment_profile.rb
213
214
  - app/models/bridge_cache/grant.rb
214
215
  - app/models/bridge_cache/group.rb
215
216
  - app/models/bridge_cache/group_enrollment.rb
@@ -250,6 +251,8 @@ files:
250
251
  - db/migrate/20171019195512_create_live_course_session_registrations.rb
251
252
  - db/migrate/20171019195516_create_live_course_sessions.rb
252
253
  - db/migrate/20171031165231_add_indexes.rb
254
+ - db/migrate/20180316205458_create_bridge_cache_enrollment_profiles.rb
255
+ - db/migrate/20180320190443_add_index_to_enrollment_profile.rb
253
256
  - lib/bridge_cache.rb
254
257
  - lib/bridge_cache/engine.rb
255
258
  - lib/bridge_cache/version.rb
@@ -274,7 +277,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
277
  version: '0'
275
278
  requirements: []
276
279
  rubyforge_project:
277
- rubygems_version: 2.4.8
280
+ rubygems_version: 2.7.3
278
281
  signing_key:
279
282
  specification_version: 4
280
283
  summary: A mountable engine for bridge data storage