dao-gateway-active_resource 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dao-gateway-active_resource.gemspec +1 -1
- data/lib/dao/gateway/active_resource/base.rb +3 -15
- data/lib/dao/gateway/active_resource/base_transformer.rb +1 -7
- data/lib/dao/gateway/active_resource/resource_processor.rb +1 -1
- data/lib/dao/gateway/active_resource/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 865cd34743613708bbd485c5ad6310b5508e79dc
|
4
|
+
data.tar.gz: 3ad06f0187b78cf5610849f3c0aea343b45becf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb79ad5543336f09e83082f5f1acc6567c8e7fe6764e39c7c4574d4fdbd72ea8ff7324020d35d396e7f7bc0eab1956d5066edd1735165d7f475bbde0d4a59d05
|
7
|
+
data.tar.gz: a6b69fa11dbcebf75d0600f1f417e251726ac10d03a900517e1460ee64611eb329d6a2b013a6730433eb108780f06ec9277440cbdc6e311af051108d95d4e9ca
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'dao-gateway', '~> 1.
|
21
|
+
spec.add_dependency 'dao-gateway', '~> 1.2'
|
22
22
|
spec.add_dependency 'activeresource', '>= 4.1'
|
23
23
|
|
24
24
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
@@ -2,15 +2,11 @@ module Dao
|
|
2
2
|
module Gateway
|
3
3
|
module ActiveResource
|
4
4
|
class Base < Dao::Gateway::Base
|
5
|
-
def map(object, _)
|
6
|
-
import(object)
|
7
|
-
end
|
8
|
-
|
9
5
|
def save!(domain, _)
|
10
6
|
record = export(domain, record(domain.id))
|
11
7
|
record.save!
|
12
8
|
|
13
|
-
domain.attributes = import(record).attributes
|
9
|
+
domain.attributes = import(record, domain.initialized_with).attributes
|
14
10
|
domain
|
15
11
|
rescue ::ActiveResource::ResourceInvalid
|
16
12
|
raise Dao::Gateway::InvalidRecord.new(record.errors.to_hash)
|
@@ -33,16 +29,8 @@ module Dao
|
|
33
29
|
record
|
34
30
|
end
|
35
31
|
|
36
|
-
def
|
37
|
-
|
38
|
-
if relation.is_a?(::ActiveResource::Collection)
|
39
|
-
@transformer.many(relation)
|
40
|
-
elsif relation.is_a?(source)
|
41
|
-
@transformer.one(relation)
|
42
|
-
else
|
43
|
-
@transformer.other(relation)
|
44
|
-
end
|
45
|
-
end
|
32
|
+
def collection_scope?(relation)
|
33
|
+
relation.is_a?(::ActiveResource::Collection)
|
46
34
|
end
|
47
35
|
|
48
36
|
def record(domain_id)
|
@@ -2,14 +2,8 @@ module Dao
|
|
2
2
|
module Gateway
|
3
3
|
module ActiveResource
|
4
4
|
class BaseTransformer < Dao::Gateway::ScopeTransformer
|
5
|
-
def one(relation)
|
6
|
-
super(Array(relation))
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
5
|
def add_processors
|
12
|
-
|
6
|
+
pipe.preprocess(ResourceProcessor.new)
|
13
7
|
end
|
14
8
|
end
|
15
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dao-gateway-active_resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- llxff
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-07-
|
12
|
+
date: 2016-07-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dao-gateway
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '1.
|
20
|
+
version: '1.2'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '1.
|
27
|
+
version: '1.2'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: activeresource
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|