dolly 0.0.1 → 0.1.0

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: ea68df6004ba83c19215952ce9a3ce9e19169ec3
4
- data.tar.gz: 835ecc53373d834ff7a8c05173200911490d7e4e
3
+ metadata.gz: ad0bbb9be5691d6b00639f4af6d401657f7892a9
4
+ data.tar.gz: 00f1dbd0c0fb0c29b3ffedbde617875fe2c737e9
5
5
  SHA512:
6
- metadata.gz: 40468de07bee1d6412e8dcae7b96f06d85ab9a7c8e1c7a41158a648f922cbb08b0b9c7ac3e54b30bf98a23647597f30d1c603dafabe784db61997323f5e12a9c
7
- data.tar.gz: 30ddf8c41e68c48645f899d145aa439f6c4bde64218f82e048ba3af8aa85dc614fe7c18eeda6973faee88345cea4932c1ad07b4d4671c068d71c5416a4aa7f18
6
+ metadata.gz: 2e9514240a3f8e2a2e9c62d6142aa45cb534ba2d935d3c11789cbf039e0a43e500066de6b9c9db20a04bc68e76833bbd57a38d4049f86d90d3ef9448e31f33cc
7
+ data.tar.gz: 4fbb5496d005ad2110ce3268f42249a3e62116ddbf41ac9c92b8b8bc30470a6ad561b82cc764a485c796d1ccf150fdbc9c0ba6f48ba0794c50fa305ee6d578cf
@@ -40,6 +40,11 @@ module Dolly
40
40
  @set = self.extend(representation).from_json(json).rows
41
41
  end
42
42
 
43
+ def to_json options = {}
44
+ load if empty?
45
+ map{|r| r.doc }.to_json(options)
46
+ end
47
+
43
48
  private
44
49
  def representation
45
50
  Representations::CollectionRepresentation.config(docs_class)
@@ -1,7 +1,9 @@
1
1
  require "dolly/request"
2
+ require "dolly/name_space"
2
3
 
3
4
  module Dolly
4
5
  module Connection
6
+ include Dolly::NameSpace
5
7
 
6
8
  def database
7
9
  @database ||= Request.new(database_name: @@database_name)
@@ -11,5 +13,16 @@ module Dolly
11
13
  @@database_name ||= value
12
14
  end
13
15
 
16
+ def default_doc
17
+ "#{design_doc}/_view/#{name_paramitized}"
18
+ end
19
+
20
+ def design_doc
21
+ "_design/#{@@design_doc || DESIGN_DOC}"
22
+ end
23
+
24
+ def set_design_doc value
25
+ @@design_doc = value
26
+ end
14
27
  end
15
28
  end
@@ -1,12 +1,13 @@
1
- require "active_model/naming"
2
- require "dolly/connection"
3
- require "dolly/collection"
4
- require "dolly/representations/document_representation"
5
- require "dolly/representations/collection_representation"
6
- require "exceptions/dolly"
1
+ require "dolly/query"
2
+ require "dolly/property"
7
3
 
8
4
  module Dolly
9
- module Document
5
+ class Document
6
+ extend Dolly::Connection
7
+ include Dolly::Query
8
+
9
+ attr_accessor :rows, :doc, :key
10
+ class_attribute :properties
10
11
 
11
12
  def id
12
13
  doc['_id']
@@ -28,6 +29,14 @@ module Dolly
28
29
  save
29
30
  end
30
31
 
32
+ def rows= col
33
+ col.each{ |r| @doc = r['doc'] }
34
+ _properties.each do |p|
35
+ self.send "#{p.name}=", doc[p.name]
36
+ end
37
+ @rows = col
38
+ end
39
+
31
40
  def from_json string
32
41
  self.class.new.extend(representation).from_json( string )
33
42
  end
@@ -41,74 +50,38 @@ module Dolly
41
50
  end
42
51
 
43
52
  def representation
44
- Representations::DocumentRepresentation.config(self.class.properties)
53
+ Representations::DocumentRepresentation.config(self.properties)
45
54
  end
46
55
 
47
- module ClassMethods
48
- include ActiveModel::Naming
49
- include Dolly::Connection
50
- attr_accessor :properties
51
-
52
- DESIGN_DOC = "dolly"
53
-
54
- def find *ids
55
- response = default_view(keys: ids.map{|id| namespace(id)}).parsed_response
56
- ids.count > 1 ? Collection.new(response, name.constantize) : self.new.from_json(response)
57
- rescue NoMethodError => err
58
- if err.message == "undefined method `[]' for nil:NilClass"
59
- raise Dolly::ResourceNotFound
60
- else
61
- raise
62
- end
63
- end
64
-
65
- def all
66
- Collection.new default_view.parsed_response, name.constantize
67
- end
68
-
69
- def default_view options = {}
70
- view default_doc, options
71
- end
72
-
73
- def view doc, options = {}
74
- options.merge! include_docs: true
75
- database.get doc, options
76
- end
77
-
78
- def default_doc
79
- "#{design_doc}/_view/#{name_paramitized}"
80
- end
56
+ def self.property *ary
57
+ options = ary.pop if ary.last.kind_of? Hash
58
+ options ||= {}
59
+ self.properties ||= []
81
60
 
82
- def design_doc
83
- "_design/#{@@design_doc || DESIGN_DOC}"
84
- end
61
+ self.properties += ary.map do |name|
62
+ options.merge!({name: name})
63
+ property = Property.new(options)
85
64
 
