cyrax 0.3.8 → 0.4.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/cyrax.rb +1 -1
- data/lib/cyrax/base.rb +4 -1
- data/lib/cyrax/extensions/has_decorator.rb +6 -2
- data/lib/cyrax/extensions/has_serializer.rb +6 -2
- data/lib/cyrax/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTJkY2U0ODEzYTY3NzYzNGFjZWIwMWUwMDEwNDM1ZGY4MjBlZTZmYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmQwYzVlNWI1Y2RjYzAwNGQ1ZmJiYjYxZjk5NjI0ZmEyM2NlMTZjYw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OGQyYWE3NzU4NjZkMTE3NzE4Mzc3Y2I0MDUxMTNmMGFiNjQzYTg1NGYzNTk1
|
10
|
+
OTQyNjNmZmM1Yzg4ZWJlY2I5NWNjNzYxZjc0OTFhNmRkYTRkYmFiODBkYWM3
|
11
|
+
MzU0OGI0YjUwMjU2OTk0ZjkzYmZiYzFiOTk1YWJiOWMzZTE4YzA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTZiODY0ZDRkZTAxYTk2ZjcwNWI5YTBhNThkY2Q2MTQ5Njk1YjljMDgzN2Q2
|
14
|
+
ZmZlYjMzNjJiYmMyNDBmM2U1YThlMWQ0ZWY1MjAwNDlhYTg4MmJmYzgwNjk5
|
15
|
+
ZGMyODdhOTA1MTU5NTAwMmYwZmRmMWYyYzFmYmUxZDRmYTJhYjg=
|
data/lib/cyrax.rb
CHANGED
data/lib/cyrax/base.rb
CHANGED
@@ -3,18 +3,21 @@ class Cyrax::Base
|
|
3
3
|
include HasActiveLogger::Mixin
|
4
4
|
include Cyrax::Extensions::HasResponse
|
5
5
|
|
6
|
-
attr_accessor :params, :accessor
|
6
|
+
attr_accessor :params, :accessor, :options
|
7
7
|
|
8
8
|
# Creates a new Cyrax resource
|
9
9
|
#
|
10
10
|
# @param options [Hash] Options to pass in. You need `:as` and `:params`
|
11
11
|
# :as defines the accessor
|
12
12
|
# :params are parameters passed by the controller usually
|
13
|
+
# :serializer overrides resource serializer
|
14
|
+
# :decorator overrides resource serializer
|
13
15
|
#
|
14
16
|
# @example Instantiating a new resource
|
15
17
|
# Products::UserResource.new(as: current_user, params: params)
|
16
18
|
def initialize(options = {})
|
17
19
|
@accessor = options[:as]
|
18
20
|
@params = options[:params]
|
21
|
+
@options = options
|
19
22
|
end
|
20
23
|
end
|
@@ -6,12 +6,16 @@ module Cyrax::Extensions
|
|
6
6
|
class_attribute :decorator_class_name
|
7
7
|
end
|
8
8
|
|
9
|
+
def decorator_class_name
|
10
|
+
options[:decorator] || self.class.decorator_class_name
|
11
|
+
end
|
12
|
+
|
9
13
|
def decorable?
|
10
|
-
!
|
14
|
+
!decorator_class_name.nil?
|
11
15
|
end
|
12
16
|
|
13
17
|
def decorator_class
|
14
|
-
|
18
|
+
decorator_class_name.to_s.classify.constantize
|
15
19
|
end
|
16
20
|
|
17
21
|
module ClassMethods
|
@@ -6,12 +6,16 @@ module Cyrax::Extensions
|
|
6
6
|
class_attribute :serializer_class_name
|
7
7
|
end
|
8
8
|
|
9
|
+
def serializer_class_name
|
10
|
+
options[:serializer] || self.class.serializer_class_name
|
11
|
+
end
|
12
|
+
|
9
13
|
def serializable?
|
10
|
-
!
|
14
|
+
!serializer_class_name.nil?
|
11
15
|
end
|
12
16
|
|
13
17
|
def serializer_class
|
14
|
-
|
18
|
+
serializer_class_name.to_s.classify.constantize
|
15
19
|
end
|
16
20
|
|
17
21
|
module ClassMethods
|
data/lib/cyrax/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cyrax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Droidlabs
|
@@ -206,9 +206,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
206
206
|
version: '0'
|
207
207
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
208
|
requirements:
|
209
|
-
- - ! '
|
209
|
+
- - ! '>'
|
210
210
|
- !ruby/object:Gem::Version
|
211
|
-
version:
|
211
|
+
version: 1.3.1
|
212
212
|
requirements: []
|
213
213
|
rubyforge_project:
|
214
214
|
rubygems_version: 2.0.5
|