cyrax 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
OTlkODZmYzc2NjI3NTJmOGIxZjRiYWQ2ZDNiZmRjYzBjMzY2NjdkZTZjMDE4
|
10
|
-
NWIwM2VjNDEyYzNlZmRmZjE4YmE1ODQ4Nzc2ZTM0MTM1ZGFlYTY2NTJjNWVh
|
11
|
-
ZDRkNGZhYjFmMDg3NmE2NDhjNGIxYTg2MDEwM2YyYmI2ZjJhZTE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MDEwN2QyZTM2OTQwZDVmNzNhOTlkMGIzNDk2M2M2ODc2MDQ5YmVhMmNmZTcz
|
14
|
-
MzQzMDExOTEwNDlhODFlMDBkYTM1ZDJhNTlmZjc0M2YxMDc0MTM4MDJiZGVk
|
15
|
-
ZDI0ODRhZWU2MjExODJjMmM3MmRjOTMzMThkZWJiY2Q2NWMxZmQ=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6e5f735826c558a7f4fa5b23910e1919c4e43b2b
|
4
|
+
data.tar.gz: 281c7225738c63b7b9e41725f2e14c1092ec721d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e47c1e63406636e35d085ebfa824e30b1f4931f9751dea52e4fe4d2be1cf18d667a5bd554efa88fbfd2a30f0c7a85299c076cbfeef6ed52a04ea49ccc87680af
|
7
|
+
data.tar.gz: 7e2cec99408da893526907ad316eb08e52a39cf36ec46258cb95ff2adc25c1d7155ee147936edf6a3a5dd73f73fff2bcc82a63233a3bd40acfaddf58c1558fea
|
data/lib/cyrax/decorator.rb
CHANGED
@@ -21,6 +21,10 @@ class Cyrax::Decorator < Cyrax::Wrapper
|
|
21
21
|
resource.send(method, *args, &block)
|
22
22
|
end
|
23
23
|
|
24
|
+
def respond_to?(method_sym, include_private = false)
|
25
|
+
super || resource.respond_to?(method_sym, include_private)
|
26
|
+
end
|
27
|
+
|
24
28
|
class << self
|
25
29
|
alias_method :decorate, :new
|
26
30
|
|
@@ -64,14 +64,14 @@ module Cyrax::Serializers
|
|
64
64
|
end
|
65
65
|
@relation_attrs.map do |attribute, scope|
|
66
66
|
value = resource.send(attribute)
|
67
|
-
result[attribute] = scope.serialize(value)
|
67
|
+
result[attribute] = scope.serialize(value, options)
|
68
68
|
end
|
69
69
|
@namespace_attrs.map do |attribute, scope|
|
70
|
-
result[attribute] = scope.serialize(resource)
|
70
|
+
result[attribute] = scope.serialize(resource, options)
|
71
71
|
end
|
72
72
|
@assigned_attrs.map do |attribute, scope|
|
73
73
|
value = options[:assignments][attribute]
|
74
|
-
result[attribute] = scope.serialize(value)
|
74
|
+
result[attribute] = scope.serialize(value, options)
|
75
75
|
end
|
76
76
|
@attrs.map do |attribute, options|
|
77
77
|
result[attribute] = resource.send(attribute)
|
data/lib/cyrax/version.rb
CHANGED
@@ -40,12 +40,12 @@ module Cyrax
|
|
40
40
|
describe '#decorable?' do
|
41
41
|
context 'when `decorator_class_name` present' do
|
42
42
|
before { subject.class.decorator(Foo) }
|
43
|
-
its(:decorable?) { should
|
43
|
+
its(:decorable?) { should be true }
|
44
44
|
end
|
45
45
|
|
46
46
|
context 'when `decorator_class_name` empty' do
|
47
47
|
before { subject.class.decorator(nil) }
|
48
|
-
its(:decorable?) { should
|
48
|
+
its(:decorable?) { should be false }
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -22,14 +22,14 @@ module Cyrax
|
|
22
22
|
describe '#add_error' do
|
23
23
|
it 'should add error' do
|
24
24
|
subject.add_error(:foo, 'bar')
|
25
|
-
subject.instance_variable_get(:@_errors).has_key?(:foo).should
|
25
|
+
subject.instance_variable_get(:@_errors).has_key?(:foo).should be true
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
describe '#add_error_unless' do
|
30
30
|
it 'should add error when condition false' do
|
31
31
|
subject.add_error_unless(:foo, 'bar', 1==0)
|
32
|
-
subject.instance_variable_get(:@_errors).has_key?(:foo).should
|
32
|
+
subject.instance_variable_get(:@_errors).has_key?(:foo).should be true
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'should not add error when condition true' do
|
data/spec/cyrax/response_spec.rb
CHANGED
@@ -21,24 +21,24 @@ module Cyrax
|
|
21
21
|
describe '#success?' do
|
22
22
|
context 'when there are no errors' do
|
23
23
|
before { subject.with_errors({}) }
|
24
|
-
its(:success?) { should
|
24
|
+
its(:success?) { should be true }
|
25
25
|
end
|
26
26
|
|
27
27
|
context 'when there are errors' do
|
28
28
|
before { subject.with_errors({foo: 'some', bar: 'errors'}) }
|
29
|
-
its(:success?) { should
|
29
|
+
its(:success?) { should be false }
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
describe '#failure?' do
|
34
34
|
context 'when there are no errors' do
|
35
35
|
before { subject.with_errors({}) }
|
36
|
-
its(:failure?) { should
|
36
|
+
its(:failure?) { should be false }
|
37
37
|
end
|
38
38
|
|
39
39
|
context 'when there are errors' do
|
40
40
|
before { subject.with_errors(['some', 'errors']) }
|
41
|
-
its(:failure?) { should
|
41
|
+
its(:failure?) { should be true }
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -78,13 +78,13 @@ module Cyrax
|
|
78
78
|
describe '#has_error?' do
|
79
79
|
context 'when there are no errors' do
|
80
80
|
before { subject.with_errors({}) }
|
81
|
-
specify { subject.has_error?(:foo).should
|
81
|
+
specify { subject.has_error?(:foo).should be false }
|
82
82
|
end
|
83
83
|
|
84
84
|
context 'when there are errors' do
|
85
85
|
before { subject.with_errors({foo: 'some', bar: 'errors'}) }
|
86
|
-
specify { subject.has_error?(:foo).should
|
87
|
-
specify { subject.has_error?(:foo1).should
|
86
|
+
specify { subject.has_error?(:foo).should be true }
|
87
|
+
specify { subject.has_error?(:foo1).should be false }
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
metadata
CHANGED
@@ -1,105 +1,109 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cyrax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Droidlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activemodel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: has_active_logger
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: multi_json
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: sqlite3
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 2.99.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 2.99.0
|
97
97
|
description: Small library for adding service layer to Rails projects
|
98
98
|
email:
|
99
99
|
executables: []
|
100
100
|
extensions: []
|
101
101
|
extra_rdoc_files: []
|
102
102
|
files:
|
103
|
+
- LICENSE.txt
|
104
|
+
- README.md
|
105
|
+
- Rakefile
|
106
|
+
- lib/cyrax.rb
|
103
107
|
- lib/cyrax/base.rb
|
104
108
|
- lib/cyrax/decorator.rb
|
105
109
|
- lib/cyrax/extensions/has_decorator.rb
|
@@ -119,10 +123,6 @@ files:
|
|
119
123
|
- lib/cyrax/serializers/scope.rb
|
120
124
|
- lib/cyrax/version.rb
|
121
125
|
- lib/cyrax/wrapper.rb
|
122
|
-
- lib/cyrax.rb
|
123
|
-
- LICENSE.txt
|
124
|
-
- Rakefile
|
125
|
-
- README.md
|
126
126
|
- spec/cyrax/base_spec.rb
|
127
127
|
- spec/cyrax/decorator_spec.rb
|
128
128
|
- spec/cyrax/extensions/has_decorator_spec.rb
|
@@ -145,17 +145,17 @@ require_paths:
|
|
145
145
|
- lib
|
146
146
|
required_ruby_version: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
|
-
- -
|
148
|
+
- - ">="
|
149
149
|
- !ruby/object:Gem::Version
|
150
150
|
version: '0'
|
151
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
152
|
requirements:
|
153
|
-
- -
|
153
|
+
- - ">="
|
154
154
|
- !ruby/object:Gem::Version
|
155
155
|
version: '0'
|
156
156
|
requirements: []
|
157
157
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.
|
158
|
+
rubygems_version: 2.2.2
|
159
159
|
signing_key:
|
160
160
|
specification_version: 4
|
161
161
|
summary: Small library for adding service layer to Rails projects
|
@@ -172,4 +172,3 @@ test_files:
|
|
172
172
|
- spec/cyrax/response_spec.rb
|
173
173
|
- spec/cyrax/serializer_spec.rb
|
174
174
|
- spec/spec_helper.rb
|
175
|
-
has_rdoc:
|