86
- def set_design_doc value
87
- @@design_doc = value
88
- end
65
+ define_method(name) do
66
+ property.value = @doc[name.to_s]
67
+ property.value
68
+ end
89
69
 
90
- def name_paramitized
91
- model_name.param_key
92
- end
70
+ define_method("#{name}=") do |val|
71
+ @doc ||={}
72
+ @doc[name.to_s] = val
73
+ end
93
74
 
94
- def namespace id
95
- return id if id =~ /^#{name_paramitized}/
96
- "#{name_paramitized}/#{id}"
97
- end
75
+ define_method(:"#{name}?") { send name } if property.boolean?
76
+ define_method("[]") {|n| send n.to_sym}
98
77
 
99
- def timestamps!
100
- %i/created_at updated_at/.each do |method|
101
- define_method(method){ @doc[method.to_s] ||= DateTime.now }
102
- define_method(:"[]"){|m| self.send(m.to_sym) }
103
- define_method(:"[]="){|m, v| self.send(:"#{m}=", v) }
104
- define_method(:"#{method}="){|val| @doc[method.to_s] = val }
105
- end
78
+ property
106
79
  end
107
-
108
80
  end
109
81
 
110
- def self.included(base)
111
- base.extend ClassMethods
82
+ private
83
+ def _properties
84
+ self.properties
112
85
  end
113
86
  end
114
87
  end
@@ -0,0 +1,12 @@
1
+ module Dolly
2
+ module NameSpace
3
+ def name_paramitized
4
+ model_name.param_key
5
+ end
6
+
7
+ def namespace id
8
+ return id if id =~ /^#{name_paramitized}/
9
+ "#{name_paramitized}/#{id}"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,57 @@
1
+ require "active_model/naming"
2
+ require "dolly/connection"
3
+ require "dolly/collection"
4
+ require "dolly/representations/document_representation"
5
+ require "dolly/representations/collection_representation"
6
+ require "dolly/name_space"
7
+ require "exceptions/dolly"
8
+
9
+ module Dolly
10
+ module Query
11
+ module ClassMethods
12
+ include Dolly::NameSpace
13
+ include ActiveModel::Naming
14
+ include Dolly::Connection
15
+ attr_accessor :properties
16
+
17
+ DESIGN_DOC = "dolly"
18
+
19
+ def find *ids
20
+ response = default_view(keys: ids.map{|id| namespace(id)}).parsed_response
21
+ ids.count > 1 ? Collection.new(response, name.constantize) : self.new.from_json(response)
22
+ rescue NoMethodError => err
23
+ if err.message == "undefined method `[]' for nil:NilClass"
24
+ raise Dolly::ResourceNotFound
25
+ else
26
+ raise
27
+ end
28
+ end
29
+
30
+ def all
31
+ Collection.new default_view.parsed_response, name.constantize
32
+ end
33
+
34
+ def default_view options = {}
35
+ view default_doc, options
36
+ end
37
+
38
+ def view doc, options = {}
39
+ options.merge! include_docs: true
40
+ database.get doc, options
41
+ end
42
+
43
+ def timestamps!
44
+ %i/created_at updated_at/.each do |method|
45
+ define_method(method){ @doc[method.to_s] ||= DateTime.now }
46
+ define_method(:"[]"){|m| self.send(m.to_sym) }
47
+ define_method(:"[]="){|m, v| self.send(:"#{m}=", v) }
48
+ define_method(:"#{method}="){|val| @doc[method.to_s] = val }
49
+ end
50
+ end
51
+ end
52
+
53
+ def self.included(base)
54
+ base.extend ClassMethods
55
+ end
56
+ end
57
+ end
@@ -1,12 +1,17 @@
1
1
  require 'representable/json'
2
+ require 'dolly/representations/tools'
2
3
 
3
4
  module Dolly
4
5
  module Representations
5
6
  module CollectionRepresentation
6
7
  include Representable::JSON
8
+ include Dolly::Representations::Tools
9
+
10
+ clean_representables
7
11
 
8
12
  def self.config docs_class
9
- self.collection :rows, extend: DocumentRepresentation, class: docs_class
13
+ properties = docs_class.send(:properties)
14
+ self.collection :rows, extend: DocumentRepresentation.config(properties), class: docs_class
10
15
  self
11
16
  end
12
17
  end
@@ -1,19 +1,22 @@
1
1
  require 'representable/json'
2
+ require 'dolly/representations/tools'
2
3
 
3
4
  module Dolly
4
5
  module Representations
5
6
  module DocumentRepresentation
6
7
  include Representable::JSON
8
+ include Dolly::Representations::Tools
7
9
 
8
- property :rows
10
+ clean_representables
9
11
  property :doc
10
12
 
11
13
  def self.config properties
12
- properties.each do |p|
13
- self.property p.name
14
- end
14
+ self.clean_representables
15
+ self.property :doc
16
+ properties.each {|p| self.property p.name}
15
17
  self
16
18
  end
19
+
17
20
  end
18
21
  end
19
22
  end
