ork 0.1.0 → 0.1.1

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
2
  SHA1:
3
- metadata.gz: 609ee14359a522c9a80be687981cf6280fb2f2ea
4
- data.tar.gz: d2b93d067769324259a9d48daebaff978a6e32c6
3
+ metadata.gz: 47e2643acef3adcb2aeac374845b5361247ba439
4
+ data.tar.gz: 28fe5d544ea0c7fbb31d8630429a207d73cae3be
5
5
  SHA512:
6
- metadata.gz: beb105369966731ad130fb658f7586defa8d8d2c64f12e1438a3c6fad6946e75cf181a836d4c197f308020d1178733559ff76494f85e812691bfd35c096c71fe
7
- data.tar.gz: caa7d2aff4293bc60f84cc9b85b228389447aa76ecac6ac291b85ff0ac23d059d2ec552eb4f7b00025fb4402d2b3db82a2eee27a67b26402c6f6c37fe9b219e6
6
+ metadata.gz: f25201cb3a85190b9f9b1fdcb07ea09b0c7aec3c820304547b90c3e66129e2fa6c15900d531493f817ad53c2f28af4b06630c9cb91b9102ba53c61dc7ccb2a1c
7
+ data.tar.gz: 3beec74ee51de51612f07191eb1421dd5c558404048ad18e6d8e3d15a4560387efcc1dfc30f0bbd2240abcfa72d319a41a24c5d20f71060536af61ff0be2496d
data/README.md CHANGED
@@ -171,3 +171,19 @@ Provides an accessor to the object that `embeds` the current model.
171
171
  ```ruby
172
172
  embedded :post, :Post
173
173
  ```
174
+
175
+ ## Validations
176
+
177
+ As you can see, there is no reference to validations in this document and I'm aware of that!
178
+ The validation logic for _nested embedded objects_ makes the code more complex than I want.
179
+ Given that I want to keep this gem as simple as I can, I decided to avoid _object validation_ logic here and promote the use of other gems.
180
+
181
+ There are good implementations for object validation like [hatch](https://github.com/tonchis/hatch) or [scrivener](https://github.com/soveran/scrivener) which they do a great job!
182
+ If you don't know them, you should take a look, but remember that you are free to use your prefered _gem_ or even your own method!
183
+
184
+ Just remember to check if an object is _valid_ __before__ you _save_ it.
185
+
186
+
187
+ # Tools
188
+
189
+ * `rekon` - A visual browser for **riak**, built as a [riak app](https://github.com/basho/rekon).
@@ -38,6 +38,15 @@ module Ork::Model
38
38
  @defaults ||= {}
39
39
  end
40
40
 
41
+ # When a value is given, sets the content_type of the object.
42
+ # When the parameter is nil, it will return the content_type.
43
+ # It also sets as default the standard content_type.
44
+ #
45
+ def content_type(type = nil)
46
+ @content_type = type unless type.nil?
47
+ @content_type ||= 'application/json'
48
+ end
49
+
41
50
  protected
42
51
 
43
52
  # Declares persisted attributes.
@@ -70,7 +70,7 @@ module Ork
70
70
  # # => #<User:6kS5VHNbaed9h7gFLnVg5lmO4U7 {:name=>"John"}>
71
71
  #
72
72
  def save
73
- __robject.content_type = 'application/json'
73
+ __robject.content_type = model.content_type
74
74
  __robject.data = __persist_attributes
75
75
 
76
76
  __check_unique_indices
data/ork.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ork'
3
- s.version = '0.1.0'
3
+ s.version = '0.1.1'
4
4
  s.date = Time.now.strftime('%Y-%m-%d')
5
5
  s.summary = 'Ruby modeling layer for Riak.'
6
6
  s.description = 'Ork is a small Ruby modeling layer for Riak, inspired by Ohm.'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emiliano Mancuso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-27 00:00:00.000000000 Z
11
+ date: 2013-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riak-client
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubyforge_project:
98
- rubygems_version: 2.0.3
98
+ rubygems_version: 2.1.9
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: Ruby modeling layer for Riak.