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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 009d64b19fabf9d073230a4203c9c8bc00704108
4
- data.tar.gz: 747bfd831530458d0a23aebd12a8e192355dcc87
3
+ metadata.gz: 865cd34743613708bbd485c5ad6310b5508e79dc
4
+ data.tar.gz: 3ad06f0187b78cf5610849f3c0aea343b45becf2
5
5
  SHA512:
6
- metadata.gz: f0b1e990345cb01ba3d4316ec53d6a6c9916cbdc18d8194429832b5b5f8c98b6de18906d6a1eba68c1a658f03548b81ef21130c9a355f550e5ceb6e190e0fd4a
7
- data.tar.gz: 1336db860d01f50a01c4ceb98d656d26d919fbeaec0be0f9f577c66be3cc7dbbe4c6d4d1330c55f5c8adac22b69f0077a1f5bd890274cb38c21c7ba4dcdf7271
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.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 import(relation)
37
- unless relation.nil?
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
- @processors.unshift ResourceProcessor.new
6
+ pipe.preprocess(ResourceProcessor.new)
13
7
  end
14
8
  end
15
9
  end
@@ -2,7 +2,7 @@ module Dao
2
2
  module Gateway
3
3
  module ActiveResource
4
4
  class ResourceProcessor < Gateway::Processor
5
- def process(record, *)
5
+ def process(record)
6
6
  HashWithIndifferentAccess.new(record.try(:serializable_hash))
7
7
  end
8
8
  end
@@ -1,7 +1,7 @@
1
1
  module Dao
2
2
  module Gateway
3
3
  module ActiveResource
4
- VERSION = '1.1.0'
4
+ VERSION = '1.2.0'
5
5
  end
6
6
  end
7
7
  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.1.0
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-28 00:00:00.000000000 Z
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.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.1'
27
+ version: '1.2'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: activeresource
30
30
  requirement: !ruby/object:Gem::Requirement