@@ -0,0 +1,16 @@
1
+ module Dolly
2
+ module Representations
3
+ module Tools
4
+ module ClassMethods
5
+ def clean_representables
6
+ self.instance_variable_set("@representable_attrs", nil)
7
+ self.property :rows
8
+ end
9
+ end
10
+
11
+ def self.included(base)
12
+ base.extend ClassMethods
13
+ end
14
+ end
15
+ end
16
+ end
data/lib/dolly/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dolly
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/dolly.rb CHANGED
@@ -1,51 +1,4 @@
1
1
  require "dolly/version"
2
2
  require "dolly/document"
3
- require "dolly/property"
4
3
 
5
- module Dolly
6
-
7
- class Base
8
- include Dolly::Document
9
- attr_accessor :rows, :doc, :key
10
-
11
- def rows= col
12
- col.each{ |r| @doc = r['doc'] }
13
- _properties.each do |p|
14
- self.send "#{p.name}=", doc[p.name]
15
- end
16
- @rows = col
17
- end
18
-
19
- def self.property *ary
20
- options = ary.pop if ary.last.kind_of? Hash
21
- options ||= {}
22
- @properties ||= []
23
-
24
- @properties += ary.map do |name|
25
- options.merge!({name: name})
26
- property = Property.new(options)
27
-
28
- define_method(name) do
29
- property.value = @doc[name.to_s]
30
- property.value
31
- end
32
-
33
- define_method("#{name}=") do |val|
34
- @doc ||={}
35
- @doc[name.to_s] = val
36
- end
37
-
38
- define_method(:"#{name}?") { send name } if property.boolean?
39
- define_method("[]") {|n| send n.to_sym}
40
-
41
- property
42
- end
43
- end
44
-
45
- private
46
- def _properties
47
- self.class.properties
48
- end
49
- end
50
-
51
- end
4
+ module Dolly; end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class FooBar < Dolly::Base
3
+ class FooBar < Dolly::Document
4
4
  database_name 'test'
5
5
  set_design_doc 'test'
6
6
 
@@ -11,7 +11,7 @@ class FooBar < Dolly::Base
11
11
  timestamps!
12
12
  end
13
13
 
14
- class DollyTest < ActiveSupport::TestCase
14
+ class DocumentTest < ActiveSupport::TestCase
15
15
 
16
16
  def setup
17
17
  data = {foo: 'Foo', bar: 'Bar', type: 'foo_bar'}
@@ -12658,3 +12658,591 @@ DollyTest: test_with_default_will_return_default_value_on_nil
12658
12658
  --------------------------------
12659
12659
  DollyTest: test_with_timestamps!
12660
12660
  --------------------------------
