sequel_couchbase_model 0.0.1 → 0.0.2

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: a5216794d8c9ea3493cc71f980818b527315b9d8
4
- data.tar.gz: a12dd7bc07ebfcff484b4b4a1c6a3589f54f9b06
3
+ metadata.gz: 7385023745b1858951601e1b31d0d9afedef4a79
4
+ data.tar.gz: 356d70c677ecab48ef43cbfacf5a786184320a75
5
5
  SHA512:
6
- metadata.gz: 8ed2ad81a618dc74897c18c18fba048660251b279887184861425b2a5f45fa1f3a50f11c8bf64e21d8face14080e54d10b896ac8e5dc3bee103f56afb244b777
7
- data.tar.gz: 3efeba0c9db10f619c93e0beae9c0e183181cf4cddef4646921a6be7a2a2544341b49d16ab000de5dea5607ae7389bb914682638cb008ecafae90cee2d8628ae
6
+ metadata.gz: b739ed44418fd6700b0f3356e0ea0d47d11b1f323559b87d02d163c9f2b21f75168514426f5164b98b44e3e354a62ff41e84fe9353004e969b710aeb779cdc47
7
+ data.tar.gz: db410b48d7d7d9238d60cb901cb692bf147dbd429505bc9aa607f146fd054882d91f01c6e36f14f032524fe8c8fa66d60c136d8f793f4f92ad567cc58cfbd0c2
data/README.md CHANGED
@@ -1,6 +1,48 @@
1
1
  # SequelCouchbaseModel
2
2
 
3
- TODO: Write a gem description
3
+ This gem is designed for people who are using both the couchbase-model and sequel gems and would like to use sequel model logic
4
+ in their couchbase models. This gem is still in beta stage, but right now it has preliminary support for sequel validations and
5
+ a few sequel hooks. To use it, your couchbase models must inherit Sequel::Couchbase::Model.
6
+
7
+ ## Example
8
+
9
+ class VideoWatch < Sequel::Couchbase::Model
10
+ attribute :title
11
+ attribute :a
12
+ attribute :b
13
+ attribute :milliseconds_watched
14
+ attribute :created_at
15
+ attribute :updated_at
16
+
17
+ plugin :validation_helpers
18
+
19
+ def before_validate
20
+ self.milliseconds_watched ||= 0
21
+ end
22
+
23
+ def validate
24
+ validates_presence [:title, :updated_at, :created_at, :milliseconds_watched]
25
+ validates_type String, :title
26
+ validates_type Fixnum, [:a, :b, :milliseconds_watched]
27
+ if a.blank? && b.blank?
28
+ errors.add :base, "At least one of a or b must be filled out!"
29
+ end
30
+ end
31
+
32
+ def before_save
33
+
34
+ end
35
+
36
+ ......
37
+ rest of your logic
38
+ ......
39
+ end
40
+
41
+
42
+
43
+
44
+
45
+
4
46
 
5
47
  ## Installation
6
48
 
@@ -1,4 +1,5 @@
1
1
  require "sequel_couchbase_model/version"
2
+ require 'couchbase/model'
2
3
 
3
4
  module Sequel
4
5
  module Couchbase
@@ -1,3 +1,3 @@
1
1
  module SequelCouchbaseModel
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_couchbase_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Misha Conway