dao-gateway-active_record 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/README.md +1 -0
- data/dao-gateway-active_record.gemspec +2 -1
- data/lib/dao/gateway/active_record.rb +1 -0
- data/lib/dao/gateway/active_record/base_transformer.rb +2 -9
- data/lib/dao/gateway/active_record/record_processor.rb +13 -0
- data/lib/dao/gateway/active_record/version.rb +1 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87d40ef5baf959eec23c5f6031c9be1bcaf44959
|
4
|
+
data.tar.gz: 55e79ba0e99e6784c9b4283e3e86745885c96eb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c85da288f12e278fe12719738a11aeda9a0bf62c590666b267fb8fd9371814663527d4a42b3923e765575bfd66fdee190f7e48c5bc2d93b2b49eb627eaacc750
|
7
|
+
data.tar.gz: 728a5ea93c0a7d900f07fb49c67dda01156be70b668f565dbf0db2f3d8b40c7b5d065f49aff64b0c6838e7812af31262e91f8417df6ec34e21e86278e402a740
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Dao::Gateway::ActiveRecord
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/dao-gateway-active_record.svg)](https://badge.fury.io/rb/dao-gateway-active_record)
|
3
4
|
[![Build Status](https://travis-ci.org/dao-rb/dao-gateway-active_record.svg?branch=master)](https://travis-ci.org/dao-rb/dao-gateway-active_record)
|
4
5
|
[![Code Climate](https://codeclimate.com/github/dao-rb/dao-gateway-active_record/badges/gpa.svg)](https://codeclimate.com/github/dao-rb/dao-gateway-active_record)
|
5
6
|
[![Test Coverage](https://codeclimate.com/github/dao-rb/dao-gateway-active_record/badges/coverage.svg)](https://codeclimate.com/github/dao-rb/dao-gateway-active_record/coverage)
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.required_ruby_version = '>= 2.2.2'
|
22
22
|
|
23
|
-
spec.add_dependency 'dao-gateway', '~> 1.
|
23
|
+
spec.add_dependency 'dao-gateway', '~> 1.1'
|
24
24
|
spec.add_dependency 'activerecord', '>= 4.2'
|
25
25
|
spec.add_dependency 'activesupport', '>= 4.2'
|
26
26
|
|
@@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'rake', '~> 10.0'
|
29
29
|
spec.add_development_dependency 'rspec', '~> 3.4'
|
30
30
|
spec.add_development_dependency 'rspec-its'
|
31
|
+
spec.add_development_dependency 'codeclimate-test-reporter'
|
31
32
|
end
|
@@ -5,6 +5,7 @@ require 'active_record'
|
|
5
5
|
require 'active_support/hash_with_indifferent_access'
|
6
6
|
require 'active_support/rescuable'
|
7
7
|
|
8
|
+
require 'dao/gateway/active_record/record_processor'
|
8
9
|
require 'dao/gateway/active_record/base'
|
9
10
|
require 'dao/gateway/active_record/base_transformer'
|
10
11
|
|
@@ -8,15 +8,8 @@ module Dao
|
|
8
8
|
|
9
9
|
private
|
10
10
|
|
11
|
-
def
|
12
|
-
|
13
|
-
collect_attributes(record, associations)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def collect_attributes(record, associations)
|
18
|
-
associations = associations.first if associations.count == 1
|
19
|
-
::HashWithIndifferentAccess.new(record.try(:serializable_hash, force_except: [], include: associations))
|
11
|
+
def add_processors
|
12
|
+
@processors.unshift RecordProcessor.new
|
20
13
|
end
|
21
14
|
end
|
22
15
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Dao
|
2
|
+
module Gateway
|
3
|
+
module ActiveRecord
|
4
|
+
class RecordProcessor < Gateway::Processor
|
5
|
+
def process(record, associations, *)
|
6
|
+
associations = associations.first if associations.count == 1
|
7
|
+
|
8
|
+
::HashWithIndifferentAccess.new(record.try(:serializable_hash, force_except: [], include: associations))
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dao-gateway-active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.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-
|
12
|
+
date: 2016-07-28 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.1'
|
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.1'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: activerecord
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,6 +109,20 @@ dependencies:
|
|
109
109
|
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: codeclimate-test-reporter
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
112
126
|
description: ActiveRecord gateway for dao-repository
|
113
127
|
email:
|
114
128
|
- ll.wg.bin@gmail.com
|
@@ -129,6 +143,7 @@ files:
|
|
129
143
|
- lib/dao/gateway/active_record.rb
|
130
144
|
- lib/dao/gateway/active_record/base.rb
|
131
145
|
- lib/dao/gateway/active_record/base_transformer.rb
|
146
|
+
- lib/dao/gateway/active_record/record_processor.rb
|
132
147
|
- lib/dao/gateway/active_record/version.rb
|
133
148
|
homepage: https://github.com/dao-rb/dao-gateway-active_record
|
134
149
|
licenses:
|