12661
+ --------------------------------------
12662
+ DocumentTest: test_all_will_get_2_docs
12663
+ --------------------------------------
12664
+ ------------------------------------------------
12665
+ DocumentTest: test_all_will_get_FooBar_documents
12666
+ ------------------------------------------------
12667
+ ----------------------------------------------
12668
+ DocumentTest: test_default_will_be_avoerwriten
12669
+ ----------------------------------------------
12670
+ ------------------------------------------------
12671
+ DocumentTest: test_empty_find_should_raise_error
12672
+ ------------------------------------------------
12673
+ ------------------------------------------------------------
12674
+ DocumentTest: test_error_on_server_raises_Dolly::ServerError
12675
+ ------------------------------------------------------------
12676
+ --------------------------------------------------
12677
+ DocumentTest: test_find_will_get_a_FooBar_document
12678
+ --------------------------------------------------
12679
+ ----------------------------------------------------------------
12680
+ DocumentTest: test_find_with_multiple_ids_will_return_Collection
12681
+ ----------------------------------------------------------------
12682
+ ---------------------------------------------
12683
+ DocumentTest: test_getting_not_found_document
12684
+ ---------------------------------------------
12685
+ -------------------------------------------------
12686
+ DocumentTest: test_multi_response_with_right_data
12687
+ -------------------------------------------------
12688
+ -------------------------------------------
12689
+ DocumentTest: test_will_have_key_properties
12690
+ -------------------------------------------
12691
+ --------------------------------------------------------
12692
+ DocumentTest: test_will_have_object_with_boolean?_method
12693
+ --------------------------------------------------------
12694
+ ------------------------------------------------
12695
+ DocumentTest: test_will_have_only_set_properties
12696
+ ------------------------------------------------
12697
+ ----------------------------------------------------------------
12698
+ DocumentTest: test_with_default_will_return_default_value_on_nil
12699
+ ----------------------------------------------------------------
12700
+ -----------------------------------
12701
+ DocumentTest: test_with_timestamps!
12702
+ -----------------------------------
12703
+ --------------------------------------
12704
+ DocumentTest: test_all_will_get_2_docs
12705
+ --------------------------------------
12706
+ ------------------------------------------------
12707
+ DocumentTest: test_all_will_get_FooBar_documents
12708
+ ------------------------------------------------
12709
+ ----------------------------------------------
12710
+ DocumentTest: test_default_will_be_avoerwriten
12711
+ ----------------------------------------------
12712
+ ------------------------------------------------
12713
+ DocumentTest: test_empty_find_should_raise_error
12714
+ ------------------------------------------------
12715
+ ------------------------------------------------------------
12716
+ DocumentTest: test_error_on_server_raises_Dolly::ServerError
12717
+ ------------------------------------------------------------
12718
+ --------------------------------------------------
12719
+ DocumentTest: test_find_will_get_a_FooBar_document
12720
+ --------------------------------------------------
12721
+ ----------------------------------------------------------------
12722
+ DocumentTest: test_find_with_multiple_ids_will_return_Collection
12723
+ ----------------------------------------------------------------
12724
+ ---------------------------------------------
12725
+ DocumentTest: test_getting_not_found_document
12726
+ ---------------------------------------------
12727
+ -------------------------------------------------
12728
+ DocumentTest: test_multi_response_with_right_data
12729
+ -------------------------------------------------
12730
+ -------------------------------------------
12731
+ DocumentTest: test_will_have_key_properties
12732
+ -------------------------------------------
12733
+ --------------------------------------------------------
12734
+ DocumentTest: test_will_have_object_with_boolean?_method
12735
+ --------------------------------------------------------
12736
+ ------------------------------------------------
12737
+ DocumentTest: test_will_have_only_set_properties
12738
+ ------------------------------------------------
12739
+ ----------------------------------------------------------------
12740
+ DocumentTest: test_with_default_will_return_default_value_on_nil
12741
+ ----------------------------------------------------------------
12742
+ -----------------------------------
12743
+ DocumentTest: test_with_timestamps!
12744
+ -----------------------------------
12745
+ --------------------------------------
12746
+ DocumentTest: test_all_will_get_2_docs
12747
+ --------------------------------------
12748
+ ------------------------------------------------
12749
+ DocumentTest: test_all_will_get_FooBar_documents
12750
+ ------------------------------------------------
12751
+ ----------------------------------------------
12752
+ DocumentTest: test_default_will_be_avoerwriten
12753
+ ----------------------------------------------
12754
+ ------------------------------------------------
12755
+ DocumentTest: test_empty_find_should_raise_error
12756
+ ------------------------------------------------
12757
+ ------------------------------------------------------------
12758
+ DocumentTest: test_error_on_server_raises_Dolly::ServerError
12759
+ ------------------------------------------------------------
12760
+ --------------------------------------------------
12761
+ DocumentTest: test_find_will_get_a_FooBar_document
12762
+ --------------------------------------------------
12763
+ ----------------------------------------------------------------
12764
+ DocumentTest: test_find_with_multiple_ids_will_return_Collection
12765
+ ----------------------------------------------------------------
12766
+ ---------------------------------------------
12767
+ DocumentTest: test_getting_not_found_document
12768
+ ---------------------------------------------
12769
+ -------------------------------------------------
12770
+ DocumentTest: test_multi_response_with_right_data
12771
+ -------------------------------------------------
12772
+ -------------------------------------------
12773
+ DocumentTest: test_will_have_key_properties
12774
+ -------------------------------------------
12775
+ --------------------------------------------------------
12776
+ DocumentTest: test_will_have_object_with_boolean?_method
12777
+ --------------------------------------------------------
12778
+ ------------------------------------------------
12779
+ DocumentTest: test_will_have_only_set_properties
12780
+ ------------------------------------------------
12781
+ ----------------------------------------------------------------
12782
+ DocumentTest: test_with_default_will_return_default_value_on_nil
12783
+ ----------------------------------------------------------------
12784
+ -----------------------------------
12785
+ DocumentTest: test_with_timestamps!
12786
+ -----------------------------------
12787
+ --------------------------------------
12788
+ DocumentTest: test_all_will_get_2_docs
12789
+ --------------------------------------
12790
+ ------------------------------------------------
12791
+ DocumentTest: test_all_will_get_FooBar_documents
12792
+ ------------------------------------------------
12793
+ ----------------------------------------------
12794
+ DocumentTest: test_default_will_be_avoerwriten
12795
+ ----------------------------------------------
12796
+ ------------------------------------------------
12797
+ DocumentTest: test_empty_find_should_raise_error
12798
+ ------------------------------------------------
12799
+ ------------------------------------------------------------
12800
+ DocumentTest: test_error_on_server_raises_Dolly::ServerError
12801
+ ------------------------------------------------------------
12802
+ --------------------------------------------------
12803
+ DocumentTest: test_find_will_get_a_FooBar_document
12804
+ --------------------------------------------------
12805
+ ----------------------------------------------------------------
12806
+ DocumentTest: test_find_with_multiple_ids_will_return_Collection
12807
+ ----------------------------------------------------------------
12808
+ ---------------------------------------------
12809
+ DocumentTest: test_getting_not_found_document
12810
+ ---------------------------------------------
12811
+ -------------------------------------------------
12812
+ DocumentTest: test_multi_response_with_right_data
12813
+ -------------------------------------------------
12814
+ -------------------------------------------
12815
+ DocumentTest: test_will_have_key_properties
12816
+ -------------------------------------------
12817
+ --------------------------------------------------------
12818
+ DocumentTest: test_will_have_object_with_boolean?_method
12819
+ --------------------------------------------------------
12820
+ ------------------------------------------------
12821
+ DocumentTest: test_will_have_only_set_properties
12822
+ ------------------------------------------------
12823
+ ----------------------------------------------------------------
12824
+ DocumentTest: test_with_default_will_return_default_value_on_nil
12825
+ ----------------------------------------------------------------
12826
+ -----------------------------------
12827
+ DocumentTest: test_with_timestamps!
12828
+ -----------------------------------
12829
+ --------------------------------------
12830
+ DocumentTest: test_all_will_get_2_docs
12831
+ --------------------------------------
12832
+ ------------------------------------------------
12833
+ DocumentTest: test_all_will_get_FooBar_documents
12834
+ ------------------------------------------------
12835
+ ----------------------------------------------
12836
+ DocumentTest: test_default_will_be_avoerwriten
12837
+ ----------------------------------------------
12838
+ ------------------------------------------------
12839
+ DocumentTest: test_empty_find_should_raise_error
12840
+ ------------------------------------------------
12841
+ ------------------------------------------------------------
12842
+ DocumentTest: test_error_on_server_raises_Dolly::ServerError
12843
+ ------------------------------------------------------------
12844
+ --------------------------------------------------
12845
+ DocumentTest: test_find_will_get_a_FooBar_document
12846
+ --------------------------------------------------
12847
+ ----------------------------------------------------------------
12848
+ DocumentTest: test_find_with_multiple_ids_will_return_Collection
12849
+ ----------------------------------------------------------------
12850
+ ---------------------------------------------
12851
+ DocumentTest: test_getting_not_found_document
12852
+ ---------------------------------------------
12853
+ -------------------------------------------------
12854
+ DocumentTest: test_multi_response_with_right_data
12855
+ -------------------------------------------------
12856
+ -------------------------------------------
12857
+ DocumentTest: test_will_have_key_properties
12858
+ -------------------------------------------
12859
+ --------------------------------------------------------
12860
+ DocumentTest: test_will_have_object_with_boolean?_method
12861
+ --------------------------------------------------------
12862
+ ------------------------------------------------
12863
+ DocumentTest: test_will_have_only_set_properties
12864
+ ------------------------------------------------
12865
+ ----------------------------------------------------------------
12866
+ DocumentTest: test_with_default_will_return_default_value_on_nil
12867
+ ----------------------------------------------------------------
12868
+ -----------------------------------
12869
+ DocumentTest: test_with_timestamps!
12870
+ -----------------------------------
12871
+ --------------------------------------
12872
+ DocumentTest: test_all_will_get_2_docs
12873
+ --------------------------------------
12874
+ ------------------------------------------------
12875
+ DocumentTest: test_all_will_get_FooBar_documents
12876
+ ------------------------------------------------
12877
+ ----------------------------------------------
12878
+ DocumentTest: test_default_will_be_avoerwriten
12879
+ ----------------------------------------------
12880
+ ------------------------------------------------
12881
+ DocumentTest: test_empty_find_should_raise_error
12882
+ ------------------------------------------------
12883
+ ------------------------------------------------------------
12884
+ DocumentTest: test_error_on_server_raises_Dolly::ServerError
12885
+ ------------------------------------------------------------
12886
+ --------------------------------------------------
12887
+ DocumentTest: test_find_will_get_a_FooBar_document
12888
+ --------------------------------------------------
12889
+ ----------------------------------------------------------------
12890
+ DocumentTest: test_find_with_multiple_ids_will_return_Collection
12891
+ ----------------------------------------------------------------
12892
+ ---------------------------------------------
12893
+ DocumentTest: test_getting_not_found_document
12894
+ ---------------------------------------------
12895
+ -------------------------------------------------
12896
+ DocumentTest: test_multi_response_with_right_data
12897
+ -------------------------------------------------
12898
+ -------------------------------------------
12899
+ DocumentTest: test_will_have_key_properties
12900
+ -------------------------------------------
12901
+ --------------------------------------------------------
12902
+ DocumentTest: test_will_have_object_with_boolean?_method
12903
+ --------------------------------------------------------
12904
+ ------------------------------------------------
12905
+ DocumentTest: test_will_have_only_set_properties
12906
+ ------------------------------------------------
12907
+ ----------------------------------------------------------------
12908
+ DocumentTest: test_with_default_will_return_default_value_on_nil
12909
+ ----------------------------------------------------------------
12910
+ -----------------------------------
12911
+ DocumentTest: test_with_timestamps!
12912
+ -----------------------------------
12913
+ --------------------------------------
12914
+ DocumentTest: test_all_will_get_2_docs
12915
+ --------------------------------------
12916
+ ------------------------------------------------
12917
+ DocumentTest: test_all_will_get_FooBar_documents
12918
+ ------------------------------------------------
12919
+ ----------------------------------------------
12920
+ DocumentTest: test_default_will_be_avoerwriten
12921
+ ----------------------------------------------
12922
+ ------------------------------------------------
12923
+ DocumentTest: test_empty_find_should_raise_error
12924
+ ------------------------------------------------
12925
+ ------------------------------------------------------------
12926
+ DocumentTest: test_error_on_server_raises_Dolly::ServerError
12927
+ ------------------------------------------------------------
12928
+ --------------------------------------------------
12929
+ DocumentTest: test_find_will_get_a_FooBar_document
12930
+ --------------------------------------------------
12931
+ ----------------------------------------------------------------
12932
+ DocumentTest: test_find_with_multiple_ids_will_return_Collection
12933
+ ----------------------------------------------------------------
12934
+ ---------------------------------------------
12935
+ DocumentTest: test_getting_not_found_document
12936
+ ---------------------------------------------
12937
+ -------------------------------------------------
12938
+ DocumentTest: test_multi_response_with_right_data
12939
+ -------------------------------------------------
12940
+ -------------------------------------------
12941
+ DocumentTest: test_will_have_key_properties
12942
+ -------------------------------------------
12943
+ --------------------------------------------------------
12944
+ DocumentTest: test_will_have_object_with_boolean?_method
12945
+ --------------------------------------------------------
12946
+ ------------------------------------------------
12947
+ DocumentTest: test_will_have_only_set_properties
12948
+ ------------------------------------------------
12949
+ ----------------------------------------------------------------
12950
+ DocumentTest: test_with_default_will_return_default_value_on_nil
12951
+ ----------------------------------------------------------------
12952
+ -----------------------------------
12953
+ DocumentTest: test_with_timestamps!
12954
+ -----------------------------------
12955
+ --------------------------------------
12956
+ DocumentTest: test_all_will_get_2_docs
12957
+ --------------------------------------
12958
+ ------------------------------------------------
12959
+ DocumentTest: test_all_will_get_FooBar_documents
12960
+ ------------------------------------------------
12961
+ ----------------------------------------------
12962
+ DocumentTest: test_default_will_be_avoerwriten
12963
+ ----------------------------------------------
12964
+ ------------------------------------------------
12965
+ DocumentTest: test_empty_find_should_raise_error
12966
+ ------------------------------------------------
12967
+ ------------------------------------------------------------
12968
+ DocumentTest: test_error_on_server_raises_Dolly::ServerError
12969
+ ------------------------------------------------------------
12970
+ --------------------------------------------------
12971
+ DocumentTest: test_find_will_get_a_FooBar_document
12972
+ --------------------------------------------------
12973
+ ----------------------------------------------------------------
12974
+ DocumentTest: test_find_with_multiple_ids_will_return_Collection
12975
+ ----------------------------------------------------------------
12976
+ ---------------------------------------------
12977
+ DocumentTest: test_getting_not_found_document
12978
+ ---------------------------------------------
12979
+ -------------------------------------------------
12980
+ DocumentTest: test_multi_response_with_right_data
12981
+ -------------------------------------------------
12982
+ -------------------------------------------
12983
+ DocumentTest: test_will_have_key_properties
12984
+ -------------------------------------------
12985
+ --------------------------------------------------------
12986
+ DocumentTest: test_will_have_object_with_boolean?_method
12987
+ --------------------------------------------------------
12988
+ ------------------------------------------------
12989
+ DocumentTest: test_will_have_only_set_properties
12990
+ ------------------------------------------------
12991
+ ----------------------------------------------------------------
12992
+ DocumentTest: test_with_default_will_return_default_value_on_nil
12993
+ ----------------------------------------------------------------
12994
+ -----------------------------------
12995
+ DocumentTest: test_with_timestamps!
12996
+ -----------------------------------
12997
+ --------------------------------------
12998
+ DocumentTest: test_all_will_get_2_docs
12999
+ --------------------------------------
13000
+ ------------------------------------------------
13001
+ DocumentTest: test_all_will_get_FooBar_documents
13002
+ ------------------------------------------------
13003
+ ----------------------------------------------
13004
+ DocumentTest: test_default_will_be_avoerwriten
13005
+ ----------------------------------------------
13006
+ ------------------------------------------------
13007
+ DocumentTest: test_empty_find_should_raise_error
13008
+ ------------------------------------------------
13009
+ ------------------------------------------------------------
13010
+ DocumentTest: test_error_on_server_raises_Dolly::ServerError
13011
+ ------------------------------------------------------------
13012
+ --------------------------------------------------
13013
+ DocumentTest: test_find_will_get_a_FooBar_document
13014
+ --------------------------------------------------
13015
+ ----------------------------------------------------------------
13016
+ DocumentTest: test_find_with_multiple_ids_will_return_Collection
13017
+ ----------------------------------------------------------------
13018
+ ---------------------------------------------
13019
+ DocumentTest: test_getting_not_found_document
13020
+ ---------------------------------------------
13021
+ -------------------------------------------------
13022
+ DocumentTest: test_multi_response_with_right_data
13023
+ -------------------------------------------------
13024
+ -------------------------------------------
13025
+ DocumentTest: test_will_have_key_properties
13026
+ -------------------------------------------
13027
+ --------------------------------------------------------
13028
+ DocumentTest: test_will_have_object_with_boolean?_method
13029
+ --------------------------------------------------------
13030
+ ------------------------------------------------
13031
+ DocumentTest: test_will_have_only_set_properties
13032
+ ------------------------------------------------
13033
+ ----------------------------------------------------------------
13034
+ DocumentTest: test_with_default_will_return_default_value_on_nil
13035
+ ----------------------------------------------------------------
13036
+ -----------------------------------
13037
+ DocumentTest: test_with_timestamps!
13038
+ -----------------------------------
13039
+ --------------------------------------
13040
+ DocumentTest: test_all_will_get_2_docs
13041
+ --------------------------------------
13042
+ ------------------------------------------------
13043
+ DocumentTest: test_all_will_get_FooBar_documents
13044
+ ------------------------------------------------
13045
+ ----------------------------------------------
13046
+ DocumentTest: test_default_will_be_avoerwriten
13047
+ ----------------------------------------------
13048
+ ------------------------------------------------
13049
+ DocumentTest: test_empty_find_should_raise_error
13050
+ ------------------------------------------------
13051
+ ------------------------------------------------------------
13052
+ DocumentTest: test_error_on_server_raises_Dolly::ServerError
13053
+ ------------------------------------------------------------
13054
+ --------------------------------------------------
13055
+ DocumentTest: test_find_will_get_a_FooBar_document
13056
+ --------------------------------------------------
13057
+ ----------------------------------------------------------------
13058
+ DocumentTest: test_find_with_multiple_ids_will_return_Collection
13059
+ ----------------------------------------------------------------
13060
+ ---------------------------------------------
13061
+ DocumentTest: test_getting_not_found_document
13062
+ ---------------------------------------------
13063
+ -------------------------------------------------
13064
+ DocumentTest: test_multi_response_with_right_data
13065
+ -------------------------------------------------
13066
+ -------------------------------------------
13067
+ DocumentTest: test_will_have_key_properties
13068
+ -------------------------------------------
13069
+ --------------------------------------------------------
13070
+ DocumentTest: test_will_have_object_with_boolean?_method
13071
+ --------------------------------------------------------
13072
+ ------------------------------------------------
13073
+ DocumentTest: test_will_have_only_set_properties
13074
+ ------------------------------------------------
13075
+ ----------------------------------------------------------------
13076
+ DocumentTest: test_with_default_will_return_default_value_on_nil
13077
+ ----------------------------------------------------------------
13078
+ -----------------------------------
13079
+ DocumentTest: test_with_timestamps!
13080
+ -----------------------------------
13081
+ --------------------------------------
13082
+ DocumentTest: test_all_will_get_2_docs
13083
+ --------------------------------------
13084
+ ------------------------------------------------
13085
+ DocumentTest: test_all_will_get_FooBar_documents
13086
+ ------------------------------------------------
13087
+ ----------------------------------------------
13088
+ DocumentTest: test_default_will_be_avoerwriten
13089
+ ----------------------------------------------
13090
+ ------------------------------------------------
13091
+ DocumentTest: test_empty_find_should_raise_error
13092
+ ------------------------------------------------
13093
+ ------------------------------------------------------------
13094
+ DocumentTest: test_error_on_server_raises_Dolly::ServerError
13095
+ ------------------------------------------------------------
13096
+ --------------------------------------------------
13097
+ DocumentTest: test_find_will_get_a_FooBar_document
13098
+ --------------------------------------------------
13099
+ ----------------------------------------------------------------
13100
+ DocumentTest: test_find_with_multiple_ids_will_return_Collection
13101
+ ----------------------------------------------------------------
13102
+ ---------------------------------------------
13103
+ DocumentTest: test_getting_not_found_document
13104
+ ---------------------------------------------
13105
+ -------------------------------------------------
13106
+ DocumentTest: test_multi_response_with_right_data
13107
+ -------------------------------------------------
13108
+ -------------------------------------------
13109
+ DocumentTest: test_will_have_key_properties
13110
+ -------------------------------------------
13111
+ --------------------------------------------------------
13112
+ DocumentTest: test_will_have_object_with_boolean?_method
13113
+ --------------------------------------------------------
13114
+ ------------------------------------------------
13115
+ DocumentTest: test_will_have_only_set_properties
13116
+ ------------------------------------------------
13117
+ ----------------------------------------------------------------
13118
+ DocumentTest: test_with_default_will_return_default_value_on_nil
13119
+ ----------------------------------------------------------------
13120
+ -----------------------------------
13121
+ DocumentTest: test_with_timestamps!
13122
+ -----------------------------------
13123
+ --------------------------------------
13124
+ DocumentTest: test_all_will_get_2_docs
13125
+ --------------------------------------
13126
+ ------------------------------------------------
13127
+ DocumentTest: test_all_will_get_FooBar_documents
13128
+ ------------------------------------------------
13129
+ ----------------------------------------------
13130
+ DocumentTest: test_default_will_be_avoerwriten
13131
+ ----------------------------------------------
13132
+ ------------------------------------------------
13133
+ DocumentTest: test_empty_find_should_raise_error
13134
+ ------------------------------------------------
13135
+ ------------------------------------------------------------
13136
+ DocumentTest: test_error_on_server_raises_Dolly::ServerError
13137
+ ------------------------------------------------------------
13138
+ --------------------------------------------------
13139
+ DocumentTest: test_find_will_get_a_FooBar_document
13140
+ --------------------------------------------------
13141
+ ----------------------------------------------------------------
13142
+ DocumentTest: test_find_with_multiple_ids_will_return_Collection
13143
+ ----------------------------------------------------------------
13144
+ ---------------------------------------------
13145
+ DocumentTest: test_getting_not_found_document
13146
+ ---------------------------------------------
13147
+ -------------------------------------------------
13148
+ DocumentTest: test_multi_response_with_right_data
13149
+ -------------------------------------------------
13150
+ -------------------------------------------
13151
+ DocumentTest: test_will_have_key_properties
13152
+ -------------------------------------------
13153
+ --------------------------------------------------------
13154
+ DocumentTest: test_will_have_object_with_boolean?_method
13155
+ --------------------------------------------------------
13156
+ ------------------------------------------------
13157
+ DocumentTest: test_will_have_only_set_properties
13158
+ ------------------------------------------------
13159
+ ----------------------------------------------------------------
13160
+ DocumentTest: test_with_default_will_return_default_value_on_nil
13161
+ ----------------------------------------------------------------
13162
+ -----------------------------------
13163
+ DocumentTest: test_with_timestamps!
13164
+ -----------------------------------
13165
+ --------------------------------------
13166
+ DocumentTest: test_all_will_get_2_docs
13167
+ --------------------------------------
13168
+ ------------------------------------------------
13169
+ DocumentTest: test_all_will_get_FooBar_documents
13170
+ ------------------------------------------------
13171
+ ----------------------------------------------
13172
+ DocumentTest: test_default_will_be_avoerwriten
13173
+ ----------------------------------------------
13174
+ ------------------------------------------------
13175
+ DocumentTest: test_empty_find_should_raise_error
13176
+ ------------------------------------------------
13177
+ ------------------------------------------------------------
13178
+ DocumentTest: test_error_on_server_raises_Dolly::ServerError
13179
+ ------------------------------------------------------------
13180
+ --------------------------------------------------
13181
+ DocumentTest: test_find_will_get_a_FooBar_document
13182
+ --------------------------------------------------
13183
+ ----------------------------------------------------------------
13184
+ DocumentTest: test_find_with_multiple_ids_will_return_Collection
13185
+ ----------------------------------------------------------------
13186
+ ---------------------------------------------
13187
+ DocumentTest: test_getting_not_found_document
13188
+ ---------------------------------------------
13189
+ -------------------------------------------------
13190
+ DocumentTest: test_multi_response_with_right_data
13191
+ -------------------------------------------------
13192
+ -------------------------------------------
13193
+ DocumentTest: test_will_have_key_properties
13194
+ -------------------------------------------
13195
+ --------------------------------------------------------
13196
+ DocumentTest: test_will_have_object_with_boolean?_method
13197
+ --------------------------------------------------------
13198
+ ------------------------------------------------
13199
+ DocumentTest: test_will_have_only_set_properties
13200
+ ------------------------------------------------
13201
+ ----------------------------------------------------------------
13202
+ DocumentTest: test_with_default_will_return_default_value_on_nil
13203
+ ----------------------------------------------------------------
13204
+ -----------------------------------
13205
+ DocumentTest: test_with_timestamps!
13206
+ -----------------------------------
13207
+ --------------------------------------
13208
+ DocumentTest: test_all_will_get_2_docs
13209
+ --------------------------------------
13210
+ ------------------------------------------------
13211
+ DocumentTest: test_all_will_get_FooBar_documents
13212
+ ------------------------------------------------
13213
+ ----------------------------------------------
13214
+ DocumentTest: test_default_will_be_avoerwriten
13215
+ ----------------------------------------------
13216
+ ------------------------------------------------
13217
+ DocumentTest: test_empty_find_should_raise_error
13218
+ ------------------------------------------------
13219
+ ------------------------------------------------------------
13220
+ DocumentTest: test_error_on_server_raises_Dolly::ServerError
13221
+ ------------------------------------------------------------
13222
+ --------------------------------------------------
13223
+ DocumentTest: test_find_will_get_a_FooBar_document
13224
+ --------------------------------------------------
13225
+ ----------------------------------------------------------------
13226
+ DocumentTest: test_find_with_multiple_ids_will_return_Collection
13227
+ ----------------------------------------------------------------
13228
+ ---------------------------------------------
13229
+ DocumentTest: test_getting_not_found_document
13230
+ ---------------------------------------------
13231
+ -------------------------------------------------
13232
+ DocumentTest: test_multi_response_with_right_data
13233
+ -------------------------------------------------
13234
+ -------------------------------------------
13235
+ DocumentTest: test_will_have_key_properties
13236
+ -------------------------------------------
13237
+ --------------------------------------------------------
13238
+ DocumentTest: test_will_have_object_with_boolean?_method
13239
+ --------------------------------------------------------
13240
+ ------------------------------------------------
13241
+ DocumentTest: test_will_have_only_set_properties
13242
+ ------------------------------------------------
13243
+ ----------------------------------------------------------------
13244
+ DocumentTest: test_with_default_will_return_default_value_on_nil
13245
+ ----------------------------------------------------------------
13246
+ -----------------------------------
13247
+ DocumentTest: test_with_timestamps!
13248
+ -----------------------------------
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dolly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - javierg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-17 00:00:00.000000000 Z
11
+ date: 2013-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -132,15 +132,18 @@ files:
132
132
  - lib/dolly/collection.rb
