oat 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +146 -84
- data/lib/oat/adapter.rb +1 -0
- data/lib/oat/serializer.rb +23 -5
- data/lib/oat/version.rb +1 -1
- metadata +3 -4
- data/LICENSE.txt +0 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b2d910f58530d5cbf88e106998c333704b15237f
|
|
4
|
+
data.tar.gz: 4aeb7c7638228de5debc7fdfca5adf68e7b311ea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 61302f48f109b9f6d354b858aff022d06e5df6d182d7c51f423e9d3b05990b1b677e5917661784bb57fcebdc683cfbf1b581402b7e5bb9eb6a936a8cd535d264
|
|
7
|
+
data.tar.gz: 43bcffc5b42c3782246f2b388cacb9bbe1ac733d16d19150701dbad4b7f95f32451e7b3e901e4d11a6714286490c1c102d66e8edb1aabb27325b4bacfdf860ad
|
data/CHANGELOG.md
CHANGED
|
@@ -1,150 +1,212 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Change Log
|
|
2
2
|
|
|
3
|
-
## [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
## [Unreleased](https://github.com/ismasan/oat/tree/HEAD)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/ismasan/oat/compare/v0.5.0...HEAD)
|
|
6
|
+
|
|
7
|
+
**Merged pull requests:**
|
|
8
|
+
|
|
9
|
+
- Improve serialization performance by avoiding instance\_eval and method\_missing [\#73](https://github.com/ismasan/oat/pull/73) ([ivoanjo](https://github.com/ivoanjo))
|
|
10
|
+
- Remove duplicated license file [\#70](https://github.com/ismasan/oat/pull/70) ([tjmw](https://github.com/tjmw))
|
|
11
|
+
|
|
12
|
+
## [v0.5.0](https://github.com/ismasan/oat/tree/v0.5.0) (2016-08-24)
|
|
13
|
+
[Full Changelog](https://github.com/ismasan/oat/compare/v0.4.7...v0.5.0)
|
|
7
14
|
|
|
8
|
-
|
|
15
|
+
**Closed issues:**
|
|
9
16
|
|
|
10
|
-
-
|
|
17
|
+
- :only option for filtering [\#67](https://github.com/ismasan/oat/issues/67)
|
|
11
18
|
|
|
12
|
-
|
|
19
|
+
**Merged pull requests:**
|
|
13
20
|
|
|
14
|
-
-
|
|
21
|
+
- Add support for multiple schema blocks [\#69](https://github.com/ismasan/oat/pull/69) ([tjmw](https://github.com/tjmw))
|
|
15
22
|
|
|
16
|
-
|
|
23
|
+
## [v0.4.7](https://github.com/ismasan/oat/tree/v0.4.7) (2016-02-29)
|
|
24
|
+
[Full Changelog](https://github.com/ismasan/oat/compare/v0.4.6...v0.4.7)
|
|
17
25
|
|
|
18
|
-
|
|
26
|
+
**Implemented enhancements:**
|
|
19
27
|
|
|
20
|
-
-
|
|
28
|
+
- Override context on embedded serializers [\#13](https://github.com/ismasan/oat/issues/13)
|
|
21
29
|
|
|
22
|
-
|
|
30
|
+
**Closed issues:**
|
|
23
31
|
|
|
24
|
-
-
|
|
32
|
+
- The Siren adapter renders multiple rels per link as an array of an array instead of a flat array [\#64](https://github.com/ismasan/oat/issues/64)
|
|
33
|
+
- JsonApi adapter generates anything but JSON API conformant document [\#62](https://github.com/ismasan/oat/issues/62)
|
|
34
|
+
- Cross-cutting concerns [\#61](https://github.com/ismasan/oat/issues/61)
|
|
35
|
+
|
|
36
|
+
**Merged pull requests:**
|
|
37
|
+
|
|
38
|
+
- Support for multiple rels specified as an array for a single link. fixes \#64. [\#65](https://github.com/ismasan/oat/pull/65) ([landlessness](https://github.com/landlessness))
|
|
39
|
+
|
|
40
|
+
## [v0.4.6](https://github.com/ismasan/oat/tree/v0.4.6) (2015-02-07)
|
|
41
|
+
[Full Changelog](https://github.com/ismasan/oat/compare/v0.4.5...v0.4.6)
|
|
25
42
|
|
|
26
|
-
|
|
43
|
+
**Closed issues:**
|
|
27
44
|
|
|
28
|
-
-
|
|
45
|
+
- Serialize to vanilla JSON using the same serializer class [\#59](https://github.com/ismasan/oat/issues/59)
|
|
46
|
+
- HAL support for multiple link objects per relationship? [\#58](https://github.com/ismasan/oat/issues/58)
|
|
47
|
+
- Nested serializers: undefined method [\#56](https://github.com/ismasan/oat/issues/56)
|
|
48
|
+
- Array serialization [\#54](https://github.com/ismasan/oat/issues/54)
|
|
49
|
+
- Oat, Rails Responders and hypermedia mime types [\#50](https://github.com/ismasan/oat/issues/50)
|
|
50
|
+
- is lib/support/class\_attribute necessary? [\#44](https://github.com/ismasan/oat/issues/44)
|
|
29
51
|
|
|
30
|
-
|
|
52
|
+
**Merged pull requests:**
|
|
31
53
|
|
|
32
|
-
|
|
54
|
+
- HAL support for an array of linked objects [\#60](https://github.com/ismasan/oat/pull/60) ([abargnesi](https://github.com/abargnesi))
|
|
55
|
+
- Fixing Nested Serializers example [\#57](https://github.com/ismasan/oat/pull/57) ([coderdave](https://github.com/coderdave))
|
|
56
|
+
- Fix spelling in README.md [\#53](https://github.com/ismasan/oat/pull/53) ([killpack](https://github.com/killpack))
|
|
57
|
+
- provide an example of using Rails responders to support requests using a Hypermedia mime type [\#52](https://github.com/ismasan/oat/pull/52) ([apsoto](https://github.com/apsoto))
|
|
58
|
+
- Stop entities/entity from duplicating entries in linked hash. [\#49](https://github.com/ismasan/oat/pull/49) ([dpdawson](https://github.com/dpdawson))
|
|
59
|
+
- Better documentation for Oat::Adapters::JsonAPI\#collection [\#46](https://github.com/ismasan/oat/pull/46) ([emilesilvis](https://github.com/emilesilvis))
|
|
60
|
+
- add the required rel attribute for Siren sub-entities [\#45](https://github.com/ismasan/oat/pull/45) ([apsoto](https://github.com/apsoto))
|
|
61
|
+
|
|
62
|
+
## [v0.4.5](https://github.com/ismasan/oat/tree/v0.4.5) (2014-07-09)
|
|
33
63
|
[Full Changelog](https://github.com/ismasan/oat/compare/v0.4.4...v0.4.5)
|
|
34
|
-
#### 09/07/14
|
|
35
|
-
- *Merged pull-request:* Fix serializer ampersand warning [\#43](https://github.com/ismasan/oat/pull/43) ([iainbeeston](https://github.com/iainbeeston))
|
|
36
64
|
|
|
37
|
-
|
|
65
|
+
**Closed issues:**
|
|
66
|
+
|
|
67
|
+
- Thread Safety [\#39](https://github.com/ismasan/oat/issues/39)
|
|
38
68
|
|
|
39
|
-
|
|
69
|
+
**Merged pull requests:**
|
|
40
70
|
|
|
41
|
-
-
|
|
71
|
+
- Fix serializer ampersand warning [\#43](https://github.com/ismasan/oat/pull/43) ([iainbeeston](https://github.com/iainbeeston))
|
|
72
|
+
- Update build matrix [\#42](https://github.com/ismasan/oat/pull/42) ([iainbeeston](https://github.com/iainbeeston))
|
|
73
|
+
- Update to rspec3 [\#41](https://github.com/ismasan/oat/pull/41) ([iainbeeston](https://github.com/iainbeeston))
|
|
42
74
|
|
|
43
|
-
## [v0.4.4](https://github.com/ismasan/oat/tree/v0.4.4)
|
|
75
|
+
## [v0.4.4](https://github.com/ismasan/oat/tree/v0.4.4) (2014-05-26)
|
|
44
76
|
[Full Changelog](https://github.com/ismasan/oat/compare/v0.4.3...v0.4.4)
|
|
45
|
-
#### 26/05/14
|
|
46
|
-
- *Merged pull-request:* Add title addribute to siren action's fields [\#38](https://github.com/ismasan/oat/pull/38) ([erezesk](https://github.com/erezesk))
|
|
47
77
|
|
|
48
|
-
|
|
78
|
+
**Closed issues:**
|
|
79
|
+
|
|
80
|
+
- Top level json api meta [\#28](https://github.com/ismasan/oat/issues/28)
|
|
81
|
+
|
|
82
|
+
**Merged pull requests:**
|
|
49
83
|
|
|
50
|
-
|
|
84
|
+
- Add title addribute to siren action's fields [\#38](https://github.com/ismasan/oat/pull/38) ([erezesk](https://github.com/erezesk))
|
|
85
|
+
|
|
86
|
+
## [v0.4.3](https://github.com/ismasan/oat/tree/v0.4.3) (2014-05-01)
|
|
51
87
|
[Full Changelog](https://github.com/ismasan/oat/compare/v0.4.2...v0.4.3)
|
|
52
|
-
#### 01/05/14
|
|
53
|
-
- *Merged pull-request:* json-api: Don't add templated links to the resource [\#37](https://github.com/ismasan/oat/pull/37) ([kjg](https://github.com/kjg))
|
|
54
88
|
|
|
55
|
-
|
|
89
|
+
**Merged pull requests:**
|
|
90
|
+
|
|
91
|
+
- json-api: Don't add templated links to the resource [\#37](https://github.com/ismasan/oat/pull/37) ([kjg](https://github.com/kjg))
|
|
92
|
+
|
|
93
|
+
## [v0.4.2](https://github.com/ismasan/oat/tree/v0.4.2) (2014-04-29)
|
|
56
94
|
[Full Changelog](https://github.com/ismasan/oat/compare/v0.4.1...v0.4.2)
|
|
57
|
-
#### 29/04/14
|
|
58
|
-
- *Merged pull-request:* Add type attribute for siren actions [\#36](https://github.com/ismasan/oat/pull/36) ([erezesk](https://github.com/erezesk))
|
|
59
95
|
|
|
60
|
-
|
|
96
|
+
**Closed issues:**
|
|
97
|
+
|
|
98
|
+
- Errors management [\#35](https://github.com/ismasan/oat/issues/35)
|
|
61
99
|
|
|
62
|
-
|
|
100
|
+
**Merged pull requests:**
|
|
101
|
+
|
|
102
|
+
- Add type attribute for siren actions [\#36](https://github.com/ismasan/oat/pull/36) ([erezesk](https://github.com/erezesk))
|
|
103
|
+
|
|
104
|
+
## [v0.4.1](https://github.com/ismasan/oat/tree/v0.4.1) (2014-04-25)
|
|
63
105
|
[Full Changelog](https://github.com/ismasan/oat/compare/v0.4.0...v0.4.1)
|
|
64
|
-
#### 25/04/14
|
|
65
|
-
- *Merged pull-request:* Add meta property [\#32](https://github.com/ismasan/oat/pull/32) ([ahx](https://github.com/ahx))
|
|
66
106
|
|
|
67
|
-
|
|
107
|
+
**Merged pull requests:**
|
|
108
|
+
|
|
109
|
+
- Add meta property [\#32](https://github.com/ismasan/oat/pull/32) ([ahx](https://github.com/ahx))
|
|
110
|
+
|
|
111
|
+
## [v0.4.0](https://github.com/ismasan/oat/tree/v0.4.0) (2014-04-07)
|
|
68
112
|
[Full Changelog](https://github.com/ismasan/oat/compare/v0.3.0...v0.4.0)
|
|
69
|
-
#### 07/04/14
|
|
70
|
-
- *Merged pull-request:* Don't block NoMethodErrors from raising [\#31](https://github.com/ismasan/oat/pull/31) ([shekibobo](https://github.com/shekibobo))
|
|
71
113
|
|
|
72
|
-
|
|
114
|
+
**Closed issues:**
|
|
115
|
+
|
|
116
|
+
- Does this support any type of caching? [\#30](https://github.com/ismasan/oat/issues/30)
|
|
73
117
|
|
|
74
|
-
|
|
118
|
+
**Merged pull requests:**
|
|
119
|
+
|
|
120
|
+
- Don't block NoMethodErrors from raising [\#31](https://github.com/ismasan/oat/pull/31) ([shekibobo](https://github.com/shekibobo))
|
|
121
|
+
|
|
122
|
+
## [v0.3.0](https://github.com/ismasan/oat/tree/v0.3.0) (2014-03-25)
|
|
75
123
|
[Full Changelog](https://github.com/ismasan/oat/compare/v0.2.5...v0.3.0)
|
|
76
|
-
#### 25/03/14
|
|
77
|
-
- *Merged pull-request:* Don't allow rake 10.2 on ruby 1.8.7 [\#29](https://github.com/ismasan/oat/pull/29) ([kjg](https://github.com/kjg))
|
|
78
124
|
|
|
79
|
-
|
|
125
|
+
**Closed issues:**
|
|
80
126
|
|
|
81
|
-
-
|
|
127
|
+
- How to serialize many records? [\#24](https://github.com/ismasan/oat/issues/24)
|
|
82
128
|
|
|
83
|
-
|
|
129
|
+
**Merged pull requests:**
|
|
84
130
|
|
|
85
|
-
-
|
|
131
|
+
- Don't allow rake 10.2 on ruby 1.8.7 [\#29](https://github.com/ismasan/oat/pull/29) ([kjg](https://github.com/kjg))
|
|
132
|
+
- Json api link templates [\#27](https://github.com/ismasan/oat/pull/27) ([kjg](https://github.com/kjg))
|
|
133
|
+
- Json api attribute links [\#26](https://github.com/ismasan/oat/pull/26) ([kjg](https://github.com/kjg))
|
|
86
134
|
|
|
87
|
-
## [v0.2.5](https://github.com/ismasan/oat/tree/v0.2.5)
|
|
135
|
+
## [v0.2.5](https://github.com/ismasan/oat/tree/v0.2.5) (2014-03-20)
|
|
88
136
|
[Full Changelog](https://github.com/ismasan/oat/compare/v0.2.4...v0.2.5)
|
|
89
|
-
#### 20/03/14
|
|
90
|
-
- *Merged pull-request:* Json api nil entities [\#25](https://github.com/ismasan/oat/pull/25) ([kjg](https://github.com/kjg))
|
|
91
137
|
|
|
92
|
-
|
|
138
|
+
**Merged pull requests:**
|
|
139
|
+
|
|
140
|
+
- Json api nil entities [\#25](https://github.com/ismasan/oat/pull/25) ([kjg](https://github.com/kjg))
|
|
141
|
+
|
|
142
|
+
## [v0.2.4](https://github.com/ismasan/oat/tree/v0.2.4) (2014-02-24)
|
|
93
143
|
[Full Changelog](https://github.com/ismasan/oat/compare/v0.2.3...v0.2.4)
|
|
94
|
-
#### 24/02/14
|
|
95
|
-
- *Merged pull-request:* Allow for serializing json api resource collections into root key [\#23](https://github.com/ismasan/oat/pull/23) ([kjg](https://github.com/kjg))
|
|
96
144
|
|
|
97
|
-
|
|
145
|
+
**Merged pull requests:**
|
|
98
146
|
|
|
99
|
-
|
|
147
|
+
- Allow for serializing json api resource collections into root key [\#23](https://github.com/ismasan/oat/pull/23) ([kjg](https://github.com/kjg))
|
|
148
|
+
- Json api subent top linked [\#22](https://github.com/ismasan/oat/pull/22) ([kjg](https://github.com/kjg))
|
|
149
|
+
|
|
150
|
+
## [v0.2.3](https://github.com/ismasan/oat/tree/v0.2.3) (2014-02-17)
|
|
100
151
|
[Full Changelog](https://github.com/ismasan/oat/compare/v0.2.2...v0.2.3)
|
|
101
|
-
#### 17/02/14
|
|
102
|
-
- *Merged pull-request:* Json api sub behaviour [\#20](https://github.com/ismasan/oat/pull/20) ([kjg](https://github.com/kjg))
|
|
103
152
|
|
|
104
|
-
|
|
153
|
+
**Merged pull requests:**
|
|
154
|
+
|
|
155
|
+
- Json api sub behaviour [\#20](https://github.com/ismasan/oat/pull/20) ([kjg](https://github.com/kjg))
|
|
156
|
+
- Add version badge to README [\#18](https://github.com/ismasan/oat/pull/18) ([shekibobo](https://github.com/shekibobo))
|
|
105
157
|
|
|
106
|
-
## [v0.2.2](https://github.com/ismasan/oat/tree/v0.2.2)
|
|
158
|
+
## [v0.2.2](https://github.com/ismasan/oat/tree/v0.2.2) (2014-02-17)
|
|
107
159
|
[Full Changelog](https://github.com/ismasan/oat/compare/v0.1.2...v0.2.2)
|
|
108
|
-
#### 17/02/14
|
|
109
|
-
- *Merged pull-request:* Test more combinations in travis [\#17](https://github.com/ismasan/oat/pull/17) ([kjg](https://github.com/kjg))
|
|
110
160
|
|
|
111
|
-
|
|
161
|
+
**Closed issues:**
|
|
112
162
|
|
|
113
|
-
-
|
|
163
|
+
- Remove activesupport dependency [\#10](https://github.com/ismasan/oat/issues/10)
|
|
114
164
|
|
|
115
|
-
|
|
165
|
+
**Merged pull requests:**
|
|
116
166
|
|
|
117
|
-
-
|
|
167
|
+
- Test more combinations in travis [\#17](https://github.com/ismasan/oat/pull/17) ([kjg](https://github.com/kjg))
|
|
168
|
+
- Serializer from block or class update [\#16](https://github.com/ismasan/oat/pull/16) ([kjg](https://github.com/kjg))
|
|
169
|
+
- Make specs more accurate and using updated syntax [\#15](https://github.com/ismasan/oat/pull/15) ([shekibobo](https://github.com/shekibobo))
|
|
170
|
+
- Better Context [\#14](https://github.com/ismasan/oat/pull/14) ([shekibobo](https://github.com/shekibobo))
|
|
171
|
+
- Less active support [\#11](https://github.com/ismasan/oat/pull/11) ([kjg](https://github.com/kjg))
|
|
118
172
|
|
|
119
|
-
## [v0.1.2](https://github.com/ismasan/oat/tree/v0.1.2)
|
|
173
|
+
## [v0.1.2](https://github.com/ismasan/oat/tree/v0.1.2) (2014-02-13)
|
|
120
174
|
[Full Changelog](https://github.com/ismasan/oat/compare/v0.1.1...v0.1.2)
|
|
121
|
-
#### 13/02/14
|
|
122
|
-
- *Merged pull-request:* Support ruby 1.8.7 [\#12](https://github.com/ismasan/oat/pull/12) ([kjg](https://github.com/kjg))
|
|
123
175
|
|
|
124
|
-
|
|
176
|
+
**Closed issues:**
|
|
177
|
+
|
|
178
|
+
- Serializing collections [\#9](https://github.com/ismasan/oat/issues/9)
|
|
179
|
+
|
|
180
|
+
**Merged pull requests:**
|
|
125
181
|
|
|
126
|
-
|
|
182
|
+
- Support ruby 1.8.7 [\#12](https://github.com/ismasan/oat/pull/12) ([kjg](https://github.com/kjg))
|
|
183
|
+
|
|
184
|
+
## [v0.1.1](https://github.com/ismasan/oat/tree/v0.1.1) (2014-01-26)
|
|
127
185
|
[Full Changelog](https://github.com/ismasan/oat/compare/v0.1.0...v0.1.1)
|
|
128
|
-
#### 26/01/14
|
|
129
|
-
- *Merged pull-request:* Don't add invalid link relations to HAL output [\#8](https://github.com/ismasan/oat/pull/8) ([shekibobo](https://github.com/shekibobo))
|
|
130
186
|
|
|
131
|
-
|
|
187
|
+
**Merged pull requests:**
|
|
188
|
+
|
|
189
|
+
- Don't add invalid link relations to HAL output [\#8](https://github.com/ismasan/oat/pull/8) ([shekibobo](https://github.com/shekibobo))
|
|
190
|
+
|
|
191
|
+
## [v0.1.0](https://github.com/ismasan/oat/tree/v0.1.0) (2014-01-14)
|
|
132
192
|
[Full Changelog](https://github.com/ismasan/oat/compare/v0.0.1...v0.1.0)
|
|
133
|
-
#### 14/01/14
|
|
134
|
-
- *Merged pull-request:* Add Serializer#map\_properties to DRY property definitions [\#6](https://github.com/ismasan/oat/pull/6) ([shekibobo](https://github.com/shekibobo))
|
|
135
193
|
|
|
136
|
-
|
|
194
|
+
**Closed issues:**
|
|
195
|
+
|
|
196
|
+
- DRY property declaration [\#5](https://github.com/ismasan/oat/issues/5)
|
|
137
197
|
|
|
138
|
-
|
|
198
|
+
**Merged pull requests:**
|
|
139
199
|
|
|
140
|
-
-
|
|
200
|
+
- Add Serializer\#map\_properties to DRY property definitions [\#6](https://github.com/ismasan/oat/pull/6) ([shekibobo](https://github.com/shekibobo))
|
|
201
|
+
- Add action support for Siren. [\#4](https://github.com/ismasan/oat/pull/4) ([SebastianEdwards](https://github.com/SebastianEdwards))
|
|
202
|
+
- Don't try to serialize nil with an entity serializer [\#3](https://github.com/ismasan/oat/pull/3) ([shekibobo](https://github.com/shekibobo))
|
|
203
|
+
- Fix a small typo in the README [\#2](https://github.com/ismasan/oat/pull/2) ([stevenharman](https://github.com/stevenharman))
|
|
141
204
|
|
|
142
|
-
|
|
205
|
+
## [v0.0.1](https://github.com/ismasan/oat/tree/v0.0.1) (2013-11-18)
|
|
206
|
+
**Merged pull requests:**
|
|
143
207
|
|
|
144
|
-
|
|
145
|
-
#### 18/11/13
|
|
146
|
-
- *Merged pull-request:* Fix a few spelling and grammar errors [\#1](https://github.com/ismasan/oat/pull/1) ([leemachin](https://github.com/leemachin))
|
|
208
|
+
- Fix a few spelling and grammar errors [\#1](https://github.com/ismasan/oat/pull/1) ([leemachin](https://github.com/leemachin))
|
|
147
209
|
|
|
148
210
|
|
|
149
211
|
|
|
150
|
-
\* *This
|
|
212
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/lib/oat/adapter.rb
CHANGED
|
@@ -27,6 +27,7 @@ module Oat
|
|
|
27
27
|
if block_given?
|
|
28
28
|
serializer_class = Class.new(serializer.class)
|
|
29
29
|
serializer_class.schemas = []
|
|
30
|
+
serializer_class.schema_methods = []
|
|
30
31
|
serializer_class.adapter self.class
|
|
31
32
|
s = serializer_class.new(obj, serializer.context.merge(context_options), serializer.adapter_class, serializer.top)
|
|
32
33
|
serializer.instance_exec(obj, s, &block)
|
data/lib/oat/serializer.rb
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
require 'support/class_attribute'
|
|
2
|
+
|
|
2
3
|
module Oat
|
|
3
4
|
class Serializer
|
|
4
5
|
|
|
5
|
-
class_attribute :_adapter, :logger, :schemas
|
|
6
|
+
class_attribute :_adapter, :logger, :schemas, :schema_methods
|
|
6
7
|
|
|
7
8
|
self.schemas = []
|
|
9
|
+
self.schema_methods = []
|
|
8
10
|
|
|
9
11
|
def self.schema(&block)
|
|
10
|
-
|
|
12
|
+
if block_given?
|
|
13
|
+
schema_method_name = :"schema_block_#{self.schema_methods.count}"
|
|
14
|
+
|
|
15
|
+
self.schemas += [block]
|
|
16
|
+
self.schema_methods += [schema_method_name]
|
|
17
|
+
|
|
18
|
+
define_method(schema_method_name, &block)
|
|
19
|
+
private(schema_method_name)
|
|
20
|
+
end
|
|
11
21
|
end
|
|
12
22
|
|
|
13
23
|
def self.adapter(adapter_class = nil)
|
|
@@ -34,7 +44,15 @@ module Oat
|
|
|
34
44
|
|
|
35
45
|
def method_missing(name, *args, &block)
|
|
36
46
|
if adapter.respond_to?(name)
|
|
37
|
-
|
|
47
|
+
self.class.class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
|
48
|
+
private
|
|
49
|
+
|
|
50
|
+
def #{name}(*args, &block)
|
|
51
|
+
adapter.#{name}(*args, &block)
|
|
52
|
+
end
|
|
53
|
+
RUBY
|
|
54
|
+
|
|
55
|
+
send(name, *args, &block)
|
|
38
56
|
else
|
|
39
57
|
super
|
|
40
58
|
end
|
|
@@ -52,8 +70,8 @@ module Oat
|
|
|
52
70
|
|
|
53
71
|
def to_hash
|
|
54
72
|
@to_hash ||= (
|
|
55
|
-
self.class.
|
|
56
|
-
|
|
73
|
+
self.class.schema_methods.each do |schema_method_name|
|
|
74
|
+
send(schema_method_name)
|
|
57
75
|
end
|
|
58
76
|
|
|
59
77
|
adapter.to_hash
|
data/lib/oat/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: oat
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ismael Celis
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-06-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -95,7 +95,6 @@ files:
|
|
|
95
95
|
- CHANGELOG.md
|
|
96
96
|
- Gemfile
|
|
97
97
|
- LICENSE
|
|
98
|
-
- LICENSE.txt
|
|
99
98
|
- README.md
|
|
100
99
|
- Rakefile
|
|
101
100
|
- gemfiles/Gemfile.as-1.4.4
|
|
@@ -141,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
141
140
|
version: '0'
|
|
142
141
|
requirements: []
|
|
143
142
|
rubyforge_project:
|
|
144
|
-
rubygems_version: 2.
|
|
143
|
+
rubygems_version: 2.5.1
|
|
145
144
|
signing_key:
|
|
146
145
|
specification_version: 4
|
|
147
146
|
summary: Adapters-based serializers with Hypermedia support
|
data/LICENSE.txt
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2013 Ismael Celis
|
|
2
|
-
|
|
3
|
-
MIT License
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
a copy of this software and associated documentation files (the
|
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
-
the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
included in all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|