133
133
  - lib/dolly/connection.rb
134
134
  - lib/dolly/document.rb
135
+ - lib/dolly/name_space.rb
135
136
  - lib/dolly/property.rb
137
+ - lib/dolly/query.rb
136
138
  - lib/dolly/representations/collection_representation.rb
137
139
  - lib/dolly/representations/document_representation.rb
140
+ - lib/dolly/representations/tools.rb
138
141
  - lib/dolly/request.rb
139
142
  - lib/dolly/version.rb
140
143
  - lib/dolly.rb
141
144
  - lib/exceptions/dolly.rb
142
145
  - Rakefile
143
- - test/dolly_test.rb
146
+ - test/document_test.rb
144
147
  - test/dummy/app/assets/javascripts/application.js
145
148
  - test/dummy/app/assets/stylesheets/application.css
146
149
  - test/dummy/app/controllers/application_controller.rb
@@ -201,7 +204,7 @@ signing_key:
201
204
  specification_version: 4
202
205
  summary: will write something
203
206
  test_files:
204
- - test/dolly_test.rb
207
+ - test/document_test.rb
205
208
  - test/dummy/app/assets/javascripts/application.js
206
209
  - test/dummy/app/assets/stylesheets/application.css
207
210
  - test/dummy/app/controllers/application_controller.rb